From: Jeongmo Yang Date: Mon, 5 Apr 2021 06:57:40 +0000 (+0900) Subject: camera_test: Add menu for media packet preview callback X-Git-Tag: accepted/tizen/unified/20210406.083555^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86613096d4e9cc7d30d7cc8074f0d7a7a01ef8a7;p=platform%2Fcore%2Fapi%2Fcamera.git camera_test: Add menu for media packet preview callback [Version] 0.4.50 [Issue Type] Test Change-Id: Ie54f3a0a3c409de4bf4d764ae00e8508289e0010 Signed-off-by: Jeongmo Yang --- diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index a630686..46eefa0 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.4.49 +Version: 0.4.50 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/test/camera_test.c b/test/camera_test.c index d850519..e311c35 100644 --- a/test/camera_test.c +++ b/test/camera_test.c @@ -551,6 +551,33 @@ void _camera_preview_cb(camera_preview_data_s *frame, void *user_data) } +static void _camera_media_packet_preview_cb(media_packet_h pkt, void *user_data) +{ + int ret = 0; + int width = 0; + int height = 0; + media_format_h fmt = NULL; + media_format_mimetype_e type = MEDIA_FORMAT_I420; + + ret = media_packet_get_format(pkt, &fmt); + if (ret != MEDIA_PACKET_ERROR_NONE) { + g_print("get media format failed[0x%x]", ret); + goto _MEDIA_PACKET_PREVIEW_CB_OUT; + } + + ret = media_format_get_video_info(fmt, &type, &width, &height, NULL, NULL); + if (ret != MEDIA_FORMAT_ERROR_NONE) { + g_print("get video info failed[0x%x]", ret); + goto _MEDIA_PACKET_PREVIEW_CB_OUT; + } + + g_print("==== media_packet_preview_cb[mimetype:0x%x, %dx%d]\n", type, width, height); + +_MEDIA_PACKET_PREVIEW_CB_OUT: + media_packet_unref(pkt); +} + + static bool preview_resolution_cb(int width, int height, void *user_data) { resolution_stack *data = (resolution_stack *)user_data; @@ -744,8 +771,10 @@ static void print_menu() g_print("\t '2' Multishot test\n"); g_print("\t '3' Setting\n"); g_print("\t '4' Change device (CAMERA0 <-> CAMERA1)\n"); - g_print("\t '5' Add preview callback\n"); - g_print("\t '6' Remove preview callback\n"); + g_print("\t '5' Set preview callback\n"); + g_print("\t '6' Unset preview callback\n"); + g_print("\t '7' Set media packet preview callback\n"); + g_print("\t '8' Unset media packet preview callback\n"); g_print("\t 'b' back\n"); g_print("\t=======================================\n"); break; @@ -887,6 +916,12 @@ static void main_menu(gchar buf) case '6': camera_unset_preview_cb(hcamcorder->camera); break; + case '7': + camera_set_media_packet_preview_cb(hcamcorder->camera, _camera_media_packet_preview_cb, hcamcorder->camera); + break; + case '8': + camera_unset_media_packet_preview_cb(hcamcorder->camera); + break; case 'b': /* back */ camera_stop_preview(hcamcorder->camera); camera_destroy(hcamcorder->camera);