mlt_properties_set_int( properties, "width", 720 );
mlt_properties_set_int( properties, "height", 576 );
mlt_properties_set_int( properties, "progressive", 0 );
- mlt_properties_set_double( properties, "aspect_ratio", 128.0 / 117.0 );
+ mlt_properties_set_double( properties, "aspect_ratio", 59.0 / 54.0 );
}
else
{
mlt_properties_set_int( properties, "width", 720 );
mlt_properties_set_int( properties, "height", 480 );
mlt_properties_set_int( properties, "progressive", 0 );
- mlt_properties_set_double( properties, "aspect_ratio", 72.0 / 79.0 );
+ mlt_properties_set_double( properties, "aspect_ratio", 10.0 / 11.0 );
}
// Default rescaler for all consumers
// Determine if there's a test card producer
char *test_card = mlt_properties_get( properties, "test_card" );
+ // Just to make sure nothing is hanging around...
+ mlt_frame_close( this->put );
+ this->put = NULL;
+
// Deal with it now.
if ( test_card != NULL )
{
if ( producer != NULL )
{
// Test card should loop I guess...
- mlt_properties_set( mlt_producer_properties( producer ), "eof", "loop" );
+ mlt_properties_set( mlt_producer_properties( producer ), "eof", "pause" );
+ 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 );
if ( mlt_service_producer( service ) == NULL )
{
+ struct timeval now;
+ struct timespec tm;
pthread_mutex_lock( &this->put_mutex );
- if ( this->put != NULL )
- pthread_cond_wait( &this->put_cond, &this->put_mutex );
+ while ( !mlt_consumer_is_stopped( this ) && this->put != NULL )
+ {
+ gettimeofday( &now, NULL );
+ tm.tv_sec = now.tv_sec + 1;
+ tm.tv_nsec = now.tv_usec * 1000;
+ pthread_cond_timedwait( &this->put_cond, &this->put_mutex, &tm );
+ }
if ( this->put == NULL )
this->put = frame;
else
// Get the service assoicated to the consumer
mlt_service service = mlt_consumer_service( this );
+ // Get the consumer properties
+ mlt_properties properties = mlt_consumer_properties( this );
+
// Get the frame
- if ( mlt_service_producer( service ) == NULL )
+ if ( mlt_service_producer( service ) == NULL && mlt_properties_get_int( properties, "put_mode" ) )
{
+ struct timeval now;
+ struct timespec tm;
pthread_mutex_lock( &this->put_mutex );
- if ( this->put == NULL )
- pthread_cond_wait( &this->put_cond, &this->put_mutex );
+ while ( !mlt_consumer_is_stopped( this ) && this->put == NULL )
+ {
+ gettimeofday( &now, NULL );
+ tm.tv_sec = now.tv_sec + 1;
+ tm.tv_nsec = now.tv_usec * 1000;
+ pthread_cond_timedwait( &this->put_cond, &this->put_mutex, &tm );
+ }
frame = this->put;
this->put = NULL;
pthread_cond_broadcast( &this->put_cond );
if ( frame != NULL )
mlt_service_apply_filters( service, frame, 0 );
}
-
- if ( frame != NULL || mlt_service_get_frame( service, &frame, 0 ) == 0 )
+ else if ( mlt_service_producer( service ) != NULL )
{
- // Get the consumer properties
- mlt_properties properties = mlt_consumer_properties( this );
+ mlt_service_get_frame( service, &frame, 0 );
+ }
+ if ( frame != NULL )
+ {
// Get the frame properties
mlt_properties frame_properties = mlt_frame_properties( frame );
mlt_deque_push_back( this->queue, frame );
pthread_cond_broadcast( &this->cond );
pthread_mutex_unlock( &this->mutex );
+
time_wait += time_difference( &ante );
// Get the next frame
frame = mlt_consumer_get_frame( this );
time_frame += time_difference( &ante );
+ // If there's no frame, we're probably stopped...
+ if ( frame == NULL )
+ continue;
+
// Increment the count
count ++;
frame = mlt_consumer_get_frame( this );
// This isn't true, but from the consumers perspective it is
- mlt_properties_set_int( mlt_frame_properties( frame ), "rendered", 1 );
+ if ( frame != NULL )
+ mlt_properties_set_int( mlt_frame_properties( frame ), "rendered", 1 );
}
return frame;
if ( mlt_properties_get( properties, "post" ) )
system( mlt_properties_get( properties, "post" ) );
+ if ( this->put != NULL )
+ {
+ mlt_frame_close( this->put );
+ this->put = NULL;
+ }
+
return 0;
}