summaryrefslogtreecommitdiff
path: root/plugins/aac
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-03-24 09:50:35 +0100
committerGravatar waker <wakeroid@gmail.com>2012-03-24 09:50:35 +0100
commitc05d132836f94d6418555d5f6f66ed6e5cbc142b (patch)
tree831b62ed6e97ada150833139b41129db26b7a50c /plugins/aac
parent1982be260513d2ecf84a26e4bd0785a119eb2a6c (diff)
fixed skipping garbage at the start of raw aac files
Diffstat (limited to 'plugins/aac')
-rw-r--r--plugins/aac/aac.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/plugins/aac/aac.c b/plugins/aac/aac.c
index d598ecfe..ce8d1e8f 100644
--- a/plugins/aac/aac.c
+++ b/plugins/aac/aac.c
@@ -460,7 +460,6 @@ aac_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
int channels = -1;
int totalsamples = -1;
- int offs = -1;
info->junk = deadbeef->junk_get_leading_size (info->file);
if (!info->file->vfs->is_streaming ()) {
if (info->junk >= 0) {
@@ -469,7 +468,6 @@ aac_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
else {
info->junk = 0;
}
- offs = deadbeef->ftell (info->file);
}
else {
deadbeef->fset_track (info->file, it);
@@ -633,10 +631,14 @@ aac_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
else {
deadbeef->rewind (info->file);
}
- if (parse_aac_stream (info->file, &samplerate, &channels, &duration, &totalsamples) == -1) {
+ int offs = parse_aac_stream (info->file, &samplerate, &channels, &duration, &totalsamples);
+ if (offs == -1) {
trace ("aac stream not found\n");
return -1;
}
+ if (offs > info->junk) {
+ info->junk = offs;
+ }
if (info->junk >= 0) {
deadbeef->fseek (info->file, info->junk, SEEK_SET);
}
@@ -653,18 +655,18 @@ aac_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
// sync before attempting to init
int samplerate, channels;
float duration;
- offs = parse_aac_stream (info->file, &samplerate, &channels, &duration, NULL);
+ int offs = parse_aac_stream (info->file, &samplerate, &channels, &duration, NULL);
if (offs < 0) {
trace ("aac: parse_aac_stream failed\n");
return -1;
}
+ if (offs > info->junk) {
+ info->junk = offs;
+ }
trace("parse_aac_stream returned %x\n", offs);
deadbeef->pl_replace_meta (it, "!FILETYPE", "AAC");
}
- if (offs >= 0) {
- deadbeef->fseek (info->file, offs, SEEK_SET);
- }
// duration = (float)totalsamples / samplerate;
// deadbeef->pl_set_item_duration (it, duration);