mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
Rename avctx_opts to avcodec_opts.
The new name is more meaningful and consistent with avformat_opts and sws_opts. Originally committed as revision 17789 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
511b3667d6
commit
636f1c4cd0
18
cmdutils.c
18
cmdutils.c
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
const char **opt_names;
|
const char **opt_names;
|
||||||
static int opt_name_count;
|
static int opt_name_count;
|
||||||
AVCodecContext *avctx_opts[CODEC_TYPE_NB];
|
AVCodecContext *avcodec_opts[CODEC_TYPE_NB];
|
||||||
AVFormatContext *avformat_opts;
|
AVFormatContext *avformat_opts;
|
||||||
struct SwsContext *sws_opts;
|
struct SwsContext *sws_opts;
|
||||||
|
|
||||||
@ -179,9 +179,9 @@ int opt_default(const char *opt, const char *arg){
|
|||||||
int opt_types[]={AV_OPT_FLAG_VIDEO_PARAM, AV_OPT_FLAG_AUDIO_PARAM, 0, AV_OPT_FLAG_SUBTITLE_PARAM, 0};
|
int opt_types[]={AV_OPT_FLAG_VIDEO_PARAM, AV_OPT_FLAG_AUDIO_PARAM, 0, AV_OPT_FLAG_SUBTITLE_PARAM, 0};
|
||||||
|
|
||||||
for(type=0; type<CODEC_TYPE_NB && ret>= 0; type++){
|
for(type=0; type<CODEC_TYPE_NB && ret>= 0; type++){
|
||||||
const AVOption *o2 = av_find_opt(avctx_opts[0], opt, NULL, opt_types[type], opt_types[type]);
|
const AVOption *o2 = av_find_opt(avcodec_opts[0], opt, NULL, opt_types[type], opt_types[type]);
|
||||||
if(o2)
|
if(o2)
|
||||||
ret = av_set_string3(avctx_opts[type], opt, arg, 1, &o);
|
ret = av_set_string3(avcodec_opts[type], opt, arg, 1, &o);
|
||||||
}
|
}
|
||||||
if(!o)
|
if(!o)
|
||||||
ret = av_set_string3(avformat_opts, opt, arg, 1, &o);
|
ret = av_set_string3(avformat_opts, opt, arg, 1, &o);
|
||||||
@ -189,11 +189,11 @@ int opt_default(const char *opt, const char *arg){
|
|||||||
ret = av_set_string3(sws_opts, opt, arg, 1, &o);
|
ret = av_set_string3(sws_opts, opt, arg, 1, &o);
|
||||||
if(!o){
|
if(!o){
|
||||||
if(opt[0] == 'a')
|
if(opt[0] == 'a')
|
||||||
ret = av_set_string3(avctx_opts[CODEC_TYPE_AUDIO], opt+1, arg, 1, &o);
|
ret = av_set_string3(avcodec_opts[CODEC_TYPE_AUDIO], opt+1, arg, 1, &o);
|
||||||
else if(opt[0] == 'v')
|
else if(opt[0] == 'v')
|
||||||
ret = av_set_string3(avctx_opts[CODEC_TYPE_VIDEO], opt+1, arg, 1, &o);
|
ret = av_set_string3(avcodec_opts[CODEC_TYPE_VIDEO], opt+1, arg, 1, &o);
|
||||||
else if(opt[0] == 's')
|
else if(opt[0] == 's')
|
||||||
ret = av_set_string3(avctx_opts[CODEC_TYPE_SUBTITLE], opt+1, arg, 1, &o);
|
ret = av_set_string3(avcodec_opts[CODEC_TYPE_SUBTITLE], opt+1, arg, 1, &o);
|
||||||
}
|
}
|
||||||
if (o && ret < 0) {
|
if (o && ret < 0) {
|
||||||
fprintf(stderr, "Invalid value '%s' for option '%s'\n", arg, opt);
|
fprintf(stderr, "Invalid value '%s' for option '%s'\n", arg, opt);
|
||||||
@ -202,13 +202,13 @@ int opt_default(const char *opt, const char *arg){
|
|||||||
if(!o)
|
if(!o)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// av_log(NULL, AV_LOG_ERROR, "%s:%s: %f 0x%0X\n", opt, arg, av_get_double(avctx_opts, opt, NULL), (int)av_get_int(avctx_opts, opt, NULL));
|
// av_log(NULL, AV_LOG_ERROR, "%s:%s: %f 0x%0X\n", opt, arg, av_get_double(avcodec_opts, opt, NULL), (int)av_get_int(avcodec_opts, opt, NULL));
|
||||||
|
|
||||||
//FIXME we should always use avctx_opts, ... for storing options so there will not be any need to keep track of what i set over this
|
//FIXME we should always use avcodec_opts, ... for storing options so there will not be any need to keep track of what i set over this
|
||||||
opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1));
|
opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1));
|
||||||
opt_names[opt_name_count++]= o->name;
|
opt_names[opt_name_count++]= o->name;
|
||||||
|
|
||||||
if(avctx_opts[0]->debug || avformat_opts->debug)
|
if(avcodec_opts[0]->debug || avformat_opts->debug)
|
||||||
av_log_set_level(AV_LOG_DEBUG);
|
av_log_set_level(AV_LOG_DEBUG);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ extern const int program_birth_year;
|
|||||||
extern const int this_year;
|
extern const int this_year;
|
||||||
|
|
||||||
extern const char **opt_names;
|
extern const char **opt_names;
|
||||||
extern AVCodecContext *avctx_opts[CODEC_TYPE_NB];
|
extern AVCodecContext *avcodec_opts[CODEC_TYPE_NB];
|
||||||
extern AVFormatContext *avformat_opts;
|
extern AVFormatContext *avformat_opts;
|
||||||
extern struct SwsContext *sws_opts;
|
extern struct SwsContext *sws_opts;
|
||||||
|
|
||||||
|
24
ffmpeg.c
24
ffmpeg.c
@ -946,7 +946,7 @@ static void do_video_out(AVFormatContext *s,
|
|||||||
/* better than nothing: use input picture interlaced
|
/* better than nothing: use input picture interlaced
|
||||||
settings */
|
settings */
|
||||||
big_picture.interlaced_frame = in_picture->interlaced_frame;
|
big_picture.interlaced_frame = in_picture->interlaced_frame;
|
||||||
if(avctx_opts[CODEC_TYPE_VIDEO]->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)){
|
if(avcodec_opts[CODEC_TYPE_VIDEO]->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)){
|
||||||
if(top_field_first == -1)
|
if(top_field_first == -1)
|
||||||
big_picture.top_field_first = in_picture->top_field_first;
|
big_picture.top_field_first = in_picture->top_field_first;
|
||||||
else
|
else
|
||||||
@ -2328,7 +2328,7 @@ static int opt_bitrate(const char *opt, const char *arg)
|
|||||||
|
|
||||||
opt_default(opt, arg);
|
opt_default(opt, arg);
|
||||||
|
|
||||||
if (av_get_int(avctx_opts[codec_type], "b", NULL) < 1000)
|
if (av_get_int(avcodec_opts[codec_type], "b", NULL) < 1000)
|
||||||
fprintf(stderr, "WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s\n");
|
fprintf(stderr, "WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -2854,7 +2854,7 @@ static void opt_input_file(const char *filename)
|
|||||||
enc->thread_count= thread_count;
|
enc->thread_count= thread_count;
|
||||||
switch(enc->codec_type) {
|
switch(enc->codec_type) {
|
||||||
case CODEC_TYPE_AUDIO:
|
case CODEC_TYPE_AUDIO:
|
||||||
set_context_opts(enc, avctx_opts[CODEC_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM);
|
set_context_opts(enc, avcodec_opts[CODEC_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM);
|
||||||
//fprintf(stderr, "\nInput Audio channels: %d", enc->channels);
|
//fprintf(stderr, "\nInput Audio channels: %d", enc->channels);
|
||||||
channel_layout = enc->channel_layout;
|
channel_layout = enc->channel_layout;
|
||||||
audio_channels = enc->channels;
|
audio_channels = enc->channels;
|
||||||
@ -2865,7 +2865,7 @@ static void opt_input_file(const char *filename)
|
|||||||
ic->streams[i]->discard= AVDISCARD_ALL;
|
ic->streams[i]->discard= AVDISCARD_ALL;
|
||||||
break;
|
break;
|
||||||
case CODEC_TYPE_VIDEO:
|
case CODEC_TYPE_VIDEO:
|
||||||
set_context_opts(enc, avctx_opts[CODEC_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM);
|
set_context_opts(enc, avcodec_opts[CODEC_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM);
|
||||||
frame_height = enc->height;
|
frame_height = enc->height;
|
||||||
frame_width = enc->width;
|
frame_width = enc->width;
|
||||||
if(ic->streams[i]->sample_aspect_ratio.num)
|
if(ic->streams[i]->sample_aspect_ratio.num)
|
||||||
@ -2994,11 +2994,11 @@ static void new_video_stream(AVFormatContext *oc)
|
|||||||
if( (video_global_header&1)
|
if( (video_global_header&1)
|
||||||
|| (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){
|
|| (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){
|
||||||
video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||||
avctx_opts[CODEC_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
|
avcodec_opts[CODEC_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
|
||||||
}
|
}
|
||||||
if(video_global_header&2){
|
if(video_global_header&2){
|
||||||
video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER;
|
video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER;
|
||||||
avctx_opts[CODEC_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;
|
avcodec_opts[CODEC_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (video_stream_copy) {
|
if (video_stream_copy) {
|
||||||
@ -3023,7 +3023,7 @@ static void new_video_stream(AVFormatContext *oc)
|
|||||||
|
|
||||||
video_enc->codec_id = codec_id;
|
video_enc->codec_id = codec_id;
|
||||||
|
|
||||||
set_context_opts(video_enc, avctx_opts[CODEC_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
|
set_context_opts(video_enc, avcodec_opts[CODEC_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
|
||||||
|
|
||||||
if (codec && codec->supported_framerates && !force_fps)
|
if (codec && codec->supported_framerates && !force_fps)
|
||||||
fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];
|
fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];
|
||||||
@ -3137,7 +3137,7 @@ static void new_audio_stream(AVFormatContext *oc)
|
|||||||
|
|
||||||
if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
|
if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
|
||||||
audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||||
avctx_opts[CODEC_TYPE_AUDIO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
|
avcodec_opts[CODEC_TYPE_AUDIO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
|
||||||
}
|
}
|
||||||
if (audio_stream_copy) {
|
if (audio_stream_copy) {
|
||||||
st->stream_copy = 1;
|
st->stream_copy = 1;
|
||||||
@ -3145,7 +3145,7 @@ static void new_audio_stream(AVFormatContext *oc)
|
|||||||
} else {
|
} else {
|
||||||
AVCodec *codec;
|
AVCodec *codec;
|
||||||
|
|
||||||
set_context_opts(audio_enc, avctx_opts[CODEC_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
|
set_context_opts(audio_enc, avcodec_opts[CODEC_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
|
||||||
|
|
||||||
if (audio_codec_name) {
|
if (audio_codec_name) {
|
||||||
codec_id = find_codec_or_die(audio_codec_name, CODEC_TYPE_AUDIO, 1);
|
codec_id = find_codec_or_die(audio_codec_name, CODEC_TYPE_AUDIO, 1);
|
||||||
@ -3211,7 +3211,7 @@ static void new_subtitle_stream(AVFormatContext *oc)
|
|||||||
if (subtitle_stream_copy) {
|
if (subtitle_stream_copy) {
|
||||||
st->stream_copy = 1;
|
st->stream_copy = 1;
|
||||||
} else {
|
} else {
|
||||||
set_context_opts(avctx_opts[CODEC_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
|
set_context_opts(avcodec_opts[CODEC_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
|
||||||
subtitle_enc->codec_id = find_codec_or_die(subtitle_codec_name, CODEC_TYPE_SUBTITLE, 1);
|
subtitle_enc->codec_id = find_codec_or_die(subtitle_codec_name, CODEC_TYPE_SUBTITLE, 1);
|
||||||
output_codecs[nb_ocodecs] = avcodec_find_encoder_by_name(subtitle_codec_name);
|
output_codecs[nb_ocodecs] = avcodec_find_encoder_by_name(subtitle_codec_name);
|
||||||
}
|
}
|
||||||
@ -3503,7 +3503,7 @@ static void show_help(void)
|
|||||||
OPT_GRAB,
|
OPT_GRAB,
|
||||||
OPT_GRAB);
|
OPT_GRAB);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
av_opt_show(avctx_opts[0], NULL);
|
av_opt_show(avcodec_opts[0], NULL);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
av_opt_show(avformat_opts, NULL);
|
av_opt_show(avformat_opts, NULL);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -3888,7 +3888,7 @@ int main(int argc, char **argv)
|
|||||||
url_set_interrupt_cb(decode_interrupt_cb);
|
url_set_interrupt_cb(decode_interrupt_cb);
|
||||||
|
|
||||||
for(i=0; i<CODEC_TYPE_NB; i++){
|
for(i=0; i<CODEC_TYPE_NB; i++){
|
||||||
avctx_opts[i]= avcodec_alloc_context2(i);
|
avcodec_opts[i]= avcodec_alloc_context2(i);
|
||||||
}
|
}
|
||||||
avformat_opts = avformat_alloc_context();
|
avformat_opts = avformat_alloc_context();
|
||||||
sws_opts = sws_getContext(16,16,0, 16,16,0, sws_flags, NULL,NULL,NULL);
|
sws_opts = sws_getContext(16,16,0, 16,16,0, sws_flags, NULL,NULL,NULL);
|
||||||
|
4
ffplay.c
4
ffplay.c
@ -1752,7 +1752,7 @@ static int stream_component_open(VideoState *is, int stream_index)
|
|||||||
enc->error_recognition= error_recognition;
|
enc->error_recognition= error_recognition;
|
||||||
enc->error_concealment= error_concealment;
|
enc->error_concealment= error_concealment;
|
||||||
|
|
||||||
set_context_opts(enc, avctx_opts[enc->codec_type], 0);
|
set_context_opts(enc, avcodec_opts[enc->codec_type], 0);
|
||||||
|
|
||||||
if (!codec ||
|
if (!codec ||
|
||||||
avcodec_open(enc, codec) < 0)
|
avcodec_open(enc, codec) < 0)
|
||||||
@ -2558,7 +2558,7 @@ int main(int argc, char **argv)
|
|||||||
av_register_all();
|
av_register_all();
|
||||||
|
|
||||||
for(i=0; i<CODEC_TYPE_NB; i++){
|
for(i=0; i<CODEC_TYPE_NB; i++){
|
||||||
avctx_opts[i]= avcodec_alloc_context2(i);
|
avcodec_opts[i]= avcodec_alloc_context2(i);
|
||||||
}
|
}
|
||||||
avformat_opts = avformat_alloc_context();
|
avformat_opts = avformat_alloc_context();
|
||||||
sws_opts = sws_getContext(16,16,0, 16,16,0, sws_flags, NULL,NULL,NULL);
|
sws_opts = sws_getContext(16,16,0, 16,16,0, sws_flags, NULL,NULL,NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user