MLT  7.28.0
Macros | Functions | Variables
mlt_factory.c File Reference

the factory method interfaces More...

#include "mlt.h"
#include "mlt_repository.h"
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Macros

#define PRESETS_DIR   "/presets"
 the default subdirectory of the datadir for holding presets More...
 

Functions

char * mlt_environment (const char *name)
 Get a value from the environment. More...
 
int mlt_environment_set (const char *name, const char *value)
 Set a value in the environment. More...
 
void mlt_factory_close ()
 Close the factory. More...
 
mlt_consumer mlt_factory_consumer (mlt_profile profile, const char *service, const void *input)
 Fetch a consumer from the repository. More...
 
const char * mlt_factory_directory ()
 Fetch the module directory used in this instance. More...
 
mlt_properties mlt_factory_event_object ()
 Fetch the events object. More...
 
mlt_filter mlt_factory_filter (mlt_profile profile, const char *service, const void *input)
 Fetch a filter from the repository. More...
 
mlt_repository mlt_factory_init (const char *directory)
 Construct the repository and factories. More...
 
mlt_link mlt_factory_link (const char *service, const void *input)
 Fetch a link from the repository. More...
 
mlt_producer mlt_factory_producer (mlt_profile profile, const char *service, const void *resource)
 Fetch a producer from the repository. More...
 
void mlt_factory_register_for_clean_up (void *ptr, mlt_destructor destructor)
 Register an object for clean up. More...
 
mlt_repository mlt_factory_repository ()
 Fetch the repository. More...
 
mlt_transition mlt_factory_transition (mlt_profile profile, const char *service, const void *input)
 Fetch a transition from the repository. More...
 
mlt_properties mlt_global_properties ()
 
static void set_common_properties (mlt_properties properties, mlt_profile profile, const char *type, const char *service)
 Set some properties common to all services. More...
 

Variables

static mlt_properties event_object = NULL
 the events object for the factory events More...
 
static mlt_properties global_properties = NULL
 a global properties list for holding environment config data and things needing session-oriented cleanup More...
 
static char * mlt_directory = NULL
 holds the full path to the modules directory - initialized and retained for the entire session More...
 
static mlt_repository repository = NULL
 the global repository singleton More...
 
static int unique_id = 0
 for tracking the unique_id set on each constructed service More...
 

Detailed Description

the factory method interfaces

Copyright (C) 2003-2022 Meltytech, LLC

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Macro Definition Documentation

◆ PRESETS_DIR

#define PRESETS_DIR   "/presets"

the default subdirectory of the datadir for holding presets

Function Documentation

◆ mlt_environment()

char* mlt_environment ( const char *  name)

Get a value from the environment.

Parameters
namethe name of a MLT (runtime configuration) environment variable
Returns
the value of the variable

◆ mlt_environment_set()

int mlt_environment_set ( const char *  name,
const char *  value 
)

Set a value in the environment.

Parameters
namethe name of a MLT environment variable
valuethe value of the variable
Returns
true on error

◆ mlt_factory_close()

void mlt_factory_close ( )

Close the factory.

Cleanup all resources for the session.

◆ mlt_factory_consumer()

mlt_consumer mlt_factory_consumer ( mlt_profile  profile,
const char *  service,
const void *  input 
)

Fetch a consumer from the repository.

Parameters
profilethe mlt_profile to use
servicethe name of the consumer (optional, defaults to MLT_CONSUMER)
inputan optional argument to the consumer constructor, typically a string
Returns
a new consumer

◆ mlt_factory_directory()

const char* mlt_factory_directory ( )

Fetch the module directory used in this instance.

Returns
the full path to the module directory that this session is using

◆ mlt_factory_event_object()

mlt_properties mlt_factory_event_object ( )

Fetch the events object.

Returns
the global factory event object

◆ mlt_factory_filter()

mlt_filter mlt_factory_filter ( mlt_profile  profile,
const char *  service,
const void *  input 
)

Fetch a filter from the repository.

Parameters
profilethe mlt_profile to use
servicethe name of the filter
inputan optional argument to the filter constructor, typically a string
Returns
a new filter

◆ mlt_factory_init()

mlt_repository mlt_factory_init ( const char *  directory)

Construct the repository and factories.

Parameters
directoryan optional full path to a directory containing the modules that overrides the default and the MLT_REPOSITORY environment variable
Returns
the repository

◆ mlt_factory_link()

mlt_link mlt_factory_link ( const char *  service,
const void *  input 
)

Fetch a link from the repository.

Parameters
servicethe name of the link
inputan optional argument to the link constructor, typically a string
Returns
a new link

◆ mlt_factory_producer()

mlt_producer mlt_factory_producer ( mlt_profile  profile,
const char *  service,
const void *  resource 
)

Fetch a producer from the repository.

If you give NULL to service, then it will use core module's special "loader"producer to load resource. One can override this default producer by setting the environment variable MLT_PRODUCER.

Parameters
profilethe mlt_profile to use
servicethe name of the producer (optional, defaults to MLT_PRODUCER)
resourcean optional argument to the producer constructor, typically a string
Returns
a new producer

◆ mlt_factory_register_for_clean_up()

void mlt_factory_register_for_clean_up ( void *  ptr,
mlt_destructor  destructor 
)

Register an object for clean up.

Parameters
ptran opaque pointer to anything allocated on the heap
destructorthe function pointer of the deallocation subroutine (e.g., free or mlt_pool_release)

◆ mlt_factory_repository()

mlt_repository mlt_factory_repository ( )

Fetch the repository.

Returns
the global repository object

◆ mlt_factory_transition()

mlt_transition mlt_factory_transition ( mlt_profile  profile,
const char *  service,
const void *  input 
)

Fetch a transition from the repository.

Parameters
profilethe mlt_profile to use
servicethe name of the transition
inputan optional argument to the transition constructor, typically a string
Returns
a new transition

◆ mlt_global_properties()

mlt_properties mlt_global_properties ( )

◆ set_common_properties()

static void set_common_properties ( mlt_properties  properties,
mlt_profile  profile,
const char *  type,
const char *  service 
)
static

Set some properties common to all services.

This sets _unique_id, mlt_type, mlt_service (unless _mlt_service_hidden), and _profile.

Parameters
propertiesa service's properties list
profilethe mlt_profile supplied to the factory function
typethe MLT service class
servicethe name of the service

Variable Documentation

◆ event_object

mlt_properties event_object = NULL
static

the events object for the factory events

◆ global_properties

mlt_properties global_properties = NULL
static

a global properties list for holding environment config data and things needing session-oriented cleanup

◆ mlt_directory

char* mlt_directory = NULL
static

holds the full path to the modules directory - initialized and retained for the entire session

◆ repository

mlt_repository repository = NULL
static

the global repository singleton

◆ unique_id

int unique_id = 0
static

for tracking the unique_id set on each constructed service