[FFmpeg-devel] [PATCH 1/2] avformat/aviobuf: fix avio_flush() for read streams

Michael Niedermayer michaelni at gmx.at
Tue Sep 30 01:02:45 CEST 2014


On Mon, Sep 29, 2014 at 07:41:27PM +0200, wm4 wrote:
> avio_flush() did nothing useful for read streams. Fix it to behave as
> expected, and discard the currently read buffer properly.
> ---
> Since avio_flush() was just broken for read streams, I don't think this
> needs to be treated as an API-change.
> ---
>  libavformat/avio.h    | 8 ++++++--
>  libavformat/aviobuf.c | 2 ++
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/avio.h b/libavformat/avio.h
> index 2210c01..86f754e 100644
> --- a/libavformat/avio.h
> +++ b/libavformat/avio.h
> @@ -289,10 +289,14 @@ int url_feof(AVIOContext *s);
>  int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
>  
>  /**
> - * Force flushing of buffered data to the output s.
> + * Force flushing of buffered data.
>   *
> - * Force the buffered data to be immediately written to the output,
> + * For write streams, force the buffered data to be immediately written to the output,
>   * without to wait to fill the internal buffer.
> + *
> + * For read streams, discard all currently buffered data, and advance the
> + * reported file position to that of the underlying stream. This does not
> + * read new data, and does not perform any seeks.
>   */
>  void avio_flush(AVIOContext *s);
>  
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index 9795ba4..b8586bd 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -148,6 +148,8 @@ static void flush_buffer(AVIOContext *s)
>          }
>      }

this is calling writeout(), for a read flush

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140930/de0975c1/attachment.asc>


More information about the ffmpeg-devel mailing list