[Libav-user] Decoding H.264 SPS

Sergey Fedorov night.rain.whisper at gmail.com
Fri Jun 7 20:51:45 CEST 2013


Hi,

I'm trying to implement hardware codec emulation by using libavcodec
for doing actual coding. The hardware codec driver roughly operates as
follows:

1. Send a command to decode sequence header
2. Get a stream info from the hardware
3. Knowing frame width, height, reference picture count allocate
decoded picture buffers
4. Send a command to decode a frame
5. Process a decoded picture and repeat from 4

Now I have a trouble on the first two steps. I try to allocate
AVCodecContext and set extradata and extradata_size to pass sequence
header received from the driver. Then I call avcodec_open2() to allow
the decoder to decode SPS from extradata. avcodec_open() succeeds but
AVCodecContext is not updated with SPS info. So I can't provide the
driver with necessary width, height and refs info. As I can see from
the source code these fields are updated only when processing slice
header. But I have nothing but SPS on the first command from the
driver. How could I get SPS info on that stage?

Thanks in advance!

Sergey.


More information about the Libav-user mailing list