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 386A94BE97 for ; Tue, 4 Feb 2025 11:15:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 70E1568B561; Tue, 4 Feb 2025 13:15:38 +0200 (EET) Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D934A68B009 for ; Tue, 4 Feb 2025 13:15:31 +0200 (EET) Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-46fa734a0b8so48389411cf.1 for ; Tue, 04 Feb 2025 03:15:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738667730; x=1739272530; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2ty7TL6NZO0xwHGyHoLcxapaYzHQeeZgUvnCJ7SgfDg=; b=nF65iMxPwslRkF+EJGYFDEqbIoldKjc0RqSqqdDlk3PPyXRteiNRklDoUvIezby27h Jrn86cAzj3DEf+uICIH6+QNHJEbvO7gJZIyWD0+nrR7WadiLZbWOSX5BbzbqQAnPn0HL 4ZfJqtes/mDT2RuFU6wDyAXJm5hhYAVJbVvsIueRaIefFiXFlKhDRxm0XCY9PHhwA/mo nxn32XjIoV1usmrzb0NQZyMtzali3AuNq3X1vxZRhn2QQmM4jJV5diO4uqI9vAfQAQOw TNcRmLQJrSAWoBnQcf5pErvy82LU0cfBvk/kiQTXjFPytvJO1IkMY93rMtDUHFDDe5C+ uOPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738667730; x=1739272530; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2ty7TL6NZO0xwHGyHoLcxapaYzHQeeZgUvnCJ7SgfDg=; b=pMPsbpOwDpdDzscPIeYaeMYe1uQ+W7O1z8o8sauMyHThkJsO8ODoUH0vhdXGtEFD+3 5IwLnlE4RLy9wtagTjvkqtb9TxNkWlOkaF5T6pKnZBcf51QB+DxxFdGuecmqbUYNIa7H fnUgBtevlOwJnPR7915/Ldri0B0YmhUMvpNRs0dQUu/lRszY3StYHzxWWrROgRo8lwh4 7Xz+iJuRVWhbH0Jf6kElBqJrzqirTTVcWfeC5zWpHJIsEuBIRbL1Gvq56BJtv3HN5aGv od08EDGpaG8bPQBudPQl42H+R5AWKy+BBrMcM6tJJSmXgfAAyg5fYFQzDRrsIldgi2VG sMrA== X-Gm-Message-State: AOJu0YyO5bKCn+/Xh6rQaE7he2rtnt7AiI7uTxumuldorc9nR0adiu05 n0/TrMnKQzY/Mh+M6gc5s0CBmGVpd3N8ffDCfWGqw/KvPRU1aF/zq2nyeXf4jQcYhg== X-Gm-Gg: ASbGnct2jMus898H8EK7bGdfIvE67w9M8IDarwcVyXwev0sfL6S8B3kyutgqHkB5hSt mkDSb8sglr29ICOr0ueVk7HEHNPp17PypKXZfddfcDRC2Q/P7lxHCdQfUwkXVQciAXBOPi/yOiZ nFSAyiHJp0BkDXHwRpvWNTQzNU9kik3Mg5CvM1HtAvXHeADsqJ8ukvpuPXCOwaLrNPldCRDoH25 MXWucshqv6+05VOpyDNbJ9PB/CRPv3A5GgOjJidEFE+9ku2SuiwyhCcQnpKladShMPxIuDhW10S 1OC+vjWYWCDE7ZFzOHxNtJf0WB7Ie0/NFNY6BZ8Z3GIBNg== X-Google-Smtp-Source: AGHT+IHp99b6O+fd1IPxHAO4e7AuZMrgqt2D3WSa0CJGXJBxO9UNtKHqW4EL8UDVOhE4bkv2VxlLPw== X-Received: by 2002:a05:622a:1985:b0:461:9d9:15c2 with SMTP id d75a77b69052e-46fd0a113a1mr391830381cf.1.1738667729919; Tue, 04 Feb 2025 03:15:29 -0800 (PST) Received: from localhost.localdomain ([12.172.251.101]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46fdf17c92fsm58181831cf.67.2025.02.04.03.15.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 04 Feb 2025 03:15:29 -0800 (PST) From: Romain Beauxis To: ffmpeg-devel@ffmpeg.org Date: Tue, 4 Feb 2025 06:15:18 -0500 Message-Id: <20250204111521.48785-1-romain.beauxis@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 0/3] Properly decode ogg metadata in ogg/flac chained bitstreams 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: epirat07@gmail.com, Romain Beauxis 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: This is a series of 3 patches to allow proper decoding of ogg metadata in chained ogg/flac streams. ogg/flac streams are pretty important because there are perhaps the only combination of lossless audio codec and open-source container that allows for proper transmittion of lossless audio data accross systems such as Icecast, browser media tags and more. In the context of long-running audio streams, the ogg bitstream specs[1] have historically been very badly implemented. For each new track and each new metadata, the specs require the logical bitstream to come to a full EOF and then start with a full new logical stream. These specs have often been confused with a gobal EOF by most implementations. Furtunately, FFmpeg is a little better at that in that it is capable to parsing chained logical ogg bitstreams and properly output either encoded ogg packets or decoded audio. Chained bitstreams with more than one underlying type of content (audio+video, etc) is not yet supported though this is a much less needed feature. The purpose of these changes is to also allow proper decoding of metadata associated with subsequent streams in chained ogg/flac bitstream. This is done by simply intercepting ogg packets with comments in the flac decoded, parsing the comment block and retaining it to be attached with the next decoded audio frame. Along with the changes is a new FATE test validating the implementation. This solution keeps a proper separation of concerns: ogg packets are sill output by the demuxer (as shown in the test) but consumer of decoded data see decoded metadata in the decoded frames. Only drawback is that this adds a dependency on libavformat to libavcodec. I have looked at moving the vorbis metadata parsing to libavutil but a lot of definitions and utilities related to metadata are in fact located in libavformat so perhaps this makes sense. Follow-up work not addressed in this series of patch: * Ensure valid PTS in decoded frames of subsequent streams? * Generalize this approach to other chained ogg codec. Thanks, -- Romain Romain Beauxis (3): libavformat/oggdec: Allow first parameter in ff_vorbis_comment to be a generic AVClass struct libavcodec/flacdec: parse vorbis metadata from ogg packets, add them to the next decoded frame. Add stream dump test with test for ogg/flac. libavcodec/flacdec.c | 12 +- libavformat/oggdec.h | 5 +- libavformat/oggparsevorbis.c | 4 +- tests/Makefile | 2 + tests/api/Makefile | 2 +- tests/api/api-dump-stream-meta-test.c | 169 ++++++++++++++++++++++++++ tests/fate/api.mak | 5 + tests/fate/ogg-flac.mak | 11 ++ 8 files changed, 205 insertions(+), 5 deletions(-) create mode 100644 tests/api/api-dump-stream-meta-test.c create mode 100644 tests/fate/ogg-flac.mak -- 2.39.5 (Apple Git-154) _______________________________________________ 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".