summaryrefslogtreecommitdiff
path: root/apps/codecs/demac/libdemac/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/demac/libdemac/parser.c')
-rw-r--r--apps/codecs/demac/libdemac/parser.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/codecs/demac/libdemac/parser.c b/apps/codecs/demac/libdemac/parser.c
index 4e907308b6..7e0fd8f250 100644
--- a/apps/codecs/demac/libdemac/parser.c
+++ b/apps/codecs/demac/libdemac/parser.c
@@ -92,6 +92,10 @@ int ape_parseheaderbuf(unsigned char* buf, struct ape_ctx_t* ape_ctx)
92 ape_ctx->channels = get_uint16(header + 18); 92 ape_ctx->channels = get_uint16(header + 18);
93 ape_ctx->samplerate = get_uint32(header + 20); 93 ape_ctx->samplerate = get_uint32(header + 20);
94 94
95 ape_ctx->seektablefilepos = ape_ctx->junklength +
96 ape_ctx->descriptorlength +
97 ape_ctx->headerlength;
98
95 ape_ctx->firstframe = ape_ctx->junklength + ape_ctx->descriptorlength + 99 ape_ctx->firstframe = ape_ctx->junklength + ape_ctx->descriptorlength +
96 ape_ctx->headerlength + ape_ctx->seektablelength + 100 ape_ctx->headerlength + ape_ctx->seektablelength +
97 ape_ctx->wavheaderlength; 101 ape_ctx->wavheaderlength;
@@ -133,15 +137,19 @@ int ape_parseheaderbuf(unsigned char* buf, struct ape_ctx_t* ape_ctx)
133 else 137 else
134 ape_ctx->blocksperframe = 9216; 138 ape_ctx->blocksperframe = 9216;
135 139
136 ape_ctx->firstframe = ape_ctx->junklength + ape_ctx->headerlength + 140 ape_ctx->seektablefilepos = ape_ctx->junklength + ape_ctx->headerlength +
137 ape_ctx->seektablelength + ape_ctx->wavheaderlength; 141 ape_ctx->wavheaderlength;
142
143 ape_ctx->firstframe = ape_ctx->junklength + ape_ctx->headerlength +
144 ape_ctx->wavheaderlength + ape_ctx->seektablelength;
138 } 145 }
139 146
140 ape_ctx->totalsamples = ape_ctx->finalframeblocks; 147 ape_ctx->totalsamples = ape_ctx->finalframeblocks;
141 if (ape_ctx->totalframes > 1) 148 if (ape_ctx->totalframes > 1)
142 ape_ctx->totalsamples += ape_ctx->blocksperframe * (ape_ctx->totalframes-1); 149 ape_ctx->totalsamples += ape_ctx->blocksperframe * (ape_ctx->totalframes-1);
143 150
144 /* TODO: Parse and store seektable */ 151 ape_ctx->numseekpoints = MAX(ape_ctx->maxseekpoints,
152 ape_ctx->seektablelength / sizeof(int32_t));
145 153
146 return 0; 154 return 0;
147} 155}