}
}
- _mmcam_dbg_warn("failed to find tilt control channel");
+ _mmcam_dbg_warn("failed to find ptz type control channel");
}
return FALSE;
}
if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink") ||
- !strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "evasimagesink")) {
+ !strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "evasimagesink") ||
+ !strcmp(videosink_name, "directvideosink")) {
method = value->value.i_val;
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-geometry-method", method);
} else {
}
if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink") ||
- !strcmp(videosink_name, "evaspixmapsink")) {
+ !strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "directvideosink")) {
int rect_x = 0;
int rect_y = 0;
int rect_width = 0;
static int __mmcamcorder_get_amrnb_bitrate_mode(int bitrate);
static guint32 _mmcamcorder_convert_fourcc_string_to_value(const gchar* format_name);
+#ifdef _MMCAMCORDER_PRODUCT_TV
+static bool __mmcamcorder_find_max_resolution(MMHandleType handle, gint *max_width, gint *max_height);
+#endif /* _MMCAMCORDER_PRODUCT_TV */
+
/*=======================================================================================
| FUNCTION DEFINITIONS |
=======================================================================================*/
}
/* make demux and decoder for H264 stream from videosrc */
- if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+ if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264 && display_surface_type != MM_DISPLAY_SURFACE_NULL) {
int preview_bitrate = 0;
int gop_interval = 0;
const char *videodecoder_name = NULL;
_mmcam_dbg_log("(overlay=%p, size=%d)", overlay, size);
/* Set display handle */
- if (!strcmp(videosink_name, "xvimagesink") ||
- !strcmp(videosink_name, "ximagesink")) {
+ if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "ximagesink") ||
+ !strcmp(videosink_name, "directvideosink")) {
if (overlay) {
xid = *overlay;
_mmcam_dbg_log("xid = %lu )", xid);
_mmcam_dbg_err("display handle(eavs object) is NULL");
return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
}
- } else if (!strcmp(videosink_name, "tizenwlsink") || !strcmp(videosink_name, "directvideosink")) {
+ } else if (!strcmp(videosink_name, "tizenwlsink")) {
if (overlay) {
_mmcam_dbg_log("wayland global surface id : %d", *overlay);
gst_video_overlay_set_wl_window_wl_surface_id(GST_VIDEO_OVERLAY(vsink), *overlay);
gboolean do_set_caps = FALSE;
GstCaps *caps = NULL;
-#ifdef _MMCAMCORDER_PRODUCT_TV
- GstPad *sinkpad;
- GstCaps *decsink_caps = NULL;
- GstStructure *decsink_struct = NULL;
- int maxwidth = 0;
- int maxheight = 0;
-#endif /*_MMCAMCORDER_PRODUCT_TV */
mmf_camcorder_t *hcamcorder = NULL;
_MMCamcorderSubContext *sc = NULL;
if (do_set_caps) {
if (sc->info_image->preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
#ifdef _MMCAMCORDER_PRODUCT_TV
- sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst, "sink");
- if (!sinkpad) {
- _mmcam_dbg_err("There are no decoder caps");
- return FALSE;
- }
-
- decsink_caps = gst_pad_get_pad_template_caps(sinkpad);
- if (!decsink_caps) {
- gst_object_unref(sinkpad);
- _mmcam_dbg_err("There is no decoder sink caps");
- return FALSE;
- }
+ gint maxwidth = 0;
+ gint maxheight = 0;
+ int display_surface_type = MM_DISPLAY_SURFACE_NULL;
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_DISPLAY_SURFACE, &display_surface_type,
+ NULL);
- decsink_struct = gst_caps_get_structure(decsink_caps, 0);
- if (!decsink_struct) {
- _mmcam_dbg_err("There are no structure from caps");
- gst_object_unref(decsink_caps);
- gst_object_unref(sinkpad);
- return FALSE;
+ if (display_surface_type != MM_DISPLAY_SURFACE_NULL && __mmcamcorder_find_max_resolution(handle, &maxwidth, &maxheight) == false) {
+ _mmcam_dbg_err("can not find max resolution limitation");
+ return false;
+ } else if (display_surface_type == MM_DISPLAY_SURFACE_NULL) {
+ maxwidth = set_width;
+ maxheight = set_height;
}
-
- if (gst_structure_has_field(decsink_struct, "maxwidth"))
- gst_structure_get_int(decsink_struct, "maxwidth", &maxwidth);
-
- if (gst_structure_has_field(decsink_struct, "maxheight"))
- gst_structure_get_int(decsink_struct, "maxheight", &maxheight);
#endif /* _MMCAMCORDER_PRODUCT_TV */
-
caps = gst_caps_new_simple("video/x-h264",
"width", G_TYPE_INT, set_width,
"height", G_TYPE_INT, set_height,
"alignment", G_TYPE_STRING, "au",
#endif /* _MMCAMCORDER_PRODUCT_TV */
NULL);
-
-#ifdef _MMCAMCORDER_PRODUCT_TV
- gst_object_unref(decsink_caps);
- gst_object_unref(sinkpad);
-#endif /* _MMCAMCORDER_PRODUCT_TV */
} else {
char fourcc_string[sizeof(fourcc)+1];
strncpy(fourcc_string, (char*)&fourcc, sizeof(fourcc));
return TRUE;
}
+
+#ifdef _MMCAMCORDER_PRODUCT_TV
+static bool __mmcamcorder_find_max_resolution(MMHandleType handle, gint *max_width, gint *max_height)
+{
+ _MMCamcorderSubContext *sc = NULL;
+ mmf_camcorder_t *hcamcorder = NULL;
+ int index = 0;
+ const gchar *mime = NULL;
+ GstPad *sinkpad;
+ GstCaps *decsink_caps = NULL;
+ GstStructure *decsink_struct = NULL;
+
+ mmf_return_val_if_fail(handle, false);
+ mmf_return_val_if_fail(max_width, false);
+ mmf_return_val_if_fail(max_height, false);
+
+ hcamcorder = MMF_CAMCORDER(handle);
+ mmf_return_val_if_fail(hcamcorder, false);
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
+
+ sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_DECODE].gst, "sink");
+ if (!sinkpad) {
+ _mmcam_dbg_err("There are no decoder caps");
+ return false;
+ }
+
+ decsink_caps = gst_pad_get_pad_template_caps(sinkpad);
+ if (!decsink_caps) {
+ gst_object_unref(sinkpad);
+ _mmcam_dbg_err("There is no decoder sink caps");
+ return false;
+ }
+
+ for (index = 0; index < gst_caps_get_size(decsink_caps); index++) {
+ decsink_struct = gst_caps_get_structure(decsink_caps, index);
+ if (!decsink_struct) {
+ _mmcam_dbg_err("There are no structure from caps");
+ gst_object_unref(decsink_caps);
+ gst_object_unref(sinkpad);
+ return false;
+ }
+ mime = gst_structure_get_name(decsink_struct);
+ if (!strcmp(mime, "video/x-h264")) {
+ _mmcam_dbg_log("h264 caps structure found");
+ if (gst_structure_has_field(decsink_struct, "maxwidth"))
+ *max_width = gst_value_get_int_range_max(gst_structure_get_value(decsink_struct, "maxwidth"));
+ if (gst_structure_has_field(decsink_struct, "maxheight"))
+ *max_height = gst_value_get_int_range_max(gst_structure_get_value(decsink_struct, "maxheight"));
+ break;
+ }
+ }
+ _mmcam_dbg_log("maxwidth = %d , maxheight = %d", (int)*max_width, (int)*max_height);
+ gst_object_unref(decsink_caps);
+ gst_object_unref(sinkpad);
+
+ if (*max_width <= 0 || *max_height <= 0)
+ return false;
+
+ return true;
+}
+#endif /* _MMCAMCORDER_PRODUCT_TV */
#endif /* _MMCAMCORDER_MM_RM_SUPPORT */
#ifdef _MMCAMCORDER_RM_SUPPORT
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CLIENT_PID, &app_pid,
- NULL);
- rci.app_pid = app_pid;
- aul_app_get_appid_bypid(rci.app_pid, rci.app_id, sizeof(rci.app_id));
-
- /* RM register */
- if (hcamcorder->rm_handle == 0) {
- iret = rm_register((rm_resource_cb)_mmcamcorder_rm_callback, (void*)hcamcorder, &(hcamcorder->rm_handle), &rci);
- if (iret != RM_OK) {
- _mmcam_dbg_err("rm_register fail");
- ret = MM_ERROR_RESOURCE_INTERNAL;
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ if (display_surface_type != MM_DISPLAY_SURFACE_NULL) {
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_CLIENT_PID, &app_pid,
+ NULL);
+ rci.app_pid = app_pid;
+ aul_app_get_appid_bypid(rci.app_pid, rci.app_id, sizeof(rci.app_id));
+
+ /* RM register */
+ if (hcamcorder->rm_handle == 0) {
+ iret = rm_register((rm_resource_cb)_mmcamcorder_rm_callback, (void*)hcamcorder, &(hcamcorder->rm_handle), &rci);
+ if (iret != RM_OK) {
+ _mmcam_dbg_err("rm_register fail");
+ ret = MM_ERROR_RESOURCE_INTERNAL;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ }
}
- }
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CAMERA_FORMAT, &preview_format,
- NULL);
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_CAMERA_FORMAT, &preview_format,
+ NULL);
- resource_count = 0;
- memset(&hcamcorder->request_resources, 0x0, sizeof(rm_category_request_s));
- memset(&hcamcorder->returned_devices, 0x0, sizeof(rm_device_return_s));
+ resource_count = 0;
+ memset(&hcamcorder->request_resources, 0x0, sizeof(rm_category_request_s));
+ memset(&hcamcorder->returned_devices, 0x0, sizeof(rm_device_return_s));
- if (preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
- hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
- hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_VIDEO_DECODER;
+ if (preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+ hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
+ hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_VIDEO_DECODER;
- _mmcam_dbg_log("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER);
+ _mmcam_dbg_log("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER);
- resource_count++;
- }
+ resource_count++;
+ }
- if (display_surface_type == MM_DISPLAY_SURFACE_OVERLAY) {
- hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
- hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER;
+ if (display_surface_type == MM_DISPLAY_SURFACE_OVERLAY) {
+ hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
+ hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER;
- _mmcam_dbg_log("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER);
+ _mmcam_dbg_log("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER);
- resource_count++;
- }
+ resource_count++;
+ }
- hcamcorder->request_resources.request_num = resource_count;
+ hcamcorder->request_resources.request_num = resource_count;
- if (resource_count > 0) {
- qret = rm_query(hcamcorder->rm_handle, RM_QUERY_ALLOCATION, &(hcamcorder->request_resources), &qret_avail);
- if (qret != RM_OK || qret_avail != 1) {
- _mmcam_dbg_log("rm query failed. retry with sub devices");
+ if (resource_count > 0) {
+ qret = rm_query(hcamcorder->rm_handle, RM_QUERY_ALLOCATION, &(hcamcorder->request_resources), &qret_avail);
+ if (qret != RM_OK || qret_avail != 1) {
+ _mmcam_dbg_log("rm query failed. retry with sub devices");
- resource_count = 0;
+ resource_count = 0;
- if (preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
- hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_VIDEO_DECODER_SUB;
- _mmcam_dbg_log("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER_SUB);
- resource_count++;
- }
+ if (preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+ hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_VIDEO_DECODER_SUB;
+ _mmcam_dbg_log("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER_SUB);
+ resource_count++;
+ }
- if (display_surface_type == MM_DISPLAY_SURFACE_OVERLAY) {
- hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER_SUB;
- _mmcam_dbg_log("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER_SUB);
- resource_count++;
+ if (display_surface_type == MM_DISPLAY_SURFACE_OVERLAY) {
+ hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER_SUB;
+ _mmcam_dbg_log("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER_SUB);
+ resource_count++;
+ }
}
}
- }
- hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
- hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_CAMERA;
+ hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
+ hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_CAMERA;
- hcamcorder->request_resources.request_num = resource_count + 1;
- _mmcam_dbg_log("request camera rsc - category 0x%x", RM_CATEGORY_CAMERA);
+ hcamcorder->request_resources.request_num = resource_count + 1;
+ _mmcam_dbg_log("request camera rsc - category 0x%x", RM_CATEGORY_CAMERA);
- iret = rm_allocate_resources(hcamcorder->rm_handle, &(hcamcorder->request_resources), &hcamcorder->returned_devices);
- if (iret != RM_OK) {
- _mmcam_dbg_err("Resource allocation request failed");
- ret = MM_ERROR_RESOURCE_INTERNAL;
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ iret = rm_allocate_resources(hcamcorder->rm_handle, &(hcamcorder->request_resources), &hcamcorder->returned_devices);
+ if (iret != RM_OK) {
+ _mmcam_dbg_err("Resource allocation request failed");
+ ret = MM_ERROR_RESOURCE_INTERNAL;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ }
}
#endif /* _MMCAMCORDER_RM_SUPPORT */
}