MLT  7.22.0
Public Member Functions | Data Fields | Private Member Functions | Private Attributes
mlt_service_s Struct Reference

Service abstract base class. More...

#include <mlt_service.h>

Inheritance diagram for mlt_service_s:
mlt_properties_s mlt_consumer_s mlt_filter_s mlt_producer_s mlt_transition_s mlt_chain_s mlt_link_s mlt_multitrack_s mlt_playlist_s mlt_tractor_s

Public Member Functions

void mlt_service_apply_filters (mlt_service self, mlt_frame frame, int index)
 Recursively apply attached filters. More...
 
int mlt_service_attach (mlt_service self, mlt_filter filter)
 Attach a filter. More...
 
mlt_cache_item mlt_service_cache_get (mlt_service self, const char *name)
 Get an object from a service's cache. More...
 
int mlt_service_cache_get_size (mlt_service self, const char *name)
 Get the current maximum size of the named cache. More...
 
void mlt_service_cache_put (mlt_service self, const char *name, void *data, int size, mlt_destructor destructor)
 Put an object into a service's cache. More...
 
void mlt_service_cache_set_size (mlt_service self, const char *name, int size)
 Set the number of items to cache for the named cache. More...
 
void mlt_service_close (mlt_service self)
 Destroy a service. More...
 
int mlt_service_connect_producer (mlt_service self, mlt_service producer, int index)
 Connect a producer to the service. More...
 
mlt_service mlt_service_consumer (mlt_service self)
 Obtain the consumer a service is connected to. More...
 
int mlt_service_detach (mlt_service self, mlt_filter filter)
 Detach a filter. More...
 
int mlt_service_disconnect_all_producers (mlt_service self)
 Remove the all the attached producers. More...
 
int mlt_service_disconnect_producer (mlt_service self, int index)
 Remove the N-th producer. More...
 
mlt_filter mlt_service_filter (mlt_service self, int index)
 Retrieve an attached filter. More...
 
int mlt_service_filter_count (mlt_service self)
 Get the number of filters attached. More...
 
int mlt_service_get_frame (mlt_service self, mlt_frame_ptr frame, int index)
 Obtain a frame. More...
 
mlt_service mlt_service_get_producer (mlt_service self)
 Get the first connected producer. More...
 
mlt_service_type mlt_service_identify (mlt_service self)
 Identify the subclass of the service. More...
 
int mlt_service_init (mlt_service self, void *child)
 Initialize a service. More...
 
int mlt_service_insert_producer (mlt_service self, mlt_service producer, int index)
 Insert a producer connected to the service. More...
 
void mlt_service_lock (mlt_service self)
 Acquire a mutual exclusion lock on this service. More...
 
int mlt_service_move_filter (mlt_service self, int from, int to)
 Reorder the attached filters. More...
 
mlt_service mlt_service_producer (mlt_service self)
 Obtain the producer a service is connected to. More...
 
mlt_profile mlt_service_profile (mlt_service self)
 Retrieve the profile. More...
 
mlt_properties mlt_service_properties (mlt_service self)
 Return the properties object. More...
 
void mlt_service_set_profile (mlt_service self, mlt_profile profile)
 Set the profile for a service. More...
 
void mlt_service_unlock (mlt_service self)
 Release a mutual exclusion lock on this service. More...
 
- Public Member Functions inherited from mlt_properties_s
char * mlt_properties_anim_get (mlt_properties self, const char *name, int position, int length)
 Get a string value by name at a frame position. More...
 
mlt_color mlt_properties_anim_get_color (mlt_properties self, const char *name, int position, int length)
 Get a color associated to the name at a frame position. More...
 
double mlt_properties_anim_get_double (mlt_properties self, const char *name, int position, int length)
 Get a real number associated to the name at a frame position. More...
 
int mlt_properties_anim_get_int (mlt_properties self, const char *name, int position, int length)
 Get an integer associated to the name at a frame position. More...
 
mlt_rect mlt_properties_anim_get_rect (mlt_properties self, const char *name, int position, int length)
 Get a rectangle associated to the name at a frame position. More...
 
int mlt_properties_anim_set (mlt_properties self, const char *name, const char *value, int position, int length)
 Set a property to a string at a frame position. More...
 
int mlt_properties_anim_set_color (mlt_properties self, const char *name, mlt_color value, int position, int length, mlt_keyframe_type keyframe_type)
 Set a property to an integer value by color at a frame position. More...
 
int mlt_properties_anim_set_double (mlt_properties self, const char *name, double value, int position, int length, mlt_keyframe_type keyframe_type)
 Set a property to a real number at a frame position. More...
 
int mlt_properties_anim_set_int (mlt_properties self, const char *name, int value, int position, int length, mlt_keyframe_type keyframe_type)
 Set a property to an integer value at a frame position. More...
 
int mlt_properties_anim_set_rect (mlt_properties self, const char *name, mlt_rect value, int position, int length, mlt_keyframe_type keyframe_type)
 Set a property to a rectangle value at a frame position. More...
 
void mlt_properties_clear (mlt_properties self, const char *name)
 Remove the value for a property. More...
 
void mlt_properties_close (mlt_properties self)
 Close a properties object. More...
 
int mlt_properties_copy (mlt_properties self, mlt_properties that, const char *prefix)
 Copy all serializable properties that match a prefix to another properties object. More...
 
int mlt_properties_count (mlt_properties self)
 Return the number of items in the list. More...
 
void mlt_properties_debug (mlt_properties self, const char *title, FILE *output)
 Output the properties to a file handle. More...
 
int mlt_properties_dec_ref (mlt_properties self)
 Decrement the reference count. More...
 
int mlt_properties_dir_list (mlt_properties self, const char *dirname, const char *pattern, int sort)
 Get the contents of a directory. More...
 
void mlt_properties_dump (mlt_properties self, FILE *output)
 Dump the properties to a file handle. More...
 
int mlt_properties_exists (mlt_properties self, const char *name)
 Check if a property exists. More...
 
char * mlt_properties_frames_to_time (mlt_properties self, mlt_position frames, mlt_time_format format)
 Convert a frame count to a time string. More...
 
int mlt_properties_from_utf8 (mlt_properties properties, const char *name_from, const char *name_to)
 Convert UTF-8 property to the locale-defined encoding. More...
 
char * mlt_properties_get (mlt_properties self, const char *name)
 Get a string value by name. More...
 
mlt_animation mlt_properties_get_animation (mlt_properties self, const char *name)
 Get the animation associated to the name. More...
 
mlt_color mlt_properties_get_color (mlt_properties self, const char *name)
 Convert a numeric property to a tuple of color components. More...
 
void * mlt_properties_get_data (mlt_properties self, const char *name, int *length)
 Get a binary data value associated to the name. More...
 
void * mlt_properties_get_data_at (mlt_properties self, int index, int *size)
 Get a data value by index. More...
 
double mlt_properties_get_double (mlt_properties self, const char *name)
 Get a floating point value associated to the name. More...
 
int mlt_properties_get_int (mlt_properties self, const char *name)
 Get an integer associated to the name. More...
 
int64_t mlt_properties_get_int64 (mlt_properties self, const char *name)
 Get a 64-bit integer associated to the name. More...
 
const char * mlt_properties_get_lcnumeric (mlt_properties self)
 Get the numeric locale for this properties object. More...
 
char * mlt_properties_get_name (mlt_properties self, int index)
 Get a property name by index. More...
 
mlt_position mlt_properties_get_position (mlt_properties self, const char *name)
 Get a position value associated to the name. More...
 
mlt_properties mlt_properties_get_properties (mlt_properties self, const char *name)
 Get a nested properties object by name. More...
 
mlt_properties mlt_properties_get_properties_at (mlt_properties self, int index)
 Get a nested properties object by index. More...
 
mlt_rect mlt_properties_get_rect (mlt_properties self, const char *name)
 Get a rectangle associated to the name. More...
 
char * mlt_properties_get_time (mlt_properties self, const char *name, mlt_time_format format)
 Get a time string associated to the name. More...
 
char * mlt_properties_get_value (mlt_properties self, int index)
 Get a property's string value by index. More...
 
char * mlt_properties_get_value_tf (mlt_properties self, int index, mlt_time_format time_format)
 Get a property's string value by index (with time format). More...
 
int mlt_properties_inc_ref (mlt_properties self)
 Increment the reference count. More...
 
int mlt_properties_inherit (mlt_properties self, mlt_properties that)
 Copy all serializable properties to another properties list. More...
 
int mlt_properties_init (mlt_properties self, void *child)
 Initialize a properties object that was already allocated. More...
 
int mlt_properties_is_anim (mlt_properties self, const char *name)
 Check if a property is animated. More...
 
int mlt_properties_is_sequence (mlt_properties properties)
 Determine if the properties list is really just a sequence or ordered list. More...
 
mlt_properties mlt_properties_load (const char *filename)
 Create a properties object by reading a .properties text file. More...
 
void mlt_properties_lock (mlt_properties self)
 Protect a properties list against concurrent access. More...
 
void mlt_properties_mirror (mlt_properties self, mlt_properties that)
 Set a properties list to be a mirror copy of another. More...
 
mlt_properties mlt_properties_new ()
 Create a properties object. More...
 
int mlt_properties_parse (mlt_properties self, const char *namevalue)
 Set a value by parsing a name=value string. More...
 
mlt_properties mlt_properties_parse_yaml (const char *filename)
 Parse a YAML Tiny file by name. More...
 
int mlt_properties_pass (mlt_properties self, mlt_properties that, const char *prefix)
 Pass all serializable properties that match a prefix to another properties object. More...
 
int mlt_properties_pass_list (mlt_properties self, mlt_properties that, const char *list)
 Copy all properties specified in a comma-separated list to another properties list. More...
 
void mlt_properties_pass_property (mlt_properties self, mlt_properties that, const char *name)
 Copy a property to another properties list. More...
 
int mlt_properties_preset (mlt_properties self, const char *name)
 Set properties from a preset. More...
 
int mlt_properties_ref_count (mlt_properties self)
 Get the reference count. More...
 
int mlt_properties_rename (mlt_properties self, const char *source, const char *dest)
 Rename a property. More...
 
int mlt_properties_save (mlt_properties self, const char *filename)
 Save the properties to a file by name. More...
 
char * mlt_properties_serialise_yaml (mlt_properties self)
 Serialize a properties list as a string of YAML Tiny. More...
 
int mlt_properties_set (mlt_properties self, const char *name, const char *value)
 Set a property to a string. More...
 
int mlt_properties_set_color (mlt_properties self, const char *name, mlt_color color)
 Set a property to an integer value by color. More...
 
int mlt_properties_set_data (mlt_properties self, const char *name, void *value, int length, mlt_destructor destroy, mlt_serialiser serialise)
 Store binary data as a property. More...
 
int mlt_properties_set_double (mlt_properties self, const char *name, double value)
 Set a property to a floating point value. More...
 
int mlt_properties_set_int (mlt_properties self, const char *name, int value)
 Set a property to an integer value. More...
 
int mlt_properties_set_int64 (mlt_properties self, const char *name, int64_t value)
 Set a property to a 64-bit integer value. More...
 
int mlt_properties_set_lcnumeric (mlt_properties self, const char *locale)
 Set the numeric locale used for string/double conversions. More...
 
int mlt_properties_set_or_default (mlt_properties self, const char *name, const char *value, const char *def)
 Set or default a property to a string. More...
 
int mlt_properties_set_position (mlt_properties self, const char *name, mlt_position value)
 Set a property to a position value. More...
 
int mlt_properties_set_properties (mlt_properties self, const char *name, mlt_properties properties)
 Set a property to a nested properties object. More...
 
int mlt_properties_set_rect (mlt_properties self, const char *name, mlt_rect value)
 Set a property to a rectangle value. More...
 
int mlt_properties_set_string (mlt_properties self, const char *name, const char *value)
 Set a property to a string. More...
 
mlt_position mlt_properties_time_to_frames (mlt_properties self, const char *time)
 Convert a time string to a frame count. More...
 
void mlt_properties_unlock (mlt_properties self)
 End protecting a properties list against concurrent access. More...
 

Data Fields

mlt_destructor close
 the destructor virtual function More...
 
void * close_object
 the object supplied to the close virtual function More...
 
int(* get_frame )(mlt_service self, mlt_frame_ptr frame, int index)
 Get a frame of data (virtual function). More...
 
- Data Fields inherited from mlt_properties_s
mlt_destructor close
 the destructor virtual function More...
 
void * close_object
 the object supplied to the close virtual function More...
 

Private Member Functions

static mlt_cache get_cache (mlt_service self, const char *name)
 Lookup the cache object for a service. More...
 
void mlt_service_cache_purge (mlt_service self)
 Release a service's cache items. More...
 
static void mlt_service_connect (mlt_service self, mlt_service that)
 Associate a service to a consumer. More...
 
static void mlt_service_disconnect (mlt_service self)
 Disconnect a service from its consumer. More...
 
static void mlt_service_filter_changed (mlt_service owner, mlt_service self)
 The service-changed event handler. More...
 
static void mlt_service_filter_property_changed (mlt_service owner, mlt_service self, mlt_event_data event_data)
 The property-changed event handler. More...
 
static int service_get_frame (mlt_service self, mlt_frame_ptr frame, int index)
 Default implementation of the get_frame virtual function. More...
 

Private Attributes

void * child
 the object of a subclass More...
 
void * local
 instance object More...
 
struct mlt_properties_s parent
 A service extends properties. More...
 

Detailed Description

Service abstract base class.

The service is the base class for all of the interesting classes and plugins for MLT. A service can have multiple inputs connections to other services called its "producers" but only a single output to another service called its "consumer." A service that has both producer and consumer connections is called a filter. Any service can have zero or more filters "attached" to it. We call any collection of services and their connections a "service network," which is similar to what DirectShow calls a filter graph or what gstreamer calls an element pipeline.

Event:

service-changed a filter was attached or detached or a transition was connected or disconnected

property-changed a property's value changed; the event data is a string for the name of the property

Property:

mlt_type identifies the subclass

_mlt_service_hidden a flag that indicates whether to hide the mlt_service

mlt_service is the name of the implementation of the service

resource is either the stream identifier or grandchild-class

in when to start, what is started is service-specific

out when to stop

_filter_private Set this on a service to ensure that attached filters are handled privately. See modules/core/filter_watermark.c for example.

_profile stores the mlt_profile for a service

_unique_id is a unique identifier

_need_previous_next boolean that instructs producers to get preceding and following frames inside of mlt_service_get_frame

Member Function Documentation

◆ get_cache()

static mlt_cache get_cache ( mlt_service  self,
const char *  name 
)
private

Lookup the cache object for a service.

Parameters
selfa service
namea name for the object
Returns
a cache

◆ mlt_service_apply_filters()

void mlt_service_apply_filters ( mlt_service  self,
mlt_frame  frame,
int  index 
)

Recursively apply attached filters.

Parameters
selfa service
framea frame
indexused to track depth of recursion, top caller should supply 0

◆ mlt_service_attach()

int mlt_service_attach ( mlt_service  self,
mlt_filter  filter 
)

Attach a filter.

Parameters
selfa service
filterthe filter to attach
Returns
true if there was an error

◆ mlt_service_cache_get()

mlt_cache_item mlt_service_cache_get ( mlt_service  self,
const char *  name 
)

Get an object from a service's cache.

Parameters
selfa service
namea name for the object that is unique to the service class, but not to the instance
Returns
a cache item or NULL if an object is not found
See also
mlt_cache_item_data

◆ mlt_service_cache_get_size()

int mlt_service_cache_get_size ( mlt_service  self,
const char *  name 
)

Get the current maximum size of the named cache.

Parameters
selfa service
namea name for the object that is unique to the service class, but not to the instance
Returns
the current maximum number of items to cache or zero if there is an error

◆ mlt_service_cache_purge()

void mlt_service_cache_purge ( mlt_service  self)
private

Release a service's cache items.

Parameters
selfa service

◆ mlt_service_cache_put()

void mlt_service_cache_put ( mlt_service  self,
const char *  name,
void *  data,
int  size,
mlt_destructor  destructor 
)

Put an object into a service's cache.

Parameters
selfa service
namea name for the object that is unique to the service class, but not to the instance
dataan opaque pointer to the object to put into the cache
sizethe number of bytes pointed to by data
destructora function that releases the data

◆ mlt_service_cache_set_size()

void mlt_service_cache_set_size ( mlt_service  self,
const char *  name,
int  size 
)

Set the number of items to cache for the named cache.

Parameters
selfa service
namea name for the object that is unique to the service class, but not to the instance
sizethe number of items to cache

◆ mlt_service_close()

void mlt_service_close ( mlt_service  self)

Destroy a service.

Parameters
selfthe service to destroy

◆ mlt_service_connect()

static void mlt_service_connect ( mlt_service  self,
mlt_service  that 
)
private

Associate a service to a consumer.

Overwrites connection to any existing consumer.

Parameters
selfa service
thata consumer

◆ mlt_service_connect_producer()

int mlt_service_connect_producer ( mlt_service  self,
mlt_service  producer,
int  index 
)

Connect a producer to the service.

Parameters
selfa service
producera producer
indexwhich of potentially multiple producers to this service (0 based)
Returns
0 for success, -1 for error, or 3 if producer is already connected to self

◆ mlt_service_consumer()

mlt_service mlt_service_consumer ( mlt_service  self)

Obtain the consumer a service is connected to.

Parameters
selfa service
Returns
the consumer

◆ mlt_service_detach()

int mlt_service_detach ( mlt_service  self,
mlt_filter  filter 
)

Detach a filter.

Parameters
selfa service
filterthe filter to detach
Returns
true if there was an error

◆ mlt_service_disconnect()

static void mlt_service_disconnect ( mlt_service  self)
private

Disconnect a service from its consumer.

Parameters
selfa service

◆ mlt_service_disconnect_all_producers()

int mlt_service_disconnect_all_producers ( mlt_service  self)

Remove the all the attached producers.

Parameters
selfa service
Returns
the number of successfully disconnected producers

◆ mlt_service_disconnect_producer()

int mlt_service_disconnect_producer ( mlt_service  self,
int  index 
)

Remove the N-th producer.

Parameters
selfa service
indexwhich producer to remove (0-based)
Returns
true if there was an error

◆ mlt_service_filter()

mlt_filter mlt_service_filter ( mlt_service  self,
int  index 
)

Retrieve an attached filter.

Parameters
selfa service
indexwhich one of potentially multiple filters
Returns
the filter or null if there was an error

◆ mlt_service_filter_changed()

static void mlt_service_filter_changed ( mlt_service  owner,
mlt_service  self 
)
private

The service-changed event handler.

Parameters
ownerignored
selfthe service on which the "service-changed" event is fired

◆ mlt_service_filter_count()

int mlt_service_filter_count ( mlt_service  self)

Get the number of filters attached.

Parameters
selfa service
Returns
the number of attached filters or -1 if there was an error

◆ mlt_service_filter_property_changed()

static void mlt_service_filter_property_changed ( mlt_service  owner,
mlt_service  self,
mlt_event_data  event_data 
)
private

The property-changed event handler.

Parameters
ownerignored
selfthe service on which the "property-changed" event is fired
namethe name of the property that changed

◆ mlt_service_get_frame()

int mlt_service_get_frame ( mlt_service  self,
mlt_frame_ptr  frame,
int  index 
)

Obtain a frame.

Parameters
selfa service
[out]framea frame by reference
indexas determined by the producer
Returns
true if there was an error

◆ mlt_service_get_producer()

mlt_service mlt_service_get_producer ( mlt_service  self)

Get the first connected producer.

Parameters
selfa service
Returns
the first producer

◆ mlt_service_identify()

mlt_service_type mlt_service_identify ( mlt_service  self)

Identify the subclass of the service.

Parameters
selfa service
Returns
the subclass

◆ mlt_service_init()

int mlt_service_init ( mlt_service  self,
void *  child 
)

Initialize a service.

Parameters
selfthe service structure to initialize
childpointer to the child object for the subclass
Returns
true if there was an error

◆ mlt_service_insert_producer()

int mlt_service_insert_producer ( mlt_service  self,
mlt_service  producer,
int  index 
)

Insert a producer connected to the service.

mlt_service_connect_producer() appends or overwrites a producer at input index whereas this function inserts pushing all of the inputs down by 1 in the list of inputs.

Parameters
selfa service
producera producer
indexwhich of potentially multiple producers to this service (0 based)
Returns
0 for success, -1 for error, or 3 if producer is already connected to self

◆ mlt_service_lock()

void mlt_service_lock ( mlt_service  self)

Acquire a mutual exclusion lock on this service.

Parameters
selfthe service to lock

◆ mlt_service_move_filter()

int mlt_service_move_filter ( mlt_service  self,
int  from,
int  to 
)

Reorder the attached filters.

Parameters
selfa service
fromthe current index value of the filter to move
tothe new index value for the filter specified in from
Returns
true if there was an error

◆ mlt_service_producer()

mlt_service mlt_service_producer ( mlt_service  self)

Obtain the producer a service is connected to.

Parameters
selfa service
Returns
the last-most producer

◆ mlt_service_profile()

mlt_profile mlt_service_profile ( mlt_service  self)

Retrieve the profile.

Parameters
selfa service
Returns
the profile

◆ mlt_service_properties()

mlt_properties mlt_service_properties ( mlt_service  self)

Return the properties object.

Parameters
selfa service
Returns
the properties

◆ mlt_service_set_profile()

void mlt_service_set_profile ( mlt_service  self,
mlt_profile  profile 
)

Set the profile for a service.

Parameters
selfa service
profilethe profile to set onto the service

◆ mlt_service_unlock()

void mlt_service_unlock ( mlt_service  self)

Release a mutual exclusion lock on this service.

Parameters
selfthe service to unlock

◆ service_get_frame()

static int service_get_frame ( mlt_service  self,
mlt_frame_ptr  frame,
int  index 
)
private

Default implementation of the get_frame virtual function.

Parameters
selfa service
[out]framea frame by reference
indexas determined by the producer
Returns
false

Field Documentation

◆ child

void* mlt_service_s::child
private

the object of a subclass

◆ close

mlt_destructor mlt_service_s::close

the destructor virtual function

◆ close_object

void* mlt_service_s::close_object

the object supplied to the close virtual function

◆ get_frame

int(* mlt_service_s::get_frame) (mlt_service self, mlt_frame_ptr frame, int index)

Get a frame of data (virtual function).

Parameters
mlt_producera producer
mlt_frame_ptra frame pointer by reference
intan index
Returns
true if there was an error

◆ local

void* mlt_service_s::local
private

instance object

◆ parent

struct mlt_properties_s mlt_service_s::parent
private

A service extends properties.


The documentation for this struct was generated from the following files: