summaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-28 17:07:47 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-28 18:11:13 +0200
commita63b479d119107db5330239402b388cb399bf116 (patch)
treedba0f406a4584d8468d116808509b652fe7707bb /libavformat
parent07da0854fe98793b17a7125ff96c54b206e452a4 (diff)
downloadffmpeg-streaming-a63b479d119107db5330239402b388cb399bf116.zip
ffmpeg-streaming-a63b479d119107db5330239402b388cb399bf116.tar.gz
avformat/utils: factor find_decoder() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 822b216..1f118df 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -99,6 +99,14 @@ static int64_t wrap_timestamp(AVStream *st, int64_t timestamp)
MAKE_ACCESSORS(AVStream, stream, AVRational, r_frame_rate)
+static AVCodec *find_decoder(AVStream *st, enum AVCodecID codec_id)
+{
+ if (st->codec->codec)
+ return st->codec->codec;
+
+ return avcodec_find_decoder(codec_id);
+}
+
int av_format_get_probe_score(const AVFormatContext *s)
{
return s->probe_score;
@@ -2444,8 +2452,7 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option
if (!avcodec_is_open(st->codec) && !st->info->found_decoder) {
AVDictionary *thread_opt = NULL;
- codec = st->codec->codec ? st->codec->codec :
- avcodec_find_decoder(st->codec->codec_id);
+ codec = find_decoder(st, st->codec->codec_id);
if (!codec) {
st->info->found_decoder = -1;
@@ -2696,8 +2703,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
avcodec_get_name(st->codec->codec_id));
}
}
- codec = st->codec->codec ? st->codec->codec :
- avcodec_find_decoder(st->codec->codec_id);
+ codec = find_decoder(st, st->codec->codec_id);
/* force thread count to 1 since the h264 decoder will not extract SPS
* and PPS to extradata during multi-threaded decoding */
@@ -3148,7 +3154,7 @@ int av_find_best_stream(AVFormatContext *ic,
if (st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED|AV_DISPOSITION_VISUAL_IMPAIRED))
continue;
if (decoder_ret) {
- decoder = avcodec_find_decoder(st->codec->codec_id);
+ decoder = find_decoder(st, st->codec->codec_id);
if (!decoder) {
if (ret < 0)
ret = AVERROR_DECODER_NOT_FOUND;
OpenPOWER on IntegriCloud