[FFmpeg-devel] [PATCH] issue251, xvid within .ogm will not remux to .avi try2

Michael Niedermayer michaelni
Wed Jun 25 12:47:44 CEST 2008


Hi

This patch fixes "according to spec" timestamp association for theora
it also as a sideeffect fixes the file from issue 251

quote of the theora spec: (A.2.2)
   Frame data pages MUST be marked with a granule index corresponding to
the display time of the last frame/packet that finishes in that page.

Note ive not tested this extensively, i thought our users can do this better

Ill apply this in a few days if i hear no objections


Index: libavformat/oggdec.c
===================================================================
--- libavformat/oggdec.c	(revision 13799)
+++ libavformat/oggdec.c	(working copy)
@@ -523,11 +523,25 @@
         return AVERROR(EIO);
     pkt->stream_index = idx;
     memcpy (pkt->data, os->buf + pstart, psize);
+    if (s->streams[idx]->codec->codec_id == CODEC_ID_VORBIS){
     if (os->lastgp != -1LL){
         pkt->pts = ogg_gptopts (s, idx, os->lastgp);
         os->lastgp = -1;
     }
+    }else{
+        int segp= os->segp;
+        int nsegs=os->nsegs;
+        while (segp < nsegs){
+            if (os->segments[segp] < 255)
+                break;
+            segp++;
+        }
 
+        if (segp == nsegs && os->granule != -1LL){
+            pkt->pts = ogg_gptopts (s, idx, os->granule);
+        }
+    }
+
     pkt->flags = os->pflags;
 
     return psize;

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080625/5790b002/attachment.pgp>



More information about the ffmpeg-devel mailing list