提交 3ab1e5a4 编写于 作者: N Nicolas George

lavf: add FFERROR_REDO to let demuxers return no packet.

上级 64f7db55
...@@ -516,4 +516,10 @@ int ff_copy_whitelists(AVFormatContext *dst, AVFormatContext *src); ...@@ -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, int ffio_open2_wrapper(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags,
const AVIOInterruptCB *int_cb, AVDictionary **options); 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 */ #endif /* AVFORMAT_INTERNAL_H */
...@@ -680,6 +680,11 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -680,6 +680,11 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
av_init_packet(pkt); av_init_packet(pkt);
ret = s->iformat->read_packet(s, pkt); ret = s->iformat->read_packet(s, pkt);
if (ret < 0) { 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)) if (!pktl || ret == AVERROR(EAGAIN))
return ret; return ret;
for (i = 0; i < s->nb_streams; i++) { for (i = 0; i < s->nb_streams; i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册