if ( test_card != NULL )
mlt_properties_set_data( frame_properties, "test_card_producer", test_card, 0, NULL, NULL );
- // Attach the rescale property
+ // Pass along the interpolation and deinterlace options
+ // TODO: get rid of consumer_deinterlace and use profile.progressive
mlt_properties_set( frame_properties, "rescale.interp", mlt_properties_get( properties, "rescale" ) );
-
- // 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" ) );
mlt_properties_set_int( frame_properties, "consumer_tff", mlt_properties_get_int( properties, "top_field_first" ) );
if ( test_frame )
{
mlt_properties test_properties = MLT_FRAME_PROPERTIES( test_frame );
- mlt_properties_set_double( test_properties, "consumer_aspect_ratio", mlt_properties_get_double( properties, "consumer_aspect_ratio" ) );
mlt_properties_set( test_properties, "rescale.interp", mlt_properties_get( properties, "rescale.interp" ) );
mlt_frame_get_image( test_frame, buffer, format, width, height, writable );
mlt_properties_set_data( properties, "test_card_frame", test_frame, 0, ( mlt_destructor )mlt_frame_close, NULL );
if ( ! mlt_service_get_frame( MLT_PRODUCER_SERVICE(producer), &fr, 0 ) && fr )
{
- mlt_properties_set_double( MLT_FRAME_PROPERTIES( fr ), "consumer_aspect_ratio", mlt_profile_sar( profile ) );
if ( ! mlt_frame_get_image( fr, &buffer, &fmt, &w, &h, 0 ) )
{
// Some source properties are not exposed until after the first get_image call.
mlt_properties_set( frame_properties, "rescale.interp", mlt_properties_get( properties, "rescale.interp" ) );
mlt_properties_set_int( frame_properties, "resize_alpha", mlt_properties_get_int( properties, "resize_alpha" ) );
mlt_properties_set_int( frame_properties, "distort", mlt_properties_get_int( properties, "distort" ) );
- mlt_properties_set_double( frame_properties, "consumer_aspect_ratio", mlt_properties_get_double( properties, "consumer_aspect_ratio" ) );
mlt_properties_set_int( frame_properties, "consumer_deinterlace", mlt_properties_get_int( properties, "consumer_deinterlace" ) );
mlt_properties_set( frame_properties, "deinterlace_method", mlt_properties_get( properties, "deinterlace_method" ) );
mlt_properties_set_int( frame_properties, "consumer_tff", mlt_properties_get_int( properties, "consumer_tff" ) );
static int get_image_a( mlt_frame a_frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
{
+ mlt_transition self = mlt_frame_pop_service( a_frame );
mlt_properties a_props = MLT_FRAME_PROPERTIES( a_frame );
// All transitions get scaling
mlt_properties_set( a_props, "rescale.interp", "nearest" );
// Ensure sane aspect ratio
- if ( mlt_properties_get_double( a_props, "aspect_ratio" ) == 0.0 )
- mlt_properties_set_double( a_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
+ if ( mlt_frame_get_aspect_ratio( a_frame ) == 0.0 )
+ mlt_frame_set_aspect_ratio( a_frame, mlt_profile_sar( mlt_service_profile( MLT_TRANSITION_SERVICE(self) ) ) );
return mlt_frame_get_image( a_frame, image, format, width, height, writable );
}
static int get_image_b( mlt_frame b_frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
{
+ mlt_transition self = mlt_frame_pop_service( b_frame );
mlt_frame a_frame = mlt_frame_pop_frame( b_frame );
mlt_properties a_props = MLT_FRAME_PROPERTIES( a_frame );
mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame );
}
// Ensure sane aspect ratio
- if ( mlt_properties_get_double( b_props, "aspect_ratio" ) == 0.0 )
- mlt_properties_set_double( b_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
+ if ( mlt_frame_get_aspect_ratio( b_frame ) == 0.0 )
+ mlt_frame_set_aspect_ratio( b_frame, mlt_profile_sar( mlt_service_profile( MLT_TRANSITION_SERVICE(self) ) ) );
mlt_properties_pass_list( b_props, a_props,
- "consumer_deinterlace, deinterlace_method, consumer_aspect_ratio, consumer_tff" );
+ "consumer_deinterlace, deinterlace_method, consumer_tff" );
return mlt_frame_get_image( b_frame, image, format, width, height, writable );
}
if ( !( a_hide & type ) && !( b_hide & type ) )
{
// Add hooks for pre-processing frames
+ mlt_frame_push_service( a_frame_ptr, self );
mlt_frame_push_get_image( a_frame_ptr, get_image_a );
mlt_frame_push_frame( b_frame_ptr, a_frame_ptr );
+ mlt_frame_push_service( b_frame_ptr, self );
mlt_frame_push_get_image( b_frame_ptr, get_image_b );
// Process the transition
{
double aspect_ratio = mlt_frame_get_aspect_ratio( frame );
if ( aspect_ratio == 0.0 )
- aspect_ratio = mlt_properties_get_double( frame_props, "consumer_aspect_ratio" );
+ aspect_ratio = mlt_profile_sar( profile );
double input_ar = aspect_ratio * width / height;
double output_ar = mlt_profile_dar( mlt_service_profile( MLT_FILTER_SERVICE(filter) ) );
int bias = mlt_properties_get_int( filter_props, "center_bias" );
// Get the a and b frame properties
mlt_properties a_props = MLT_FRAME_PROPERTIES( frame );
mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame );
+ mlt_profile profile = mlt_service_profile( service );
// Set the b frame to be in the same position and have same consumer requirements
mlt_frame_set_position( b_frame, position );
- mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
mlt_properties_set_int( b_props, "consumer_deinterlace", mlt_properties_get_int( a_props, "consumer_deinterlace" ) || mlt_properties_get_int( properties, "deinterlace" ) );
// Check for the special case - no aspect ratio means no problem :-)
if ( mlt_frame_get_aspect_ratio( b_frame ) == 0 )
- mlt_properties_set_double( b_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
+ mlt_frame_set_aspect_ratio( b_frame, mlt_profile_sar( profile ) );
if ( mlt_frame_get_aspect_ratio( frame ) == 0 )
- mlt_properties_set_double( a_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
+ mlt_frame_set_aspect_ratio( frame, mlt_profile_sar( profile ) );
if ( mlt_properties_get_int( properties, "distort" ) )
{
mlt_service_get_frame( mlt_producer_service(producer), &freeze_frame, 0 );
mlt_properties freeze_properties = MLT_FRAME_PROPERTIES( freeze_frame );
- mlt_properties_set_double( freeze_properties, "consumer_aspect_ratio", mlt_properties_get_double( props, "consumer_aspect_ratio" ) );
mlt_properties_set( freeze_properties, "rescale.interp", mlt_properties_get( props, "rescale.interp" ) );
mlt_properties_set_double( freeze_properties, "aspect_ratio", mlt_frame_get_aspect_ratio( frame ) );
mlt_properties_set_int( freeze_properties, "progressive", mlt_properties_get_int( props, "progressive" ) );
uint8_t *first_alpha = mlt_properties_get_data( first_frame_properties, "alpha", NULL );
if ( !first_image )
{
- mlt_properties_set_double( first_frame_properties, "consumer_aspect_ratio", mlt_properties_get_double( frame_properties, "consumer_aspect_ratio" ) );
mlt_properties_set( first_frame_properties, "rescale.interp", mlt_properties_get( frame_properties, "rescale.interp" ) );
int error = mlt_frame_get_image( first_frame, &first_image, format, width, height, writable );
if ( mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), &luma_frame, 0 ) == 0 ){
- mlt_properties_set_double ( MLT_FRAME_PROPERTIES ( luma_frame ) , "consumer_aspect_ratio" , 1.0 );
mlt_image_format luma_format = mlt_image_yuv422;
luma_width = dx;
luma_height = luma_width * mlt_properties_get_int( MLT_FRAME_PROPERTIES ( luma_frame ) , "height" ) / mlt_properties_get_int( MLT_FRAME_PROPERTIES ( luma_frame ) , "width" );
mlt_producer producer = mlt_properties_get_data( properties, "producer", NULL );
mlt_transition transition = mlt_properties_get_data( properties, "transition", NULL );
mlt_frame a_frame = NULL;
+ mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( filter ) );
if ( producer == NULL )
{
char *background = mlt_properties_get( properties, "background" );
- mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( filter ) );
producer = mlt_factory_producer( profile, NULL, background );
mlt_properties_set_data( properties, "producer", producer, 0, (mlt_destructor)mlt_producer_close, NULL );
}
if ( transition == NULL )
{
- mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( filter ) );
transition = mlt_factory_transition( profile, "affine", NULL );
mlt_properties_set_data( properties, "transition", transition, 0, (mlt_destructor)mlt_transition_close, NULL );
}
mlt_properties frame_properties = MLT_FRAME_PROPERTIES( this );
mlt_position in = mlt_filter_get_in( filter );
mlt_position out = mlt_filter_get_out( filter );
- double consumer_ar = mlt_properties_get_double( frame_properties, "consumer_aspect_ratio" );
+ double consumer_ar = mlt_profile_sar( profile );
mlt_transition_set_in_and_out( transition, in, out );
if ( out > 0 ) {
mlt_properties_set_position( MLT_PRODUCER_PROPERTIES( producer ), "length", out - in + 1 );
// mlt_properties_set_int( MLT_FRAME_PROPERTIES( a_frame ), "distort", 1 );
// Special case - aspect_ratio = 0
- if ( mlt_properties_get_double( frame_properties, "aspect_ratio" ) == 0 )
- mlt_properties_set_double( frame_properties, "aspect_ratio", consumer_ar );
- if ( mlt_properties_get_double( MLT_FRAME_PROPERTIES( a_frame ), "aspect_ratio" ) == 0 )
- mlt_properties_set_double( MLT_FRAME_PROPERTIES( a_frame ), "aspect_ratio", consumer_ar );
- mlt_properties_set_double( MLT_FRAME_PROPERTIES( a_frame ), "consumer_aspect_ratio", consumer_ar );
+ if ( mlt_frame_get_aspect_ratio( this ) == 0 )
+ mlt_frame_set_aspect_ratio( this, consumer_ar );
+ if ( mlt_frame_get_aspect_ratio( a_frame ) == 0 )
+ mlt_frame_set_aspect_ratio( a_frame, consumer_ar );
// Add the affine transition onto the frame stack
mlt_service_unlock( MLT_FILTER_SERVICE( filter ) );
int normalised_width = profile->width;
int normalised_height = profile->height;
- double consumer_ar = mlt_properties_get_double( a_props, "consumer_aspect_ratio" );
+ double consumer_ar = mlt_profile_sar( mlt_service_profile( MLT_TRANSITION_SERVICE(transition) ) );
// Structures for geometry
struct mlt_geometry_item_s result;