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

Michael Niedermayer michaelni
Tue Dec 12 03:45:34 CET 2006


Hi

On Mon, Dec 11, 2006 at 04:50:06PM -0600, Ryan Martell wrote:
> 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.)

please elaborate on what the problem is with URLContext and seeking
note, i know nothing about mms ...


> 
> 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?  

no, ByteIOContext is not intended for read+write, it would be possible
to have 2 ByteIOContexts one for reading and one for writing but they
would need something to store any data written and as mms streams arent
"writeable" this doesnt make any sense to me ...


> 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.)

please explain why you want to hack ByteIOContext, and no i dont like
the idea at all

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates




More information about the ffmpeg-devel mailing list