changeset 2654:37484d332087 libavformat

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
author kostya
date Sun, 21 Oct 2007 17:21:20 +0000
parents 67667d13bab5
children 2d3a902acf89
files matroska.h matroskadec.c
diffstat 2 files changed, 4 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/matroska.h	Sun Oct 21 17:17:28 2007 +0000
+++ b/matroska.h	Sun Oct 21 17:21:20 2007 +0000
@@ -169,7 +169,6 @@
   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;
 
--- a/matroskadec.c	Sun Oct 21 17:17:28 2007 +0000
+++ b/matroskadec.c	Sun Oct 21 17:21:20 2007 +0000
@@ -2110,7 +2110,6 @@
                      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 @@
     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 @@
     }
 
     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 @@
             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; slice<slices; slice++) {
-                int slice_size, slice_offset = 0;
-                if (real_v)
-                    slice_offset = rv_offset(data, slice, slices);
-                if (slice+1 == slices)
-                    slice_size = lace_size[n] - slice_offset;
-                else
-                    slice_size = rv_offset(data, slice+1, slices) - slice_offset;
-
                 if (st->codec->codec_id == CODEC_ID_RA_288 ||
                     st->codec->codec_id == CODEC_ID_COOK ||
                     st->codec->codec_id == CODEC_ID_ATRAC3) {
@@ -2444,19 +2420,19 @@
                     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 @@
 
                 if (timecode != AV_NOPTS_VALUE)
                     timecode = duration ? timecode + duration : AV_NOPTS_VALUE;
-            }
             data += lace_size[n];
         }
     }