[Libav-user] Having trouble with custom I/O

fkwatson at aol.com fkwatson at aol.com
Tue Sep 24 02:54:49 CEST 2013


Hi,


I am using a Zeranoe build of ffmpeg 1.2.1 for windows 32-bit.  I am also using Java Native Access (JNA) to do the reading and writing of Java InputStreams. Has anyone had success using custom i/o reads and seeks with Zeranoe builds?   Are there any known bugs with custom i/o in this version?


I set  AVFormatCtx pFormatCtx.debug=1 to see the debug messages for reading packets and frames.  Packets and frames are read correctly during:


avformat_open_input();
avformat_find_stream_info();


However during the main reading/decoding loop:


while (av_read_frame(pFormatCtx, &pkt) > 0)
{
.
.
.
av_free_packet(&pkt)
}


Frames are read correctly up to a point. Then for the next packet, pkt.size is less than what was read during the avformat_find_stream_info() call.  This packet happens to be an audio packet and the av_decode_audio4 call fails. The next read returns a video packet, but pkt.size is also less than what was read earlier.  I can read no more packets after this.


I have tried setting different buffer sizes including zero (null) when I open the context avio_alloc_context().  This has no effect on the results. I  also tried setting AVFMT_FLAG_CUSTOM_IO and AVFMT_FLAG_NO_BUFFER: same results. I can only read and decode to the exact same point every time.


-Felix

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130923/9f1afd15/attachment.html>


More information about the Libav-user mailing list