[FFmpeg-devel] [PATCH 1/2] lavf: add AVOption support for muxers

Anssi Hannula anssi.hannula
Wed Dec 29 05:54:14 CET 2010


---
 libavformat/avformat.h |    2 ++
 libavformat/utils.c    |    4 ++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index c6f2827..9eab2da 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -368,6 +368,8 @@ typedef struct AVOutputFormat {
     const AVMetadataConv *metadata_conv;
 #endif
 
+    const AVClass *priv_class; ///< AVClass for the private context
+
     /* private fields */
     struct AVOutputFormat *next;
 } AVOutputFormat;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 6f994a1..e1928c4 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2720,6 +2720,10 @@ int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap)
         s->priv_data = av_mallocz(s->oformat->priv_data_size);
         if (!s->priv_data)
             return AVERROR(ENOMEM);
+        if (s->oformat->priv_class) {
+            *(const AVClass**)s->priv_data= s->oformat->priv_class;
+            av_opt_set_defaults(s->priv_data);
+        }
     } else
         s->priv_data = NULL;
 
-- 
1.7.3




More information about the ffmpeg-devel mailing list