summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/announce_status.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/apps/plugins/announce_status.c b/apps/plugins/announce_status.c
index 9df6fef7bc..f9f656da86 100644
--- a/apps/plugins/announce_status.c
+++ b/apps/plugins/announce_status.c
@@ -141,7 +141,8 @@ static void playback_event_callback(unsigned short id, void *data)
141{ 141{
142 (void)id; 142 (void)id;
143 (void)data; 143 (void)data;
144 rb->queue_post(&gThread.queue, EV_TRACKCHANGE, 0); 144 if (gThread.id > 0)
145 rb->queue_post(&gThread.queue, EV_TRACKCHANGE, 0);
145} 146}
146 147
147/****************** config functions *****************/ 148/****************** config functions *****************/
@@ -458,11 +459,11 @@ void thread_create(void)
458 { 459 {
459 rb->splash(HZ*2, "Out of memory"); 460 rb->splash(HZ*2, "Out of memory");
460 gThread.exiting = true; 461 gThread.exiting = true;
462 rb->remove_event(PLAYBACK_EVENT_TRACK_CHANGE, playback_event_callback);
461 gThread.id = UINT_MAX; 463 gThread.id = UINT_MAX;
462 return; 464 return;
463 } 465 }
464 466
465
466 /* put the thread's queue in the bcast list */ 467 /* put the thread's queue in the bcast list */
467 rb->queue_init(&gThread.queue, true); 468 rb->queue_init(&gThread.queue, true);
468 469
@@ -480,6 +481,8 @@ void thread_quit(void)
480 if (!gThread.exiting) { 481 if (!gThread.exiting) {
481 rb->queue_post(&gThread.queue, EV_EXIT, 0); 482 rb->queue_post(&gThread.queue, EV_EXIT, 0);
482 rb->thread_wait(gThread.id); 483 rb->thread_wait(gThread.id);
484 /* we don't want any more events */
485 rb->remove_event(PLAYBACK_EVENT_TRACK_CHANGE, playback_event_callback);
483 /* remove the thread's queue from the broadcast list */ 486 /* remove the thread's queue from the broadcast list */
484 rb->queue_delete(&gThread.queue); 487 rb->queue_delete(&gThread.queue);
485 gThread.exiting = true; 488 gThread.exiting = true;
@@ -511,7 +514,6 @@ int plugin_main(const void* parameter)
511 gAnnounce.index = 0; 514 gAnnounce.index = 0;
512 gAnnounce.timeout = 0; 515 gAnnounce.timeout = 0;
513 516
514
515 rb->splash(HZ / 2, "Announce Status"); 517 rb->splash(HZ / 2, "Announce Status");
516 518
517 if (configfile_load(CFG_FILE, config, gCfg_sz, CFG_VER) < 0) 519 if (configfile_load(CFG_FILE, config, gCfg_sz, CFG_VER) < 0)
@@ -520,17 +522,13 @@ int plugin_main(const void* parameter)
520 config_set_defaults(); 522 config_set_defaults();
521 configfile_save(CFG_FILE, config, gCfg_sz, CFG_VER); 523 configfile_save(CFG_FILE, config, gCfg_sz, CFG_VER);
522 524
523 if (rb->mixer_channel_status(PCM_MIXER_CHAN_PLAYBACK) == CHANNEL_PLAYING)
524 {
525 while (rb->mixer_channel_get_bytes_waiting(PCM_MIXER_CHAN_PLAYBACK) > 0)
526 rb->sleep(HZ / 10);
527 }
528
529 rb->talk_id(LANG_HOLD_FOR_SETTINGS, false);
530
531 rb->splash(HZ, ID2P(LANG_HOLD_FOR_SETTINGS)); 525 rb->splash(HZ, ID2P(LANG_HOLD_FOR_SETTINGS));
532 } 526 }
533 527
528 if (rb->mixer_channel_status(PCM_MIXER_CHAN_PLAYBACK) != CHANNEL_PLAYING)
529 {
530 rb->talk_id(LANG_HOLD_FOR_SETTINGS, false);
531 }
534 rb->splash(HZ, ID2P(LANG_HOLD_FOR_SETTINGS)); 532 rb->splash(HZ, ID2P(LANG_HOLD_FOR_SETTINGS));
535 533
536 rb->button_clear_queue(); 534 rb->button_clear_queue();
@@ -567,6 +565,7 @@ int plugin_main(const void* parameter)
567 rb->add_event(PLAYBACK_EVENT_TRACK_CHANGE, playback_event_callback); 565 rb->add_event(PLAYBACK_EVENT_TRACK_CHANGE, playback_event_callback);
568 566
569 thread_create(); 567 thread_create();
568
570 return 0; 569 return 0;
571} 570}
572 571
@@ -578,8 +577,6 @@ enum plugin_status plugin_start(const void* parameter)
578{ 577{
579 /* now go ahead and have fun! */ 578 /* now go ahead and have fun! */
580 int ret = plugin_main(parameter); 579 int ret = plugin_main(parameter);
581
582 rb->remove_event(PLAYBACK_EVENT_START_PLAYBACK, playback_event_callback);
583 return (ret==0) ? PLUGIN_OK : PLUGIN_ERROR; 580 return (ret==0) ? PLUGIN_OK : PLUGIN_ERROR;
584} 581}
585 582