Commit ef2b2243 authored by Anssi Hannula's avatar Anssi Hannula Committed by Carl Eugen Hoyos

Use AVOption for muxers in ffmpeg.

Patch by Anssi Hannula, anssi d hannula d iki d fi

Originally committed as revision 26199 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 815495f0
...@@ -241,12 +241,20 @@ int opt_default(const char *opt, const char *arg){ ...@@ -241,12 +241,20 @@ int opt_default(const char *opt, const char *arg){
} }
if (!o) { if (!o) {
AVCodec *p = NULL; AVCodec *p = NULL;
AVOutputFormat *oformat = NULL;
while ((p=av_codec_next(p))){ while ((p=av_codec_next(p))){
AVClass *c= p->priv_class; AVClass *c= p->priv_class;
if(c && av_find_opt(&c, opt, NULL, 0, 0)) if(c && av_find_opt(&c, opt, NULL, 0, 0))
break; break;
} }
if(!p){ if (!p) {
while ((oformat = av_oformat_next(oformat))) {
const AVClass *c = oformat->priv_class;
if (c && av_find_opt(&c, opt, NULL, 0, 0))
break;
}
}
if(!p && !oformat){
fprintf(stderr, "Unrecognized option '%s'\n", opt); fprintf(stderr, "Unrecognized option '%s'\n", opt);
exit(1); exit(1);
} }
...@@ -322,7 +330,13 @@ void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec) ...@@ -322,7 +330,13 @@ void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec)
if(codec && codec->priv_class && avctx->priv_data){ if(codec && codec->priv_class && avctx->priv_data){
priv_ctx= avctx->priv_data; priv_ctx= avctx->priv_data;
} }
} else if (!strcmp("AVFormatContext", (*(AVClass**)ctx)->class_name)) {
AVFormatContext *avctx = ctx;
if (avctx->oformat && avctx->oformat->priv_class) {
priv_ctx = avctx->priv_data;
}
} }
for(i=0; i<opt_name_count; i++){ for(i=0; i<opt_name_count; i++){
char buf[256]; char buf[256];
const AVOption *opt; const AVOption *opt;
......
...@@ -3904,6 +3904,7 @@ static void show_usage(void) ...@@ -3904,6 +3904,7 @@ static void show_usage(void)
static void show_help(void) static void show_help(void)
{ {
AVCodec *c; AVCodec *c;
AVOutputFormat *oformat = NULL;
av_log_set_callback(log_callback_help); av_log_set_callback(log_callback_help);
show_usage(); show_usage();
...@@ -3945,6 +3946,15 @@ static void show_help(void) ...@@ -3945,6 +3946,15 @@ static void show_help(void)
av_opt_show2(avformat_opts, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); av_opt_show2(avformat_opts, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0);
printf("\n"); printf("\n");
/* individual muxer options */
while ((oformat = av_oformat_next(oformat))) {
if (oformat->priv_class) {
av_opt_show2(&oformat->priv_class, NULL, AV_OPT_FLAG_ENCODING_PARAM, 0);
printf("\n");
}
}
av_opt_show2(sws_opts, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); av_opt_show2(sws_opts, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment