mlt 0.7.6
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_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.
int mlt_service_attach (mlt_service self, mlt_filter filter)
 Attach a filter.
mlt_cache_item mlt_service_cache_get (mlt_service self, const char *name)
 Get an object from a service's cache.
int mlt_service_cache_get_size (mlt_service self, const char *name)
 Get the current maximum size of the named cache.
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.
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.
void mlt_service_close (mlt_service self)
 Destroy a service.
int mlt_service_connect_producer (mlt_service self, mlt_service producer, int index)
 Connect a producer to the service.
mlt_service mlt_service_consumer (mlt_service self)
 Obtain the consumer a service is connected to.
int mlt_service_detach (mlt_service self, mlt_filter filter)
 Detach a filter.
static void mlt_service_disconnect (mlt_service self)
 Disconnect a service from its consumer.
mlt_filter mlt_service_filter (mlt_service self, int index)
 Retrieve a filter.
int mlt_service_get_frame (mlt_service self, mlt_frame_ptr frame, int index)
 Obtain a frame.
mlt_service mlt_service_get_producer (mlt_service self)
 Get the first connected producer.
mlt_service_type mlt_service_identify (mlt_service self)
 Identify the subclass of the service.
int mlt_service_init (mlt_service self, void *child)
 Initialize a service.
void mlt_service_lock (mlt_service self)
 Acquire a mutual exclusion lock on this service.
mlt_service mlt_service_producer (mlt_service self)
 Obtain the producer a service is connected to.
mlt_profile mlt_service_profile (mlt_service self)
 Retrieve the profile.
mlt_properties mlt_service_properties (mlt_service self)
 Return the properties object.
void mlt_service_unlock (mlt_service self)
 Release a mutual exclusion lock on this service.

Data Fields

mlt_destructor close
 the destructor virtual function
void * close_object
 the object supplied to the close virtual function
int(* get_frame )(mlt_service self, mlt_frame_ptr frame, int index)
 Get a frame of data (virtual function).

Private Member Functions

static mlt_cache get_cache (mlt_service self, const char *name)
 Lookup the cache object for a service.
void mlt_service_cache_purge (mlt_service self)
 Release a service's cache items.
static void mlt_service_connect (mlt_service self, mlt_service that)
 Associate a service to a consumer.
static void mlt_service_filter_changed (mlt_service owner, mlt_service self)
 The service-changed event handler.
static void mlt_service_property_changed (mlt_listener listener, mlt_properties owner, mlt_service self, void **args)
 The transmitter for property changes.
static int service_get_frame (mlt_service self, mlt_frame_ptr frame, int index)
 Default implementation of the get_frame virtual function.

Private Attributes

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

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
Event:
property-changed
Property:
mlt_type identifies the subclass
Property:
_mlt_service_hidden a flag that indicates whether to hide the mlt_service
Property:
mlt_service is the name of the implementation of the service
Property:
resource is either the stream identifier or grandchild-class
Property:
in when to start, what is started is service-specific
Property:
out when to stop
Property:
_filter_private Set this on a service to ensure that attached filters are handled privately. See modules/core/filter_region.c and modules/core/filter_watermark.c for examples.
Property:
disable Set this on a filter to disable it while keeping it in the object model.
Property:
_profile stores the mlt_profile for a service
Property:
_unique_id is a unique identifier
Property:
_need_previous_next boolean that instructs producers to get preceding and following frames inside of mlt_service_get_frame

Member Function Documentation

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
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
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_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
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
void mlt_service_cache_purge ( mlt_service  self) [private]

Release a service's cache items.

Parameters:
selfa service
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
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
void mlt_service_close ( mlt_service  self)

Destroy a service.

Parameters:
selfthe service to destroy
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
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 warning, == 0 success, < 0 serious error, 1 = this service does not accept input, 2 = the producer is invalid, 3 = the producer is already registered with self consumer
mlt_service mlt_service_consumer ( mlt_service  self)

Obtain the consumer a service is connected to.

Parameters:
selfa service
Returns:
the consumer
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
static void mlt_service_disconnect ( mlt_service  self)

Disconnect a service from its consumer.

Parameters:
selfa service
mlt_filter mlt_service_filter ( mlt_service  self,
int  index 
)

Retrieve a filter.

Parameters:
selfa service
indexwhich one of potentially multiple filters
Returns:
the filter or null if there was an error
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
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 mlt_service_get_producer ( mlt_service  self)

Get the first connected producer.

Parameters:
selfa service
Returns:
the first producer
mlt_service_type mlt_service_identify ( mlt_service  self)

Identify the subclass of the service.

Parameters:
selfa service
Returns:
the subclass
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
void mlt_service_lock ( mlt_service  self)

Acquire a mutual exclusion lock on this service.

Parameters:
selfthe service to lock
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_profile mlt_service_profile ( mlt_service  self)

Retrieve the profile.

Parameters:
selfa service
Returns:
the profile
mlt_properties mlt_service_properties ( mlt_service  self)

Return the properties object.

Parameters:
selfa service
Returns:
the properties
static void mlt_service_property_changed ( mlt_listener  listener,
mlt_properties  owner,
mlt_service  self,
void **  args 
) [private]

The transmitter for property changes.

Invokes the listener.

Parameters:
listenera function pointer that will be invoked
ownera properties list that will be passed to listener
selfa service that will be passed to listener
argsan array of pointers - the first entry is passed as a string to listener
void mlt_service_unlock ( mlt_service  self)

Release a mutual exclusion lock on this service.

Parameters:
selfthe service to unlock
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

void* mlt_service_s::child [private]

the object of a subclass

Reimplemented from mlt_properties_s.

Reimplemented in mlt_consumer_s, mlt_filter_s, mlt_producer_s, and mlt_transition_s.

the destructor virtual function

Reimplemented from mlt_properties_s.

Reimplemented in mlt_consumer_s, mlt_filter_s, mlt_producer_s, and mlt_transition_s.

the object supplied to the close virtual function

Reimplemented from mlt_properties_s.

Reimplemented in mlt_producer_s.

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

Reimplemented in mlt_producer_s.

void* mlt_service_s::local [private]

instance object

Reimplemented from mlt_properties_s.

Reimplemented in mlt_consumer_s, and mlt_producer_s.

A service extends properties.

Reimplemented in mlt_consumer_s, mlt_filter_s, mlt_multitrack_s, mlt_playlist_s, mlt_producer_s, mlt_tractor_s, and mlt_transition_s.


The documentation for this struct was generated from the following files:
TWiki Appliance - Powered by TurnKey Linux