Lines Matching refs:model_context
205 struct recognition_context *model_context = NULL; in fetch_model_with_handle() local
209 model_context = last_model_context; in fetch_model_with_handle()
214 return model_context; in fetch_model_with_handle()
311 struct recognition_context *model_context = fetch_model_with_handle(stdev, model_handle_str); in send_event_with_handle() local
312 if (model_context) { in send_event_with_handle()
314 if (model_context->recognition_callback == NULL) { in send_event_with_handle()
319 if (model_context->model_type == SOUND_MODEL_TYPE_KEYPHRASE) { in send_event_with_handle()
322 sound_trigger_keyphrase_event_alloc(model_context->model_handle, in send_event_with_handle()
323 model_context->config, status); in send_event_with_handle()
325 model_context->recognition_callback(event, model_context->recognition_cookie); in send_event_with_handle()
328 } else if (model_context->model_type == SOUND_MODEL_TYPE_GENERIC) { in send_event_with_handle()
331 sound_trigger_generic_event_alloc(model_context->model_handle, in send_event_with_handle()
332 model_context->config, status); in send_event_with_handle()
334 model_context->recognition_callback(event, model_context->recognition_cookie); in send_event_with_handle()
351 event->model = model_context->model_handle; in send_event_with_handle()
353 model_context->model_callback(&event, model_context->model_cookie); in send_event_with_handle()
397 struct recognition_context *model_context = NULL; in get_model_context() local
402 model_context = current_model_context; in get_model_context()
408 return model_context; in get_model_context()
627 struct recognition_context *model_context; in stdev_load_sound_model() local
628 model_context = malloc(sizeof(struct recognition_context)); in stdev_load_sound_model()
629 if(!model_context) { in stdev_load_sound_model()
645 free(model_context); in stdev_load_sound_model()
650 current_model_context->next = model_context; in stdev_load_sound_model()
652 stdev->root_model_context = model_context; in stdev_load_sound_model()
655 model_context->model_handle = generate_sound_model_handle(dev); in stdev_load_sound_model()
656 *handle = model_context->model_handle; in stdev_load_sound_model()
657 model_context->model_type = sound_model->type; in stdev_load_sound_model()
662 model_context->model_uuid = sound_model->uuid; in stdev_load_sound_model()
663 model_context->model_callback = callback; in stdev_load_sound_model()
664 model_context->model_cookie = cookie; in stdev_load_sound_model()
665 model_context->config = NULL; in stdev_load_sound_model()
666 model_context->recognition_callback = NULL; in stdev_load_sound_model()
667 model_context->recognition_cookie = NULL; in stdev_load_sound_model()
668 model_context->next = NULL; in stdev_load_sound_model()
669 model_context->model_started = false; in stdev_load_sound_model()
678 struct recognition_context *model_context = stdev->root_model_context; in unload_all_sound_models() local
681 while (model_context) { in unload_all_sound_models()
682 ALOGI("Deleting model with handle: %d", model_context->model_handle); in unload_all_sound_models()
683 struct recognition_context *temp = model_context; in unload_all_sound_models()
684 model_context = model_context->next; in unload_all_sound_models()
700 struct recognition_context *model_context = NULL; in stdev_unload_sound_model() local
706 model_context = current_model_context; in stdev_unload_sound_model()
713 if (!model_context) { in stdev_unload_sound_model()
719 previous_model_context->next = model_context->next; in stdev_unload_sound_model()
721 stdev->root_model_context = model_context->next; in stdev_unload_sound_model()
723 free(model_context->config); in stdev_unload_sound_model()
724 free(model_context); in stdev_unload_sound_model()
741 struct recognition_context *model_context = get_model_context(stdev, handle); in stdev_start_recognition() local
742 if (!model_context) { in stdev_start_recognition()
748 free(model_context->config); in stdev_start_recognition()
749 model_context->config = NULL; in stdev_start_recognition()
751 model_context->config = malloc(sizeof(*config)); in stdev_start_recognition()
752 if (!model_context->config) { in stdev_start_recognition()
756 memcpy(model_context->config, config, sizeof(*config)); in stdev_start_recognition()
758 model_context->recognition_callback = callback; in stdev_start_recognition()
759 model_context->recognition_cookie = cookie; in stdev_start_recognition()
760 model_context->model_started = true; in stdev_start_recognition()
773 struct recognition_context *model_context = get_model_context(stdev, handle); in stdev_stop_recognition() local
774 if (!model_context) { in stdev_stop_recognition()
780 free(model_context->config); in stdev_stop_recognition()
781 model_context->config = NULL; in stdev_stop_recognition()
782 model_context->recognition_callback = NULL; in stdev_stop_recognition()
783 model_context->recognition_cookie = NULL; in stdev_stop_recognition()
784 model_context->model_started = false; in stdev_stop_recognition()
797 struct recognition_context *model_context = stdev->root_model_context; in stdev_stop_all_recognitions() local
798 while (model_context) { in stdev_stop_all_recognitions()
799 free(model_context->config); in stdev_stop_all_recognitions()
800 model_context->config = NULL; in stdev_stop_all_recognitions()
801 model_context->recognition_callback = NULL; in stdev_stop_all_recognitions()
802 model_context->recognition_cookie = NULL; in stdev_stop_all_recognitions()
803 model_context->model_started = false; in stdev_stop_all_recognitions()
804 ALOGI("%s stopped handle %d", __func__, model_context->model_handle); in stdev_stop_all_recognitions()
806 model_context = model_context->next; in stdev_stop_all_recognitions()
821 struct recognition_context *model_context = get_model_context(stdev, handle); in stdev_get_model_state() local
822 if (!model_context) { in stdev_get_model_state()
828 if (!model_context->model_started) { in stdev_get_model_state()
834 if (model_context->recognition_callback == NULL) { in stdev_get_model_state()