summaryrefslogtreecommitdiff
path: root/ffplay.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-17 13:28:50 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-17 13:28:50 +0200
commitee73a69020a8343e827a21a0de92ca1b05f89588 (patch)
treec1589f4d4269667a6b10d7c04574105e7962c5db /ffplay.c
parent019ff7a0c37a25068c99b7b72cc9650a2a47863e (diff)
parente58a140cf91d1a9cdfa3115d73c923dab0e9e7dc (diff)
Merge commit 'e58a140cf91d1a9cdfa3115d73c923dab0e9e7dc'
* commit 'e58a140cf91d1a9cdfa3115d73c923dab0e9e7dc': avplay: Always free opts Conflicts: ffplay.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/ffplay.c b/ffplay.c
index f4a6d84874..6a6829e364 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2614,7 +2614,7 @@ static int stream_component_open(VideoState *is, int stream_index)
AVDictionaryEntry *t = NULL;
int sample_rate, nb_channels;
int64_t channel_layout;
- int ret;
+ int ret = 0;
int stream_lowres = lowres;
if (stream_index < 0 || stream_index >= ic->nb_streams)
@@ -2659,11 +2659,13 @@ static int stream_component_open(VideoState *is, int stream_index)
av_dict_set_int(&opts, "lowres", stream_lowres, 0);
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO)
av_dict_set(&opts, "refcounted_frames", "1", 0);
- if (avcodec_open2(avctx, codec, &opts) < 0)
- return -1;
+ if ((ret = avcodec_open2(avctx, codec, &opts)) < 0) {
+ goto fail;
+ }
if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key);
- return AVERROR_OPTION_NOT_FOUND;
+ ret = AVERROR_OPTION_NOT_FOUND;
+ goto fail;
}
ic->streams[stream_index]->discard = AVDISCARD_DEFAULT;
@@ -2678,7 +2680,7 @@ static int stream_component_open(VideoState *is, int stream_index)
is->audio_filter_src.channel_layout = get_valid_channel_layout(avctx->channel_layout, avctx->channels);
is->audio_filter_src.fmt = avctx->sample_fmt;
if ((ret = configure_audio_filters(is, afilters, 0)) < 0)
- return ret;
+ goto fail;
link = is->out_audio_filter->inputs[0];
sample_rate = link->sample_rate;
nb_channels = link->channels;
@@ -2692,7 +2694,7 @@ static int stream_component_open(VideoState *is, int stream_index)
/* prepare audio output */
if ((ret = audio_open(is, channel_layout, nb_channels, sample_rate, &is->audio_tgt)) < 0)
- return ret;
+ goto fail;
is->audio_hw_buf_size = ret;
is->audio_src = is->audio_tgt;
is->audio_buf_size = 0;
@@ -2736,7 +2738,11 @@ static int stream_component_open(VideoState *is, int stream_index)
default:
break;
}
- return 0;
+
+fail:
+ av_dict_free(&opts);
+
+ return ret;
}
static void stream_component_close(VideoState *is, int stream_index)