diff options
author | William Wilgus <me.theuser@yahoo.com> | 2019-01-24 22:54:34 -0600 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2019-01-25 17:50:39 +0100 |
commit | 8cadef4cbbdea20d68c0b389c32d7b64e312666b (patch) | |
tree | a5ccaee5b24118eb5785474f9352396a0981f5bb /lib/rbcodec/codecs/opus.c | |
parent | 07084f62c40d3197f3a11ac4e5fbe3b923e9ae1e (diff) | |
download | rockbox-8cadef4cbbdea20d68c0b389c32d7b64e312666b.tar.gz rockbox-8cadef4cbbdea20d68c0b389c32d7b64e312666b.zip |
opus fix playback opustag skipping
Change-Id: I9ec35e276e24ec7b5a2e1199d6264d9f2d5d9fc2
Diffstat (limited to 'lib/rbcodec/codecs/opus.c')
-rw-r--r-- | lib/rbcodec/codecs/opus.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/rbcodec/codecs/opus.c b/lib/rbcodec/codecs/opus.c index acae1aaacc..f0ad5e8ba4 100644 --- a/lib/rbcodec/codecs/opus.c +++ b/lib/rbcodec/codecs/opus.c | |||
@@ -72,7 +72,8 @@ static int seek_ogg_page(uint64_t filepos) | |||
72 | ci->seek_buffer(ci->curpos - sizeof(buf)); | 72 | ci->seek_buffer(ci->curpos - sizeof(buf)); |
73 | LOGF("next page %ld", ci->curpos); | 73 | LOGF("next page %ld", ci->curpos); |
74 | return 1; | 74 | return 1; |
75 | } | 75 | } else |
76 | ci->seek_buffer(ci->curpos - (sizeof(buf) - 1)); | ||
76 | } | 77 | } |
77 | } | 78 | } |
78 | return 0; | 79 | return 0; |
@@ -81,20 +82,19 @@ static int seek_ogg_page(uint64_t filepos) | |||
81 | /* seek to comment header */ | 82 | /* seek to comment header */ |
82 | static int seek_opus_tags(void) | 83 | static int seek_opus_tags(void) |
83 | { | 84 | { |
84 | int pos = 0; | ||
85 | const int64_t maxpos = sizeof(OpusHeader) + 1024; | ||
86 | const char synccode[] = "OpusTags"; | 85 | const char synccode[] = "OpusTags"; |
87 | char buf[sizeof(synccode)]; | 86 | char buf[sizeof(synccode) - 1]; /* Exclude null */ |
88 | ci->seek_buffer(0); | 87 | ci->seek_buffer(0); |
89 | while (ci->read_filebuf(buf, 1) == 1 && ci->curpos < maxpos) { | 88 | while (ci->read_filebuf(buf, 1) == 1) { |
90 | if (buf[0] == synccode[0]) { | 89 | if (buf[0] == synccode[0]) { |
91 | if (ci->read_filebuf(&buf[1], sizeof(buf) - 2) != sizeof(buf) - 2) | 90 | if (ci->read_filebuf(&buf[1], sizeof(buf) - 1) != sizeof(buf) - 1) |
92 | break; | 91 | break; |
93 | if (memcmp(buf, synccode, sizeof(buf)) == 0) { | 92 | if (memcmp(buf, synccode, sizeof(buf)) == 0) { |
94 | ci->seek_buffer(ci->curpos - sizeof(buf)); | 93 | ci->seek_buffer(ci->curpos - sizeof(buf)); |
95 | LOGF("OpusTags %ld", ci->curpos); | 94 | LOGF("OpusTags %ld", ci->curpos); |
96 | return 1; | 95 | return 1; |
97 | } | 96 | } else |
97 | ci->seek_buffer(ci->curpos - (sizeof(buf) - 1)); | ||
98 | } | 98 | } |
99 | } | 99 | } |
100 | /* comment header not found probably invalid file */ | 100 | /* comment header not found probably invalid file */ |