diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-01-21 01:33:31 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-21 01:33:31 +0100 |
commit | 8f0768cc22788357f603695b86f5e9013652bba6 (patch) | |
tree | aece6cab293d489b857d02d206d90e56ace4eade /libavformat | |
parent | 01084336b7b969e29f163699a8414a84d00295da (diff) | |
parent | 23e57d167a87d3a671fe25efb2d5a1cf1719efc6 (diff) | |
download | ffmpeg-8f0768cc22788357f603695b86f5e9013652bba6.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
Add a tool that uses avio to read and write, doing a plain copy of data
ARM: fix build with FFT enabled and MDCT disabled
lavf: force single-threaded decoding in avformat_find_stream_info
avidec: migrate last of lavf from FF_ER_* to AV_EF_*
avserver: fix build after the next bump.
Conflicts:
libavformat/Makefile
libavformat/avidec.c
libavformat/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/Makefile | 2 | ||||
-rw-r--r-- | libavformat/avidec.c | 7 | ||||
-rw-r--r-- | libavformat/utils.c | 28 |
3 files changed, 23 insertions, 14 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile index c135eb8675..7c7cea5aad 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -374,4 +374,4 @@ OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o SKIPHEADERS-$(CONFIG_NETWORK) += network.h rtsp.h TESTPROGS = seek -TOOLS = pktdumper probetest +TOOLS = aviocat pktdumper probetest diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 76dda0f8f7..1740c9e047 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -724,8 +724,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) case MKTAG('i', 'n', 'd', 'x'): i= avio_tell(pb); if(pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX) && avi->use_odml && - read_braindead_odml_indx(s, 0) < 0 && s->error_recognition >= FF_ER_EXPLODE){ - goto fail; } + read_braindead_odml_indx(s, 0) < 0 && s->error_recognition >= FF_ER_EXPLODE) + goto fail; avio_seek(pb, i+size, SEEK_SET); break; case MKTAG('v', 'p', 'r', 'p'): @@ -762,7 +762,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if(size > 1000000){ av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, " "I will ignore it and try to continue anyway.\n"); - if (s->error_recognition >= FF_ER_EXPLODE) goto fail; + if (s->error_recognition & AV_EF_EXPLODE) + goto fail; avi->movi_list = avio_tell(pb) - 4; avi->movi_end = avi->fsize; goto end_of_header; diff --git a/libavformat/utils.c b/libavformat/utils.c index 9409ebe671..9e3f775d43 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2244,10 +2244,18 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option AVPacket pkt = *avpkt; if(!st->codec->codec){ + AVDictionary *thread_opt = NULL; + codec = avcodec_find_decoder(st->codec->codec_id); if (!codec) return -1; - ret = avcodec_open2(st->codec, codec, options); + + /* force thread count to 1 since the h264 decoder will not extract SPS + * and PPS to extradata during multi-threaded decoding */ + av_dict_set(options ? options : &thread_opt, "threads", "1", 0); + ret = avcodec_open2(st->codec, codec, options ? options : &thread_opt); + if (!options) + av_dict_free(&thread_opt); if (ret < 0) return ret; } @@ -2384,15 +2392,13 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) int i, count, ret, read_size, j; AVStream *st; AVPacket pkt1, *pkt; - AVDictionary *one_thread_opt = NULL; int64_t old_offset = avio_tell(ic->pb); int orig_nb_streams = ic->nb_streams; // new streams might appear, no options for those int flush_codecs = 1; - av_dict_set(&one_thread_opt, "threads", "1", 0); - for(i=0;i<ic->nb_streams;i++) { AVCodec *codec; + AVDictionary *thread_opt = NULL; st = ic->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || @@ -2412,20 +2418,24 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) assert(!st->codec->codec); codec = avcodec_find_decoder(st->codec->codec_id); - if (options) - av_dict_set(&options[i], "threads", "1", 0); + /* force thread count to 1 since the h264 decoder will not extract SPS + * and PPS to extradata during multi-threaded decoding */ + av_dict_set(options ? &options[i] : &thread_opt, "threads", "1", 0); /* Ensure that subtitle_header is properly set. */ if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE && codec && !st->codec->codec) - avcodec_open2(st->codec, codec, options ? &options[i] : &one_thread_opt); + avcodec_open2(st->codec, codec, options ? &options[i] + : &thread_opt); //try to just open decoders, in case this is enough to get parameters if(!has_codec_parameters(st->codec)){ if (codec && !st->codec->codec) avcodec_open2(st->codec, codec, options ? &options[i] - : &one_thread_opt); + : &thread_opt); } + if (!options) + av_dict_free(&thread_opt); } for (i=0; i<ic->nb_streams; i++) { @@ -2715,8 +2725,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) ic->streams[i]->codec->thread_count = 0; av_freep(&ic->streams[i]->info); } - - av_dict_free(&one_thread_opt); return ret; } |