From b96b441ad2b4f314f2549b40f3df3894df738a77 Mon Sep 17 00:00:00 2001 From: Aurelien Jacobs Date: Sun, 21 Oct 2007 17:21:20 +0000 Subject: [PATCH] Make Matroska demuxer output full frames instead of slices for RealVideo Patch by Aurelien Jacobs (aurel at "... is not unix"age.org) Thread [RFC] Feed whole frames to RV* decoders Originally committed as revision 10824 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/matroska.h | 1 - libavformat/matroskadec.c | 33 ++++----------------------------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/libavformat/matroska.h b/libavformat/matroska.h index 8842161e06..f46337b87f 100644 --- a/libavformat/matroska.h +++ b/libavformat/matroska.h @@ -169,7 +169,6 @@ typedef enum { MATROSKA_TRACK_ENABLED = (1<<0), MATROSKA_TRACK_DEFAULT = (1<<1), MATROSKA_TRACK_LACING = (1<<2), - MATROSKA_TRACK_REAL_V = (1<<4), MATROSKA_TRACK_SHIFT = (1<<16) } MatroskaTrackFlags; diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 9847d38df4..2bf3886c1b 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2110,7 +2110,6 @@ matroska_read_header (AVFormatContext *s, codec_id == CODEC_ID_RV30 || codec_id == CODEC_ID_RV40) { extradata_offset = 26; track->codec_priv_size -= extradata_offset; - track->flags |= MATROSKA_TRACK_REAL_V; } else if (codec_id == CODEC_ID_RA_144) { @@ -2237,12 +2236,6 @@ matroska_read_header (AVFormatContext *s, return res; } -static inline int -rv_offset(uint8_t *data, int slice, int slices) -{ - return AV_RL32(data+8*slice+4) + 8*slices; -} - static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size, int64_t pos, uint64_t cluster_time, uint64_t duration, @@ -2379,7 +2372,6 @@ matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size, } if (res == 0) { - int real_v = matroska->tracks[track]->flags & MATROSKA_TRACK_REAL_V; uint64_t timecode = AV_NOPTS_VALUE; if (cluster_time != (uint64_t)-1 @@ -2387,22 +2379,6 @@ matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size, timecode = cluster_time + block_time; for (n = 0; n < laces; n++) { - int slice, slices = 1; - - if (real_v) { - slices = *data++ + 1; - lace_size[n]--; - } - - for (slice=0; slicecodec->codec_id == CODEC_ID_RA_288 || st->codec->codec_id == CODEC_ID_COOK || st->codec->codec_id == CODEC_ID_ATRAC3) { @@ -2444,19 +2420,19 @@ matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size, if (st->codec->codec_id == CODEC_ID_TEXT && ((MatroskaSubtitleTrack *)(matroska->tracks[track]))->ass) { int i; - for (i=0; i<8 && data[slice_offset+offset]; offset++) - if (data[slice_offset+offset] == ',') + for (i=0; i<8 && data[offset]; offset++) + if (data[offset] == ',') i++; } pkt = av_mallocz(sizeof(AVPacket)); /* XXX: prevent data copy... */ - if (av_new_packet(pkt, slice_size-offset) < 0) { + if (av_new_packet(pkt, lace_size[n]-offset) < 0) { res = AVERROR(ENOMEM); n = laces-1; break; } - memcpy (pkt->data, data+slice_offset+offset, slice_size-offset); + memcpy (pkt->data, data+offset, lace_size[n]-offset); if (n == 0) pkt->flags = is_keyframe; @@ -2471,7 +2447,6 @@ matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size, if (timecode != AV_NOPTS_VALUE) timecode = duration ? timecode + duration : AV_NOPTS_VALUE; - } data += lace_size[n]; } }