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

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Oct 11 18:05:54 CEST 2006


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

> rtsp://www.as.huji.ac.il:7070/phys23/Dec_28_1600.mov

Link is down.

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.)

Hopefully improved patch attached, please comment, Carl Eugen

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

     bih->biCompression = sh_video->format = fourcc;
+    bih->biWidth = qtRTPSource->qtState.width;
+    bih->biHeight = qtRTPSource->qtState.height;
+
+#define BE_32(x) (((unsigned char *)(x))[0] << 24 | \
+                  ((unsigned char *)(x))[1] << 16 | \
+                  ((unsigned char *)(x))[2] <<  8 | \
+                  ((unsigned char *)(x))[3])
+#define char2int(x,y)   BE_32(&(x)[(y)])
+#define MOV_FOURCC(a,b,c,d) ((a<<24)|(b<<16)|(c<<8)|(d))
+
+    if (bih->biCompression == mmioFOURCC('a','v','c','1')) {
+      unsigned pos = 86;
+      while (pos+8 < qtRTPSource->qtState.sdAtomSize) {
+        unsigned atomLength = char2int(qtRTPSource->qtState.sdAtom, pos);
+        if (atomLength > qtRTPSource->qtState.sdAtomSize-pos ||
+            atomLength > UINT_MAX-pos+8)
+          break;
+        if (char2int(qtRTPSource->qtState.sdAtom, pos+4)
+              == MOV_FOURCC('a','v','c','C') &&
+            atomLength > 8 &&
+            atomLength <= INT_MAX-sizeof(BITMAPINFOHEADER)) {
+          sh_video->bih = bih
+            = (BITMAPINFOHEADER*)realloc(bih, sizeof(BITMAPINFOHEADER)
+                                              +atomLength-8);
+          bih->biSize = sizeof(BITMAPINFOHEADER)+atomLength-8;
+          memcpy((char*)bih+sizeof(BITMAPINFOHEADER),
+                 qtRTPSource->qtState.sdAtom+pos+8, atomLength-8);
+          break;
+        }
+        pos += atomLength;
+      }
+      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