summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/mpegplayer/mpeg_misc.c4
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c26
-rw-r--r--apps/plugins/mpegplayer/pcm_output.c65
3 files changed, 60 insertions, 35 deletions
diff --git a/apps/plugins/mpegplayer/mpeg_misc.c b/apps/plugins/mpegplayer/mpeg_misc.c
index d9e033322e..895fbe04a9 100644
--- a/apps/plugins/mpegplayer/mpeg_misc.c
+++ b/apps/plugins/mpegplayer/mpeg_misc.c
@@ -214,6 +214,10 @@ int mpeg_button_get(int timeout)
214 mpeg_sysevent_clear(); 214 mpeg_sysevent_clear();
215 button = timeout == TIMEOUT_BLOCK ? rb->button_get(true) : 215 button = timeout == TIMEOUT_BLOCK ? rb->button_get(true) :
216 rb->button_get_w_tmo(timeout); 216 rb->button_get_w_tmo(timeout);
217
218 /* Produce keyclick */
219 rb->keyclick_click(button);
220
217 return mpeg_sysevent_callback(button, NULL); 221 return mpeg_sysevent_callback(button, NULL);
218} 222}
219 223
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 41f6b2e868..c6e1f4dded 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -386,6 +386,7 @@ enum video_action
386 VIDEO_STOP = 0, 386 VIDEO_STOP = 0,
387 VIDEO_PREV, 387 VIDEO_PREV,
388 VIDEO_NEXT, 388 VIDEO_NEXT,
389 VIDEO_ACTION_MANUAL = 0x8000, /* Flag that says user did it */
389}; 390};
390 391
391/* OSD status - same order as icon array */ 392/* OSD status - same order as icon array */
@@ -2139,7 +2140,7 @@ static int button_loop(void)
2139 /* Release within 3 seconds of start: skip to previous 2140 /* Release within 3 seconds of start: skip to previous
2140 * file */ 2141 * file */
2141 osd_stop(); 2142 osd_stop();
2142 next_action = VIDEO_PREV; 2143 next_action = VIDEO_PREV | VIDEO_ACTION_MANUAL;
2143 } 2144 }
2144 } 2145 }
2145 else if ((button & ~BUTTON_REPEAT) == old_button) { 2146 else if ((button & ~BUTTON_REPEAT) == old_button) {
@@ -2169,7 +2170,7 @@ static int button_loop(void)
2169 if ((old_button | BUTTON_REL) == button) { 2170 if ((old_button | BUTTON_REL) == button) {
2170 /* If button has been released: skip to next file */ 2171 /* If button has been released: skip to next file */
2171 osd_stop(); 2172 osd_stop();
2172 next_action = VIDEO_NEXT; 2173 next_action = VIDEO_NEXT | VIDEO_ACTION_MANUAL;
2173 } 2174 }
2174 else if ((button & ~BUTTON_REPEAT) == old_button) { 2175 else if ((button & ~BUTTON_REPEAT) == old_button) {
2175 button = osd_seek_btn(old_button); 2176 button = osd_seek_btn(old_button);
@@ -2251,11 +2252,10 @@ enum plugin_status plugin_start(const void* parameter)
2251 2252
2252 while (!quit) 2253 while (!quit)
2253 { 2254 {
2254 int result;
2255
2256 init_settings(videofile); 2255 init_settings(videofile);
2257 2256
2258 result = stream_open(videofile); 2257 int result = stream_open(videofile);
2258 bool manual_skip = false;
2259 2259
2260 if (result >= STREAM_OK) { 2260 if (result >= STREAM_OK) {
2261 /* start menu */ 2261 /* start menu */
@@ -2267,6 +2267,8 @@ enum plugin_status plugin_start(const void* parameter)
2267 if (result != MPEG_START_QUIT) { 2267 if (result != MPEG_START_QUIT) {
2268 /* Enter button loop and process UI */ 2268 /* Enter button loop and process UI */
2269 next_action = button_loop(); 2269 next_action = button_loop();
2270 manual_skip = next_action & VIDEO_ACTION_MANUAL;
2271 next_action &= ~VIDEO_ACTION_MANUAL;
2270 } 2272 }
2271 2273
2272 stream_close(); 2274 stream_close();
@@ -2341,6 +2343,13 @@ enum plugin_status plugin_start(const void* parameter)
2341 sizeof(videofile)); 2343 sizeof(videofile));
2342 /* quit after finished the last videofile */ 2344 /* quit after finished the last videofile */
2343 quit = !get_videofile_says; 2345 quit = !get_videofile_says;
2346
2347 if (manual_skip)
2348 {
2349 rb->system_sound_play(get_videofile_says ?
2350 SOUND_TRACK_SKIP : SOUND_TRACK_NO_MORE);
2351 }
2352
2344 break; 2353 break;
2345 } 2354 }
2346 case VIDEO_PREV: 2355 case VIDEO_PREV:
@@ -2348,6 +2357,13 @@ enum plugin_status plugin_start(const void* parameter)
2348 get_videofile_says = get_videofile(VIDEO_PREV, videofile, 2357 get_videofile_says = get_videofile(VIDEO_PREV, videofile,
2349 sizeof(videofile)); 2358 sizeof(videofile));
2350 /* if there is no previous file, play the same videofile */ 2359 /* if there is no previous file, play the same videofile */
2360
2361 if (manual_skip)
2362 {
2363 rb->system_sound_play(get_videofile_says ?
2364 SOUND_TRACK_SKIP : SOUND_TRACK_NO_MORE);
2365 }
2366
2351 break; 2367 break;
2352 } 2368 }
2353 case VIDEO_STOP: 2369 case VIDEO_STOP:
diff --git a/apps/plugins/mpegplayer/pcm_output.c b/apps/plugins/mpegplayer/pcm_output.c
index fb7ff434aa..8db9531049 100644
--- a/apps/plugins/mpegplayer/pcm_output.c
+++ b/apps/plugins/mpegplayer/pcm_output.c
@@ -23,6 +23,9 @@
23#include "plugin.h" 23#include "plugin.h"
24#include "mpegplayer.h" 24#include "mpegplayer.h"
25 25
26/* PCM channel we're using */
27#define MPEG_PCM_CHANNEL PCM_MIXER_CHAN_PLAYBACK
28
26/* Pointers */ 29/* Pointers */
27 30
28/* Start of buffer */ 31/* Start of buffer */
@@ -217,24 +220,22 @@ bool pcm_output_empty(void)
217/* Flushes the buffer - clock keeps counting */ 220/* Flushes the buffer - clock keeps counting */
218void pcm_output_flush(void) 221void pcm_output_flush(void)
219{ 222{
220 bool playing, paused;
221
222 rb->pcm_play_lock(); 223 rb->pcm_play_lock();
223 224
224 playing = rb->pcm_is_playing(); 225 enum channel_status status = rb->mixer_channel_status(MPEG_PCM_CHANNEL);
225 paused = rb->pcm_is_paused();
226 226
227 /* Stop PCM to clear current buffer */ 227 /* Stop PCM to clear current buffer */
228 if (playing) 228 if (status != CHANNEL_STOPPED)
229 rb->pcm_play_stop(); 229 rb->mixer_channel_stop(MPEG_PCM_CHANNEL);
230
231 rb->pcm_play_unlock();
230 232
231 pcm_reset_buffer(); 233 pcm_reset_buffer();
232 234
233 /* Restart if playing state was current */ 235 /* Restart if playing state was current */
234 if (playing && !paused) 236 if (status == CHANNEL_PLAYING)
235 rb->pcm_play_data(get_more, NULL, 0); 237 rb->mixer_channel_play_data(MPEG_PCM_CHANNEL,
236 238 get_more, NULL, 0);
237 rb->pcm_play_unlock();
238} 239}
239 240
240/* Seek the reference clock to the specified time - next audio data ready to 241/* Seek the reference clock to the specified time - next audio data ready to
@@ -264,10 +265,12 @@ uint32_t pcm_output_get_clock(void)
264 do 265 do
265 { 266 {
266 time = clock_time; 267 time = clock_time;
267 rem = rb->pcm_get_bytes_waiting() >> 2; 268 rem = rb->mixer_channel_get_bytes_waiting(MPEG_PCM_CHANNEL) >> 2;
268 } 269 }
269 while (UNLIKELY(time != clock_time || 270 while (UNLIKELY(time != clock_time ||
270 (rem == 0 && rb->pcm_is_playing() && !rb->pcm_is_paused()))); 271 (rem == 0 &&
272 rb->mixer_channel_status(MPEG_PCM_CHANNEL) == CHANNEL_PLAYING))
273 );
271 274
272 return time - rem; 275 return time - rem;
273 276
@@ -283,10 +286,12 @@ uint32_t pcm_output_get_ticks(uint32_t *start)
283 do 286 do
284 { 287 {
285 tick = clock_tick; 288 tick = clock_tick;
286 rem = rb->pcm_get_bytes_waiting() >> 2; 289 rem = rb->mixer_channel_get_bytes_waiting(MPEG_PCM_CHANNEL) >> 2;
287 } 290 }
288 while (UNLIKELY(tick != clock_tick || 291 while (UNLIKELY(tick != clock_tick ||
289 (rem == 0 && rb->pcm_is_playing() && !rb->pcm_is_paused()))); 292 (rem == 0 &&
293 rb->mixer_channel_status(MPEG_PCM_CHANNEL) == CHANNEL_PLAYING))
294 );
290 295
291 if (start) 296 if (start)
292 *start = clock_start; 297 *start = clock_start;
@@ -299,16 +304,22 @@ void pcm_output_play_pause(bool play)
299{ 304{
300 rb->pcm_play_lock(); 305 rb->pcm_play_lock();
301 306
302 if (rb->pcm_is_playing()) 307 if (rb->mixer_channel_status(MPEG_PCM_CHANNEL) != CHANNEL_STOPPED)
303 { 308 {
304 rb->pcm_play_pause(play); 309 rb->mixer_channel_play_pause(MPEG_PCM_CHANNEL, play);
310 rb->pcm_play_unlock();
305 } 311 }
306 else if (play) 312 else
307 { 313 {
308 rb->pcm_play_data(get_more, NULL, 0); 314 rb->pcm_play_unlock();
309 }
310 315
311 rb->pcm_play_unlock(); 316 if (play)
317 {
318 rb->mixer_channel_set_amplitude(MPEG_PCM_CHANNEL, MIX_AMP_UNITY);
319 rb->mixer_channel_play_data(MPEG_PCM_CHANNEL,
320 get_more, NULL, 0);
321 }
322 }
312} 323}
313 324
314/* Stops all playback and resets the clock */ 325/* Stops all playback and resets the clock */
@@ -316,13 +327,13 @@ void pcm_output_stop(void)
316{ 327{
317 rb->pcm_play_lock(); 328 rb->pcm_play_lock();
318 329
319 if (rb->pcm_is_playing()) 330 if (rb->mixer_channel_status(MPEG_PCM_CHANNEL) != CHANNEL_STOPPED)
320 rb->pcm_play_stop(); 331 rb->mixer_channel_stop(MPEG_PCM_CHANNEL);
332
333 rb->pcm_play_unlock();
321 334
322 pcm_output_flush(); 335 pcm_output_flush();
323 pcm_output_set_clock(0); 336 pcm_output_set_clock(0);
324
325 rb->pcm_play_unlock();
326} 337}
327 338
328/* Drains any data if the start threshold hasn't been reached */ 339/* Drains any data if the start threshold hasn't been reached */
@@ -343,11 +354,6 @@ bool pcm_output_init(void)
343 354
344 pcm_reset_buffer(); 355 pcm_reset_buffer();
345 356
346 /* Some targets could play at the movie frequency without resampling but
347 * as of now DSP assumes a certain frequency (always 44100Hz) so
348 * resampling will be needed for other movie audio rates. */
349 rb->pcm_set_frequency(NATIVE_FREQUENCY);
350
351#if INPUT_SRC_CAPS != 0 357#if INPUT_SRC_CAPS != 0
352 /* Select playback */ 358 /* Select playback */
353 rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); 359 rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
@@ -379,5 +385,4 @@ bool pcm_output_init(void)
379 385
380void pcm_output_exit(void) 386void pcm_output_exit(void)
381{ 387{
382 rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
383} 388}