|
mlt 0.7.6
|
Frame class. More...
#include <mlt_frame.h>
Public Member Functions | |
| const char * | mlt_audio_format_name (mlt_audio_format format) |
| Get the short name for an audio format. | |
| int | mlt_audio_format_size (mlt_audio_format format, int samples, int channels) |
| Get the amount of bytes needed for a block of audio. | |
| mlt_frame | mlt_frame_clone (mlt_frame self, int is_deep) |
| Make a copy of a frame. | |
| void | mlt_frame_close (mlt_frame self) |
| Destroy the frame. | |
| uint8_t * | mlt_frame_get_alpha_mask (mlt_frame self) |
| Get the alpha channel associated to the frame. | |
| double | mlt_frame_get_aspect_ratio (mlt_frame self) |
| Get the sample aspect ratio of the frame. | |
| int | mlt_frame_get_audio (mlt_frame self, void **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples) |
| Get the audio associated to the frame. | |
| int | mlt_frame_get_image (mlt_frame self, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable) |
| Get the image associated to the frame. | |
| mlt_producer | mlt_frame_get_original_producer (mlt_frame self) |
| Get the end service that produced self frame. | |
| mlt_position | mlt_frame_get_position (mlt_frame self) |
| Get the time position of this frame. | |
| unsigned char * | mlt_frame_get_waveform (mlt_frame self, int w, int h) |
| Get audio on a frame as a waveform image. | |
| mlt_frame | mlt_frame_init (mlt_service service) |
| Construct a frame object. | |
| int | mlt_frame_is_test_audio (mlt_frame self) |
| Determine if the frame will produce audio from a test card. | |
| int | mlt_frame_is_test_card (mlt_frame self) |
| Determine if the frame will produce a test card image. | |
| void * | mlt_frame_pop_audio (mlt_frame self) |
| Pop an audio item from the stack. | |
| mlt_frame | mlt_frame_pop_frame (mlt_frame self) |
| Pop a frame. | |
| mlt_get_image | mlt_frame_pop_get_image (mlt_frame self) |
| Pop a get_image callback. | |
| void * | mlt_frame_pop_service (mlt_frame self) |
| Pop a service. | |
| int | mlt_frame_pop_service_int (mlt_frame self) |
| Pop a number. | |
| mlt_properties | mlt_frame_properties (mlt_frame self) |
| Get a frame's properties. | |
| int | mlt_frame_push_audio (mlt_frame self, void *that) |
| Push an audio item on the stack. | |
| int | mlt_frame_push_frame (mlt_frame self, mlt_frame that) |
| Push a frame. | |
| int | mlt_frame_push_get_image (mlt_frame self, mlt_get_image get_image) |
| Stack a get_image callback. | |
| int | mlt_frame_push_service (mlt_frame self, void *that) |
| Push a service. | |
| int | mlt_frame_push_service_int (mlt_frame self, int that) |
| Push a number. | |
| void | mlt_frame_replace_image (mlt_frame self, uint8_t *image, mlt_image_format format, int width, int height) |
| Replace image stack with the information provided. | |
| mlt_deque | mlt_frame_service_stack (mlt_frame self) |
| Return the service stack. | |
| int | mlt_frame_set_alpha (mlt_frame self, uint8_t *alpha, int size, mlt_destructor destroy) |
| Set a new alpha channel on the frame. | |
| int | mlt_frame_set_aspect_ratio (mlt_frame self, double value) |
| Set the sample aspect ratio of the frame. | |
| int | mlt_frame_set_audio (mlt_frame self, void *buffer, mlt_audio_format format, int size, mlt_destructor destructor) |
| Set the audio on a frame. | |
| int | mlt_frame_set_image (mlt_frame self, uint8_t *image, int size, mlt_destructor destroy) |
| Set a new image on the frame. | |
| int | mlt_frame_set_position (mlt_frame self, mlt_position value) |
| Set the time position of this frame. | |
| mlt_properties | mlt_frame_unique_properties (mlt_frame self, mlt_service service) |
| Get or create a properties object unique to this service instance. | |
| const char * | mlt_image_format_name (mlt_image_format format) |
| Get the short name for an image format. | |
| int | mlt_image_format_size (mlt_image_format format, int width, int height, int *bpp) |
| Get the number of bytes needed for an image. | |
| int | mlt_sample_calculator (float fps, int frequency, int64_t position) |
| Determine the number of samples that belong in a frame at a time position. | |
| int64_t | mlt_sample_calculator_to_now (float fps, int frequency, int64_t position) |
| Determine the number of samples that belong before a time position. | |
Data Fields | |
| int(* | convert_audio )(mlt_frame self, void **audio, mlt_audio_format *input, mlt_audio_format output) |
| Convert the audio format (callback function). | |
| int(* | convert_image )(mlt_frame self, uint8_t **image, mlt_image_format *input, mlt_image_format output) |
| Convert the image format (callback function). | |
| uint8_t *(* | get_alpha_mask )(mlt_frame self) |
| Get the alpha channel (callback function). | |
Private Attributes | |
| int | is_processing |
| indicates if a frame is or was processed by the parallel consumer | |
| struct mlt_properties_s | parent |
| A frame extends properties. | |
| mlt_deque | stack_audio |
| the audio processing stack of operations and data | |
| mlt_deque | stack_image |
| the image processing stack of operations and data | |
| mlt_deque | stack_service |
| a general purpose data stack | |
Frame class.
The frame is the primary data object that gets passed around to and through services.
| const char * mlt_audio_format_name | ( | mlt_audio_format | format | ) |
Get the short name for an audio format.
You do not need to deallocate the returned string.
| format | an audio format enum |
| int mlt_audio_format_size | ( | mlt_audio_format | format, |
| int | samples, | ||
| int | channels | ||
| ) |
Get the amount of bytes needed for a block of audio.
| format | an audio format enum |
| samples | the number of samples per channel |
| channels | the number of channels |
Make a copy of a frame.
This does not copy the get_image/get_audio processing stacks or any data properties other than the audio and image.
| self | the frame to clone |
| is_deep | a boolean to indicate whether to make a deep copy of the audio and video data chunks or to make a shallow copy by pointing to the supplied frame |
| void mlt_frame_close | ( | mlt_frame | self | ) |
Destroy the frame.
| self | a frame |
| uint8_t * mlt_frame_get_alpha_mask | ( | mlt_frame | self | ) |
Get the alpha channel associated to the frame.
| self | a frame |
| double mlt_frame_get_aspect_ratio | ( | mlt_frame | self | ) |
Get the sample aspect ratio of the frame.
| self | a frame |
| int mlt_frame_get_audio | ( | mlt_frame | self, |
| void ** | buffer, | ||
| mlt_audio_format * | format, | ||
| int * | frequency, | ||
| int * | channels, | ||
| int * | samples | ||
| ) |
Get the audio associated to the frame.
You should express the desired format, frequency, channels, and samples as inputs. As long as the loader producer was used to generate this or the audioconvert filter was attached, then you will get the audio back in the format you desire. However, you do not always get the channels and samples you request depending on properties and filters. You do not need to supply a pre-allocated buffer, but you should always supply the desired audio format. The audio is always in interleaved format. You should use the mlt_sample_calculator to determine the number of samples you want.
| self | a frame | |
| [out] | buffer | an audio buffer |
| [in,out] | format | the audio format |
| [in,out] | frequency | the sample rate |
| [in,out] | channels | |
| [in,out] | samples | the number of samples per frame |
| int mlt_frame_get_image | ( | mlt_frame | self, |
| uint8_t ** | buffer, | ||
| mlt_image_format * | format, | ||
| int * | width, | ||
| int * | height, | ||
| int | writable | ||
| ) |
Get the image associated to the frame.
You should express the desired format, width, and height as inputs. As long as the loader producer was used to generate this or the imageconvert filter was attached, then you will get the image back in the format you desire. However, you do not always get the width and height you request depending on properties and filters. You do not need to supply a pre-allocated buffer, but you should always supply the desired image format.
| self | a frame | |
| [out] | buffer | an image buffer |
| [in,out] | format | the image format |
| [in,out] | width | the horizontal size in pixels |
| [in,out] | height | the vertical size in pixels |
| writable | whether or not you will need to be able to write to the memory returned in buffer |
| mlt_producer mlt_frame_get_original_producer | ( | mlt_frame | self | ) |
Get the end service that produced self frame.
This fetches the first producer of the frame and not any producers that encapsulate it.
| self | a frame |
| mlt_position mlt_frame_get_position | ( | mlt_frame | self | ) |
Get the time position of this frame.
| self | a frame |
| unsigned char * mlt_frame_get_waveform | ( | mlt_frame | self, |
| int | w, | ||
| int | h | ||
| ) |
Get audio on a frame as a waveform image.
This generates an 8-bit grayscale image representation of the audio in a frame. Currently, this only really works for 2 channels. This allocates the bitmap using mlt_pool so you should release the return value with mlt_pool_release.
| self | a frame |
| w | the width of the image |
| h | the height of the image to create |
| mlt_frame mlt_frame_init | ( | mlt_service | service | ) |
Construct a frame object.
| service | the pointer to any service that can provide access to the profile |
| int mlt_frame_is_test_audio | ( | mlt_frame | self | ) |
Determine if the frame will produce audio from a test card.
| self | a frame |
| int mlt_frame_is_test_card | ( | mlt_frame | self | ) |
Determine if the frame will produce a test card image.
| self | a frame |
| void * mlt_frame_pop_audio | ( | mlt_frame | self | ) |
Pop an audio item from the stack.
| self | a frame |
Pop a frame.
| self | a frame |
| mlt_get_image mlt_frame_pop_get_image | ( | mlt_frame | self | ) |
Pop a get_image callback.
| self | a frame |
| void * mlt_frame_pop_service | ( | mlt_frame | self | ) |
Pop a service.
| self | a frame |
| int mlt_frame_pop_service_int | ( | mlt_frame | self | ) |
Pop a number.
| self | a frame |
| mlt_properties mlt_frame_properties | ( | mlt_frame | self | ) |
Get a frame's properties.
| self | a frame |
| int mlt_frame_push_audio | ( | mlt_frame | self, |
| void * | that | ||
| ) |
Push an audio item on the stack.
| self | a frame |
| that | an opaque pointer |
Push a frame.
| self | a frame |
| that | the frame to push onto self |
| int mlt_frame_push_get_image | ( | mlt_frame | self, |
| mlt_get_image | get_image | ||
| ) |
Stack a get_image callback.
| self | a frame |
| the | get_image callback |
| int mlt_frame_push_service | ( | mlt_frame | self, |
| void * | that | ||
| ) |
Push a service.
| self | a frame |
| that | an opaque pointer |
| int mlt_frame_push_service_int | ( | mlt_frame | self, |
| int | that | ||
| ) |
Push a number.
| self | a frame |
| that | an integer |
| void mlt_frame_replace_image | ( | mlt_frame | self, |
| uint8_t * | image, | ||
| mlt_image_format | format, | ||
| int | width, | ||
| int | height | ||
| ) |
Replace image stack with the information provided.
This might prove to be unreliable and restrictive - the idea is that a transition which normally uses two images may decide to only use the b frame (ie: in the case of a composite where the b frame completely obscures the a frame).
The image must be writable and the destructor for the image itself must be taken care of on another frame and that frame cannot have a replace applied to it... Further it assumes that no alpha mask is in use.
For these reasons, it can only be used in a specific situation - when you have multiple tracks each with their own transition and these transitions are applied in a strictly reversed order (ie: highest numbered [lowest track] is processed first).
More reliable approach - the cases should be detected during the process phase and the upper tracks should simply not be invited to stack...
| self | a frame |
| image | a new image |
| format | the image format |
| width | the width of the new image |
| height | the height of the new image |
Return the service stack.
| self | a frame |
| int mlt_frame_set_alpha | ( | mlt_frame | self, |
| uint8_t * | alpha, | ||
| int | size, | ||
| mlt_destructor | destroy | ||
| ) |
Set a new alpha channel on the frame.
| self | a frame |
| alpha | a pointer to the alpha channel |
| size | the size of the alpha channel in bytes (optional) |
| destroy | a function to deallocate alpha when the frame is closed (optional) |
| int mlt_frame_set_aspect_ratio | ( | mlt_frame | self, |
| double | value | ||
| ) |
Set the sample aspect ratio of the frame.
| self | a frame |
| value | the new image sample aspect ratio |
| int mlt_frame_set_audio | ( | mlt_frame | self, |
| void * | buffer, | ||
| mlt_audio_format | format, | ||
| int | size, | ||
| mlt_destructor | destructor | ||
| ) |
Set the audio on a frame.
| self | a frame |
| buffer | an buffer containing audio samples |
| format | the format of the audio in the buffer |
| size | the total size of the buffer (optional) |
| destructor | a function that releases or deallocates the buffer |
| int mlt_frame_set_image | ( | mlt_frame | self, |
| uint8_t * | image, | ||
| int | size, | ||
| mlt_destructor | destroy | ||
| ) |
Set a new image on the frame.
| self | a frame |
| image | a pointer to the raw image data |
| size | the size of the image data in bytes (optional) |
| destroy | a function to deallocate image when the frame is closed (optional) |
| int mlt_frame_set_position | ( | mlt_frame | self, |
| mlt_position | value | ||
| ) |
Set the time position of this frame.
| self | a frame |
| value | the position |
| mlt_properties mlt_frame_unique_properties | ( | mlt_frame | self, |
| mlt_service | service | ||
| ) |
Get or create a properties object unique to this service instance.
Use this function to hold a service's processing parameters for this particular frame. Set the parameters in the service's process function. Then, get the parameters in the function it pushes to the frame's audio or image stack. This makes the service more parallel by reducing race conditions and less sensitive to multiple instances (by not setting a non-unique property on the frame). Creation and destruction of the properties object is handled automatically.
| self | a frame |
| service | a service |
| const char * mlt_image_format_name | ( | mlt_image_format | format | ) |
Get the short name for an image format.
| format | the image format |
| int mlt_image_format_size | ( | mlt_image_format | format, |
| int | width, | ||
| int | height, | ||
| int * | bpp | ||
| ) |
Get the number of bytes needed for an image.
| format | the image format | |
| width | width of the image in pixels | |
| height | height of the image in pixels | |
| [out] | bpp | the number of bytes per pixel (optional) |
| int mlt_sample_calculator | ( | float | fps, |
| int | frequency, | ||
| int64_t | position | ||
| ) |
Determine the number of samples that belong in a frame at a time position.
| fps | the frame rate |
| frequency | the sample rate |
| position | the time position |
| int64_t mlt_sample_calculator_to_now | ( | float | fps, |
| int | frequency, | ||
| int64_t | position | ||
| ) |
Determine the number of samples that belong before a time position.
| fps | the frame rate |
| frequency | the sample rate |
| position | the time position |
| int( * mlt_frame_s::convert_audio)(mlt_frame self, void **audio, mlt_audio_format *input, mlt_audio_format output) |
Convert the audio format (callback function).
| self | a frame | |
| [in,out] | audio | a buffer of audio data |
| [in,out] | input | the audio format of supplied data |
| output | the audio format to which to convert |
| int( * mlt_frame_s::convert_image)(mlt_frame self, uint8_t **image, mlt_image_format *input, mlt_image_format output) |
Convert the image format (callback function).
| self | a frame | |
| [in,out] | image | a buffer of image data |
| [in,out] | input | the image format of supplied image data |
| output | the image format to which to convert |
| uint8_t*( * mlt_frame_s::get_alpha_mask)(mlt_frame self) |
Get the alpha channel (callback function).
| self | a frame |
int mlt_frame_s::is_processing [private] |
indicates if a frame is or was processed by the parallel consumer
struct mlt_properties_s mlt_frame_s::parent [private] |
A frame extends properties.
mlt_deque mlt_frame_s::stack_audio [private] |
the audio processing stack of operations and data
mlt_deque mlt_frame_s::stack_image [private] |
the image processing stack of operations and data
mlt_deque mlt_frame_s::stack_service [private] |
a general purpose data stack
1.7.3