Skip to content

Commit

Permalink
Fix initialization of aspect ratio and meta.media.width/height
Browse files Browse the repository at this point in the history
  • Loading branch information
j-b-m committed Sep 22, 2014
1 parent f146e85 commit f615c1e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/modules/qt/kdenlivetitle_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,10 @@ void drawKdenliveTitle( producer_ktitle self, mlt_frame frame, int width, int he
mlt_properties_set_data( producer_props, "cached_image", self->current_image, size, mlt_pool_release, NULL );
self->current_width = width;
self->current_height = height;
mlt_events_block( producer_props, NULL );
mlt_properties_set_int( producer_props, "meta.media.width", self->current_width );
mlt_properties_set_int( producer_props, "meta.media.height", self->current_height );
mlt_events_unblock( producer_props, NULL );
}

pthread_mutex_unlock( &self->mutex );
Expand Down
17 changes: 13 additions & 4 deletions src/modules/qt/producer_kdenlivetitle.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
/* Obtain properties of producer */
mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( &this->parent );

*width = mlt_properties_get_int( properties, "rescale_width" );
*height = mlt_properties_get_int( properties, "rescale_height" );
if ( mlt_properties_get_int( properties, "rescale_width" ) > 0 )
*width = mlt_properties_get_int( properties, "rescale_width" );
if ( mlt_properties_get_int( properties, "rescale_height" ) > 0 )
*height = mlt_properties_get_int( properties, "rescale_height" );

mlt_service_lock( MLT_PRODUCER_SERVICE( &this->parent ) );

Expand Down Expand Up @@ -134,8 +136,13 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
/* Update timecode on the frame we're creating */
mlt_frame_set_position( *frame, mlt_producer_position( producer ) );

/* Set producer-specific frame properties */
mlt_properties_pass_list( properties, producer_props, "progressive, aspect_ratio" );
// Set producer-specific frame properties
mlt_properties_set_int( properties, "progressive", mlt_properties_get_int( producer_props, "progressive" ) );
double force_ratio = mlt_properties_get_double( producer_props, "force_aspect_ratio" );
if ( force_ratio > 0.0 )
mlt_properties_set_double( properties, "aspect_ratio", force_ratio );
else
mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( producer_props, "aspect_ratio" ) );

/* Push the get_image method */
mlt_frame_push_get_image( *frame, producer_get_image );
Expand Down Expand Up @@ -173,6 +180,8 @@ mlt_producer producer_kdenlivetitle_init( mlt_profile profile, mlt_service_type
producer->close = ( mlt_destructor )producer_close;
mlt_properties_set( properties, "resource", filename );
mlt_properties_set_int( properties, "progressive", 1 );
mlt_properties_set_int( properties, "aspect_ratio", 1 );
mlt_properties_set_int( properties, "seekable", 1 );
read_xml(properties);
return producer;
}
Expand Down

0 comments on commit f615c1e

Please sign in to comment.