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 241BF4CA15 for ; Mon, 10 Feb 2025 19:26:42 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F2C7068BE26; Mon, 10 Feb 2025 21:26:29 +0200 (EET) Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3528B68B72B for ; Mon, 10 Feb 2025 21:26:23 +0200 (EET) Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-6ef60e500d7so37368047b3.0 for ; Mon, 10 Feb 2025 11:26:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739215581; x=1739820381; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cW8kEp+Qf6ItUwymuFAL1JXNgZnXXJmJiqqKOrqH9WI=; b=nFQ6s0PCCkc9xdAnEEStT1ObJAktINkHI2Byt6kP9lZ8Cyf+ILBoJ2H8lix9RoYimu n4Eqg3ph+jjQctWOWxC+7vO/APET3UYdwQutWw78H4SmfflVjPPF0fkZkz+OP+JD/6u5 Ef0Nf3TUcAOM1tuSCj+WRCERD4bMDPsSQECZJBvdjIV1ef4iPIDAsaHvJOekJmjF+eh1 YHO4T843902FIirBafQ2VxP0kiaJfrD1Rtyrso++RiwJXCQlP1LY7PasEE9cPVXpwkDG +gOrj793a6NYn3wRSRFOa8owg0kZj/8DRkSmACN34h8G3hBa35tCFeQ8WSNClC+oAITU +T3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739215581; x=1739820381; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cW8kEp+Qf6ItUwymuFAL1JXNgZnXXJmJiqqKOrqH9WI=; b=uzHKUzDWS4YR9qsgVbjJF4b+OnuYQuCKpCzf5fcwQFoOCWwpfdUpmmMQpwlhowHjcg UqczvzL64a8RckV/wrn8x1cDUQfeD0Ee4q64rlUCIhMETTc4Xyz61IHbYBnVHmnrqOAD 97Yr5xRL/N66RAEjooLLi37W0pEazwn9AQORbV9ZJjxQoEz05Cyx2mMicQOASNm41PT0 /DAh70l9D8J1ArR3JTYzNmjxVOc3Qex0Hv4JUfgs5U9DIQEH1RxyQYznReIq2VA7IDhB z8uv/2KjpbaeA2xl/N5cawLXssjm9kfztpOlkl9a4IEwhqKGo1AYOqpCUbfofCv/Vwy4 f2gg== X-Gm-Message-State: AOJu0YxmeWg0ewFtepyLiiXHpUlzngnhpNGF3HT8Q2/uC8Tm5F2fOcGH laSpvUnSSAodNt6QLokVf5RVrDUxKI5TaskooFrdTWUEHKn9FdpHln6gnQ== X-Gm-Gg: ASbGnctNvq/efDuV7Pf6R01ohFHJ5RxQ93mQ4CMs/9AdTSwIC8t8sQ9cSCdsFjbKaVB KLghukuimNvftyMa4EiJGd2Ip5/8E8m3bnzeXmU9MHF4TVYZ9c7JLBOJvToSw+A8/kcbH0wbmB8 nfY8IAzAzlho5jVGfmLtVznCZnoaJ2pZjXC2IY0gaea+GvPJPVyykYYWBK/phbtwful/NnWOKNY CO3HRdWDaE0t0b+VMdL2haM+oAGtq/TuyBqgEysbbo09RgSEV0y8UAnQylXWolWvK/4aj8c0dzf SAwfwTub5dtPnRvJXGlKf8K5XMgTITqGYwQ6s3YAxzj6MVOSCNMW1VQ= X-Google-Smtp-Source: AGHT+IFZ7KOWbByYxvSWVFjWs20rY86yLcVSulIjzxmmffLDeiqVNyTgw7XrjZRTlOGbMZogPB/PFw== X-Received: by 2002:a05:690c:4983:b0:6f6:ca28:8400 with SMTP id 00721157ae682-6f9b287d3damr113930847b3.17.1739215580762; Mon, 10 Feb 2025 11:26:20 -0800 (PST) Received: from localhost.localdomain ([2607:fb91:fe6:4ec3:28a5:3f0e:2e51:b5ed]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6fafee87110sm4985567b3.15.2025.02.10.11.26.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 10 Feb 2025 11:26:20 -0800 (PST) From: Romain Beauxis To: ffmpeg-devel@ffmpeg.org Date: Mon, 10 Feb 2025 13:25:55 -0600 Message-Id: <20250210192600.42502-2-romain.beauxis@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250210192600.42502-1-romain.beauxis@gmail.com> References: <20250210192600.42502-1-romain.beauxis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 1/6] Pass ogg/opus secondary header packets to the 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: These changes make it possible to access the initial header packets of secondary chained ogg/opus bitstreams. libavformat/oggparseopus.c: Parse extradata from secondary chained streams header packet. libavformat/oggdec.c: Do not force ogg stream header parsing on secondary ogg/opus chained streams. libavcodec/opus/dec.c: Ignore opus header packets from secondary chained streams. --- libavcodec/opus/dec.c | 5 +++++ libavformat/oggdec.c | 4 ---- libavformat/oggparseopus.c | 11 +++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libavcodec/opus/dec.c b/libavcodec/opus/dec.c index 6c59dc1f46..88a650c81c 100644 --- a/libavcodec/opus/dec.c +++ b/libavcodec/opus/dec.c @@ -486,6 +486,11 @@ static int opus_decode_packet(AVCodecContext *avctx, AVFrame *frame, int delayed_samples = 0; int i, ret; + if (buf_size > 8 && ( + !memcmp(buf, "OpusHead", 8) || + !memcmp(buf, "OpusTags", 8))) + return buf_size; + /* calculate the number of delayed samples */ for (int i = 0; i < c->p.nb_streams; i++) { OpusStreamContext *s = &c->streams[i]; diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 5339fdd32c..4425279ce8 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -239,10 +239,6 @@ static int ogg_replace_stream(AVFormatContext *s, uint32_t serial, char *magic, os->start_trimming = 0; os->end_trimming = 0; - /* Chained files have extradata as a new packet */ - if (codec == &ff_opus_codec) - os->header = -1; - return i; } diff --git a/libavformat/oggparseopus.c b/libavformat/oggparseopus.c index 218e9df581..950b93bd31 100644 --- a/libavformat/oggparseopus.c +++ b/libavformat/oggparseopus.c @@ -125,6 +125,17 @@ static int opus_packet(AVFormatContext *avf, int idx) return AVERROR_INVALIDDATA; } + if (os->psize > 8 && !memcmp(packet, "OpusHead", 8)) { + if ((ret = ff_alloc_extradata(st->codecpar, os->psize)) < 0) + return ret; + + memcpy(st->codecpar->extradata, packet, os->psize); + return 0; + } + + if (os->psize > 8 && !memcmp(packet, "OpusTags", 8)) + return 0; + if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && !(os->flags & OGG_FLAG_EOS)) { int seg, d; int duration; -- 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".