Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-05-15 21:18:02 +0400
committerMichael Niedermayer <michaelni@gmx.at>2011-05-15 21:18:02 +0400
commitd46aada5c2c71b9b0a259e62699cab25837053b2 (patch)
treeab474244a6fda04d8a10d25201620cdaee11c3c6 /libavformat/avidec.c
parent66b1f210c024a08ba00e4a730e64940d248b8717 (diff)
parent5a153604c930792aa7f00c55cbf3c470f582dfb7 (diff)
Merge branch 'master' into oldabi
* master: (403 commits) Initial caf muxer. Support decoding of amr_nb and gsm in caf. Fix decoding of msrle samples with 1bpp. udp: remove resource.h inclusion, it breaks mingw compilation. ffmpeg: Allow seting and cycling through debug modes. Fix FSF address copy paste error in some license headers. Add an aac sample which uses LTP to fate-aac. ffmpeg: Help for interactive keys. UDP: dont use thread_t as truth value. swscale: fix compile on mingw32 [PATCH] Update pixdesc_be fate refs after adding 9/10bit YUV420P formats. arm: properly mark external symbol call ffmpeg: Interactivity support. Try pressing +-hs. swscale: 10l forgot git add this change from ronald. AVFrame: only set parameters from AVCodecContext in decode_video*() when no frame reordering is used. avcodec_default_get_buffer: init picture parameters. swscale: properly inline bits/endianness in yuv2yuvX16inC(). swscale: fix clipping of 9/10bit YUV420P. Add av_clip_uintp2() function Support more QT 1bpp rawvideo files. ... Conflicts: libavcodec/flacenc.c libavcodec/h261dec.c libavcodec/h263dec.c libavcodec/mpeg12.c libavcodec/msrle.c libavcodec/options.c libavcodec/qpeg.c libavcodec/rv34.c libavcodec/svq1dec.c libavcodec/svq3.c libavcodec/vc1dec.c libavcodec/version.h libavfilter/avfilter.h libavformat/file.c libavformat/options.c libavformat/rtpproto.c libavformat/udp.c libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r--libavformat/avidec.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index c388298fef..39686491e2 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -356,7 +356,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVIContext *avi = s->priv_data;
AVIOContext *pb = s->pb;
unsigned int tag, tag1, handler;
- int codec_type, stream_index, frame_period, bit_rate;
+ int codec_type, stream_index, frame_period;
unsigned int size;
int i;
AVStream *st;
@@ -428,7 +428,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* AVI header */
/* using frame_period is bad idea */
frame_period = avio_rl32(pb);
- bit_rate = avio_rl32(pb) * 8;
+ avio_rl32(pb); /* max. bytes per second */
avio_rl32(pb);
avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX;
@@ -970,7 +970,7 @@ resync:
if (CONFIG_DV_DEMUXER && avi->dv_demux) {
dstr = pkt->destruct;
size = dv_produce_packet(avi->dv_demux, pkt,
- pkt->data, pkt->size);
+ pkt->data, pkt->size, pkt->pos);
pkt->destruct = dstr;
pkt->flags |= AV_PKT_FLAG_KEY;
if (size < 0)
@@ -999,6 +999,23 @@ resync:
e= &st->index_entries[index];
if(index >= 0 && e->timestamp == ast->frame_offset){
+ if (index == st->nb_index_entries-1){
+ int key=1;
+ int i;
+ uint32_t state=-1;
+ for(i=0; i<FFMIN(size,256); i++){
+ if(st->codec->codec_id == CODEC_ID_MPEG4){
+ if(state == 0x1B6){
+ key= !(pkt->data[i]&0xC0);
+ break;
+ }
+ }else
+ break;
+ state= (state<<8) + pkt->data[i];
+ }
+ if(!key)
+ e->flags &= ~AVINDEX_KEYFRAME;
+ }
if (e->flags & AVINDEX_KEYFRAME)
pkt->flags |= AV_PKT_FLAG_KEY;
}
@@ -1347,6 +1364,22 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
index=0;
ast2->seek_pos= st2->index_entries[index].pos;
pos_min= FFMIN(pos_min,ast2->seek_pos);
+ }
+ for(i = 0; i < s->nb_streams; i++) {
+ AVStream *st2 = s->streams[i];
+ AVIStream *ast2 = st2->priv_data;
+
+ if (ast2->sub_ctx || st2->nb_index_entries <= 0)
+ continue;
+
+ index = av_index_search_timestamp(
+ st2,
+ av_rescale_q(timestamp, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1),
+ flags | AVSEEK_FLAG_BACKWARD);
+ if(index<0)
+ index=0;
+ while(index>0 && st2->index_entries[index-1].pos >= pos_min)
+ index--;
ast2->frame_offset = st2->index_entries[index].timestamp;
}