History

avformat/utils: pass AVFormatContext to find_decoder()

Michael Niedermayer committed 13 years ago

Commit f4aec341 parent af6e2321 file · +7 −7Browse files

Unified · Split

libavformat/utils.c+7−7
@@ -99,7 +99,7 @@ static int64_t wrap_timestamp(AVStream *st, int64_t timestamp) · 98 unmodified lines
99 99
100MAKE_ACCESSORS(AVStream, stream, AVRational, r_frame_rate)100MAKE_ACCESSORS(AVStream, stream, AVRational, r_frame_rate)
101 101
102static AVCodec *find_decoder(AVStream *st, enum AVCodecID codec_id)102static AVCodec *find_decoder(AVFormatContext *s, AVStream *st, enum AVCodecID codec_id)
103{103{
104 if (st->codec->codec)104 if (st->codec->codec)
105 return st->codec->codec;105 return st->codec->codec;
@@ -2438,7 +2438,7 @@ static int has_codec_parameters(AVStream *st, const char **errmsg_ptr) · 2332 unmodified lines
2438}2438}
2439 2439
2440/* returns 1 or 0 if or if not decoded data was returned, or a negative error */2440/* returns 1 or 0 if or if not decoded data was returned, or a negative error */
2441static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **options)2441static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt, AVDictionary **options)
2442{2442{
2443 const AVCodec *codec;2443 const AVCodec *codec;
2444 int got_picture = 1, ret = 0;2444 int got_picture = 1, ret = 0;
@@ -2452,7 +2452,7 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option · 7 unmodified lines
2452 if (!avcodec_is_open(st->codec) && !st->info->found_decoder) {2452 if (!avcodec_is_open(st->codec) && !st->info->found_decoder) {
2453 AVDictionary *thread_opt = NULL;2453 AVDictionary *thread_opt = NULL;
2454 2454
2455 codec = find_decoder(st, st->codec->codec_id);2455 codec = find_decoder(s, st, st->codec->codec_id);
2456 2456
2457 if (!codec) {2457 if (!codec) {
2458 st->info->found_decoder = -1;2458 st->info->found_decoder = -1;
@@ -2703,7 +2703,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) · 244 unmodified lines
2703 avcodec_get_name(st->codec->codec_id));2703 avcodec_get_name(st->codec->codec_id));
2704 }2704 }
2705 }2705 }
2706 codec = find_decoder(st, st->codec->codec_id);2706 codec = find_decoder(ic, st, st->codec->codec_id);
2707 2707
2708 /* force thread count to 1 since the h264 decoder will not extract SPS2708 /* force thread count to 1 since the h264 decoder will not extract SPS
2709 * and PPS to extradata during multi-threaded decoding */2709 * and PPS to extradata during multi-threaded decoding */
@@ -2933,7 +2933,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) · 223 unmodified lines
2933 least one frame of codec data, this makes sure the codec initializes2933 least one frame of codec data, this makes sure the codec initializes
2934 the channel configuration and does not only trust the values from the container.2934 the channel configuration and does not only trust the values from the container.
2935 */2935 */
2936 try_decode_frame(st, pkt, (options && i < orig_nb_streams ) ? &options[i] : NULL);2936 try_decode_frame(ic, st, pkt, (options && i < orig_nb_streams ) ? &options[i] : NULL);
2937 2937
2938 st->codec_info_nb_frames++;2938 st->codec_info_nb_frames++;
2939 count++;2939 count++;
@@ -2951,7 +2951,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) · 11 unmodified lines
2951 /* flush the decoders */2951 /* flush the decoders */
2952 if (st->info->found_decoder == 1) {2952 if (st->info->found_decoder == 1) {
2953 do {2953 do {
2954 err = try_decode_frame(st, &empty_pkt,2954 err = try_decode_frame(ic, st, &empty_pkt,
2955 (options && i < orig_nb_streams) ?2955 (options && i < orig_nb_streams) ?
2956 &options[i] : NULL);2956 &options[i] : NULL);
2957 } while (err > 0 && !has_codec_parameters(st, NULL));2957 } while (err > 0 && !has_codec_parameters(st, NULL));
@@ -3154,7 +3154,7 @@ int av_find_best_stream(AVFormatContext *ic, · 196 unmodified lines
3154 if (st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED|AV_DISPOSITION_VISUAL_IMPAIRED))3154 if (st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED|AV_DISPOSITION_VISUAL_IMPAIRED))
3155 continue;3155 continue;
3156 if (decoder_ret) {3156 if (decoder_ret) {
3157 decoder = find_decoder(st, st->codec->codec_id);3157 decoder = find_decoder(ic, st, st->codec->codec_id);
3158 if (!decoder) {3158 if (!decoder) {
3159 if (ret < 0)3159 if (ret < 0)
3160 ret = AVERROR_DECODER_NOT_FOUND;3160 ret = AVERROR_DECODER_NOT_FOUND;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t