shithub: opus-tools

Download patch

ref: 95d049532091f675e3622099d7b09acc776da993
parent: 6c758c0e0183dcb437658d8cc07d84127c32c934
author: Matthew Walker <mattgwwalker@gmail.com>
date: Mon Jun 8 16:00:10 EDT 2020

opusinfo: Add detection of extra packets in header pages.

Additional header packets are disallowed by the spec and
rejected by the opusfile decoder library. Report this
condition in opusinfo so it's more obvious what's wrong
with such files.

The output is a little confusing when the extra packet
is in the first page as it also tries to parse it as
a comment header.

Signed-off-by: Ralph Giles <giles@thaumas.net>

--- a/src/info_opus.c
+++ b/src/info_opus.c
@@ -109,6 +109,10 @@
             break;
 
         packets++;
+        if(header == 1 && packets >= 2) {
+          oi_warn(_("WARNING: Extra packet found in the page containing the Opus headers "
+                    "in Opus stream %d\n"), stream->num);
+        }
         if(inf->doneheaders < 2) {
             if(inf->doneheaders==0 && opus_header_parse(packet.packet,packet.bytes,&inf->oh)!=1) {
                 oi_warn(_("WARNING: Could not decode Opus header "