[FFmpeg-devel] [PATCH 2/2] avformat: add avformat_flush()
Michael Niedermayer
michaelni at gmx.at
Mon Sep 29 20:25:47 CEST 2014
On Mon, Sep 29, 2014 at 07:41:28PM +0200, wm4 wrote:
> Useful for Bluray and DVD, since the libraries used to read them just
> change the byte stream under your feet on seeking.
>
> Maybe there should be a AVInputFormat callback for this. But the
> mpeg-ps (DVD) and the mpeg-ts (Bluray) demuxers don't change much
> state during seeking - they just try to find a new packet with
> timestamps (in read_timestamp), so I haven't found a need for this
> yet. I don't want to add unused things.
>
> I've also thought about adding a flush callback, and implementing
> them in mpeg.c and mpegts.c by just calling ff_read_frame_flush().
> Might be slightly better, because you can have avformat_flush() fail
> on formats which don't support this?
>
> Or maybe a flag?
>
> TODO: add entry to APIchanges, bump minor version.
> ---
> libavformat/avformat.h | 13 +++++++++++++
> libavformat/utils.c | 6 ++++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 78054de..eaa52fa 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -2173,6 +2173,19 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp,
> int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
>
> /**
> + * Discard all internally buffered data. This can be useful when dealing with
> + * discontinuities in the byte stream. Generally works only with some simple
> + * formats.
id call them stream based or without a central header instead of
simple.
> + *
> + * This does not flush the AVIOContext (s->pb). If necessary, call
> + * avio_flush(s->pb) before calling this function.
> + *
> + * @param s media file handle
> + * @return >=0 on success, error code otherwise
> + */
> +int avformat_flush(AVFormatContext *s);
i think this should document what happens with the streams
are they flushed too so that nb_streams could decrease ...
i guess the case where they could decrease doesnt make much sense
as that can already be achived by closing the demuxer and reopening
it ...
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- 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/20140929/a2b2ef3f/attachment.asc>
More information about the ffmpeg-devel
mailing list