[MPlayer-dev-eng] Re: [PATCH] avc1 in X-QT over RTSP

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Oct 11 19:46:29 CEST 2006


Carl Eugen Hoyos <cehoyos <at> ag.or.at> writes:

> But this reference contains three streams (strings ...):
> http://stream.qtv.apple.com/events/aug/wwdc_2006/wwdc_2006_2_650_ref.mov
> 
> The first has to be played with -fps 8, the others with -fps 30
> (Patch for frame rate detection follows.)

Reimar suggested these changes on IRC:

Index: libmpdemux/demux_rtp_codec.cpp
===================================================================
--- libmpdemux/demux_rtp_codec.cpp      (Revision 20161)
+++ libmpdemux/demux_rtp_codec.cpp      (Arbeitskopie)
@@ -86,6 +86,29 @@
     } while (!parseQTState_video(qtRTPSource->qtState, fourcc));

     bih->biCompression = sh_video->format = fourcc;
+    bih->biWidth = qtRTPSource->qtState.width;
+    bih->biHeight = qtRTPSource->qtState.height;
+    if (bih->biCompression == mmioFOURCC('a','v','c','1')) {
+      uint8_t *pos = (uint8_t*)qtRTPSource->qtState.sdAtom + 86;
+      uint8_t *endpos = (uint8_t*)qtRTPSource->qtState.sdAtom
+                        + qtRTPSource->qtState.sdAtomSize;
+      while (pos+8 < endpos) {
+        unsigned atomLength = pos[0]<<24 | pos[1]<<16 | pos[2]<<8 | pos[3];
+        pos += 4;
+        if (atomLength > endpos-pos) break;
+        if (memcmp(pos, "avcC", 4) == 0 &&
+            atomLength > 8 &&
+            atomLength <= INT_MAX-sizeof(BITMAPINFOHEADER)) {
+          int length = sizeof(BITMAPINFOHEADER)+atomLength-8;
+          sh_video->bih = bih = (BITMAPINFOHEADER*)realloc(bih, length);
+          bih->biSize = length;
+          memcpy(bih+1, pos+4, atomLength-8);
+          break;
+        }
+        pos += atomLength-4;
+      }
+      needVideoFrameRate(demuxer, subsession);
+    }
   } else {
     fprintf(stderr,
            "Unknown MPlayer format code for MIME type \"video/%s\"\n",





More information about the MPlayer-dev-eng mailing list