diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-01-25 17:18:20 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-01-25 17:18:20 +0000 |
commit | c498a5cf087f1cb213444ff6f2b5b35df4f3fa18 (patch) | |
tree | 00c9dbf39d8b6edb66ce12558858b41d36c56f3e /apps/plugins | |
parent | f716e4fdedfc4858aed463428278981ac36be393 (diff) | |
download | rockbox-c498a5cf087f1cb213444ff6f2b5b35df4f3fa18.tar.gz rockbox-c498a5cf087f1cb213444ff6f2b5b35df4f3fa18.zip |
MPEGPlayer: Account for drivers that pass pointers to their internal state variables to the audio callback.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29135 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/mpegplayer/pcm_output.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/plugins/mpegplayer/pcm_output.c b/apps/plugins/mpegplayer/pcm_output.c index 0b8ad7701a..fb7ff434aa 100644 --- a/apps/plugins/mpegplayer/pcm_output.c +++ b/apps/plugins/mpegplayer/pcm_output.c | |||
@@ -127,20 +127,21 @@ static void get_more(unsigned char **start, size_t *size) | |||
127 | else if (offset < 100*CLOCK_RATE/1000) | 127 | else if (offset < 100*CLOCK_RATE/1000) |
128 | { | 128 | { |
129 | /* Frame less than 100ms early - play it */ | 129 | /* Frame less than 100ms early - play it */ |
130 | *start = pcmbuf_head->data; | 130 | struct pcm_frame_header *head = pcmbuf_head; |
131 | 131 | ||
132 | pcm_advance_buffer(&pcmbuf_head, sz); | 132 | pcm_advance_buffer(&pcmbuf_head, sz); |
133 | pcmbuf_curr_size = sz; | 133 | pcmbuf_curr_size = sz; |
134 | 134 | ||
135 | sz -= PCM_HDR_SIZE; | 135 | sz -= PCM_HDR_SIZE; |
136 | 136 | ||
137 | *size = sz; | ||
138 | |||
139 | /* Audio is time master - keep clock synchronized */ | 137 | /* Audio is time master - keep clock synchronized */ |
140 | clock_time = time + (sz >> 2); | 138 | clock_time = time + (sz >> 2); |
141 | 139 | ||
142 | /* Update base clock */ | 140 | /* Update base clock */ |
143 | clock_tick += sz >> 2; | 141 | clock_tick += sz >> 2; |
142 | |||
143 | *start = head->data; | ||
144 | *size = sz; | ||
144 | return; | 145 | return; |
145 | } | 146 | } |
146 | /* Frame will be dropped - play silence clip */ | 147 | /* Frame will be dropped - play silence clip */ |
@@ -157,12 +158,12 @@ static void get_more(unsigned char **start, size_t *size) | |||
157 | } | 158 | } |
158 | 159 | ||
159 | /* Keep clock going at all times */ | 160 | /* Keep clock going at all times */ |
161 | clock_time += sizeof (silence) / 4; | ||
162 | clock_tick += sizeof (silence) / 4; | ||
163 | |||
160 | *start = (unsigned char *)silence; | 164 | *start = (unsigned char *)silence; |
161 | *size = sizeof (silence); | 165 | *size = sizeof (silence); |
162 | 166 | ||
163 | clock_tick += sizeof (silence) / 4; | ||
164 | clock_time += sizeof (silence) / 4; | ||
165 | |||
166 | if (sz < 0) | 167 | if (sz < 0) |
167 | pcmbuf_read = pcmbuf_written; | 168 | pcmbuf_read = pcmbuf_written; |
168 | } | 169 | } |