diff mbox series

[FFmpeg-devel,4/5] avformat: add a stream event flag for new packets

Message ID 20201025145843.7776-5-anton@khirnov.net
State Accepted
Headers show
Series [FFmpeg-devel,1/5] avformat: fix typo in doxy
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Anton Khirnov Oct. 25, 2020, 2:58 p.m. UTC
---
 libavformat/avformat.h | 6 ++++++
 libavformat/utils.c    | 2 ++
 2 files changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 3ad92a06e7..6aa7c310f7 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -995,6 +995,12 @@  typedef struct AVStream {
  *     it into the file
  */
 #define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001
+/**
+ * - demuxing: new packets for this stream were read from the file. This
+ *   event is informational only and does not guarantee that new packets
+ *   for this stream will necessarily be returned from av_read_frame().
+ */
+#define AVSTREAM_EVENT_FLAG_NEW_PACKETS (1 << 1)
 
     /**
      * Real base framerate of the stream.
diff --git a/libavformat/utils.c b/libavformat/utils.c
index e8335a601f..be275971d0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1533,6 +1533,8 @@  static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
         ret = 0;
         st  = s->streams[pkt->stream_index];
 
+        st->event_flags |= AVSTREAM_EVENT_FLAG_NEW_PACKETS;
+
         /* update context if required */
         if (st->internal->need_context_update) {
             if (avcodec_is_open(st->internal->avctx)) {