[MPlayer-dev-eng] [PATCH] avc1 in X-QT over RTSP
Carl Eugen Hoyos
cehoyos at ag.or.at
Wed Sep 27 02:45:59 CEST 2006
Hi!
Attached patch allows to play avc1 Videos sent over RTSP in subsession
"X-QUICKTIME". That's the way Apple streams at the moment.
Original bugreport:
http://lists.mplayerhq.hu/pipermail/mplayer-users/2006-January/057669.html
(-fps 16.67 is needed to play the mentioned stream.)
Please comment, Carl Eugen
Index: libmpdemux/demux_rtp_codec.cpp
===================================================================
--- libmpdemux/demux_rtp_codec.cpp (Revision 19984)
+++ libmpdemux/demux_rtp_codec.cpp (Arbeitskopie)
@@ -86,6 +86,36 @@
} 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') &&
+ qtRTPSource->qtState.sdAtomSize
+ < 0xffffffff-sizeof(BITMAPINFOHEADER)) {
+ unsigned pos = 86;
+ while (pos+8 < qtRTPSource->qtState.sdAtomSize) {
+ unsigned atomLength = char2int(qtRTPSource->qtState.sdAtom, pos);
+ if (char2int(qtRTPSource->qtState.sdAtom, pos+4)
+ == MOV_FOURCC('a','v','c','C') && atomLength > 8) {
+ 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