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

Baptiste Coudurier baptiste.coudurier
Thu Mar 19 22:51:23 CET 2009


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

So which solution is the best ? :>

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
checking for life_signs in -lkenny... no
FFmpeg maintainer                                  http://www.ffmpeg.org




More information about the ffmpeg-devel mailing list