diff options
-rw-r--r-- | packaging/capi-media-camera.spec | 2 | ||||
-rw-r--r-- | src/camera.c | 10 | ||||
-rw-r--r-- | test/camera_test.c | 4 |
3 files changed, 15 insertions, 1 deletions
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 4eb1ca4..85f05b0 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -1,6 +1,6 @@ Name: capi-media-camera Summary: A Camera API -Version: 0.2.88 +Version: 0.2.89 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera.c b/src/camera.c index 8919206..088d4e6 100644 --- a/src/camera.c +++ b/src/camera.c @@ -2578,6 +2578,7 @@ ErrorExit: int camera_change_device(camera_h camera, camera_device_e device) { + int i = 0; int ret = CAMERA_ERROR_NONE; muse_camera_api_e api = MUSE_CAMERA_API_CHANGE_DEVICE; camera_cli_s *pc = (camera_cli_s *)camera; @@ -2592,6 +2593,15 @@ int camera_change_device(camera_h camera, camera_device_e device) _camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT); + if (ret == CAMERA_ERROR_NONE) { + /* reset callback and user data */ + for (i = 0 ; i < MUSE_CAMERA_EVENT_TYPE_NUM ; i++) { + pc->cb_info->user_cb[i] = NULL; + pc->cb_info->user_data[i] = NULL; + } + UNSET_PREVIEW_CB_TYPE(pc->cb_info, PREVIEW_CB_TYPE_USER); + } + return ret; } diff --git a/test/camera_test.c b/test/camera_test.c index e2ae643..88211eb 100644 --- a/test/camera_test.c +++ b/test/camera_test.c @@ -795,6 +795,10 @@ static void main_menu(gchar buf) camera_change_device(hcamcorder->camera, hcamcorder->type); + camera_set_error_cb(hcamcorder->camera, _camera_error_cb, NULL); + camera_set_state_changed_cb(hcamcorder->camera, _camera_state_changed_cb, NULL); + camera_set_interrupted_cb(hcamcorder->camera, _camera_interrupted_cb, NULL); + camera_set_display_mode(hcamcorder->camera, CAMERA_DISPLAY_MODE_LETTER_BOX); camera_start_preview(hcamcorder->camera); |