[FFmpeg-cvslog] lavf: add FFERROR_REDO to let demuxers return no packet.
Nicolas George
git at videolan.org
Thu Dec 3 19:22:38 CET 2015
ffmpeg | branch: master | Nicolas George <george at nsup.org> | Fri Nov 27 18:57:27 2015 +0100| [3ab1e5a48c53fdecdf50d177d20b6476094cec68] | committer: Nicolas George
lavf: add FFERROR_REDO to let demuxers return no packet.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3ab1e5a48c53fdecdf50d177d20b6476094cec68
---
libavformat/internal.h | 6 ++++++
libavformat/utils.c | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/libavformat/internal.h b/libavformat/internal.h
index ee86094..90f0a61 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -516,4 +516,10 @@ int ff_copy_whitelists(AVFormatContext *dst, AVFormatContext *src);
int ffio_open2_wrapper(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags,
const AVIOInterruptCB *int_cb, AVDictionary **options);
+/**
+ * Returned by demuxers to indicate that data was consumed but discarded
+ * (ignored streams or junk data). The framework will re-call the demuxer.
+ */
+#define FFERROR_REDO FFERRTAG('R','E','D','O')
+
#endif /* AVFORMAT_INTERNAL_H */
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 973256f..e93a192 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -680,6 +680,11 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
av_init_packet(pkt);
ret = s->iformat->read_packet(s, pkt);
if (ret < 0) {
+ /* Some demuxers return FFERROR_REDO when they consume
+ data and discard it (ignored streams, junk, extradata).
+ We must re-call the demuxer to get the real packet. */
+ if (ret == FFERROR_REDO)
+ continue;
if (!pktl || ret == AVERROR(EAGAIN))
return ret;
for (i = 0; i < s->nb_streams; i++) {
More information about the ffmpeg-cvslog
mailing list