comparison libmpdemux/demux_rtp_codec.cpp @ 22809:09f97d0161ba

Handle X-QT extradata in a slightly more correct way
author cehoyos
date Mon, 26 Mar 2007 09:35:03 +0000
parents 3d6a64f3d28f
children d7f4da5e9ee4
comparison
equal deleted inserted replaced
22808:c9b6a804f753 22809:09f97d0161ba
104 } while (!parseQTState_video(qtRTPSource->qtState, fourcc)); 104 } while (!parseQTState_video(qtRTPSource->qtState, fourcc));
105 105
106 bih->biCompression = sh_video->format = fourcc; 106 bih->biCompression = sh_video->format = fourcc;
107 bih->biWidth = qtRTPSource->qtState.width; 107 bih->biWidth = qtRTPSource->qtState.width;
108 bih->biHeight = qtRTPSource->qtState.height; 108 bih->biHeight = qtRTPSource->qtState.height;
109 if (bih->biCompression == mmioFOURCC('a','v','c','1') ||
110 bih->biCompression == mmioFOURCC('m','p','4','v') ||
111 bih->biCompression == mmioFOURCC('S','V','Q','3')) {
112 uint8_t *pos = (uint8_t*)qtRTPSource->qtState.sdAtom + 86; 109 uint8_t *pos = (uint8_t*)qtRTPSource->qtState.sdAtom + 86;
113 uint8_t *endpos = (uint8_t*)qtRTPSource->qtState.sdAtom 110 uint8_t *endpos = (uint8_t*)qtRTPSource->qtState.sdAtom
114 + qtRTPSource->qtState.sdAtomSize; 111 + qtRTPSource->qtState.sdAtomSize;
115 while (pos+8 < endpos) { 112 while (pos+8 < endpos) {
116 unsigned atomLength = pos[0]<<24 | pos[1]<<16 | pos[2]<<8 | pos[3]; 113 unsigned atomLength = pos[0]<<24 | pos[1]<<16 | pos[2]<<8 | pos[3];
117 if (atomLength == 0 || atomLength > endpos-pos) break; 114 if (atomLength == 0 || atomLength > endpos-pos) break;
118 if ((!memcmp(pos+4, "avcC", 4) || 115 if ((!memcmp(pos+4, "avcC", 4) && fourcc==mmioFOURCC('a','v','c','1') ||
119 !memcmp(pos+4, "esds", 4) || 116 !memcmp(pos+4, "esds", 4) ||
120 !memcmp(pos+4, "SMI ", 4)) && 117 !memcmp(pos+4, "SMI ", 4) && fourcc==mmioFOURCC('S','V','Q','3')) &&
121 atomLength > 8) { 118 atomLength > 8) {
122 sh_video->bih = bih = 119 sh_video->bih = bih =
123 insertVideoExtradata(bih, pos+8, atomLength-8); 120 insertVideoExtradata(bih, pos+8, atomLength-8);
124 break; 121 break;
125 } 122 }
126 pos += atomLength; 123 pos += atomLength;
127 } 124 }
128 }
129 needVideoFrameRate(demuxer, subsession); 125 needVideoFrameRate(demuxer, subsession);
130 } else { 126 } else {
131 fprintf(stderr, 127 fprintf(stderr,
132 "Unknown MPlayer format code for MIME type \"video/%s\"\n", 128 "Unknown MPlayer format code for MIME type \"video/%s\"\n",
133 subsession->codecName()); 129 subsession->codecName());