From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 73B4E4E881 for ; Fri, 6 Feb 2026 18:40:33 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'+Rk9LxLrRq7Zl8MgJrAyZ3IOBFzgu0YE3bqx5igtub8=', expected b'/G5oY0t6zmnyEAZA9g3BnotTLM0o0UaSHBfCTXgpkQw=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1770403223; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=+Rk9LxLrRq7Zl8MgJrAyZ3IOBFzgu0YE3bqx5igtub8=; b=Fuh++PwrlUiNRdOYAUZYBEbt6XbzwPgRfIceTUMVk4DnczmEXOCPHquLVD+s5+rT7aXrQ kZZcYlxR2Sa6pWgEVMgO5dsvvtPBCkqDS9bMd3WfODpqFMoV6wbGf2euNn7gw39DfoR56Yf 1tJ3yw6yiWcELTtpX8XpETuDqtcsLHd9dcmF9VonS7Fau8RuzmteapZVkMJbe2wlIgUQukW nofQrNwBQHNdUKmldcp31GJVo8Ej9bAgLAr9JuWKg5H7AOaZipQa7T9o9s0W/mAFUrDCWaM sbPGMyfPkMIuFSl2Khh7U+wv2GvHGbGJR5fpcpU1i7equ7c6Ivg1RhILx+bg== Received: from [172.20.0.4] (unknown [172.20.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 6931769110F; Fri, 6 Feb 2026 20:40:23 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1770403208; b=KES3B3zKkH5i3gVEYT06q+tE2MFH4FOhXJBvY9gzmRTGsKPAw3fh0LLuLgvjmmisweEep zF/I263C93QDdHjUUOYu16FJ5i3BCxqHxjgOYDokN79BM4Jn9sg+DUFhxwrSqC6XXSZ7zad A2vGM4pxMflN8dSmVyap0Ga4IKIzwcdlMIXajEVELBhXSmmFIrKlj2GF5yjTSB33HB81JG+ kS8Tlo0H3XUMsZbLV417ugIutSP3yko+lEmLRnY+MVSb3MX+4IVv58DEkYrwlEzOKlo0Oyq ztoq61GC8ZF664nqW774mOaY6jnGDh+dwoX2CtmwD/wIeMV0DnmPnlqE0Wyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1770403208; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=NZDrl+msgVxGTLKkIyqY7/jaE/t1B13CQxszkGIwqX4=; b=WeMcLIn3kI0DwiU1UTWd+wyn+Kwt7/x97+4Kf9iFPdvvk/RCiq4D0fwkUmqh6cQ9MNXt/ Ubk21CFjgedingxMMK9gxh5pS3KAoPSbqtcqz+H6qNAT5x9Kyswc0eV4wn7ZEkxJ79eM8Si hKHOthXapVOo8JHucJtQKGZTcKODCDh184AozjbRO1eStwLmqn50/WcqelOyfN7yecvUf3e lY7foFi5mjaTFe2cwPeJ380RvRydSUbOsOm41ID7Ek5HPw/yCdkqm5af2jSPeZr+ZP6z0Ag rLPHN1leTbJ7B4irf7gOJS6I9l1i3s0a4ucn3LAtu43zNZfDaqmdBZ30ze5w== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1770403198; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=/G5oY0t6zmnyEAZA9g3BnotTLM0o0UaSHBfCTXgpkQw=; b=41BPHJV2h5sJiBdgMJM8msOrhBlYvqya6B0XGjO8EejItAnE9OM6I7XqemY+kY7WS2qzQ q36ZhzJBvI2Kwt7bCjtk5m1gcWhien3QQlisZUPpF0T3hvn3PxhxuhbaiJdj34N5X71Q3m7 rMcFVzMqYaFTSwUbZepljYjMgM3YbZQxJ2Jbw1TFE7euK1cSLZFCenFZ80ejfdYz+VGvBiP mHunUWa1/pnDBacK6fjcYIJ9WA3ab4sInNAFV2V5rg14HWAIO57YxP/5/xwj8MFnmiLZru7 8QvAqv5g9umAjW9yILeCsBmfly2y8mC+8iM2v9cTjr5mXgSP50sSkRMftbQw== Received: from c8d966988b92 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id ABCC66905BF for ; Fri, 6 Feb 2026 20:39:58 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Fri, 06 Feb 2026 18:39:58 -0000 Message-ID: <177040319885.25.6721689163654028139@4457048688e7> Message-ID-Hash: XKJ3X5QWENAEEXQFO3XF6Q4GXZ3VH3KH X-Message-ID-Hash: XKJ3X5QWENAEEXQFO3XF6Q4GXZ3VH3KH X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PR] avcodec/libvorbisenc: export priming and padding samples if needed (PR #21665) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: James Almer via ffmpeg-devel Cc: James Almer Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21665 opened by James Almer (jamrial) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21665 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21665.patch Based on code from libopus and libfdk-aac encoder wrappers. >>From c85a57f9baf657fe548369c7befecacff138489a Mon Sep 17 00:00:00 2001 From: James Almer Date: Fri, 6 Feb 2026 15:34:49 -0300 Subject: [PATCH] avcodec/libvorbisenc: export priming and padding samples if needed Based on code from libopus and libfdk-aac encoder wrappers. Signed-off-by: James Almer --- libavcodec/libvorbisenc.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libavcodec/libvorbisenc.c b/libavcodec/libvorbisenc.c index 6aa1ec3b3c..50798122c1 100644 --- a/libavcodec/libvorbisenc.c +++ b/libavcodec/libvorbisenc.c @@ -23,6 +23,7 @@ #include "libavutil/avassert.h" #include "libavutil/channel_layout.h" #include "libavutil/fifo.h" +#include "libavutil/intreadwrite.h" #include "libavutil/mem.h" #include "libavutil/opt.h" #include "avcodec.h" @@ -357,10 +358,11 @@ static int libvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, duration = av_vorbis_parse_frame(s->vp, avpkt->data, avpkt->size); if (duration > 0) { + int discard_padding, delay = 0; /* we do not know encoder delay until we get the first packet from * libvorbis, so we have to update the AudioFrameQueue counts */ if (!avctx->initial_padding && s->afq.frames) { - avctx->initial_padding = duration; + avctx->initial_padding = delay = duration; av_assert0(!s->afq.remaining_delay); s->afq.frames->duration += duration; if (s->afq.frames->pts != AV_NOPTS_VALUE) @@ -368,6 +370,17 @@ static int libvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, s->afq.remaining_samples += duration; } ff_af_queue_remove(&s->afq, duration, &avpkt->pts, &avpkt->duration); + + discard_padding = duration - avpkt->duration; + if (delay > 0 || discard_padding > 0) { + uint8_t *side_data = av_packet_new_side_data(avpkt, + AV_PKT_DATA_SKIP_SAMPLES, + 10); + if (!side_data) + return AVERROR(ENOMEM); + AV_WL32(side_data, delay); + AV_WL32(side_data + 4, discard_padding); + } } *got_packet_ptr = 1; -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org