// Foward declarations
static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index );
+static void producer_close( mlt_producer this );
/** Initialise.
*/
{
// Callback registration
this->get_frame = producer_get_frame;
+ this->close = ( mlt_destructor )producer_close;
}
return this;
static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable )
{
// Obtain properties of frame
- mlt_properties properties = mlt_frame_properties( frame );
+ mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
// Calculate the size of the image
int size = *width * *height * 2;
static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples )
{
// Get the frame properties
- mlt_properties properties = mlt_frame_properties( frame );
+ mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
int size = 0;
{
int16_t *p = *buffer + size / 2;
while ( p != *buffer )
- *( -- p ) = fast_rand( ) & 0xff;
+ *( -- p ) = fast_rand( ) & 0x0f00;
}
// Set the buffer for destruction
if ( *frame != NULL )
{
// Obtain properties of frame
- mlt_properties properties = mlt_frame_properties( *frame );
+ mlt_properties properties = MLT_FRAME_PROPERTIES( *frame );
- // Aspect ratio is 1?
- mlt_properties_set_double( properties, "aspect_ratio", 1.0 );
+ // Aspect ratio is whatever it needs to be
+ mlt_properties_set_double( properties, "aspect_ratio", 0 );
// Set producer-specific frame properties
mlt_properties_set_int( properties, "progressive", 1 );
mlt_frame_push_get_image( *frame, producer_get_image );
// Specify the audio
- ( *frame )->get_audio = producer_get_audio;
+ mlt_frame_push_audio( *frame, producer_get_audio );
}
// Calculate the next timecode
return 0;
}
+static void producer_close( mlt_producer this )
+{
+ this->close = NULL;
+ mlt_producer_close( this );
+ free( this );
+}