silverlightwindows-phone-7h.264codecmediastreamsource

Find SPS and PPS from private-data


I have web-service which provides me custom format of container which contains H.264 NAL units. I want to play them via MediaElement in silverlight using custom MediaStreamSource.

According this article I need to set private codec data. Web service provides me configCodec but in base64 format (looks like "AUIAHv/hABhnQsAe2gMg7+IhAAADAAEAAAMAMo8WLqABAARozgvI")

So, in other platforms (iOS, Android) all I need is set to extra-data property of codec.

codec->extra-data = info;

But in Windows Phone I should provide this info like 00000001 [SPS] 00000001 [PPS]. So, could someone tell me how I can parse provided private data from web-service to get SPS and PPS values from it?


Solution

  • Your data decoded into hex is:

    0x01 0x42 0x00 0x1E 0xFF 
    0xE1 
    0x00 0x18 (SPS length in bytes)
    0x67 0x42 0xC0 0x1E 0xDA 0x03 0x20 0xEF (SPS...)
    0xE2 0x21 0x00 0x00 0x03 0x00 0x01 0x00 
    0x00 0x03 0x00 0x32 0x8F 0x16 0x2E 0xA0 (...SPS)
    0x01 
    0x00 0x04 (PPS length in bytes)
    0x68 0xCE 0x0B 0xC8 (PPS)
    

    I don't know what this structure exactly is and where it is rfom, however SPS and PPS are definitely on it.