4 * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Sejong Park <sejong123.park@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 /*===========================================================================================
26 ========================================================================================== */
29 #include <gst/app/gstappsrc.h>
30 #include <gst/video/videooverlay.h>
32 #include <gst/wayland/wayland.h>
43 #include "mm_camcorder_mused.h"
44 #include "mm_camcorder_internal.h"
47 #define MMCAMCORDER_MAX_INT (2147483647)
49 #define MMCAMCORDER_FREEIF(x) \
56 MM_CAM_MUSED_DISPLAY_SHM_SOCKET_PATH,
57 MM_CAM_MUSED_DISPLAY_HANDLE,
58 MM_CAM_MUSED_DISPLAY_SURFACE,
59 MM_CAM_MUSED_CLIENT_ATTRIBUTE_NUM
60 }MMCamcorderMusedAttrsID;
63 _mmcamcorder_mused_alloc_attribute(MMHandleType handle)
67 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
68 MMHandleType attrs = 0;
69 mmf_attrs_construct_info_t *attrs_const_info = NULL;
70 unsigned int attr_count = 0;
73 if (hcamcorder == NULL) {
74 _mmcam_dbg_err("handle is NULL");
78 /* Create attribute constructor */
79 _mmcam_dbg_log("start");
81 /* alloc 'mmf_attrs_construct_info_t' */
82 attr_count = MM_CAM_MUSED_CLIENT_ATTRIBUTE_NUM;
83 attrs_const_info = malloc(attr_count * sizeof(mmf_attrs_construct_info_t));
84 if (!attrs_const_info) {
85 _mmcam_dbg_err("Fail to alloc constructor.");
89 /* alloc default attribute info */
90 hcamcorder->cam_attrs_const_info = (mm_cam_attr_construct_info *)malloc(sizeof(mm_cam_attr_construct_info) * attr_count);
91 if (hcamcorder->cam_attrs_const_info == NULL) {
92 _mmcam_dbg_err("failed to alloc default attribute info");
93 free(attrs_const_info);
94 attrs_const_info = NULL;
98 /* basic attributes' info */
99 mm_cam_attr_construct_info temp_info[] = {
101 MM_CAM_MUSED_DISPLAY_SHM_SOCKET_PATH,
102 "mused-display-shm-socket-path",
103 MMF_VALUE_TYPE_STRING,
106 MM_ATTRS_VALID_TYPE_NONE,
112 MM_CAM_MUSED_DISPLAY_HANDLE,
113 "mused-display-handle",
117 MM_ATTRS_VALID_TYPE_NONE,
123 MM_CAM_MUSED_DISPLAY_SURFACE,
124 "mused-display-surface",
127 {(void*)MM_DISPLAY_SURFACE_X},
128 MM_ATTRS_VALID_TYPE_INT_RANGE,
129 MM_DISPLAY_SURFACE_X,
130 MM_DISPLAY_SURFACE_X_EXT,
135 memcpy(hcamcorder->cam_attrs_const_info, temp_info, sizeof(mm_cam_attr_construct_info) * attr_count);
137 for (idx = 0 ; idx < attr_count ; idx++) {
138 /* attribute order check. This should be same. */
139 if (idx != hcamcorder->cam_attrs_const_info[idx].attrid) {
140 _mmcam_dbg_err("Please check attributes order. Is the idx same with enum val?");
141 free(attrs_const_info);
142 attrs_const_info = NULL;
143 free(hcamcorder->cam_attrs_const_info);
144 hcamcorder->cam_attrs_const_info = NULL;
148 attrs_const_info[idx].name = hcamcorder->cam_attrs_const_info[idx].name;
149 attrs_const_info[idx].value_type = hcamcorder->cam_attrs_const_info[idx].value_type;
150 attrs_const_info[idx].flags = hcamcorder->cam_attrs_const_info[idx].flags;
151 attrs_const_info[idx].default_value = hcamcorder->cam_attrs_const_info[idx].default_value.value_void;
154 /* Camcorder Attributes */
155 _mmcam_dbg_log("Create Camcorder Attributes[%p, %d]", attrs_const_info, attr_count);
157 attrs = mmf_attrs_new_from_data("Camcorder_Mused_Attributes",
160 _mmcamcorder_commit_camcorder_attrs,
163 free(attrs_const_info);
164 attrs_const_info = NULL;
167 _mmcam_dbg_err("Fail to alloc attribute handle");
168 free(hcamcorder->cam_attrs_const_info);
169 hcamcorder->cam_attrs_const_info = NULL;
173 for (idx = 0; idx < attr_count; idx++)
175 _mmcam_dbg_log("Valid type [%s]", hcamcorder->cam_attrs_const_info[idx].name);
177 mmf_attrs_set_valid_type (attrs, idx, hcamcorder->cam_attrs_const_info[idx].validity_type);
179 switch (hcamcorder->cam_attrs_const_info[idx].validity_type)
181 case MM_ATTRS_VALID_TYPE_INT_ARRAY:
182 if (hcamcorder->cam_attrs_const_info[idx].validity_value_1.int_array &&
183 hcamcorder->cam_attrs_const_info[idx].validity_value_2.count > 0) {
184 mmf_attrs_set_valid_array(attrs, idx,
185 (const int *)(hcamcorder->cam_attrs_const_info[idx].validity_value_1.int_array),
186 hcamcorder->cam_attrs_const_info[idx].validity_value_2.count,
187 hcamcorder->cam_attrs_const_info[idx].default_value.value_int);
190 case MM_ATTRS_VALID_TYPE_INT_RANGE:
191 _mmcam_dbg_err("MM_ATTRS_VALID_TYPE_INT_RANGE");
192 mmf_attrs_set_valid_range(attrs, idx,
193 hcamcorder->cam_attrs_const_info[idx].validity_value_1.int_min,
194 hcamcorder->cam_attrs_const_info[idx].validity_value_2.int_max,
195 hcamcorder->cam_attrs_const_info[idx].default_value.value_int);
197 case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
198 if (hcamcorder->cam_attrs_const_info[idx].validity_value_1.double_array &&
199 hcamcorder->cam_attrs_const_info[idx].validity_value_2.count > 0) {
200 mmf_attrs_set_valid_double_array(attrs, idx,
201 (const double *)(hcamcorder->cam_attrs_const_info[idx].validity_value_1.double_array),
202 hcamcorder->cam_attrs_const_info[idx].validity_value_2.count,
203 hcamcorder->cam_attrs_const_info[idx].default_value.value_double);
206 case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE:
207 mmf_attrs_set_valid_double_range(attrs, idx,
208 hcamcorder->cam_attrs_const_info[idx].validity_value_1.double_min,
209 hcamcorder->cam_attrs_const_info[idx].validity_value_2.double_max,
210 hcamcorder->cam_attrs_const_info[idx].default_value.value_double);
212 case MM_ATTRS_VALID_TYPE_NONE:
214 case MM_ATTRS_VALID_TYPE_INVALID:
216 _mmcam_dbg_err("Valid type error.");
224 int mm_camcorder_mused_create(MMHandleType *handle)
226 int ret = MM_ERROR_NONE;
228 int rcmd_fmt_capture = MM_PIXEL_FORMAT_YUYV;
229 int rcmd_fmt_recording = MM_PIXEL_FORMAT_NV12;
230 int rcmd_dpy_rotation = MM_DISPLAY_ROTATION_270;
231 int play_capture_sound = TRUE;
232 int camera_device_count = MM_VIDEO_DEVICE_NUM;
233 int camera_facing_direction = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR;
234 int resource_fd = -1;
235 char *err_attr_name = NULL;
236 const char *ConfCtrlFile = NULL;
237 mmf_camcorder_t *hcamcorder = NULL;
238 type_element *EvasSurfaceElement = NULL;
240 _mmcam_dbg_log("Enter");
242 mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
244 /* Create mmf_camcorder_t handle and initialize every variable */
245 hcamcorder = (mmf_camcorder_t *)malloc(sizeof(mmf_camcorder_t));
246 mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_LOW_MEMORY);
247 memset(hcamcorder, 0x00, sizeof(mmf_camcorder_t));
250 hcamcorder->type = 0;
251 hcamcorder->state = MM_CAMCORDER_STATE_NONE;
252 hcamcorder->sub_context = NULL;
253 hcamcorder->target_state = MM_CAMCORDER_STATE_NULL;
254 hcamcorder->capture_in_recording = FALSE;
256 pthread_mutex_init(&((hcamcorder->mtsafe).lock), NULL);
257 pthread_cond_init(&((hcamcorder->mtsafe).cond), NULL);
258 pthread_mutex_init(&((hcamcorder->mtsafe).cmd_lock), NULL);
259 pthread_mutex_init(&((hcamcorder->mtsafe).state_lock), NULL);
260 pthread_mutex_init(&((hcamcorder->mtsafe).gst_state_lock), NULL);
261 pthread_mutex_init(&((hcamcorder->mtsafe).message_cb_lock), NULL);
262 pthread_mutex_init(&(hcamcorder->restart_preview_lock), NULL);
264 /* Get Camera Configure information from Camcorder INI file */
265 _mmcamcorder_conf_get_info((MMHandleType)hcamcorder, CONFIGURE_TYPE_MAIN, CONFIGURE_MAIN_FILE, &hcamcorder->conf_main);
267 if (!(hcamcorder->conf_main)) {
268 _mmcam_dbg_err( "Failed to get configure(main) info." );
270 ret = MM_ERROR_CAMCORDER_CREATE_CONFIGURE;
271 goto _ERR_AFTER_ASM_REGISTER;
273 _mmcam_dbg_log("aloc attribute handle : 0x%x", (MMHandleType)hcamcorder);
274 hcamcorder->attributes = _mmcamcorder_mused_alloc_attribute((MMHandleType)hcamcorder);
275 if (!(hcamcorder->attributes)) {
276 _mmcam_dbg_err("_mmcamcorder_create::alloc attribute error.");
278 ret = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
279 goto _ERR_AFTER_ASM_REGISTER;
282 /* Set initial state */
283 _mmcamcorder_set_state((MMHandleType)hcamcorder, MM_CAMCORDER_STATE_NULL);
285 _mmcam_dbg_log("created handle %p", hcamcorder);
287 *handle = (MMHandleType)hcamcorder;
288 _mmcam_dbg_log("created client handle : 0x%x", *handle);
290 return MM_ERROR_NONE;
292 _ERR_AFTER_ASM_REGISTER:
294 _ERR_DEFAULT_VALUE_INIT:
295 /* Release lock, cond */
296 pthread_mutex_destroy(&((hcamcorder->mtsafe).lock));
297 pthread_cond_destroy(&((hcamcorder->mtsafe).cond));
298 pthread_mutex_destroy(&((hcamcorder->mtsafe).cmd_lock));
299 pthread_mutex_destroy(&((hcamcorder->mtsafe).state_lock));
300 pthread_mutex_destroy(&((hcamcorder->mtsafe).gst_state_lock));
301 pthread_mutex_destroy(&((hcamcorder->mtsafe).gst_encode_state_lock));
302 pthread_mutex_destroy(&((hcamcorder->mtsafe).message_cb_lock));
304 pthread_mutex_destroy(&(hcamcorder->restart_preview_lock));
306 if (hcamcorder->conf_ctrl) {
307 _mmcamcorder_conf_release_info(handle, &hcamcorder->conf_ctrl);
310 if (hcamcorder->conf_main) {
311 _mmcamcorder_conf_release_info(handle, &hcamcorder->conf_main);
315 memset(hcamcorder, 0x00, sizeof(mmf_camcorder_t));
321 int _mmcamcorder_mused_videosink_window_set(MMHandleType handle)
323 int err = MM_ERROR_NONE;
325 char *err_name = NULL;
326 const char *videosink_name = NULL;
329 GstElement *vsink = NULL;
330 MMCamWaylandInfo *wl_info = NULL;
332 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
333 _MMCamcorderSubContext *sc = NULL;
335 _mmcam_dbg_log("Enter");
337 mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
339 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
340 mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
341 mmf_return_val_if_fail(sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
342 mmf_return_val_if_fail(sc->element[_MMCAMCORDER_CLIENT_VIDEOSINK_SINK].gst, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
344 vsink = sc->element[_MMCAMCORDER_CLIENT_VIDEOSINK_SINK].gst;
346 /* Get video display information */
347 err = mm_camcorder_get_attributes(handle, &err_name,
348 MMCAM_MUSED_DISPLAY_HANDLE, (void**)&overlay, &size,
350 if (err != MM_ERROR_NONE) {
352 _mmcam_dbg_err("failed to get attributes [%s][0x%x]", err_name, err);
356 _mmcam_dbg_err("failed to get attributes [0x%x]", err);
361 wl_info = (MMCamWaylandInfo *)overlay;
363 GstContext *context = NULL;
365 context = gst_wayland_display_handle_context_new((struct wl_display *)wl_info->display);
367 gst_element_set_context(vsink, context);
369 _mmcam_dbg_warn("gst_wayland_display_handle_context_new failed");
372 gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(vsink), (guintptr)wl_info->surface);
373 gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(vsink),
376 wl_info->window_width,
377 wl_info->window_height);
380 _mmcam_dbg_err("Display Handle is invalid");
383 return MM_ERROR_NONE;
386 void __mmcamcorder_mused_gst_destroy_pipeline(MMHandleType handle)
388 _MMCamcorderSubContext *sc;
389 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
391 _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_CLIENT_VIDEOSRC_SRC);
392 _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_CLIENT_VIDEOSINK_SINK);
393 _MMCAMCORDER_ELEMENT_REMOVE(sc->element, _MMCAMCORDER_CLIENT_MAIN_PIPE);
397 void mm_camcorder_mused_destroy(MMHandleType handle)
399 int result = MM_ERROR_NONE;
400 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
402 _MMCAMCORDER_TRYLOCK_CMD(hcamcorder);
404 __mmcamcorder_mused_gst_destroy_pipeline(handle);
405 _mmcamcorder_dealloc_attribute(handle, hcamcorder->attributes);
408 _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
414 int mm_camcorder_mused_realize(MMHandleType handle, char *caps)
416 int result = MM_ERROR_NONE;
418 result = _mmcamcorder_mused_realize(handle, caps);
423 int _mmcamcorder_mused_realize(MMHandleType handle, char *string_caps)
425 int ret = MM_ERROR_NONE;
430 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
431 MMHandleType attrs = hcamcorder->attributes;
435 char *socket_path = NULL;
436 int socket_path_length;
438 int surface_type = 0;
439 gchar *videosink_element = NULL;
440 gchar *videosrc_element = NULL;
442 int state = MM_CAMCORDER_STATE_NONE;
443 int state_FROM = MM_CAMCORDER_STATE_NULL;
444 int state_TO = MM_CAMCORDER_STATE_READY;
445 int vconf_camera_state = 0;
446 _MMCamcorderSubContext *sc;
447 GList *element_list = NULL;
448 GstElement *pipeline = NULL;
451 _mmcam_dbg_err("Enter");
453 if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) {
454 _mmcam_dbg_err("Another command is running.");
455 ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
456 goto _ERR_CAMCORDER_CMD_PRECON;
459 state = _mmcamcorder_get_state(handle);
460 if (state != state_FROM) {
461 _mmcam_dbg_err("Wrong state(%d)", state);
462 ret = MM_ERROR_CAMCORDER_INVALID_STATE;
463 goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
466 /* alloc sub context */
467 hcamcorder->sub_context = _mmcamcorder_alloc_subcontext(hcamcorder->type);
468 if(!hcamcorder->sub_context) {
469 ret = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
470 goto _ERR_CAMCORDER_CMD;
473 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
475 /* create pipeline */
476 _MMCAMCORDER_PIPELINE_MAKE(sc, sc->element, _MMCAMCORDER_CLIENT_MAIN_PIPE, "camera_client", ret);
479 _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_CLIENT_VIDEOSRC_SRC, "shmsrc", "shmsrc", element_list, ret);
481 mm_camcorder_get_attributes(handle, NULL,
482 MMCAM_MUSED_DISPLAY_SHM_SOCKET_PATH, &socket_path, &socket_path_length,
485 g_object_set(sc->element[_MMCAMCORDER_CLIENT_VIDEOSRC_SRC].gst,
486 "socket-path", socket_path,
491 _MMCAMCORDER_ELEMENT_MAKE(sc, sc->element, _MMCAMCORDER_CLIENT_VIDEOSINK_SINK, "waylandsink", "waylandsink", element_list, ret);
493 g_object_set(sc->element[_MMCAMCORDER_CLIENT_VIDEOSINK_SINK].gst,
495 "force-aspect-ratio", 1,
496 "enable-last-sample",0,
499 "show-preroll-frame",0,
502 if (_mmcamcorder_mused_videosink_window_set(handle) != MM_ERROR_NONE) {
503 _mmcam_dbg_err("_mmcamcorder_videosink_window_set error");
504 ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
505 goto pipeline_creation_error;
508 /* add elements to main pipeline */
509 if (!_mmcamcorder_add_elements_to_bin(GST_BIN(sc->element[_MMCAMCORDER_CLIENT_MAIN_PIPE].gst), element_list)) {
510 _mmcam_dbg_err("element_list add error.");
511 ret = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
512 goto pipeline_creation_error;
515 caps = gst_caps_from_string(string_caps);
517 if (!_mmcamcorder_filtered_link_elements(element_list, caps)) {
518 _mmcam_dbg_err( "element link error." );
519 ret = MM_ERROR_CAMCORDER_GST_LINK;
520 goto pipeline_creation_error;
523 pipeline = sc->element[_MMCAMCORDER_CLIENT_MAIN_PIPE].gst;
525 ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY);
526 if (ret != MM_ERROR_NONE) {
527 _mmcam_dbg_err("error : destroy pipeline");
528 _mmcamcorder_destroy_pipeline(handle, hcamcorder->type);
531 ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PAUSED);
532 if (ret != MM_ERROR_NONE) {
533 _mmcam_dbg_err("error : destroy pipeline");
534 _mmcamcorder_destroy_pipeline(handle, hcamcorder->type);
537 ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
538 if (ret != MM_ERROR_NONE) {
539 _mmcam_dbg_err("error : destroy pipeline");
540 _mmcamcorder_destroy_pipeline(handle, hcamcorder->type);
543 /* set command function */
544 _mmcamcorder_set_state(handle, state_TO);
545 pipeline_creation_error:
547 _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
548 _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
549 _ERR_CAMCORDER_CMD_PRECON:
553 int _mmcamcorder_mused_unrealize(MMHandleType handle)
555 int ret = MM_ERROR_NONE;
556 int state = MM_CAMCORDER_STATE_NONE;
557 int state_FROM = MM_CAMCORDER_STATE_READY;
558 int state_TO = MM_CAMCORDER_STATE_NULL;
560 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
565 _mmcam_dbg_err("Not initialized");
566 ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED;
570 if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) {
571 _mmcam_dbg_err("Another command is running.");
572 ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
573 goto _ERR_CAMCORDER_CMD_PRECON;
576 state = _mmcamcorder_get_state(handle);
577 if (state != state_FROM) {
578 _mmcam_dbg_err("Wrong state(%d)", state);
579 ret = MM_ERROR_CAMCORDER_INVALID_STATE;
580 goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
583 /* Release SubContext */
584 if (hcamcorder->sub_context) {
585 /* destroy pipeline */
586 __mmcamcorder_mused_gst_destroy_pipeline(handle);
587 /* Deallocate SubContext */
588 _mmcamcorder_dealloc_subcontext(hcamcorder->sub_context);
589 hcamcorder->sub_context = NULL;
592 /* Deinitialize main context member */
593 hcamcorder->command = NULL;
595 _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
597 _mmcamcorder_set_state(handle, state_TO);
599 return MM_ERROR_NONE;
601 _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
602 _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
604 _ERR_CAMCORDER_CMD_PRECON:
606 _mmcam_dbg_err("Unrealize fail (type %d, state %d, ret %x)",
607 hcamcorder->type, state, ret);
612 int mm_camcorder_mused_unrealize(MMHandleType handle)
614 int ret = MM_ERROR_NONE;
616 ret = _mmcamcorder_mused_unrealize(handle);
621 static int _mmcamcorder_get_video_caps(MMHandleType handle, char **caps)
623 int ret = MM_ERROR_NONE;
625 GstCaps *sink_caps = NULL;
627 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
628 _MMCamcorderSubContext *sc = NULL;
630 if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) {
631 _mmcam_dbg_err("Another command is running.");
632 return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
635 sc = MMF_CAMCORDER_SUBCONTEXT(handle);
636 _mmcam_dbg_log("Entered ");
637 pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_CLIENT_VIDEOSINK_SINK].gst, "sink");
639 _mmcam_dbg_err("static pad is NULL");
640 _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
641 return MM_ERROR_CAMCORDER_INVALID_STATE;
644 sink_caps = gst_pad_get_current_caps(pad);
645 gst_object_unref( pad );
647 _mmcam_dbg_err("fail to get caps");
648 _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
649 return MM_ERROR_CAMCORDER_INVALID_STATE;
652 *caps = gst_caps_to_string(sink_caps);
653 _mmcam_dbg_err("video caps : %s", *caps);
654 gst_caps_unref(sink_caps);
656 _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
658 return MM_ERROR_NONE;
661 int mm_camcorder_mused_get_video_caps(MMHandleType handle, char **caps)
663 return _mmcamcorder_get_video_caps(handle, caps);
666 static int _mmcamcorder_mused_set_shm_socket_path(MMHandleType handle, const char *path)
668 int ret = MM_ERROR_NONE;
669 mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
670 _mmcam_dbg_log("aloc attribute handle : 0x%x, path:%s", handle, path);
672 _MMCAMCORDER_TRYLOCK_CMD(hcamcorder);
674 mm_camcorder_set_attributes(handle, NULL,
675 MMCAM_MUSED_DISPLAY_SHM_SOCKET_PATH, path, strlen(path),
678 _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
684 * Server and client both use functions
686 int mm_camcorder_mused_set_shm_socket_path(MMHandleType handle, const char *path)
688 int result = MM_ERROR_NONE;
690 _mmcam_dbg_log("Entered ");
691 result = _mmcamcorder_mused_set_shm_socket_path(handle, path);