Hello Victor, and hello everyone!
Time went by and I spend some time in developing my app further. Some months
ago Victor sent me this code snippet here:
> struct NALMsg {
> uint8_t* data;
> int size;
> char header;
> NalMsg* next;
> }
> int my_read(void* opaq, uint8_t* buf, int size)
> {
> NalMsg msg;
> ... parse buffer 'buf' into list of NAL units in NALMsg
> return size;
> }
> main()
> {
> ...
> ByteIOContext ByteIOCtx;
> init_put_byte(&ByteIOCtx, pDataBuffer, lSize, 0, this, &my_read, NULL,
> NULL); ...
> }
>
> av_read_frame will call your 'my_read' function to "do your thing"
> Let me know if you find other methods.
I have some understanding problems with this. Its clear that my_read is a
callback function. But what I don't understand is, is my_read called every
time by an av_read_frame invocation? Then my_read is also called if an audio
frame is read? Could it be? I only want to parse the video stream from an
ts-file. How can I do that?
It would be nice of you, if you could give me some deeper details about your
example of how to extract a frame from an h.264-stream.
Thank you very much,
Sven
BTW: If I use your code:
> main()
> {
> ...
> ByteIOContext ByteIOCtx;
> init_put_byte(&ByteIOCtx, pDataBuffer, lSize, 0, this, &my_read, NULL,
> NULL); ...
> }
It does not work. It only works if I use an existing bytecontext from an
AVFormatContext like:
init_put_byte(mPFormatCtx->pb, mPFormatCtx->pb->buffer,
mPFormatCtx->pb->buffer_size, 0, this, &my_read, NULL, NULL);
Is that right? Or?
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user