try to check

iocontext->eof_reached


if it is true av_read_frame won't actually read any more

2011/1/26 Bob Sopplor <[email protected]>

> Hello,
>
> I've a problem feeding the av_read_frame function with my h.264 video
> data—after
> reading the first frame (from memory): it simply stopped and won't read
> anymore.
>
> I've build the FormatContext using av_alloc_put_byte() ... the pVideoBuffer
> is
> allocated using av_malloc and it's size is 256k. My[Read|Write|Seek]Func
> are
> static hooks I use using the this_ptr as (void*) opaque to get the call
> back to
> my object.
>
> pFormatCtx->pb = av_alloc_put_byte( pVideoBuffer, int(pVideoBufferSize), 1,
> (void*)this, MyReadFunc, MyWriteFunc, MySeekFunc );
>
> After that I probe the input stream using my video data from my internal
> buffer,
> I make a call to "av_open_input_stream" and successfully open the stream.
>
> In the next step av_read_frame() is called, which calls my MyReadFunc()
> function. From there I copy the video data from my interal buffer to the
> "buf"
> parameter in the read function - but after a call to av_read_frame(), the
> buffer
> from the ByteIOContext changes and its the 256k buffer I allocated but a
> different one and 32k large. I copy 17k of video data and quit. After that
> a
> second call goes to MyReadFunc() but at that moment no more video data is
> available ... so I copy 0 bytes. I quit the function and return from
> av_read_frame() successfully with >=0.
>
> I start decoding with avcodec_decode_video2() and I get told my frame is
> finished ... no problem there (the decoded output inside the frame looks
> okay
> and like YUV420P).
>
>
> After that i free the AVPacket and make another call to av_read_frame() but
> know
> no video data is available—but I also won't jump to MyReadFunc() trying to
> read
> data. The read-loop is started again when the next chunks of data come in
> and my
> internal buffer is filled. But all subsequent calls to av_read_frame()
> directly
> return without leaving me a chance to copy the video data to the buffer.
>
> I've checked the ByteIOContext after that: pb->buffer_size is still at 32k,
> pb->buf_ptr is the same as pb->buf_end (same address) and pos is at 17k.
>
> Did I do something wrong with the internal buffers I allocated or didn't I
> understood the use of the buffers? I don't know why this is happening, but
> after
> that no frames will get read although I've plenty of video data available.
>
> Any ideas?
>
> thank you very much...
>
>
>
> _______________________________________________
> libav-user mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user
>
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to