MLT 6.26.0
|
Consumer abstract service class. More...
#include <mlt_consumer.h>
Public Member Functions | |
void | mlt_consumer_close (mlt_consumer self) |
Close and destroy the consumer. | |
int | mlt_consumer_connect (mlt_consumer self, mlt_service producer) |
Connect the consumer to the producer. | |
mlt_frame | mlt_consumer_get_frame (mlt_consumer self) |
Protected method for consumer to get frames from connected service. | |
int | mlt_consumer_init (mlt_consumer self, void *child, mlt_profile profile) |
Initialize a consumer service. | |
int | mlt_consumer_is_stopped (mlt_consumer self) |
Determine if the consumer is stopped. | |
mlt_consumer | mlt_consumer_new (mlt_profile profile) |
Create a new consumer. | |
mlt_position | mlt_consumer_position (mlt_consumer consumer) |
Get the position of the last frame shown. | |
mlt_properties | mlt_consumer_properties (mlt_consumer self) |
Get the consumer properties. | |
void | mlt_consumer_purge (mlt_consumer self) |
Flush the read/render thread's buffer. | |
int | mlt_consumer_put_frame (mlt_consumer self, mlt_frame frame) |
An alternative method to feed frames into the consumer. | |
mlt_frame | mlt_consumer_rt_frame (mlt_consumer self) |
Get the next frame from the producer connected to a consumer. | |
mlt_service | mlt_consumer_service (mlt_consumer self) |
Get the parent service object. | |
int | mlt_consumer_start (mlt_consumer self) |
Start the consumer. | |
int | mlt_consumer_stop (mlt_consumer self) |
Stop the consumer. | |
void | mlt_consumer_stopped (mlt_consumer self) |
Callback for the implementation to indicate a stopped condition. | |
![]() | |
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. | |
int | mlt_service_disconnect_all_producers (mlt_service self) |
Remove the all the attached producers. | |
int | mlt_service_disconnect_producer (mlt_service self, int index) |
Remove the N-th producer. | |
mlt_filter | mlt_service_filter (mlt_service self, int index) |
Retrieve an attached filter. | |
int | mlt_service_filter_count (mlt_service self) |
Get the number of filters attached. | |
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. | |
int | mlt_service_insert_producer (mlt_service self, mlt_service producer, int index) |
Insert a producer connected to the service. | |
void | mlt_service_lock (mlt_service self) |
Acquire a mutual exclusion lock on this service. | |
int | mlt_service_move_filter (mlt_service self, int from, int to) |
Reorder the attached filters. | |
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_set_profile (mlt_service self, mlt_profile profile) |
Set the profile for a service. | |
void | mlt_service_unlock (mlt_service self) |
Release a mutual exclusion lock on this service. | |
![]() | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
void | mlt_properties_clear (mlt_properties self, const char *name) |
Remove the value for a property. | |
void | mlt_properties_close (mlt_properties self) |
Close a properties object. | |
int | mlt_properties_count (mlt_properties self) |
Return the number of items in the list. | |
void | mlt_properties_debug (mlt_properties self, const char *title, FILE *output) |
Output the properties to a file handle. | |
int | mlt_properties_dec_ref (mlt_properties self) |
Decrement the reference count. | |
int | mlt_properties_dir_list (mlt_properties self, const char *dirname, const char *pattern, int sort) |
Get the contents of a directory. | |
void | mlt_properties_dump (mlt_properties self, FILE *output) |
Dump the properties to a file handle. | |
int | mlt_properties_exists (mlt_properties self, const char *name) |
Check if a property exists. | |
char * | mlt_properties_frames_to_time (mlt_properties self, mlt_position frames, mlt_time_format format) |
Convert a frame count to a time string. | |
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. | |
char * | mlt_properties_get (mlt_properties self, const char *name) |
Get a string value by name. | |
mlt_animation | mlt_properties_get_animation (mlt_properties self, const char *name) |
Get the animation associated to the name. | |
mlt_color | mlt_properties_get_color (mlt_properties self, const char *name) |
Convert a numeric property to a tuple of color components. | |
void * | mlt_properties_get_data (mlt_properties self, const char *name, int *length) |
Get a binary data value associated to the name. | |
void * | mlt_properties_get_data_at (mlt_properties self, int index, int *size) |
Get a data value by index. | |
double | mlt_properties_get_double (mlt_properties self, const char *name) |
Get a floating point value associated to the name. | |
int | mlt_properties_get_int (mlt_properties self, const char *name) |
Get an integer associated to the name. | |
int64_t | mlt_properties_get_int64 (mlt_properties self, const char *name) |
Get a 64-bit integer associated to the name. | |
const char * | mlt_properties_get_lcnumeric (mlt_properties self) |
Get the numeric locale for this properties object. | |
char * | mlt_properties_get_name (mlt_properties self, int index) |
Get a property name by index. | |
mlt_position | mlt_properties_get_position (mlt_properties self, const char *name) |
Get a position value associated to the name. | |
mlt_rect | mlt_properties_get_rect (mlt_properties self, const char *name) |
Get a rectangle associated to the name. | |
char * | mlt_properties_get_time (mlt_properties self, const char *name, mlt_time_format format) |
Get a time string associated to the name. | |
char * | mlt_properties_get_value (mlt_properties self, int index) |
Get a property's string value by index. | |
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). | |
int | mlt_properties_inc_ref (mlt_properties self) |
Increment the reference count. | |
int | mlt_properties_inherit (mlt_properties self, mlt_properties that) |
Copy all serializable properties to another properties list. | |
int | mlt_properties_init (mlt_properties self, void *child) |
Initialize a properties object that was already allocated. | |
int | mlt_properties_is_sequence (mlt_properties properties) |
Determine if the properties list is really just a sequence or ordered list. | |
mlt_properties | mlt_properties_load (const char *filename) |
Create a properties object by reading a .properties text file. | |
void | mlt_properties_lock (mlt_properties self) |
Protect a properties list against concurrent access. | |
void | mlt_properties_mirror (mlt_properties self, mlt_properties that) |
Set a properties list to be a mirror copy of another. | |
mlt_properties | mlt_properties_new () |
Create a properties object. | |
int | mlt_properties_parse (mlt_properties self, const char *namevalue) |
Set a value by parsing a name=value string. | |
mlt_properties | mlt_properties_parse_yaml (const char *filename) |
Parse a YAML Tiny file by name. | |
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. | |
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. | |
void | mlt_properties_pass_property (mlt_properties self, mlt_properties that, const char *name) |
Copy a property to another properties list. | |
int | mlt_properties_preset (mlt_properties self, const char *name) |
Set properties from a preset. | |
int | mlt_properties_ref_count (mlt_properties self) |
Get the reference count. | |
int | mlt_properties_rename (mlt_properties self, const char *source, const char *dest) |
Rename a property. | |
int | mlt_properties_save (mlt_properties self, const char *filename) |
Save the properties to a file by name. | |
char * | mlt_properties_serialise_yaml (mlt_properties self) |
Serialize a properties list as a string of YAML Tiny. | |
int | mlt_properties_set (mlt_properties self, const char *name, const char *value) |
Set a property to a string. | |
int | mlt_properties_set_color (mlt_properties self, const char *name, mlt_color color) |
Set a property to an integer value by color. | |
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. | |
int | mlt_properties_set_double (mlt_properties self, const char *name, double value) |
Set a property to a floating point value. | |
int | mlt_properties_set_int (mlt_properties self, const char *name, int value) |
Set a property to an integer value. | |
int | mlt_properties_set_int64 (mlt_properties self, const char *name, int64_t value) |
Set a property to a 64-bit integer value. | |
int | mlt_properties_set_lcnumeric (mlt_properties self, const char *locale) |
Set the numeric locale used for string/double conversions. | |
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. | |
int | mlt_properties_set_position (mlt_properties self, const char *name, mlt_position value) |
Set a property to a position value. | |
int | mlt_properties_set_rect (mlt_properties self, const char *name, mlt_rect value) |
Set a property to a rectangle value. | |
int | mlt_properties_set_string (mlt_properties self, const char *name, const char *value) |
Set a property to a string. | |
mlt_position | mlt_properties_time_to_frames (mlt_properties self, const char *time) |
Convert a time string to a frame count. | |
void | mlt_properties_unlock (mlt_properties self) |
End protecting a properties list against concurrent access. | |
Data Fields | |
void(* | close )(mlt_consumer) |
The destructor virtual function. | |
int(* | is_stopped )(mlt_consumer) |
Get whether the consumer is running or stopped (virtual function). | |
struct mlt_service_s | parent |
A consumer is a service. | |
void(* | purge )(mlt_consumer) |
Purge the consumer of buffered data (virtual function). | |
int(* | start )(mlt_consumer) |
Start the consumer to pull frames (virtual function). | |
int(* | stop )(mlt_consumer) |
Stop the consumer (virtual function). | |
![]() | |
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). | |
![]() | |
mlt_destructor | close |
the destructor virtual function | |
void * | close_object |
the object supplied to the close virtual function | |
Static Private Member Functions | |
static void | apply_profile_properties (mlt_consumer self, mlt_profile profile, mlt_properties properties) |
Convert the profile into properties on the consumer. | |
static void | consumer_read_ahead_start (mlt_consumer self) |
Start the read/render thread. | |
static void | consumer_read_ahead_stop (mlt_consumer self) |
Stop the read/render thread. | |
static void * | consumer_read_ahead_thread (void *arg) |
The thread procedure for asynchronously pulling frames through the service network connected to a consumer. | |
static void | consumer_work_start (mlt_consumer self) |
Start the worker threads. | |
static void | consumer_work_stop (mlt_consumer self) |
Stop the worker threads. | |
static void * | consumer_worker_thread (void *arg) |
The worker thread procedure for parallel processing frames. | |
static int | first_unprocessed_frame (mlt_consumer self) |
Locate the first unprocessed frame in the queue. | |
static void | mlt_consumer_frame_render (mlt_listener listener, mlt_properties owner, mlt_service self, void **args) |
The transmitter for the consumer-frame-render event. | |
static void | mlt_consumer_frame_show (mlt_listener listener, mlt_properties owner, mlt_service self, void **args) |
The transmitter for the consumer-frame-show event. | |
static void | mlt_consumer_property_changed (mlt_properties owner, mlt_consumer self, char *name) |
The property-changed event listener. | |
static void | on_consumer_frame_show (mlt_properties owner, mlt_consumer consumer, mlt_frame frame) |
A listener on the consumer-frame-show event. | |
static void | set_audio_format (mlt_consumer self) |
Set the audio format to use in the render thread. | |
static void | set_image_format (mlt_consumer self) |
Set the image format to use in render threads. | |
static long | time_difference (struct timeval *time1) |
Compute the time difference between now and a time value. | |
Private Attributes | |
void * | child |
the object of a subclass | |
void * | local |
instance object | |
Consumer abstract service class.
A consumer is a service that pulls audio and video from the connected producers, filters, and transitions. Typically a consumer is used to output audio and/or video to a device, file, or socket.
rescale the scaling algorithm to pass on to all scaling filters, defaults to "bilinear"
buffer the number of frames to use in the asynchronous render thread, defaults to 25
prefill the number of frames to render before commencing output when real_time <> 0, defaults to the size of buffer
drop_max the maximum number of consecutively dropped frames, defaults to 5
frequency the audio sample rate to use in Hertz, defaults to 48000
channels the number of audio channels to use, defaults to 2
channel_layout the layout of the audio channels, defaults to auto. other options include: mono, stereo, 5.1, 7.1, etc.
real_time the asynchronous behavior: 1 (default) for asynchronous with frame dropping, -1 for asynchronous without frame dropping, 0 to disable (synchronous)
test_card the name of a resource to use as the test card, defaults to environment variable MLT_TEST_CARD. If undefined, the hard-coded default test card is white silence. A test card is what appears when nothing is produced.
consumer-frame-show Subclass implementations fire this immediately after showing a frame or when a frame should be shown (if audio-only consumer).
consumer-frame-render The base class fires this immediately before rendering a frame.
consumer-thread-create Override the implementation of creating and starting a thread by listening and responding to this (real_time 1 or -1 only).
consumer-thread-join Override the implementation of waiting and joining a terminated thread by listening and responding to this (real_time 1 or -1 only).
consumer-thread-started The base class fires when beginning execution of a rendering thread.
consumer-thread-stopped The base class fires when a rendering thread has ended.
consumer-stopping This is fired when stop was requested, but before render threads are joined.
consumer-stopped This is fired when the subclass implementation calls mlt_consumer_stopped().
fps video frames per second as floating point (read only)
frame_rate_num the numerator of the video frame rate, overrides mlt_profile_s
frame_rate_den the denominator of the video frame rate, overrides mlt_profile_s
width the horizontal video resolution, overrides mlt_profile_s
height the vertical video resolution, overrides mlt_profile_s
progressive a flag that indicates if the video is interlaced or progressive, overrides mlt_profile_s
aspect_ratio the video sample (pixel) aspect ratio as floating point (read only)
sample_aspect_num the numerator of the sample aspect ratio, overrides mlt_profile_s
sample_aspect_den the denominator of the sample aspect ratio, overrides mlt_profile_s
display_ratio the video frame aspect ratio as floating point (read only)
display_aspect_num the numerator of the video frame aspect ratio, overrides mlt_profile_s
display_aspect_den the denominator of the video frame aspect ratio, overrides mlt_profile_s
priority the OS scheduling priority for the render threads when real_time is not 0.
top_field_first when not progressive, whether interlace field order is top-field-first, defaults to 0. Set this to -1 if the consumer does not care about the field order.
mlt_image_format the image format to request in rendering threads, defaults to yuv422
mlt_audio_format the audio format to request in rendering threads, defaults to S16
audio_off set non-zero to disable audio processing
video_off set non-zero to disable video processing
drop_count the number of video frames not rendered since starting consumer
|
staticprivate |
Convert the profile into properties on the consumer.
self | a consumer |
profile | a profile |
properties | a properties list (typically, the consumer's) |
|
staticprivate |
Start the read/render thread.
self | a consumer |
|
staticprivate |
Stop the read/render thread.
self | a consumer |
|
staticprivate |
The thread procedure for asynchronously pulling frames through the service network connected to a consumer.
arg | a consumer |
|
staticprivate |
Start the worker threads.
self | a consumer |
|
staticprivate |
Stop the worker threads.
self | a consumer |
|
staticprivate |
The worker thread procedure for parallel processing frames.
arg | a consumer |
|
inlinestaticprivate |
Locate the first unprocessed frame in the queue.
When playing with realtime behavior, we do not use the true head, but rather an adjusted process_head. The process_head is adjusted based on the rate of frame-dropping or recovery from frame-dropping. The idea is that as the level of frame-dropping increases to move the process_head closer to the tail because the frames are not completing processing prior to their playout! Then, as frames are not dropped the process_head moves back closer to the head of the queue so that worker threads can work ahead of the playout point (queue head).
self | a consumer |
void mlt_consumer_close | ( | mlt_consumer | self | ) |
Close and destroy the consumer.
self | a consumer |
int mlt_consumer_connect | ( | mlt_consumer | self, |
mlt_service | producer | ||
) |
Connect the consumer to the producer.
self | a consumer |
producer | a producer |
|
staticprivate |
The transmitter for the consumer-frame-render event.
Invokes the listener.
listener | a function pointer that will be invoked |
owner | the events object that will be passed to listener |
self | a service that will be passed to listener |
args | an array of pointers - the first entry is passed as a frame to listener |
|
staticprivate |
The transmitter for the consumer-frame-show event.
Invokes the listener.
listener | a function pointer that will be invoked |
owner | the events object that will be passed to listener |
self | a service that will be passed to listener |
args | an array of pointers - the first entry is passed as a frame to listener |
mlt_frame mlt_consumer_get_frame | ( | mlt_consumer | self | ) |
Protected method for consumer to get frames from connected service.
self | a consumer |
int mlt_consumer_init | ( | mlt_consumer | self, |
void * | child, | ||
mlt_profile | profile | ||
) |
Initialize a consumer service.
self | the consumer to initialize |
child | a pointer to the object for the subclass |
profile | the mlt_profile_s to use (optional but recommended, uses the environment variable MLT if self is NULL) |
int mlt_consumer_is_stopped | ( | mlt_consumer | self | ) |
Determine if the consumer is stopped.
self | a consumer |
mlt_consumer mlt_consumer_new | ( | mlt_profile | profile | ) |
Create a new consumer.
profile | a profile (optional, but recommended) |
mlt_position mlt_consumer_position | ( | mlt_consumer | consumer | ) |
Get the position of the last frame shown.
consumer | a consumer |
mlt_properties mlt_consumer_properties | ( | mlt_consumer | self | ) |
Get the consumer properties.
self | a consumer |
|
staticprivate |
The property-changed event listener.
owner | the events object |
self | the consumer |
name | the name of the property that changed |
void mlt_consumer_purge | ( | mlt_consumer | self | ) |
Flush the read/render thread's buffer.
self | a consumer |
int mlt_consumer_put_frame | ( | mlt_consumer | self, |
mlt_frame | frame | ||
) |
An alternative method to feed frames into the consumer.
Only valid if the consumer itself is not connected.
self | a consumer |
frame | a frame |
mlt_frame mlt_consumer_rt_frame | ( | mlt_consumer | self | ) |
Get the next frame from the producer connected to a consumer.
Typically, one uses this instead of mlt_consumer_get_frame
to make the asynchronous/real-time behavior configurable at runtime. You should close the frame returned from this when you are done with it.
self | a consumer |
mlt_service mlt_consumer_service | ( | mlt_consumer | self | ) |
Get the parent service object.
self | a consumer |
int mlt_consumer_start | ( | mlt_consumer | self | ) |
Start the consumer.
self | a consumer |
int mlt_consumer_stop | ( | mlt_consumer | self | ) |
Stop the consumer.
self | a consumer |
void mlt_consumer_stopped | ( | mlt_consumer | self | ) |
Callback for the implementation to indicate a stopped condition.
self | a consumer |
|
staticprivate |
A listener on the consumer-frame-show event.
Saves the position of the frame shown.
owner | the events object |
consumer | the consumer on which this event occurred |
frame | the frame that was shown |
|
staticprivate |
Set the audio format to use in the render thread.
self | a consumer |
|
staticprivate |
Set the image format to use in render threads.
self | a consumer |
|
inlinestaticprivate |
Compute the time difference between now and a time value.
time1 | a time value to be compared against now |
|
private |
the object of a subclass
void(* mlt_consumer_s::close) (mlt_consumer) |
The destructor virtual function.
mlt_consumer | a consumer |
int(* mlt_consumer_s::is_stopped) (mlt_consumer) |
Get whether the consumer is running or stopped (virtual function).
mlt_consumer | a consumer |
|
private |
instance object
struct mlt_service_s mlt_consumer_s::parent |
A consumer is a service.
void(* mlt_consumer_s::purge) (mlt_consumer) |
Purge the consumer of buffered data (virtual function).
mlt_consumer | a consumer |
int(* mlt_consumer_s::start) (mlt_consumer) |
Start the consumer to pull frames (virtual function).
mlt_consumer | a consumer |
int(* mlt_consumer_s::stop) (mlt_consumer) |
Stop the consumer (virtual function).
mlt_consumer | a consumer |