summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSigrid Solveig Haflínudóttir <sigrid@ftrv.se>2022-10-17 23:58:24 +0000
committerSigrid Solveig Haflínudóttir <sigrid@ftrv.se>2022-10-17 23:58:24 +0000
commit0fbecab00e9354a08e8099d1ffd1e10830c25885 (patch)
treef90fdf0ec80c0a051a24889a4b4d6e031accb6ff
parentd67596f1bbdce63cd6a053cc17443fde1631ed10 (diff)
libtags: opus/vorbis: make sure to get to the last frame to have the full duration
-rw-r--r--sys/src/cmd/audio/libtags/opus.c3
-rw-r--r--sys/src/cmd/audio/libtags/vorbis.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/sys/src/cmd/audio/libtags/opus.c b/sys/src/cmd/audio/libtags/opus.c
index e846f66f1..fa2c7d403 100644
--- a/sys/src/cmd/audio/libtags/opus.c
+++ b/sys/src/cmd/audio/libtags/opus.c
@@ -83,11 +83,12 @@ tagopus(Tagctx *ctx)
if(v != nil && v[1] == 'g' && v[2] == 'g' && v[3] == 'S'){
uvlong g = leuint(v+6) | (uvlong)leuint(v+10)<<32;
ctx->duration = g * 1000 / 48000; /* granule positions are always 48KHz */
- return 0;
}
if(v != nil)
v++;
}
+ if(ctx->duration != 0)
+ break;
}
}
diff --git a/sys/src/cmd/audio/libtags/vorbis.c b/sys/src/cmd/audio/libtags/vorbis.c
index 5a41c9a7f..9cd434a68 100644
--- a/sys/src/cmd/audio/libtags/vorbis.c
+++ b/sys/src/cmd/audio/libtags/vorbis.c
@@ -119,11 +119,12 @@ tagvorbis(Tagctx *ctx)
if(v != nil && v[1] == 'g' && v[2] == 'g' && v[3] == 'S' && (v[5] & 4) == 4){ /* last page */
uvlong g = leuint(v+6) | (uvlong)leuint(v+10)<<32;
ctx->duration = g * 1000 / ctx->samplerate;
- return 0;
}
if(v != nil)
v++;
}
+ if(ctx->duration != 0)
+ break;
}
}