+
+
+int _mmcamcorder_set_extra_preview_bitrate(MMHandleType handle, int stream_id, int bitrate)
+{
+ mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)handle;
+ MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
+ GstCameraControl *control = NULL;
+ _MMCamcorderSubContext *sc = NULL;
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(hcamcorder->extra_preview.is_supported, MM_ERROR_CAMCORDER_NOT_SUPPORTED);
+ mmf_return_val_if_fail(stream_id >= 0 && stream_id < MM_CAMCORDER_EXTRA_PREVIEW_STREAM_MAX,
+ MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(bitrate > 0, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ mm_camcorder_get_state(handle, ¤t_state);
+
+ MMCAM_LOG_INFO("state[%d] stream[%d], bitrate[%d]", current_state, stream_id, bitrate);
+
+ if (current_state >= MM_CAMCORDER_STATE_READY) {
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (!gst_camera_control_set_extra_preview_bitrate(control, stream_id, bitrate)) {
+ MMCAM_LOG_ERROR("set bitrate[%d] for stream[%d] failed", bitrate, stream_id);
+ return MM_ERROR_CAMCORDER_INTERNAL;
+ }
+ } else {
+ MMCAM_LOG_INFO("It will be set when start preview");
+ hcamcorder->extra_preview.format[stream_id].need_to_set_bitrate = TRUE;
+ }
+
+ hcamcorder->extra_preview.format[stream_id].bitrate = bitrate;
+
+ return MM_ERROR_NONE;
+}
+
+
+int _mmcamcorder_get_extra_preview_bitrate(MMHandleType handle, int stream_id, int *bitrate)
+{
+ int _bitrate = 0;
+ GstCameraControl *control = NULL;
+ mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)handle;
+ MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
+ _MMCamcorderSubContext *sc = NULL;
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(hcamcorder->extra_preview.is_supported, MM_ERROR_CAMCORDER_NOT_SUPPORTED);
+ mmf_return_val_if_fail(stream_id >= 0 && stream_id < MM_CAMCORDER_EXTRA_PREVIEW_STREAM_MAX,
+ MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(bitrate, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ mm_camcorder_get_state(handle, ¤t_state);
+
+ if (current_state >= MM_CAMCORDER_STATE_READY) {
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (!gst_camera_control_get_extra_preview_bitrate(control, stream_id, &_bitrate)) {
+ MMCAM_LOG_ERROR("get bitrate for stream[%d] failed", stream_id);
+ return MM_ERROR_CAMCORDER_INTERNAL;
+ }
+
+ *bitrate = _bitrate;
+ } else {
+ *bitrate = hcamcorder->extra_preview.format[stream_id].bitrate;
+ }
+
+ MMCAM_LOG_INFO("get bitrate[%d] for stream[%d][state:%d]",
+ *bitrate, stream_id, current_state);
+
+ return MM_ERROR_NONE;
+}
+
+
+int _mmcamcorder_set_extra_preview_gop_interval(MMHandleType handle, int stream_id, int interval)
+{
+ mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)handle;
+ MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
+ GstCameraControl *control = NULL;
+ _MMCamcorderSubContext *sc = NULL;
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(hcamcorder->extra_preview.is_supported, MM_ERROR_CAMCORDER_NOT_SUPPORTED);
+ mmf_return_val_if_fail(stream_id >= 0 && stream_id < MM_CAMCORDER_EXTRA_PREVIEW_STREAM_MAX,
+ MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ mm_camcorder_get_state(handle, ¤t_state);
+
+ MMCAM_LOG_INFO("state[%d] stream[%d], interval[%d]", current_state, stream_id, interval);
+
+ if (current_state >= MM_CAMCORDER_STATE_READY) {
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (!gst_camera_control_set_extra_preview_gop_interval(control, stream_id, interval)) {
+ MMCAM_LOG_ERROR("set GOP interval[%d] for stream[%d] failed", interval, stream_id);
+ return MM_ERROR_CAMCORDER_INTERNAL;
+ }
+ } else {
+ MMCAM_LOG_INFO("It will be set when start preview");
+ hcamcorder->extra_preview.format[stream_id].need_to_set_gop_interval = TRUE;
+ }
+
+ hcamcorder->extra_preview.format[stream_id].gop_interval = interval;
+
+ return MM_ERROR_NONE;
+}
+
+
+int _mmcamcorder_get_extra_preview_gop_interval(MMHandleType handle, int stream_id, int *interval)
+{
+ int _interval = 0;
+ GstCameraControl *control = NULL;
+ mmf_camcorder_t *hcamcorder = (mmf_camcorder_t *)handle;
+ MMCamcorderStateType current_state = MM_CAMCORDER_STATE_NONE;
+ _MMCamcorderSubContext *sc = NULL;
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(hcamcorder->extra_preview.is_supported, MM_ERROR_CAMCORDER_NOT_SUPPORTED);
+ mmf_return_val_if_fail(stream_id >= 0 && stream_id < MM_CAMCORDER_EXTRA_PREVIEW_STREAM_MAX,
+ MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+ mmf_return_val_if_fail(interval, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ mm_camcorder_get_state(handle, ¤t_state);
+
+ if (current_state >= MM_CAMCORDER_STATE_READY) {
+ sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+ mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (!gst_camera_control_get_extra_preview_gop_interval(control, stream_id, &_interval)) {
+ MMCAM_LOG_ERROR("get GOP interval for stream[%d] failed", stream_id);
+ return MM_ERROR_CAMCORDER_INTERNAL;
+ }
+
+ *interval = _interval;
+ } else {
+ *interval = hcamcorder->extra_preview.format[stream_id].gop_interval;
+ }
+
+ MMCAM_LOG_INFO("get GOP interval[%d] for stream[%d][state:%d]",
+ *interval, stream_id, current_state);
+
+ return MM_ERROR_NONE;
+}