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
83 if(v != nil && v[1] == 'g' && v[2] == 'g' && v[3] == 'S'){83 if(v != nil && v[1] == 'g' && v[2] == 'g' && v[3] == 'S'){
84 uvlong g = leuint(v+6) | (uvlong)leuint(v+10)<<32;84 uvlong g = leuint(v+6) | (uvlong)leuint(v+10)<<32;
85 ctx->duration = g * 1000 / 48000; /* granule positions are always 48KHz */85 ctx->duration = g * 1000 / 48000; /* granule positions are always 48KHz */
86 return 0;
87 }86 }
88 if(v != nil)87 if(v != nil)
89 v++;88 v++;
90 }89 }
90 if(ctx->duration != 0)
91 break;
91 }92 }
92 }93 }
93 94
vorbis.c+2−1
@@ -119,11 +119,12 @@ tagvorbis(Tagctx *ctx) · 118 unmodified lines
119 if(v != nil && v[1] == 'g' && v[2] == 'g' && v[3] == 'S' && (v[5] & 4) == 4){ /* last page */119 if(v != nil && v[1] == 'g' && v[2] == 'g' && v[3] == 'S' && (v[5] & 4) == 4){ /* last page */
120 uvlong g = leuint(v+6) | (uvlong)leuint(v+10)<<32;120 uvlong g = leuint(v+6) | (uvlong)leuint(v+10)<<32;
121 ctx->duration = g * 1000 / ctx->samplerate;121 ctx->duration = g * 1000 / ctx->samplerate;
122 return 0;
123 }122 }
124 if(v != nil)123 if(v != nil)
125 v++;124 v++;
126 }125 }
126 if(ctx->duration != 0)
127 break;
127 }128 }
128 }129 }
129 130

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