comparison libmpdemux/demux_rtp_codec.cpp @ 22154:1dc228327c55

when the video codec is mpeg4video copy the content of the esds in extradata; patch by ceyes ag or at
author nicodvb
date Wed, 07 Feb 2007 23:41:07 +0000
parents c9214f2c30c4
children 7c9d838fc788
comparison
equal deleted inserted replaced
22153:0cf24df5d97b 22154:1dc228327c55
89 89
90 bih->biCompression = sh_video->format = fourcc; 90 bih->biCompression = sh_video->format = fourcc;
91 bih->biWidth = qtRTPSource->qtState.width; 91 bih->biWidth = qtRTPSource->qtState.width;
92 bih->biHeight = qtRTPSource->qtState.height; 92 bih->biHeight = qtRTPSource->qtState.height;
93 if (bih->biCompression == mmioFOURCC('a','v','c','1') || 93 if (bih->biCompression == mmioFOURCC('a','v','c','1') ||
94 bih->biCompression == mmioFOURCC('m','p','4','v') ||
94 bih->biCompression == mmioFOURCC('S','V','Q','3')) { 95 bih->biCompression == mmioFOURCC('S','V','Q','3')) {
95 uint8_t *pos = (uint8_t*)qtRTPSource->qtState.sdAtom + 86; 96 uint8_t *pos = (uint8_t*)qtRTPSource->qtState.sdAtom + 86;
96 uint8_t *endpos = (uint8_t*)qtRTPSource->qtState.sdAtom 97 uint8_t *endpos = (uint8_t*)qtRTPSource->qtState.sdAtom
97 + qtRTPSource->qtState.sdAtomSize; 98 + qtRTPSource->qtState.sdAtomSize;
98 while (pos+8 < endpos) { 99 while (pos+8 < endpos) {
99 unsigned atomLength = pos[0]<<24 | pos[1]<<16 | pos[2]<<8 | pos[3]; 100 unsigned atomLength = pos[0]<<24 | pos[1]<<16 | pos[2]<<8 | pos[3];
100 if (atomLength == 0 || atomLength > endpos-pos) break; 101 if (atomLength == 0 || atomLength > endpos-pos) break;
101 if ((!memcmp(pos+4, "avcC", 4) || !memcmp(pos+4, "SMI ", 4)) && 102 if ((!memcmp(pos+4, "avcC", 4) ||
103 !memcmp(pos+4, "esds", 4) ||
104 !memcmp(pos+4, "SMI ", 4)) &&
102 atomLength > 8 && 105 atomLength > 8 &&
103 atomLength <= INT_MAX-sizeof(BITMAPINFOHEADER)) { 106 atomLength <= INT_MAX-sizeof(BITMAPINFOHEADER)) {
104 bih->biSize = sizeof(BITMAPINFOHEADER)+atomLength-8; 107 bih->biSize = sizeof(BITMAPINFOHEADER)+atomLength-8;
105 sh_video->bih = bih = (BITMAPINFOHEADER*)realloc(bih, bih->biSize); 108 sh_video->bih = bih = (BITMAPINFOHEADER*)realloc(bih, bih->biSize);
106 memcpy(bih+1, pos+8, atomLength-8); 109 memcpy(bih+1, pos+8, atomLength-8);