]> git.sesse.net Git - mlt/commitdiff
Fix setting codec-specific options for avcodec v53.
authorDan Dennedy <dan@dennedy.org>
Tue, 7 Jun 2011 05:33:58 +0000 (22:33 -0700)
committerDan Dennedy <dan@dennedy.org>
Tue, 7 Jun 2011 05:33:58 +0000 (22:33 -0700)
src/modules/avformat/consumer_avformat.c

index 66fa19990d10830871c9a380e78d874e6190b62f..bdb002c34ccf29967d9a5b57f064d6e9a8f88e9c 100644 (file)
@@ -518,9 +518,15 @@ static int open_audio( mlt_properties properties, AVFormatContext *oc, AVStream
 
 #if LIBAVCODEC_VERSION_MAJOR > 52
        // Process properties as AVOptions on the AVCodec
-       if ( codec && codec->priv_class && c->priv_data )
+       if ( codec && codec->priv_class )
        {
                char *apre = mlt_properties_get( properties, "apre" );
+               if ( !c->priv_data && codec->priv_data_size )
+               {
+                       c->priv_data = av_mallocz( codec->priv_data_size );
+                       *(const AVClass **) c->priv_data = codec->priv_class;
+//                     av_opt_set_defaults( c );
+               }
                if ( apre )
                {
                        mlt_properties p = mlt_properties_load( apre );
@@ -889,9 +895,15 @@ static int open_video( mlt_properties properties, AVFormatContext *oc, AVStream
 
 #if LIBAVCODEC_VERSION_MAJOR > 52
        // Process properties as AVOptions on the AVCodec
-       if ( codec && codec->priv_class && video_enc->priv_data )
+       if ( codec && codec->priv_class )
        {
                char *vpre = mlt_properties_get( properties, "vpre" );
+               if ( !video_enc->priv_data && codec->priv_data_size )
+               {
+                       video_enc->priv_data = av_mallocz( codec->priv_data_size );
+                       *(const AVClass **) video_enc->priv_data = codec->priv_class;
+//                     av_opt_set_defaults( video_enc );
+               }
                if ( vpre )
                {
                        mlt_properties p = mlt_properties_load( vpre );