X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fxine%2Ffilter_deinterlace.c;h=c29e888149e75e54d03719fbee7d00e4a146f5d0;hb=bd2707bb370eda9cae39e22b5e89b9096474cd7d;hp=fa48a4da2b74f6a26fbb6c61e706566f0e4541c9;hpb=f00476101550ec7d8e863f6516aa83bc1b524570;p=melted diff --git a/src/modules/xine/filter_deinterlace.c b/src/modules/xine/filter_deinterlace.c index fa48a4d..c29e888 100644 --- a/src/modules/xine/filter_deinterlace.c +++ b/src/modules/xine/filter_deinterlace.c @@ -79,23 +79,32 @@ static void deinterlace_yuv( uint8_t *pdst, uint8_t *psrc, int width, int height static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable ) { int error = 0; + int deinterlace = mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "consumer_deinterlace" ); // Pop the service off the stack mlt_filter filter = mlt_frame_pop_service( this ); + // Determine if we need a writable version or not + if ( deinterlace && !writable ) + writable = !mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "progressive" ); + + // Get the input image + error = mlt_frame_get_image( this, image, format, width, height, writable ); + // Check that we want progressive and we aren't already progressive - if ( *format == mlt_image_yuv422 && - !mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "progressive" ) && - mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "consumer_deinterlace" ) ) + if ( deinterlace && *format == mlt_image_yuv422 && *image != NULL && !mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "progressive" ) ) { - // Get the input image - error = mlt_frame_get_image( this, image, format, width, height, 1 ); - // Determine deinterlace method char *method_str = mlt_properties_get( MLT_FILTER_PROPERTIES( filter ), "method" ); int method = DEINTERLACE_LINEARBLEND; + char *frame_method_str = mlt_properties_get( MLT_FRAME_PROPERTIES( this ), "deinterlace_method" ); - if ( strcmp( method_str, "bob" ) == 0 ) + if ( frame_method_str != NULL ) + method_str = frame_method_str; + + if ( method_str == NULL ) + method = DEINTERLACE_LINEARBLEND; + else if ( strcmp( method_str, "bob" ) == 0 ) method = DEINTERLACE_BOB; else if ( strcmp( method_str, "weave" ) == 0 ) method = DEINTERLACE_BOB; @@ -110,11 +119,6 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * // Make sure that others know the frame is deinterlaced mlt_properties_set_int( MLT_FRAME_PROPERTIES( this ), "progressive", 1 ); } - else - { - // Get the input image - error = mlt_frame_get_image( this, image, format, width, height, writable ); - } return error; } @@ -142,7 +146,7 @@ mlt_filter filter_deinterlace_init( void *arg ) if ( this != NULL ) { this->process = deinterlace_process; - mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "method", arg == NULL ? "linearblend" : arg ); + mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "method", arg ); } return this; }