Lines Matching refs:model_context
206 struct recognition_context *model_context = NULL; in fetch_model_with_handle() local
210 model_context = last_model_context; in fetch_model_with_handle()
215 return model_context; in fetch_model_with_handle()
312 struct recognition_context *model_context = fetch_model_with_handle(stdev, model_handle_str); in send_event_with_handle() local
313 if (model_context) { in send_event_with_handle()
315 if (model_context->recognition_callback == NULL) { in send_event_with_handle()
320 if (model_context->model_type == SOUND_MODEL_TYPE_KEYPHRASE) { in send_event_with_handle()
323 sound_trigger_keyphrase_event_alloc(model_context->model_handle, in send_event_with_handle()
324 model_context->config, status); in send_event_with_handle()
326 model_context->recognition_callback(event, model_context->recognition_cookie); in send_event_with_handle()
329 } else if (model_context->model_type == SOUND_MODEL_TYPE_GENERIC) { in send_event_with_handle()
332 sound_trigger_generic_event_alloc(model_context->model_handle, in send_event_with_handle()
333 model_context->config, status); in send_event_with_handle()
335 model_context->recognition_callback(event, model_context->recognition_cookie); in send_event_with_handle()
352 event->model = model_context->model_handle; in send_event_with_handle()
354 model_context->model_callback(&event, model_context->model_cookie); in send_event_with_handle()
398 struct recognition_context *model_context = NULL; in get_model_context() local
403 model_context = current_model_context; in get_model_context()
409 return model_context; in get_model_context()
628 struct recognition_context *model_context; in stdev_load_sound_model() local
629 model_context = malloc(sizeof(struct recognition_context)); in stdev_load_sound_model()
630 if(!model_context) { in stdev_load_sound_model()
646 free(model_context); in stdev_load_sound_model()
651 current_model_context->next = model_context; in stdev_load_sound_model()
653 stdev->root_model_context = model_context; in stdev_load_sound_model()
656 model_context->model_handle = generate_sound_model_handle(dev); in stdev_load_sound_model()
657 *handle = model_context->model_handle; in stdev_load_sound_model()
658 model_context->model_type = sound_model->type; in stdev_load_sound_model()
663 model_context->model_uuid = sound_model->uuid; in stdev_load_sound_model()
664 model_context->model_callback = callback; in stdev_load_sound_model()
665 model_context->model_cookie = cookie; in stdev_load_sound_model()
666 model_context->config = NULL; in stdev_load_sound_model()
667 model_context->recognition_callback = NULL; in stdev_load_sound_model()
668 model_context->recognition_cookie = NULL; in stdev_load_sound_model()
669 model_context->next = NULL; in stdev_load_sound_model()
670 model_context->model_started = false; in stdev_load_sound_model()
679 struct recognition_context *model_context = stdev->root_model_context; in unload_all_sound_models() local
682 while (model_context) { in unload_all_sound_models()
683 ALOGI("Deleting model with handle: %d", model_context->model_handle); in unload_all_sound_models()
684 struct recognition_context *temp = model_context; in unload_all_sound_models()
685 model_context = model_context->next; in unload_all_sound_models()
701 struct recognition_context *model_context = NULL; in stdev_unload_sound_model() local
707 model_context = current_model_context; in stdev_unload_sound_model()
714 if (!model_context) { in stdev_unload_sound_model()
720 previous_model_context->next = model_context->next; in stdev_unload_sound_model()
722 stdev->root_model_context = model_context->next; in stdev_unload_sound_model()
724 free(model_context->config); in stdev_unload_sound_model()
725 free(model_context); in stdev_unload_sound_model()
742 struct recognition_context *model_context = get_model_context(stdev, handle); in stdev_start_recognition() local
743 if (!model_context) { in stdev_start_recognition()
749 free(model_context->config); in stdev_start_recognition()
750 model_context->config = NULL; in stdev_start_recognition()
752 model_context->config = malloc(sizeof(*config)); in stdev_start_recognition()
753 if (!model_context->config) { in stdev_start_recognition()
757 memcpy(model_context->config, config, sizeof(*config)); in stdev_start_recognition()
759 model_context->recognition_callback = callback; in stdev_start_recognition()
760 model_context->recognition_cookie = cookie; in stdev_start_recognition()
761 model_context->model_started = true; in stdev_start_recognition()
774 struct recognition_context *model_context = get_model_context(stdev, handle); in stdev_stop_recognition() local
775 if (!model_context) { in stdev_stop_recognition()
781 free(model_context->config); in stdev_stop_recognition()
782 model_context->config = NULL; in stdev_stop_recognition()
783 model_context->recognition_callback = NULL; in stdev_stop_recognition()
784 model_context->recognition_cookie = NULL; in stdev_stop_recognition()
785 model_context->model_started = false; in stdev_stop_recognition()
798 struct recognition_context *model_context = stdev->root_model_context; in stdev_stop_all_recognitions() local
799 while (model_context) { in stdev_stop_all_recognitions()
800 free(model_context->config); in stdev_stop_all_recognitions()
801 model_context->config = NULL; in stdev_stop_all_recognitions()
802 model_context->recognition_callback = NULL; in stdev_stop_all_recognitions()
803 model_context->recognition_cookie = NULL; in stdev_stop_all_recognitions()
804 model_context->model_started = false; in stdev_stop_all_recognitions()
805 ALOGI("%s stopped handle %d", __func__, model_context->model_handle); in stdev_stop_all_recognitions()
807 model_context = model_context->next; in stdev_stop_all_recognitions()