// 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 = producer_close;
}
return this;
// Generate random noise
while ( p != *buffer )
{
- value = fast_rand( );
- *( -- p ) = 128;
- *( -- p ) = value & 0xff;
+ value = fast_rand( ) & 0xff;
*( -- p ) = 128;
- *( -- p ) = ( ( value & 0xff00 ) >> 8 ) & 0xf0;
+ *( -- p ) = value < 16 ? 16 : value > 240 ? 240 : value;
}
}
{
int16_t *p = *buffer + size / 2;
while ( p != *buffer )
- *( -- p ) = fast_rand( ) & 0xff;
+ *( -- p ) = fast_rand( ) & 0x0f00;
}
// Set the buffer for destruction
return 0;
}
+static void producer_close( mlt_producer this )
+{
+ this->close = NULL;
+ mlt_producer_close( this );
+ free( this );
+}