aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg_opt.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-01 14:35:53 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-01 14:35:53 +0200
commitd09793576760c3f6894007184875a158b7be2347 (patch)
tree853ca99459c8c753293cb733f90932f61edddfdd /ffmpeg_opt.c
parent955b31a7513e924cce36e484dc098581290af9b6 (diff)
parent41776ba9c0ebbb71394cefdf7dd1b243e6c852d5 (diff)
downloadffmpeg-d09793576760c3f6894007184875a158b7be2347.tar.gz
Merge commit '41776ba9c0ebbb71394cefdf7dd1b243e6c852d5'
* commit '41776ba9c0ebbb71394cefdf7dd1b243e6c852d5': avconv: do not use the stream codec context for decoding Conflicts: ffmpeg.c ffmpeg_filter.c ffmpeg_opt.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r--ffmpeg_opt.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index eeacf5828c..68f2f635f0 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -564,7 +564,7 @@ static AVCodec *choose_decoder(OptionsContext *o, AVFormatContext *s, AVStream *
* list of input streams. */
static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
{
- int i;
+ int i, ret;
for (i = 0; i < ic->nb_streams; i++) {
AVStream *st = ic->streams[i];
@@ -604,6 +604,18 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
ist->filter_in_rescale_delta_last = AV_NOPTS_VALUE;
+ ist->dec_ctx = avcodec_alloc_context3(ist->dec);
+ if (!ist->dec_ctx) {
+ av_log(NULL, AV_LOG_ERROR, "Error allocating the decoder context.\n");
+ exit_program(1);
+ }
+
+ ret = avcodec_copy_context(ist->dec_ctx, dec);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Error initializing the decoder context.\n");
+ exit_program(1);
+ }
+
switch (dec->codec_type) {
case AVMEDIA_TYPE_VIDEO:
if(!ist->dec)
@@ -612,9 +624,9 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
dec->flags |= CODEC_FLAG_EMU_EDGE;
}
- ist->resample_height = dec->height;
- ist->resample_width = dec->width;
- ist->resample_pix_fmt = dec->pix_fmt;
+ ist->resample_height = ist->dec_ctx->height;
+ ist->resample_width = ist->dec_ctx->width;
+ ist->resample_pix_fmt = ist->dec_ctx->pix_fmt;
MATCH_PER_STREAM_OPT(frame_rates, str, framerate, ic, st);
if (framerate && av_parse_video_rate(&ist->framerate,
@@ -668,10 +680,10 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
MATCH_PER_STREAM_OPT(guess_layout_max, i, ist->guess_layout_max, ic, st);
guess_input_channel_layout(ist);
- ist->resample_sample_fmt = dec->sample_fmt;
- ist->resample_sample_rate = dec->sample_rate;
- ist->resample_channels = dec->channels;
- ist->resample_channel_layout = dec->channel_layout;
+ ist->resample_sample_fmt = ist->dec_ctx->sample_fmt;
+ ist->resample_sample_rate = ist->dec_ctx->sample_rate;
+ ist->resample_channels = ist->dec_ctx->channels;
+ ist->resample_channel_layout = ist->dec_ctx->channel_layout;
break;
case AVMEDIA_TYPE_DATA: