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 ESMTP id 999F340BF7 for ; Fri, 5 May 2023 13:30:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5D93968C14A; Fri, 5 May 2023 16:30:00 +0300 (EEST) Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E53D7689C6C for ; Fri, 5 May 2023 16:29:53 +0300 (EEST) Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-18f22252fb7so315487fac.0 for ; Fri, 05 May 2023 06:29:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683293391; x=1685885391; 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=gdx3avGRncNjGU1Y+42t7XB4XTpV7IibGK3jszckTWo=; b=hbHMbRg0NPDASYdMWGJhPrctug1tHhdk9Pxlhd11eRZfWFBDyNHkJkQTWGYjVOLVJ4 8zSwMccl6Ir3+/ULAH5TddcuU++A0s5WSpsrkdJ3+pIXIRaZYMJYodXPadiBx41XuWpo FNlsxJsnF4eqFFtyqvdD5dVrKeS3ycrtsOuMnY5wkIdpATL1OBFwqReS63XSYVRlfaNH fUoNwf/Q5vVqjrdvavrFN2N0KeDq12DFRUMdMjGdYRKwBf0oqhtLYh3zbj5ZK8ztPWpc cxeXNc3p1hgFhp8KzBUbmDnfbrXWUIlBzGJxvqPRoTOhvHsNhpFWk6Att0qH68Qgiovu uO1g== X-Gm-Message-State: AC+VfDyZlw7aZTjnY8KGJ5NzH//BfNS3Bg2vBpIGd3MugjrgPp3CJGdH Rd36r9vWYm0UzI0ZxGvx7giUR0SlJ7oq0A== X-Google-Smtp-Source: ACHHUZ7w7IcwEgX+7dV7rpE8GUV8uPafrqzbKZIpvBKNuUeD8naDNJBQk7A3oJ9EM+IOjoO2MNvqeQ== X-Received: by 2002:a05:6871:aa:b0:192:68eb:2bb9 with SMTP id u42-20020a05687100aa00b0019268eb2bb9mr1092419oaa.0.1683293391307; Fri, 05 May 2023 06:29:51 -0700 (PDT) Received: from romains-mbp.lan (ip24-252-77-224.no.no.cox.net. [24.252.77.224]) by smtp.gmail.com with ESMTPSA id h5-20020a9d6405000000b006a632c6af05sm801469otl.54.2023.05.05.06.29.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 May 2023 06:29:50 -0700 (PDT) From: toots@rastageeks.org To: ffmpeg-devel@ffmpeg.org Date: Fri, 5 May 2023 08:28:47 -0500 Message-Id: <20230505132848.18011-1-toots@rastageeks.org> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/3] libavformat/oggparseflac.c: Decode metadata packets. 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: 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: From: Romain Beauxis This is the second version of a patch to add support for in-stream metadata updates in the ogg/flac parser. Currently, FFmpeg is unable to decode metadata in chained ogg/flac bitstreams past the initial track. This impacts all users relying on the FFmpeg backend to decode chained ogg/flac streams. Documentation on ogg chained bitstreams can be found here: https://xiph.org/ogg/doc/oggstream.html Code for detecting metadata frame is based on libavcodec/flacdec.c, code for handling comment update is based on libavformat/oggparsevorbis.c. This fix has been successfully tested locally. To reproduce: * Find a ogg/flac icecast stream, for instance from: https://dir.xiph.org/ * Decode the stream using FFMpeg API * Check the associated AVStream metadata I have not been able to find a reproduction test with the ffmpeg or ffplay CLI. However, the patch is confirmed to fix the backend from liquidsoplaySee: https://github.com/savonet/liquidsoap/issues/3010 I would be happy to provide more details or even a reproduction minimal example using the C API. --- libavformat/oggparseflac.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c index eef6e09927..1dd292483d 100644 --- a/libavformat/oggparseflac.c +++ b/libavformat/oggparseflac.c @@ -126,10 +126,30 @@ fail: return ret; } +static int flac_packet(AVFormatContext *s, int idx) +{ + struct ogg *ogg = s->priv_data; + struct ogg_stream *os = ogg->streams + idx; + int ret; + + if (os->psize > 4 && (*(os->buf + os->pstart) & 0x7F) == FLAC_METADATA_TYPE_VORBIS_COMMENT) { + AVStream *st = s->streams[idx]; + av_dict_free(&st->metadata); + ret = ff_vorbis_stream_comment(s, st, os->buf + os->pstart + 4, + os->psize - 4); + + if (ret < 0) return ret; + } + + return 0; +} + + const struct ogg_codec ff_flac_codec = { .magic = "\177FLAC", .magicsize = 5, .header = flac_header, + .packet = flac_packet, .nb_header = 2, }; -- 2.37.1 (Apple Git-137.1) _______________________________________________ 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".