From patchwork Sun Oct 25 14:58:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 23211 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D6AC0449ADF for ; Sun, 25 Oct 2020 17:00:31 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BE23868AC4C; Sun, 25 Oct 2020 17:00:31 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 408CA6800A9 for ; Sun, 25 Oct 2020 17:00:23 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 39B552964DB for ; Sun, 25 Oct 2020 16:00:18 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id gIRYtLV0B9wI for ; Sun, 25 Oct 2020 16:00:17 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.daenerys.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id CE2512964F4 for ; Sun, 25 Oct 2020 16:00:15 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id DB87C20E00BE; Sun, 25 Oct 2020 16:00:11 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 25 Oct 2020 15:58:43 +0100 Message-Id: <20201025145843.7776-5-anton@khirnov.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201025145843.7776-1-anton@khirnov.net> References: <20201025145843.7776-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/5] avformat: add a stream event flag for new packets X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/avformat.h | 6 ++++++ libavformat/utils.c | 2 ++ 2 files changed, 8 insertions(+) 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)) {