#include <stdlib.h>
#include <sys/time.h>
+static void mlt_consumer_frame_render( mlt_listener listener, mlt_properties owner, mlt_service this, void **args );
static void mlt_consumer_frame_show( mlt_listener listener, mlt_properties owner, mlt_service this, void **args );
/** Public final methods
{
mlt_properties_set( properties, "normalisation", "PAL" );
mlt_properties_set_double( properties, "fps", 25.0 );
+ mlt_properties_set_int( properties, "frame_rate_den", 25 );
+ mlt_properties_set_int( properties, "frame_rate_num", 1 );
mlt_properties_set_int( properties, "width", 720 );
mlt_properties_set_int( properties, "height", 576 );
mlt_properties_set_int( properties, "progressive", 0 );
{
mlt_properties_set( properties, "normalisation", "NTSC" );
mlt_properties_set_double( properties, "fps", 30000.0 / 1001.0 );
+ mlt_properties_set_int( properties, "frame_rate_den", 30000 );
+ mlt_properties_set_int( properties, "frame_rate_num", 1001 );
mlt_properties_set_int( properties, "width", 720 );
mlt_properties_set_int( properties, "height", 480 );
mlt_properties_set_int( properties, "progressive", 0 );
this->format = mlt_image_yuv422;
mlt_events_register( properties, "consumer-frame-show", ( mlt_transmitter )mlt_consumer_frame_show );
+ mlt_events_register( properties, "consumer-frame-render", ( mlt_transmitter )mlt_consumer_frame_render );
mlt_events_register( properties, "consumer-stopped", NULL );
// Create the push mutex and condition
listener( owner, this, ( mlt_frame )args[ 0 ] );
}
+static void mlt_consumer_frame_render( mlt_listener listener, mlt_properties owner, mlt_service this, void **args )
+{
+ if ( listener != NULL )
+ listener( owner, this, ( mlt_frame )args[ 0 ] );
+}
+
/** Create a new consumer.
*/
if ( producer != NULL )
{
// Test card should loop I guess...
- mlt_properties_set( MLT_PRODUCER_PROPERTIES( producer ), "eof", "pause" );
- mlt_producer_set_speed( producer, 0 );
- mlt_producer_set_in_and_out( producer, 0, 0 );
+ mlt_properties_set( MLT_PRODUCER_PROPERTIES( producer ), "eof", "loop" );
+ //mlt_producer_set_speed( producer, 0 );
+ //mlt_producer_set_in_and_out( producer, 0, 0 );
// Set the test card on the consumer
mlt_properties_set_data( properties, "test_card_producer", producer, 0, ( mlt_destructor )mlt_producer_close, NULL );
{
mlt_service_get_frame( service, &frame, 0 );
}
+ else
+ {
+ frame = mlt_frame_init( );
+ }
if ( frame != NULL )
{
// Aspect ratio and other jiggery pokery
mlt_properties_set_double( frame_properties, "consumer_aspect_ratio", mlt_properties_get_double( properties, "aspect_ratio" ) );
mlt_properties_set_int( frame_properties, "consumer_deinterlace", mlt_properties_get_int( properties, "progressive" ) | mlt_properties_get_int( properties, "deinterlace" ) );
+ mlt_properties_set( frame_properties, "deinterlace_method", mlt_properties_get( properties, "deinterlace_method" ) );
}
// Return the frame
// Get the image of the first frame
if ( !video_off )
+ {
+ mlt_events_fire( MLT_CONSUMER_PROPERTIES( this ), "consumer-frame-render", frame, NULL );
mlt_frame_get_image( frame, &image, &this->format, &width, &height, 0 );
+ }
if ( !audio_off )
{
// All non normal playback frames should be shown
if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "_speed" ) != 1 )
{
+ mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "consumer_deinterlace", 1 );
skipped = 0;
time_frame = 0;
time_process = 0;
{
// Get the image, mark as rendered and time it
if ( !video_off )
+ {
+ mlt_events_fire( MLT_CONSUMER_PROPERTIES( this ), "consumer-frame-render", frame, NULL );
mlt_frame_get_image( frame, &image, &this->format, &width, &height, 0 );
+ }
mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "rendered", 1 );
}
else
static void consumer_read_ahead_start( mlt_consumer this )
{
- pthread_attr_t thread_attributes;
-
// We're running now
this->ahead = 1;
// Create the condition
pthread_cond_init( &this->cond, NULL );
- // Inherit the scheduling priority
- pthread_attr_init( &thread_attributes );
- pthread_attr_setinheritsched( &thread_attributes, PTHREAD_INHERIT_SCHED );
-
// Create the read ahead
- pthread_create( &this->ahead_thread, &thread_attributes, consumer_read_ahead_thread, this );
+ pthread_create( &this->ahead_thread, NULL, consumer_read_ahead_thread, this );
}
static void consumer_read_ahead_stop( mlt_consumer this )