diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-23 13:05:52 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-23 13:05:52 +0200 |
commit | af3fe43d841cb16189a81968dcc589168e92af41 (patch) | |
tree | 7eff21028da5c97039874b95eed27f3a61c90f97 /ffmpeg_opt.c | |
parent | 7bc6631dd0270941d38d44e6190a47509ef1c801 (diff) | |
parent | 2b8dd371e4d276ca0d342e82b8b4cc281be0630a (diff) | |
download | ffmpeg-af3fe43d841cb16189a81968dcc589168e92af41.tar.gz |
Merge commit '2b8dd371e4d276ca0d342e82b8b4cc281be0630a'
* commit '2b8dd371e4d276ca0d342e82b8b4cc281be0630a':
lavu: postpone recent deprecations until the next major bump
APIchanges: update lavr bump date
avconv: only apply presets when we have an encoder.
atrac3: replace a calculation with FFALIGN()
atrac3: remove unused ATRAC3Context field, sample_rate
atrac3: use sizeof(variable) instead of sizeof(type)
atrac3: simplify MDCT window calculation
Conflicts:
doc/APIchanges
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r-- | ffmpeg_opt.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 8a2e48068d..1231e097ec 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -913,8 +913,6 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e char *bsf = NULL, *next, *codec_tag = NULL; AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; double qscale = -1; - char *buf = NULL, *arg = NULL, *preset = NULL; - AVIOContext *s = NULL; if (!st) { av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); @@ -936,37 +934,40 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e st->codec->codec_type = type; choose_encoder(o, oc, ost); if (ost->enc) { + AVIOContext *s = NULL; + char *buf = NULL, *arg = NULL, *preset = NULL; + ost->opts = filter_codec_opts(codec_opts, ost->enc->id, oc, st, ost->enc); + + MATCH_PER_STREAM_OPT(presets, str, preset, oc, st); + if (preset && (!(ret = get_preset_file_2(preset, ost->enc->name, &s)))) { + do { + buf = get_line(s); + if (!buf[0] || buf[0] == '#') { + av_free(buf); + continue; + } + if (!(arg = strchr(buf, '='))) { + av_log(NULL, AV_LOG_FATAL, "Invalid line found in the preset file.\n"); + exit(1); + } + *arg++ = 0; + av_dict_set(&ost->opts, buf, arg, AV_DICT_DONT_OVERWRITE); + av_free(buf); + } while (!s->eof_reached); + avio_close(s); + } + if (ret) { + av_log(NULL, AV_LOG_FATAL, + "Preset %s specified for stream %d:%d, but could not be opened.\n", + preset, ost->file_index, ost->index); + exit(1); + } } avcodec_get_context_defaults3(st->codec, ost->enc); st->codec->codec_type = type; // XXX hack, avcodec_get_context_defaults2() sets type to unknown for stream copy - MATCH_PER_STREAM_OPT(presets, str, preset, oc, st); - if (preset && (!(ret = get_preset_file_2(preset, ost->enc->name, &s)))) { - do { - buf = get_line(s); - if (!buf[0] || buf[0] == '#') { - av_free(buf); - continue; - } - if (!(arg = strchr(buf, '='))) { - av_log(NULL, AV_LOG_FATAL, "Invalid line found in the preset file.\n"); - exit(1); - } - *arg++ = 0; - av_dict_set(&ost->opts, buf, arg, AV_DICT_DONT_OVERWRITE); - av_free(buf); - } while (!s->eof_reached); - avio_close(s); - } - if (ret) { - av_log(NULL, AV_LOG_FATAL, - "Preset %s specified for stream %d:%d, but could not be opened.\n", - preset, ost->file_index, ost->index); - exit(1); - } - ost->max_frames = INT64_MAX; MATCH_PER_STREAM_OPT(max_frames, i64, ost->max_frames, oc, st); |