+
+
+bool _mmcamcorder_set_encoded_preview_bitrate(MMHandleType handle, int bitrate)
+{
+ _MMCamcorderSubContext *sc = NULL;
+ GstCameraControl *CameraControl = NULL;
+ GstCameraControlChannel *CameraControlChannel = NULL;
+ const GList *controls = NULL;
+ const GList *item = NULL;
+
+ if ((void *)handle == NULL) {
+ _mmcam_dbg_warn("handle is NULL");
+ return FALSE;
+ }
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ if (!sc) {
+ _mmcam_dbg_warn("subcontext is NULL");
+ return FALSE;
+ }
+
+ if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst == NULL) {
+ _mmcam_dbg_warn("videosrc plugin is NULL");
+ return FALSE;
+ }
+
+ _mmcam_dbg_log("set encoded preview bitrate : %d bps", bitrate);
+
+ CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ controls = gst_camera_control_list_channels(CameraControl);
+ _mmcam_dbg_log("controls : 0x%x", controls);
+ if (controls != NULL) {
+ _mmcam_dbg_log("controls : 0x%x", controls);
+ for (item = controls ; item && item->data ; item = item->next) {
+ CameraControlChannel = item->data;
+ _mmcam_dbg_log("label : %d", CameraControlChannel->label);
+ if (!strcmp(CameraControlChannel->label, "bitrate")) {
+ _mmcam_dbg_log("set encoded preview bitrate %d", bitrate);
+ return gst_camera_control_set_value(CameraControl, CameraControlChannel, bitrate);
+ }
+ }
+
+ if (item == NULL) {
+ _mmcam_dbg_warn("failed to find \"bitrate\" control channel");
+ }
+ }
+
+ return FALSE;
+}
+
+
+bool _mmcamcorder_set_encoded_preview_gop_interval(MMHandleType handle, int interval)
+{
+ _MMCamcorderSubContext *sc = NULL;
+
+ if ((void *)handle == NULL) {
+ _mmcam_dbg_warn("handle is NULL");
+ return FALSE;
+ }
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ if (!sc) {
+ _mmcam_dbg_warn("subcontext is NULL");
+ return FALSE;
+ }
+
+ if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst == NULL) {
+ _mmcam_dbg_warn("videosrc plugin is NULL");
+ return FALSE;
+ }
+
+ _mmcam_dbg_log("set encoded preview GOP interval : %d ms", interval);
+
+ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "newgop-interval", interval);
+
+ return TRUE;
+}
+
+
+bool _mmcamcorder_set_sound_stream_info(GstElement *element, char *stream_type, int stream_index)
+{
+ GstStructure *props = NULL;
+ char stream_props[64] = {'\0',};
+
+ if (element == NULL || stream_type == NULL || stream_index < 0) {
+ _mmcam_dbg_err("invalid argument %p %p %d", element, stream_type, stream_index);
+ return FALSE;
+ }
+
+ snprintf(stream_props, sizeof(stream_props) - 1,
+ "props,media.role=%s, media.parent_id=%d",
+ stream_type, stream_index);
+
+ _mmcam_dbg_log("stream type %s, index %d -> [%s]", stream_type, stream_index, stream_props);
+
+ props = gst_structure_from_string(stream_props, NULL);
+ if (!props) {
+ _mmcam_dbg_err("failed to create GstStructure");
+ return FALSE;
+ }
+
+ MMCAMCORDER_G_OBJECT_SET_POINTER(element, "stream-properties", props);
+
+ gst_structure_free(props);
+ props = NULL;
+
+ return TRUE;
+}
+