// Foward declarations
static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index );
+static void producer_close( mlt_producer this );
/** Initialise.
*/
// Initialise the producer
if ( this != NULL )
{
+ // Synthetic - aspect ratio of 1
+ mlt_properties_set_double( mlt_producer_properties( this ), "aspect_ratio", 1 );
+
// Callback registration
this->get_frame = producer_get_frame;
+ this->close = ( mlt_destructor )producer_close;
}
return this;
{
int16_t *p = *buffer + size / 2;
while ( p != *buffer )
- *( -- p ) = fast_rand( ) & 0xff;
+ *( -- p ) = fast_rand( ) & 0x0f00;
}
// Set the buffer for destruction
// Obtain properties of frame
mlt_properties properties = mlt_frame_properties( *frame );
+ // Obtain properties of producer
+ mlt_properties producer_props = mlt_producer_properties( this );
+
+ // Determine if we're producing PAL or NTSC
+ int is_pal = mlt_properties_get_double( producer_props, "fps" ) == 25.0;
+
// Aspect ratio is 1?
- mlt_properties_set_double( properties, "aspect_ratio", 1.0 );
+ mlt_properties_set_double( properties, "aspect_ratio", is_pal ? 128.0/117.0 : 72.0/79.0 );
// Set producer-specific frame properties
mlt_properties_set_int( properties, "progressive", 1 );
return 0;
}
+static void producer_close( mlt_producer this )
+{
+ this->close = NULL;
+ mlt_producer_close( this );
+ free( this );
+}