From patchwork Sun May 22 21:11:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/2] movenc: Add an AVClass for setting muxer specific options X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 3338 Message-Id: <1306098712-4512-1-git-send-email-martin@martin.st> To: libav-devel@libav.org Date: Mon, 23 May 2011 00:11:51 +0300 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= List-Id: libav development --- Since the last iteration, modified to add this AVClass to all variants of the muxer, since we might want to add options to all of them. libavformat/movenc.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ libavformat/movenc.h | 1 + 2 files changed, 61 insertions(+), 0 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 52c775a..2dff7e3 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -32,10 +32,64 @@ #include "libavcodec/put_bits.h" #include "internal.h" #include "libavutil/avstring.h" +#include "libavutil/opt.h" #undef NDEBUG #include +static const AVOption options[] = { + { NULL }, +}; + +#if CONFIG_MOV_MUXER +static const AVClass mov_muxer_class = { + .class_name = "MOV muxer", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; +#endif +#if CONFIG_TGP_MUXER +static const AVClass tgp_muxer_class = { + .class_name = "3GP muxer", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; +#endif +#if CONFIG_MP4_MUXER +static const AVClass mp4_muxer_class = { + .class_name = "MP4 muxer", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; +#endif +#if CONFIG_PSP_MUXER +static const AVClass psp_muxer_class = { + .class_name = "PSP MP4 muxer", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; +#endif +#if CONFIG_TG2_MUXER +static const AVClass tg2_muxer_class = { + .class_name = "3GP2 muxer", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; +#endif +#if CONFIG_IPOD_MUXER +static const AVClass ipod_muxer_class = { + .class_name = "iPod H.264 MP4 muxer", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; +#endif + //FIXME support 64 bit variant with wide placeholders static int64_t updateSize(AVIOContext *pb, int64_t pos) { @@ -2285,6 +2339,7 @@ AVOutputFormat ff_mov_muxer = { mov_write_trailer, .flags = AVFMT_GLOBALHEADER, .codec_tag = (const AVCodecTag* const []){codec_movvideo_tags, codec_movaudio_tags, 0}, + .priv_class = &mov_muxer_class, }; #endif #if CONFIG_TGP_MUXER @@ -2301,6 +2356,7 @@ AVOutputFormat ff_tgp_muxer = { mov_write_trailer, .flags = AVFMT_GLOBALHEADER, .codec_tag = (const AVCodecTag* const []){codec_3gp_tags, 0}, + .priv_class = &tgp_muxer_class, }; #endif #if CONFIG_MP4_MUXER @@ -2317,6 +2373,7 @@ AVOutputFormat ff_mp4_muxer = { mov_write_trailer, .flags = AVFMT_GLOBALHEADER, .codec_tag = (const AVCodecTag* const []){ff_mp4_obj_type, 0}, + .priv_class = &mp4_muxer_class, }; #endif #if CONFIG_PSP_MUXER @@ -2333,6 +2390,7 @@ AVOutputFormat ff_psp_muxer = { mov_write_trailer, .flags = AVFMT_GLOBALHEADER, .codec_tag = (const AVCodecTag* const []){ff_mp4_obj_type, 0}, + .priv_class = &psp_muxer_class, }; #endif #if CONFIG_TG2_MUXER @@ -2349,6 +2407,7 @@ AVOutputFormat ff_tg2_muxer = { mov_write_trailer, .flags = AVFMT_GLOBALHEADER, .codec_tag = (const AVCodecTag* const []){codec_3gp_tags, 0}, + .priv_class = &tg2_muxer_class, }; #endif #if CONFIG_IPOD_MUXER @@ -2365,5 +2424,6 @@ AVOutputFormat ff_ipod_muxer = { mov_write_trailer, .flags = AVFMT_GLOBALHEADER, .codec_tag = (const AVCodecTag* const []){codec_ipod_tags, 0}, + .priv_class = &ipod_muxer_class, }; #endif diff --git a/libavformat/movenc.h b/libavformat/movenc.h index 0cc1eb8..6e2b5b7 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -101,6 +101,7 @@ typedef struct MOVIndex { } MOVTrack; typedef struct MOVMuxContext { + const AVClass *av_class; int mode; int64_t time; int nb_streams;