Lines Matching refs:handler
400 static int __comb_play_url(comb_handler_t *handler) in __comb_play_url() argument
407 player = handler->player; in __comb_play_url()
409 os_mutex_lock(handler->url_list_lock, OS_WAIT_FOREVER); in __comb_play_url()
410 if (uvoice_list_empty(&handler->url_list)) { in __comb_play_url()
411 os_mutex_unlock(handler->url_list_lock); in __comb_play_url()
417 os_mutex_unlock(handler->url_list_lock); in __comb_play_url()
422 os_mutex_unlock(handler->url_list_lock); in __comb_play_url()
426 uvoice_list_for_each_entry_safe(&handler->url_list, temp, node, url_node_t, list) in __comb_play_url()
437 handler->player->clr_source(); in __comb_play_url()
446 os_mutex_unlock(handler->url_list_lock); in __comb_play_url()
452 comb_handler_t *handler = (comb_handler_t *)arg; in __comb_task() local
469 if (!handler) { in __comb_task()
474 player = handler->player; in __comb_task()
479 os_task_exit(handler->task); in __comb_task()
483 handler->running = 1; in __comb_task()
484 handler->comb_play_state = PLAYER_STAT_LIST_PLAY_STOP; in __comb_task()
486 while (!handler->stop) { in __comb_task()
487 os_mutex_lock(handler->list_lock, OS_WAIT_FOREVER); in __comb_task()
488 if (uvoice_list_empty(&handler->list)) { in __comb_task()
489 os_mutex_unlock(handler->list_lock); in __comb_task()
490 __comb_play_url(handler); in __comb_task()
507 uvoice_list_for_each_entry_safe(&handler->list, temp, node, comb_node_t, list) in __comb_task()
509 if (handler->listplay_stop) { in __comb_task()
515 handler->listplay_count--; in __comb_task()
519 os_mutex_unlock(handler->list_lock); in __comb_task()
521 if (handler->comb_play_state == PLAYER_STAT_LIST_PLAY_STOP) { in __comb_task()
522 handler->comb_play_state = PLAYER_STAT_LIST_PLAY_START; in __comb_task()
523 … uvoice_event_post(UVOICE_EV_PLAYER, UVOICE_CODE_PLAYER_STATE, handler->comb_play_state); in __comb_task()
530 os_mutex_lock(handler->list_lock, OS_WAIT_FOREVER); in __comb_task()
548 os_mutex_lock(handler->list_lock, OS_WAIT_FOREVER); in __comb_task()
556 os_mutex_lock(handler->list_lock, OS_WAIT_FOREVER); in __comb_task()
601 if (handler->listplay_stop) { in __comb_task()
612 if (handler->listplay_stop) { in __comb_task()
624 if (handler->listplay_stop) { in __comb_task()
631 os_mutex_lock(handler->list_lock, OS_WAIT_FOREVER); in __comb_task()
633 handler->listplay_count--; in __comb_task()
643 handler->comb_play_state = PLAYER_STAT_LIST_PLAY_STOP; in __comb_task()
644 uvoice_event_post(UVOICE_EV_PLAYER, UVOICE_CODE_PLAYER_STATE, handler->comb_play_state); in __comb_task()
646 if (handler->listplay_stop) { in __comb_task()
647 handler->listplay_stop = 0; in __comb_task()
648 os_sem_signal(handler->listplay_stop_sem); in __comb_task()
656 os_mutex_unlock(handler->list_lock); in __comb_task()
661 os_task_exit(handler->task); in __comb_task()
666 comb_handler_t *handler = g_comb_handler; in comb_receipt_play() local
677 if (!handler) { in comb_receipt_play()
682 if (!handler->running) { in comb_receipt_play()
738 os_mutex_lock(handler->list_lock, OS_WAIT_FOREVER); in comb_receipt_play()
752 add_amount(&handler->list, atof(ptr + 1), index); in comb_receipt_play()
757 add_number(&handler->list, ptr, index); in comb_receipt_play()
761 ret = add_file_source(&handler->list, sub_item->valuestring, index, 0, NULL, NULL); in comb_receipt_play()
763 os_mutex_unlock(handler->list_lock); in comb_receipt_play()
771 comb_handler_t *handler = g_comb_handler; in comb_content_play() local
780 if (!handler) { in comb_content_play()
785 if (!handler->running) { in comb_content_play()
826 os_mutex_lock(handler->url_list_lock, OS_WAIT_FOREVER); in comb_content_play()
827 add_http_source(&handler->url_list, item->valuestring, index); in comb_content_play()
828 os_mutex_unlock(handler->url_list_lock); in comb_content_play()
836 comb_handler_t *handler = g_comb_handler; in comb_add_amount() local
840 if (!handler) { in comb_add_amount()
845 if (!handler->running) { in comb_add_amount()
852 os_mutex_lock(handler->list_lock, OS_WAIT_FOREVER); in comb_add_amount()
853 ret = add_amount(&handler->list, _amount, index); in comb_add_amount()
854 os_mutex_unlock(handler->list_lock); in comb_add_amount()
860 comb_handler_t *handler = g_comb_handler; in comb_add_number() local
863 if (!handler) { in comb_add_number()
868 if (!handler->running) { in comb_add_number()
873 os_mutex_lock(handler->list_lock, OS_WAIT_FOREVER); in comb_add_number()
874 ret = add_number(&handler->list, number, index); in comb_add_number()
875 os_mutex_unlock(handler->list_lock); in comb_add_number()
881 comb_handler_t *handler = g_comb_handler; in comb_add_file_source_list() local
885 if (!handler) { in comb_add_file_source_list()
890 if (!handler->running) { in comb_add_file_source_list()
895 os_mutex_lock(handler->list_lock, OS_WAIT_FOREVER); in comb_add_file_source_list()
896 if (handler->listplay_count <= FILE_LIST_COUNT_MAX) { in comb_add_file_source_list()
899 … add_file_source(&handler->list, info->sources[i], i, 1, info->callback, info->userdata); in comb_add_file_source_list()
901 add_file_source(&handler->list, info->sources[i], i, 0, NULL, NULL); in comb_add_file_source_list()
903 handler->listplay_count++; in comb_add_file_source_list()
908 os_mutex_unlock(handler->list_lock); in comb_add_file_source_list()
915 comb_handler_t *handler = g_comb_handler; in comb_add_file_source_unlock() local
918 if (!handler) { in comb_add_file_source_unlock()
923 if (!handler->running) { in comb_add_file_source_unlock()
932 if (handler->listplay_count <= FILE_LIST_COUNT_MAX) { in comb_add_file_source_unlock()
933 ret = add_file_source(&handler->list, source, index, final, cb, userdata); in comb_add_file_source_unlock()
936 handler->listplay_count++; in comb_add_file_source_unlock()
946 comb_handler_t *handler = g_comb_handler; in comb_file_source_lock() local
948 if (!handler) { in comb_file_source_lock()
953 if (!handler->running) { in comb_file_source_lock()
958 return os_mutex_lock(handler->list_lock, OS_WAIT_FOREVER); in comb_file_source_lock()
963 comb_handler_t *handler = g_comb_handler; in comb_file_source_unlock() local
965 if (!handler) { in comb_file_source_unlock()
970 if (!handler->running) { in comb_file_source_unlock()
975 return os_mutex_unlock(handler->list_lock); in comb_file_source_unlock()
980 comb_handler_t *handler = g_comb_handler; in comb_add_http_source() local
983 if (!handler) { in comb_add_http_source()
988 if (!handler->running) { in comb_add_http_source()
993 os_mutex_lock(handler->url_list_lock, OS_WAIT_FOREVER); in comb_add_http_source()
994 if (uvoice_list_entry_count(&handler->url_list) <= HTTP_LIST_COUNT_MAX) { in comb_add_http_source()
995 ret = add_http_source(&handler->url_list, source, index); in comb_add_http_source()
999 os_mutex_unlock(handler->url_list_lock); in comb_add_http_source()
1005 comb_handler_t *handler = g_comb_handler; in comb_clr_http_source() local
1009 if (!handler) { in comb_clr_http_source()
1014 if (!handler->running) { in comb_clr_http_source()
1019 os_mutex_lock(handler->url_list_lock, OS_WAIT_FOREVER); in comb_clr_http_source()
1020 uvoice_list_for_each_entry_safe(&handler->url_list, temp, node, url_node_t, list) in comb_clr_http_source()
1026 os_mutex_unlock(handler->url_list_lock); in comb_clr_http_source()
1032 comb_handler_t *handler = g_comb_handler; in comb_play_stop() local
1034 if (!handler) { in comb_play_stop()
1039 if (handler->comb_play_state == PLAYER_STAT_LIST_PLAY_START) { in comb_play_stop()
1040 handler->listplay_stop = 1; in comb_play_stop()
1041 os_sem_wait(handler->listplay_stop_sem, 5000); in comb_play_stop()
1048 comb_handler_t *handler = g_comb_handler; in comb_init() local
1051 if (handler) { in comb_init()
1056 handler = snd_zalloc(sizeof(comb_handler_t), AFM_EXTN); in comb_init()
1057 if (!handler) { in comb_init()
1062 handler->player = uvoice_player_create(); in comb_init()
1063 if (!handler->player) { in comb_init()
1065 snd_free(handler); in comb_init()
1071 handler->player->cache_config(&config); in comb_init()
1073 handler->player->set_standby(0); in comb_init()
1075 uvoice_list_init(&handler->list); in comb_init()
1076 uvoice_list_init(&handler->url_list); in comb_init()
1077 handler->list_lock = os_mutex_new(); in comb_init()
1078 handler->url_list_lock = os_mutex_new(); in comb_init()
1079 handler->listplay_stop_sem = os_sem_new(0); in comb_init()
1081 g_comb_handler = handler; in comb_init()
1083 …if (os_task_create(&handler->task, "comb_player_task", __comb_task, handler, 8192, UVOICE_TASK_PRI… in comb_init()
1085 os_mutex_free(handler->list_lock); in comb_init()
1086 os_mutex_free(handler->url_list_lock); in comb_init()
1087 os_sem_free(handler->listplay_stop_sem); in comb_init()
1088 uvoice_player_release(handler->player); in comb_init()
1089 snd_free(handler); in comb_init()
1101 comb_handler_t *handler = g_comb_handler; in comb_deinit() local
1103 if (!handler) { in comb_deinit()
1108 handler->stop = 1; in comb_deinit()
1111 os_mutex_free(handler->list_lock); in comb_deinit()
1112 os_mutex_free(handler->url_list_lock); in comb_deinit()
1113 os_sem_free(handler->listplay_stop_sem); in comb_deinit()
1114 uvoice_player_release(handler->player); in comb_deinit()
1115 snd_free(handler); in comb_deinit()