From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 1E1754E920 for ; Tue, 18 Mar 2025 12:59:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 08458687A67; Tue, 18 Mar 2025 14:59:09 +0200 (EET) Received: from xmbghk7.mail.qq.com (xmbghk7.mail.qq.com [43.163.128.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A62E2687A63 for ; Tue, 18 Mar 2025 14:59:01 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1742302733; bh=KP/YSdb2ZepsrngslhHXBT78CjOt50cqOGSZGub2QMs=; h=From:To:Cc:Subject:Date; b=TCkWxYQT1ttfAV62Dy6Pfp3HvrYeV+KxK8SFjvLvbrI5Y+UJMAGjnEvPMIRcjOghz WFjxA84qeYtfvZALy3E1jUCEsoBIe26I8xXMawOvD9CexdLhGu/5oFfLxeuc3PsFXH sQXibQxff4E3ehHUT00wFUrQ7vhxrSe78AGJFngQ= Received: from localhost.localdomain ([119.147.10.242]) by newxmesmtplogicsvrszc13-0.qq.com (NewEsmtp) with SMTP id EB4B3A16; Tue, 18 Mar 2025 20:58:52 +0800 X-QQ-mid: xmsmtpt1742302732tv9u2cpmw Message-ID: X-QQ-XMAILINFO: NAuAIaytDrXpLOMwbwY2VHOhqX9PH83h44jlsODkAuvXw7MqL7+4NPUxpUxTo4 tQeSCfxPcLS8ZoN5TGJW4QpQqktH3nGnjW1mnkLQswnwXWXbGoM8cd0ves4LqSE+RwE3r01PUmFE L4qlsT+SsDqQKcSdYMPgeJ/i9h6uM9spk+CbyaKmFg8hKjeK9Lhb8m3vT/1Dk292tvi6UZ5GwqHb 7uTNA1xqnMd05UKe46kDxQ6QtOMl7GAao8nDhCUfBS+rY7XwqTs5HpQzr0nH9NkcyQfUeXxsjSA5 pB1kcieKtuIR+nL4YOfHuN1JziScCsJ1LSd9YdanRXgsmL/Ih01DxIAuaJl07JPJoWClxyKFatbb SRt1cj4TgupBJA5NvFogvGZUa9KL7BZ3FvkMNjKGQ7/Jbc1nTu/8e37Ht8sl847HO8Kk4UEuDMIC 0orQXgbvwIp2jXLpxOLGjaCSI/5GXfO1eG7bX3McVWYjGEwoOKkkUbyBXcWEeW26qrVxV9J+sWEx r0ANtnHZ2Ko3ziHUCXSXmx13J+03eUiK8hJI3PmCGfl2/vKr26yvbkWolh/rxz1upWyxb1uMm9vy IDXstKI2IQfo+rECNBWbrw/C0nupv5Ezlhf6FQNkQjYI/pPyDdpyZPkPgJJoKFT2KpafpuOpHi53 8Mlb64kcmn9LwGi9HC6zRvKahT6s0V5e5+kmloX5zZ2HmKLv5M0rb6bTlhIIFo31eQaF15hTo+F+ Lg129+HT5V9EZ14dJiSQYsgKPUs09cFRjoJ1QUFSUsR9DIhpT25KLw6/mtxsUGFnfgQtjCjGBPqa 6l53/TbDGsAExyXhzXXaC+O5X8PgEhmOwIXItbuVdYPHSArE7NeJHDsH2aXc7JhTFNT6ZBUcjLLc zrGq144QmoFd6b4xqgux36NjxpOTGzgQjoHgDvnsevU6cQR8F8haXKuAHZW2pEMQuyYXcR54GwT4 oJMVNSNmWchrThfAm51KSCRIh8dYH8rV2df/QYnGevLB0PuT7xwsYDBmVwXtQb15Q07eJlP2DQGZ m37ea7oMaffv0m2cci X-QQ-XMRINFO: OWPUhxQsoeAVDbp3OJHYyFg= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Mar 2025 20:58:51 +0800 X-OQ-MSGID: <20250318125851.12022-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/6] avformat/mov: Notify new sequence at the start of editlist X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Cc: Zhao Zhili Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Zhao Zhili --- libavformat/avformat.h | 2 ++ libavformat/mov.c | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 498c557a3c..f83151a73f 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -611,6 +611,8 @@ typedef struct AVIndexEntry { #define AVINDEX_DISCARD_FRAME 0x0002 /** * Flag is used to indicate which frame should be discarded after decoding. */ +#define AVINDEX_NEW_SEQUENCE 0x0004 /* Mark the start of a new sequence */ + int flags:2; int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment). int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */ diff --git a/libavformat/mov.c b/libavformat/mov.c index bf526db67a..787a2b87e6 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4394,20 +4394,23 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) } } - if (add_index_entry(st, current->pos, edit_list_dts_counter, current->size, - current->min_distance, flags) == -1) { - av_log(mov->fc, AV_LOG_ERROR, "Cannot add index entry\n"); - break; - } // Update the index ranges array if (!current_index_range || index != current_index_range->end) { current_index_range = current_index_range ? current_index_range + 1 : msc->index_ranges; current_index_range->start = index; + if ((flags & AVINDEX_KEYFRAME) && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) + flags |= AVINDEX_NEW_SEQUENCE; } current_index_range->end = index + 1; + if (add_index_entry(st, current->pos, edit_list_dts_counter, current->size, + current->min_distance, flags) == -1) { + av_log(mov->fc, AV_LOG_ERROR, "Cannot add index entry\n"); + break; + } + // Only start incrementing DTS in frame_duration amounts, when we encounter a frame in edit list. if (edit_list_start_encountered > 0) { edit_list_dts_counter = edit_list_dts_counter + frame_duration; @@ -10889,7 +10892,11 @@ static int mov_finalize_packet(AVFormatContext *s, AVStream *st, AVIndexEntry *s uint8_t sample_is_depended_on = (sample_flags >> 2) & 0x3; pkt->flags |= sample_is_depended_on == MOV_SAMPLE_DEPENDENCY_NO ? AV_PKT_FLAG_DISPOSABLE : 0; } - pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? AV_PKT_FLAG_KEY : 0; + if (sample->flags & AVINDEX_KEYFRAME) { + pkt->flags |= AV_PKT_FLAG_KEY; + if (sample->flags & AVINDEX_NEW_SEQUENCE) + pkt->flags |= AV_PKT_FLAG_NEW_SEQUENCE; + } pkt->pos = sample->pos; /* Multiple stsd handling. */ -- 2.46.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".