]> git.sesse.net Git - mlt/commitdiff
Consumer deinterlace_method property added
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 4 Jun 2005 11:20:09 +0000 (11:20 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 4 Jun 2005 11:20:09 +0000 (11:20 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@734 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_consumer.c
src/framework/mlt_tractor.c
src/modules/avformat/filter_avdeinterlace.c
src/modules/sdl/consumer_sdl_preview.c
src/modules/xine/filter_deinterlace.c

index e9c8a3420a5a8082bb21f541dcb9fc0114cccac9..8f99db4dce52086ca24c6b8d73e35bb658af1279 100644 (file)
@@ -311,6 +311,7 @@ mlt_frame mlt_consumer_get_frame( mlt_consumer this )
                // 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
index 7eb43c5214b6fa5181e7217f0c4600958e62d2d1..9a1f32e11b092a5107281350f27c2200f9ebe439 100644 (file)
@@ -209,6 +209,7 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma
        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_double( properties, "consumer_deinterlace" ) );
+       mlt_properties_set( frame_properties, "deinterlace_method", mlt_properties_get( properties, "deinterlace_method" ) );
        mlt_properties_set_int( frame_properties, "normalised_width", mlt_properties_get_double( properties, "normalised_width" ) );
        mlt_properties_set_int( frame_properties, "normalised_height", mlt_properties_get_double( properties, "normalised_height" ) );
        mlt_frame_get_image( frame, buffer, format, width, height, writable );
index 919d1e4f2bb22208b1ec7ef58e09905e387a4ddd..84f9cb929beaaa9702c8ede1f84264831ddb4cba 100644 (file)
@@ -294,14 +294,17 @@ static int mlt_avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
 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" );
+
+       // 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, 1 );
+       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 && *image != NULL &&
-                !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 )
        {
                // Create a picture
                AVPicture *output = mlt_pool_alloc( sizeof( AVPicture ) );
index d2dd85956f275827e54000f6e826bce4fccead9e..4e55bd6f99f7c382c116eee3e2558433834c01aa 100644 (file)
@@ -204,6 +204,8 @@ static void *consumer_thread( void *arg )
        mlt_properties play = MLT_CONSUMER_PROPERTIES( this->play );
        mlt_properties still = MLT_CONSUMER_PROPERTIES( this->still );
 
+       int progressive = mlt_properties_get_int( properties, "progressive" ) | mlt_properties_get_int( properties, "deinterlace" );
+
        if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE ) < 0 )
        {
                fprintf( stderr, "Failed to initialize SDL: %s\n", SDL_GetError() );
@@ -231,8 +233,10 @@ static void *consumer_thread( void *arg )
        mlt_properties_set_int( play, "height", mlt_properties_get_int( properties, "height" ) );
        mlt_properties_set_int( still, "height", mlt_properties_get_int( properties, "height" ) );
 
-       mlt_properties_set_int( play, "progressive", 1 );
-       mlt_properties_set_int( still, "progressive", 1 );
+       mlt_properties_set_int( play, "progressive", progressive );
+       mlt_properties_set_int( still, "progressive", progressive );
+       mlt_properties_set( play, "deinterlace_method", mlt_properties_get( properties, "deinterlace_method" ) );
+       mlt_properties_set( still, "deinterlace_method", mlt_properties_get( properties, "deinterlace_method" ) );
 
        mlt_properties_pass( play, MLT_CONSUMER_PROPERTIES( consumer ), "play." );
        mlt_properties_pass( still, MLT_CONSUMER_PROPERTIES( consumer ), "still." );
index 70210567d2e86519947ac393bf938c63bd47d3a3..8916647b144fba4e1432980a8ca7bfdc7e71d7cf 100644 (file)
@@ -79,27 +79,31 @@ 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 && *image != NULL &&
-                !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 )
        {
-               // 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 ( method_str == NULL )
-                       method_str = mlt_properties_get( MLT_FRAME_PROPERTIES( this ), "deinterlace_method" );
+               if ( frame_method_str != NULL )
+                       method_str = frame_method_str;
                
                if ( method_str == NULL )
-                       mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "method", "linearblend" );
+                       method = DEINTERLACE_LINEARBLEND;
                else if ( strcmp( method_str, "bob" ) == 0 )
                        method = DEINTERLACE_BOB;
                else if ( strcmp( method_str, "weave" ) == 0 )
@@ -115,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;
 }