On Jan 24, 2008 9:54 PM, Reinhard Nissl rnissl@gmx.de wrote:
Typically, a SPS is found in the same memory block which starts with an AUD for an "I frame". From VDR's remux.c, cRemux::ScanVideoPacket():
if (!p[-2] && !p[-1]) { // found 0x000001 if (h264) { int nal_unit_type = p[1] & 0x1F; switch (nal_unit_type) { case 9: { // access unit delimiter int primary_pic_type = p[2] >> 5; switch (primary_pic_type) { case 0: // I case 3: // SI case 5: // I, SI PictureType = I_FRAME; break;
It might be the case that the whole initialisation of the CoreAVC decoder would be better suited somewhere else in the code.... :-\
Doesn't the decoder support a callback function where it tells you, the detected frame size? It'll really be a mess to do H.264 "decoding" in the demuxer.
I'm not sure about that. So, if the function identifies an AUD at the start of the payload then it could go on and scan the rest of the payload for an SPS? In other words we must scan after the AUD for
Data[0] = 0x00 Data[1] = 0x00 Data[2] = 0x01 Data[3] & 0x1F = 0x07
and start parsing from Data[4]?
How can we be sure that combination of bytes doesn't exist by chance in the picture payload anyway?
Cheers