History

libtags: opus/vorbis: make sure to get to the last frame to have the full duration

Sigrid Solveig Haflínudóttir committed 4 years ago

Commit 19f590d1 parent 3fc10ff2 files · +4 −2Browse files

Unified · Split

2 files
  1. opus.c +2 −1
  2. vorbis.c +2 −1
opus.c+2−1
@@ -83,11 +83,12 @@ tagopus(Tagctx *ctx) · 82 unmodified lines
8383 if(v != nil && v[1] == 'g' && v[2] == 'g' && v[3] == 'S'){
8484 uvlong g = leuint(v+6) | (uvlong)leuint(v+10)<<32;
8585 ctx->duration = g * 1000 / 48000; /* granule positions are always 48KHz */
86− return 0;
8786 }
8887 if(v != nil)
8988 v++;
9089 }
90+ if(ctx->duration != 0)
91+ break;
9192 }
9293 }
9394
vorbis.c+2−1
@@ -119,11 +119,12 @@ tagvorbis(Tagctx *ctx) · 118 unmodified lines
119119 if(v != nil && v[1] == 'g' && v[2] == 'g' && v[3] == 'S' && (v[5] & 4) == 4){ /* last page */
120120 uvlong g = leuint(v+6) | (uvlong)leuint(v+10)<<32;
121121 ctx->duration = g * 1000 / ctx->samplerate;
122− return 0;
123122 }
124123 if(v != nil)
125124 v++;
126125 }
126+ if(ctx->duration != 0)
127+ break;
127128 }
128129 }
129130

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t