static int __mmcamcorder_get_amrnb_bitrate_mode(int bitrate);
static guint32 _mmcamcorder_get_structure_fourcc(const GstStructure *structure);
-#ifdef _MMCAMCORDER_PRODUCT_TV
-static bool __mmcamcorder_find_max_resolution(MMHandleType handle, gint *max_width, gint *max_height);
-#endif /* _MMCAMCORDER_PRODUCT_TV */
static gboolean __mmcamcorder_set_stream_data(MMCamcorderVideoStreamDataType *stream, GstBuffer *buffer, GstMapInfo *map_info);
static gboolean __mmcamcorder_set_stream_data_zero_copy(MMCamcorderVideoStreamDataType *stream, GstBuffer *buffer, GstMemory *memory);
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
- type_element *VideosrcElement = NULL;
+ type_element *videosrc_element = NULL;
type_int_array *input_index = NULL;
mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
/* Get fourcc from picture format */
sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codectype, hcamcorder->use_zero_copy_format);
- /* Get videosrc element and its name from configure */
- _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
- "VideosrcElement",
- &VideosrcElement);
- _mmcamcorder_conf_get_value_element_name(VideosrcElement, &videosrc_name);
+ _mmcamcorder_conf_get_element_and_name((MMHandleType)hcamcorder,
+ CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT, "VideosrcElement",
+ &videosrc_element, &videosrc_name);
/**
* Create child element
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", fps);
/* Set basic information of videosrc element */
- _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, VideosrcElement);
+ _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, videosrc_element);
/* Set video device index */
if (hcamcorder->is_network) {
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_MMCamcorderSubContext *sc = NULL;
_MMCamcorderGstElement *last_element = NULL;
- type_element *AudiosrcElement = NULL;
+ type_element *audiosrc_element = NULL;
mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
goto pipeline_creation_error;
}
- _mmcamcorder_conf_get_element(handle, hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT,
- cat_name,
- &AudiosrcElement);
- _mmcamcorder_conf_get_value_element_name(AudiosrcElement, &audiosrc_name);
+ _mmcamcorder_conf_get_element_and_name((MMHandleType)hcamcorder,
+ CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT, cat_name,
+ &audiosrc_element, &audiosrc_name);
free(cat_name);
cat_name = NULL;
_mmcamcorder_set_sound_stream_info(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, stream_type, stream_index);
/* set audiosrc properties in ini configuration */
- _mmcamcorder_conf_set_value_element_property(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, AudiosrcElement);
+ _mmcamcorder_conf_set_value_element_property(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, audiosrc_element);
/* set block size */
_mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
gst_object_unref(bus);
bus = NULL;
+ /* capture mode */
+ err = _mmcamcorder_initialize_capture_mode(handle);
+ if (err != MM_ERROR_NONE) {
+ MMCAM_LOG_ERROR("initialize capture mode[%d] failed", hcamcorder->capture_mode);
+ goto pipeline_creation_error;
+ }
+
+ /* extra preview mode */
+ err = _mmcamcorder_initialize_extra_preview_mode(handle);
+ if (err != MM_ERROR_NONE) {
+ MMCAM_LOG_ERROR("initialize extra preview mode[%d] failed", hcamcorder->extra_preview.mode);
+ goto pipeline_creation_error;
+ }
+
return MM_ERROR_NONE;
pipeline_creation_error:
int fps_auto = 0;
unsigned int caps_fourcc = 0;
gboolean do_set_caps = FALSE;
- char fourcc_string[sizeof(fourcc) + 1];
- gchar *caps_str = NULL;
-#ifdef _MMCAMCORDER_PRODUCT_TV
- gint maxwidth = 0;
- gint maxheight = 0;
- int display_surface_type = MM_DISPLAY_SURFACE_NULL;
-#endif /* _MMCAMCORDER_PRODUCT_TV */
-
GstCaps *caps = NULL;
mmf_camcorder_t *hcamcorder = NULL;
if (!do_set_caps)
return TRUE;
- switch (sc->info_image->preview_format) {
- case MM_PIXEL_FORMAT_ENCODED_H264:
-#ifdef _MMCAMCORDER_PRODUCT_TV
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_DISPLAY_SURFACE, &display_surface_type,
- NULL);
- if (display_surface_type != MM_DISPLAY_SURFACE_NULL &&
- __mmcamcorder_find_max_resolution(handle, &maxwidth, &maxheight) == false) {
- MMCAM_LOG_ERROR("can not find max resolution limitation");
- return false;
- } else if (display_surface_type == MM_DISPLAY_SURFACE_NULL) {
- maxwidth = set_width;
- maxheight = set_height;
- }
-#endif /* _MMCAMCORDER_PRODUCT_TV */
- caps = gst_caps_new_simple("video/x-h264",
- "width", G_TYPE_INT, set_width,
- "height", G_TYPE_INT, set_height,
- "framerate", GST_TYPE_FRACTION, fps, 1,
- "stream-format", G_TYPE_STRING, "byte-stream",
-#ifdef _MMCAMCORDER_PRODUCT_TV
- "maxwidth", G_TYPE_INT, maxwidth,
- "maxheight", G_TYPE_INT, maxheight,
- "alignment", G_TYPE_STRING, "au",
-#endif /* _MMCAMCORDER_PRODUCT_TV */
- NULL);
- break;
- case MM_PIXEL_FORMAT_ENCODED_MJPEG:
-#ifdef _MMCAMCORDER_PRODUCT_TV
- caps = gst_caps_new_simple("video/x-jpeg",
-#else
- caps = gst_caps_new_simple("image/jpeg",
-#endif
- "width", G_TYPE_INT, set_width,
- "height", G_TYPE_INT, set_height,
- "framerate", GST_TYPE_FRACTION, fps, 1,
- NULL);
- break;
- case MM_PIXEL_FORMAT_ENCODED_VP8:
- caps = gst_caps_new_simple("video/x-vp8",
- "width", G_TYPE_INT, set_width,
- "height", G_TYPE_INT, set_height,
- "framerate", GST_TYPE_FRACTION, fps, 1,
- NULL);
- break;
- case MM_PIXEL_FORMAT_ENCODED_VP9:
- caps = gst_caps_new_simple("video/x-vp9",
- "width", G_TYPE_INT, set_width,
- "height", G_TYPE_INT, set_height,
- "framerate", GST_TYPE_FRACTION, fps, 1,
- NULL);
- break;
- break;
- default:
- memcpy(fourcc_string, (char*)&fourcc, sizeof(fourcc));
- fourcc_string[sizeof(fourcc)] = '\0';
- caps = gst_caps_new_simple("video/x-raw",
- "format", G_TYPE_STRING, fourcc_string,
- "width", G_TYPE_INT, set_width,
- "height", G_TYPE_INT, set_height,
- "framerate", GST_TYPE_FRACTION, fps, 1,
- "rotate", G_TYPE_INT, set_rotate,
- NULL);
- break;
- }
-
+ caps = _mmcamcorder_get_video_caps(handle,
+ sc->info_image->preview_format, set_width, set_height, fps, set_rotate);
if (!caps) {
MMCAM_LOG_ERROR("There are no caps");
return FALSE;
}
- caps_str = gst_caps_to_string(caps);
- MMCAM_LOG_INFO("vidoesrc new caps set [%s]", caps_str);
- g_free(caps_str);
-
MMCAMCORDER_G_OBJECT_SET_POINTER(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", caps);
gst_caps_unref(caps);
}
#ifdef _MMCAMCORDER_PRODUCT_TV
-static bool __mmcamcorder_find_max_resolution(MMHandleType handle, gint *max_width, gint *max_height)
+bool __mmcamcorder_find_max_resolution(MMHandleType handle, gint *max_width, gint *max_height)
{
_MMCamcorderSubContext *sc = NULL;
mmf_camcorder_t *hcamcorder = NULL;