From 7eea19633c574c7002cc41d8a6f7ccbb0e941dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Mangano?= Date: Fri, 27 Jan 2023 15:19:59 +0900 Subject: [PATCH] Support multiple-page OpusTags packets --- src/ogg.cc | 40 +++++++++++++++++++++------------------- t/opustags.t | 12 +++++++++++- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/ogg.cc b/src/ogg.cc index cc149ee..074317e 100644 --- a/src/ogg.cc +++ b/src/ogg.cc @@ -57,19 +57,28 @@ void ot::ogg_reader::process_header_packet(const std::function 50; +use Test::More tests => 54; use Digest::MD5; use File::Basename; @@ -311,3 +311,13 @@ U=\xFE END_OUT unlink('out.opus'); + +#################################################################################################### +# Multiple-page tags + +my $big_tags = "DATA=x\n" x 15000; # > 90K, which is over the max page size of 64KiB. +is_deeply(opustags(qw(-S gobble.opus -o out.opus), {in => $big_tags}), ['', '', 0], 'write multi-page header'); +is_deeply(opustags('out.opus'), [$big_tags, '', 0], 'read multi-page header'); +is_deeply(opustags(qw(out.opus -i -D -a), 'encoder=Lavc58.18.100 libopus'), ['', '', 0], 'shrink the header'); +is(md5('out.opus'), '111a483596ac32352fbce4d14d16abd2', 'the result is identical to the original file'); +unlink('out.opus');