Commit ee73a690 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'e58a140c'

* commit 'e58a140c':
  avplay: Always free opts

Conflicts:
	ffplay.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 019ff7a0 e58a140c
...@@ -2614,7 +2614,7 @@ static int stream_component_open(VideoState *is, int stream_index) ...@@ -2614,7 +2614,7 @@ static int stream_component_open(VideoState *is, int stream_index)
AVDictionaryEntry *t = NULL; AVDictionaryEntry *t = NULL;
int sample_rate, nb_channels; int sample_rate, nb_channels;
int64_t channel_layout; int64_t channel_layout;
int ret; int ret = 0;
int stream_lowres = lowres; int stream_lowres = lowres;
if (stream_index < 0 || stream_index >= ic->nb_streams) if (stream_index < 0 || stream_index >= ic->nb_streams)
...@@ -2659,11 +2659,13 @@ static int stream_component_open(VideoState *is, int stream_index) ...@@ -2659,11 +2659,13 @@ static int stream_component_open(VideoState *is, int stream_index)
av_dict_set_int(&opts, "lowres", stream_lowres, 0); av_dict_set_int(&opts, "lowres", stream_lowres, 0);
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO) if (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO)
av_dict_set(&opts, "refcounted_frames", "1", 0); av_dict_set(&opts, "refcounted_frames", "1", 0);
if (avcodec_open2(avctx, codec, &opts) < 0) if ((ret = avcodec_open2(avctx, codec, &opts)) < 0) {
return -1; goto fail;
}
if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) { if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key); 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; ic->streams[stream_index]->discard = AVDISCARD_DEFAULT;
...@@ -2678,7 +2680,7 @@ static int stream_component_open(VideoState *is, int stream_index) ...@@ -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.channel_layout = get_valid_channel_layout(avctx->channel_layout, avctx->channels);
is->audio_filter_src.fmt = avctx->sample_fmt; is->audio_filter_src.fmt = avctx->sample_fmt;
if ((ret = configure_audio_filters(is, afilters, 0)) < 0) if ((ret = configure_audio_filters(is, afilters, 0)) < 0)
return ret; goto fail;
link = is->out_audio_filter->inputs[0]; link = is->out_audio_filter->inputs[0];
sample_rate = link->sample_rate; sample_rate = link->sample_rate;
nb_channels = link->channels; nb_channels = link->channels;
...@@ -2692,7 +2694,7 @@ static int stream_component_open(VideoState *is, int stream_index) ...@@ -2692,7 +2694,7 @@ static int stream_component_open(VideoState *is, int stream_index)
/* prepare audio output */ /* prepare audio output */
if ((ret = audio_open(is, channel_layout, nb_channels, sample_rate, &is->audio_tgt)) < 0) 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_hw_buf_size = ret;
is->audio_src = is->audio_tgt; is->audio_src = is->audio_tgt;
is->audio_buf_size = 0; is->audio_buf_size = 0;
...@@ -2736,7 +2738,11 @@ static int stream_component_open(VideoState *is, int stream_index) ...@@ -2736,7 +2738,11 @@ static int stream_component_open(VideoState *is, int stream_index)
default: default:
break; break;
} }
return 0;
fail:
av_dict_free(&opts);
return ret;
} }
static void stream_component_close(VideoState *is, int stream_index) static void stream_component_close(VideoState *is, int stream_index)
......
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