[FFmpeg-devel] [RFC] using ByteIOContext with buffer without reading function

Michael Niedermayer michaelni
Mon Apr 13 02:47:48 CEST 2009


On Sat, Apr 11, 2009 at 03:52:44PM -0700, Baptiste Coudurier wrote:
> Hi Michael,
> 
> On Fri, Mar 20, 2009 at 04:36:04AM +0100, Michael Niedermayer wrote:
> > On Sun, Mar 15, 2009 at 03:53:07PM -0700, Baptiste Coudurier wrote:
> > > Hi,
> > > 
> > > I notice something strange when using ByteIOContext with a supplied
> > > buffer without read function, reading only.
> > > 
> > > aviobuf.c
> > > init:
> > >     if(!read_packet && !write_flag){
> > >         s->pos = buffer_size;
> > >         s->buf_end = s->buffer + buffer_size;
> > >     }
> > > 
> > > seek:
> > >     if (!s->must_flush &&
> > >         offset1 >= 0 && offset1 < (s->buf_end - s->buffer)) {
> > >         /* can do the seek inside the buffer */
> > >         s->buf_ptr = s->buffer + offset1;
> > > 
> > > mov.c:
> > >     if(init_put_byte(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL,
> > > NULL) != 0)
> > >         goto free_and_return;
> > > 
> > > Problem is:
> > > when you use url_fskip on the ByteIOContext, for example to skip
> > > everything not read (size is 51, url_fskip(51)), you will end up seeking
> > > at s->buf_end.
> > > 
> > > However the condition in "seek" won't allow this since offset1 ==
> > > s->buf_end - s->buffer.
> > > 
> > > Would it be better to change init to set buf_end to s->buffer +
> > > buffer_size + 1 or check for <= in seek ?
> > 
> > i would guess to <= in seek but this should be carefully tested, iam
> > not sure if this might have some unexpeted sideeffects
> > 
>  
> Any confidence in the <= case ?
> 
> I've checked the buf_end tests in aviobuf.c and they seem ok.
> 
> It would be nice to move on on the multiple stsd feature. This should be a
> good step in exporting the struct to decoders needing it.

if you belive its ok, commit

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090413/625ec224/attachment.pgp>



More information about the ffmpeg-devel mailing list