]> git.sesse.net Git - mlt/commitdiff
Let loader producer use new GLSL normalizing filters (opengl branch).
authorDan Dennedy <dan@dennedy.org>
Thu, 21 Feb 2013 04:28:49 +0000 (20:28 -0800)
committerDan Dennedy <dan@dennedy.org>
Thu, 21 Feb 2013 04:28:49 +0000 (20:28 -0800)
src/framework/mlt_profile.c
src/modules/avformat/filter_avcolour_space.c
src/modules/avformat/filter_swscale.c
src/modules/avformat/producer_avformat.c
src/modules/core/consumer_multi.c
src/modules/core/filter_crop.c
src/modules/core/filter_fieldorder.c
src/modules/core/filter_imageconvert.c
src/modules/core/loader.ini
src/modules/core/producer_loader.c

index a0ae64808ca1057594fbc01ed1cb714f1433d601..06fa2c3212b505f4c9d9cfe1e2aeda601568e3dd 100644 (file)
@@ -403,7 +403,7 @@ void mlt_profile_from_producer( mlt_profile profile, mlt_producer producer )
 {
        mlt_frame fr = NULL;
        uint8_t *buffer;
-       mlt_image_format fmt = mlt_image_yuv422;
+       mlt_image_format fmt = mlt_image_none;
        mlt_properties p;
        int w = profile->width;
        int h = profile->height;
index 5bf53ea415d1d993a722aa78c6c0c5c1a28c931d..9b5cfbc87ca460b2c6910306931fd6c96d3bf3b4 100644 (file)
@@ -65,7 +65,7 @@ static int convert_mlt_to_av_cs( mlt_image_format format )
                case mlt_image_yuv420p:
                        value = PIX_FMT_YUV420P;
                        break;
-               case mlt_image_none:
+               default:
                        mlt_log_error( NULL, "[filter avcolor_space] Invalid format\n" );
                        break;
        }
@@ -303,8 +303,9 @@ static mlt_frame filter_process( mlt_filter filter, mlt_frame frame )
        if ( mlt_properties_get_int( properties, "colorspace" ) <= 0 )
                mlt_properties_set_int( properties, "colorspace", mlt_service_profile( MLT_FILTER_SERVICE(filter) )->colorspace );
 
-       frame->convert_image = convert_image;
-    
+       if ( !frame->convert_image )
+               frame->convert_image = convert_image;
+
 //     Not working yet - see comment for get_image() above.
 //     mlt_frame_push_service( frame, mlt_service_profile( MLT_FILTER_SERVICE( filter ) ) );
 //     mlt_frame_push_get_image( frame, get_image );
index ac7840f4368148ff4a760f6437eb41294a53b7d6..8e88f7c623df199df972d45837415bc52b298fd1 100644 (file)
@@ -55,7 +55,7 @@ static inline int convert_mlt_to_av_cs( mlt_image_format format )
                case mlt_image_yuv420p:
                        value = PIX_FMT_YUV420P;
                        break;
-               case mlt_image_none:
+               default:
                        fprintf( stderr, "Invalid format...\n" );
                        break;
        }
index 89643505c02e6ff93ca1eb977e065e88c02555d5..8f7094aba6eff44337b62e04b55c3b08afb6ac8a 100644 (file)
@@ -1426,6 +1426,10 @@ static int allocate_buffer( mlt_frame frame, AVCodecContext *codec_context, uint
 
        if ( codec_context->width == 0 || codec_context->height == 0 )
                return size;
+
+       if ( *format == mlt_image_glsl )
+               *format = pick_pix_format( codec_context->pix_fmt );
+
        *width = codec_context->width;
        *height = codec_context->height;
        size = mlt_image_format_size( *format, *width, *height, NULL );
index 653547e0d88a600078afedd673687c7793a5d6c5..38ef951939de93d0a6014f26da983f97d5df736b 100644 (file)
@@ -87,13 +87,17 @@ static void create_filter( mlt_profile profile, mlt_service service, char *effec
        if ( strncmp( effect, "swscale", 7 ) == 0 || strncmp( effect, "avcolo", 6 ) == 0 )
                arg = (char*) mlt_properties_get_int( MLT_SERVICE_PROPERTIES( service ), "meta.media.width" );
 
-       mlt_filter filter = mlt_factory_filter( profile, id, arg );
-       if ( filter != NULL )
+       // We cannot use GLSL-based filters here.
+       if ( strncmp( effect, "movit.", 6 ) && strncmp( effect, "glsl.", 5 ) )
        {
-               mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "_loader", 1 );
-               mlt_service_attach( service, filter );
-               mlt_filter_close( filter );
-               *created = 1;
+               mlt_filter filter = mlt_factory_filter( profile, id, arg );
+               if ( filter != NULL )
+               {
+                       mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "_loader", 1 );
+                       mlt_service_attach( service, filter );
+                       mlt_filter_close( filter );
+                       *created = 1;
+               }
        }
        free( id );
 }
index 1969fdb18c479978814dd5f5f4d80368d26670e0..8f3b7765042315e8e4f13afbc2329c428b63d3f5 100644 (file)
@@ -96,13 +96,6 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
                mlt_log_debug( NULL, "[filter crop] %s %dx%d -> %dx%d\n", mlt_image_format_name(*format),
                                 *width, *height, owidth, oheight);
 
-               // Provides a manual override for misreported field order
-               if ( mlt_properties_get( properties, "meta.top_field_first" ) )
-               {
-                       mlt_properties_set_int( properties, "top_field_first", mlt_properties_get_int( properties, "meta.top_field_first" ) );
-                       mlt_properties_set_int( properties, "meta.top_field_first", 0 );
-               }
-
                if ( top % 2 )
                        mlt_properties_set_int( properties, "top_field_first", !mlt_properties_get_int( properties, "top_field_first" ) );
                
index 79223757323d84cd9e10801aa1313a353f0b7285..a0a571f0c868dd1743a2a9b71a458b9cfdda63de 100644 (file)
@@ -47,11 +47,8 @@ static int get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format
                        mlt_properties_get_int( properties, "progressive" ) == 0 )
                {
                        // We only work with non-planar formats
-                       if ( *format == mlt_image_yuv420p )
-                       {
-                               *format = mlt_image_yuv422;
-                               mlt_frame_get_image( frame, image, format, width, height, writable );
-                       }
+                       if ( *format == mlt_image_yuv420p && frame->convert_image )
+                               error = frame->convert_image( frame, image, format, mlt_image_yuv422 );
 
                        // Make a new image
                        int bpp;
index f651f172a067b67955effd116690c0c90e42e59e..33c938802ce8762a91d1d840e24c09982cdcf8b8 100644 (file)
@@ -372,7 +372,8 @@ static int convert_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *f
 
 static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
 {
-       frame->convert_image = convert_image;
+       if ( !frame->convert_image )
+               frame->convert_image = convert_image;
        return frame;
 }
 
index 168bbda626fea576e01cd6bbb7ab0c2fed6c54c5..c586a176a32f4ca2c395ff72fcc075c1a3c31aee 100644 (file)
@@ -8,10 +8,10 @@
 
 # image filters
 deinterlace=deinterlace,avdeinterlace
-crop=crop:1
-rescaler=swscale,gtkrescale,rescale
 fieldorder=fieldorder
-resizer=resize
+crop=movit.crop,crop:1
+rescaler=movit.resample,swscale,gtkrescale,rescale
+resizer=movit.resize,resize
 
 # audio filters
 channels=audiochannels
index c74aebfa512c82b54fd13750f7feee31960041dc..52016a328b5995f7dd3db3ccaed2b2086ec35552 100644 (file)
@@ -222,6 +222,9 @@ mlt_producer producer_loader_init( mlt_profile profile, mlt_service_type type, c
        {
                // Always let the image and audio be converted
                int created = 0;
+               create_filter( profile, producer, "movit.convert", &created );
+               // glsl.csc skips setting the frame->convert_image pointer if GLSL cannot be used.
+               // avcolor_space and imageconvert only set frame->convert_image if it has not been set.
                create_filter( profile, producer, "avcolor_space", &created );
                if ( !created )
                        create_filter( profile, producer, "imageconvert", &created );