[Ffmpeg-devel] [Question] avio/ByteIOContext/Circular Buffers?

Ryan Martell rdm4
Mon Dec 11 23:50:06 CET 2006


Hi--

I'm trying to get the mms stuff working, and having a tough time  
integrating with asf.c.  I can do this rather easily as a URLContext,  
but I need seeking to work, and the other nice features that the  
AVInputFormat structure gives me. (Pausing, etc.)

Anyway.

I'm trying to use a ByteIOContext as a circular queue, and it doesn't  
look like they're made for that.  They appear to be either read or  
write, but not both- am I missing something?  Essentially, I need  
put_byte() and read_byte() to maintain their own indexes, and read  
from separate places.

I setup the ByteIOContext at init, then I put the asf header in it as  
a i read it.  I then pad it with the necessary bytes (it must be a  
multiple of packet_size).  At this point, I call the standard packet  
read function in asf.  It seeks to the end of my header, and then  
keeps reading (garbage) because it doesn't call the read_packet  
function in my ByteIOContext.

Any suggestions on ways to proceed would be appreciated.  Rewriting  
asf.c is an option, but it has lots of seeks and tells in places, and  
I worry about breaking it on the non-seeking version.  My thought  
might be to add a flag to init_put_byte() that turns it into a  
circular queue. (By that I mean that the it has a read and a write  
ptr, and they are incremented separately and wrap when they hit the  
end of the buffer.  The number of bytes available is calculated by  
the difference between the two, taking into consideration buffer end,  
etc.)

Thanks!
-Ryan




More information about the ffmpeg-devel mailing list