cameracontrol: Add new interface for extra preview stream format
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 15 Jun 2021 03:26:39 +0000 (12:26 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 15 Jun 2021 03:26:52 +0000 (12:26 +0900)
[Version] 1.16.2-14
[Issue Type] New feature

Change-Id: If83351104c86b97be5d354b874ad5d777eab796b
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
gst-libs/gst/video/cameracontrol.c
gst-libs/gst/video/cameracontrol.h
packaging/gst-plugins-base.spec

index 8001ab8..7305922 100644 (file)
@@ -155,9 +155,8 @@ const GList *gst_camera_control_list_channels(GstCameraControl *control)
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->list_channels) {
+       if (iface->list_channels)
                return iface->list_channels(control);
-       }
 
        return NULL;
 }
@@ -171,9 +170,8 @@ gboolean gst_camera_control_set_value(GstCameraControl *control, GstCameraContro
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_value) {
+       if (iface->set_value)
                return iface->set_value(control, control_channel, value);
-       }
 
        return FALSE;
 }
@@ -186,9 +184,8 @@ gboolean gst_camera_control_get_value(GstCameraControl *control, GstCameraContro
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_value) {
+       if (iface->get_value)
                return iface->get_value(control, control_channel, value);
-       }
 
        return FALSE;
 }
@@ -203,9 +200,8 @@ gboolean gst_camera_control_set_exposure(GstCameraControl *control, gint type, g
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_exposure) {
+       if (iface->set_exposure)
                return iface->set_exposure(control, type, value1, value2);
-       }
 
        return FALSE;
 }
@@ -218,9 +214,8 @@ gboolean gst_camera_control_get_exposure(GstCameraControl *control, gint type, g
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_exposure) {
+       if (iface->get_exposure)
                return iface->get_exposure(control, type, value1, value2);
-       }
 
        return FALSE;
 }
@@ -233,9 +228,8 @@ gboolean gst_camera_control_set_capture_mode(GstCameraControl *control, gint typ
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_capture_mode) {
+       if (iface->set_capture_mode)
                return iface->set_capture_mode(control, type, value);
-       }
 
        return FALSE;
 }
@@ -248,9 +242,8 @@ gboolean gst_camera_control_get_capture_mode(GstCameraControl *control, gint typ
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_capture_mode) {
+       if (iface->get_capture_mode)
                return iface->get_capture_mode(control, type, value);
-       }
 
        return FALSE;
 }
@@ -263,9 +256,8 @@ gboolean gst_camera_control_set_strobe(GstCameraControl *control, gint type, gin
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_strobe) {
+       if (iface->set_strobe)
                return iface->set_strobe(control, type, value);
-       }
 
        return FALSE;
 }
@@ -278,9 +270,8 @@ gboolean gst_camera_control_get_strobe(GstCameraControl *control, gint type, gin
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_strobe) {
+       if (iface->get_strobe)
                return iface->get_strobe(control, type, value);
-       }
 
        return FALSE;
 }
@@ -293,9 +284,8 @@ gboolean gst_camera_control_set_detect(GstCameraControl *control, gint type, gin
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_detect) {
+       if (iface->set_detect)
                return iface->set_detect(control, type, value);
-       }
 
        return FALSE;
 }
@@ -308,9 +298,8 @@ gboolean gst_camera_control_get_detect(GstCameraControl *control, gint type, gin
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_detect) {
+       if (iface->get_detect)
                return iface->get_detect(control, type, value);
-       }
 
        return FALSE;
 }
@@ -323,9 +312,8 @@ gboolean gst_camera_control_set_zoom(GstCameraControl *control, gint type, gint
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_zoom) {
+       if (iface->set_zoom)
                return iface->set_zoom(control, type, value);
-       }
 
        return FALSE;
 }
@@ -338,9 +326,8 @@ gboolean gst_camera_control_get_zoom(GstCameraControl *control, gint type, gint
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_zoom) {
+       if (iface->get_zoom)
                return iface->get_zoom(control, type, value);
-       }
 
        return FALSE;
 }
@@ -353,9 +340,8 @@ gboolean gst_camera_control_set_focus(GstCameraControl *control, gint mode, gint
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_focus) {
+       if (iface->set_focus)
                return iface->set_focus(control, mode, range);
-       }
 
        return FALSE;
 }
@@ -368,9 +354,8 @@ gboolean gst_camera_control_get_focus(GstCameraControl *control, gint *mode, gin
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_focus) {
+       if (iface->get_focus)
                return iface->get_focus(control, mode, range);
-       }
 
        return FALSE;
 }
@@ -383,9 +368,8 @@ gboolean gst_camera_control_start_auto_focus(GstCameraControl *control)
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->start_auto_focus) {
+       if (iface->start_auto_focus)
                return iface->start_auto_focus(control);
-       }
 
        return FALSE;
 }
@@ -398,9 +382,8 @@ gboolean gst_camera_control_stop_auto_focus(GstCameraControl *control)
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->stop_auto_focus) {
+       if (iface->stop_auto_focus)
                return iface->stop_auto_focus(control);
-       }
 
        return FALSE;
 }
@@ -413,9 +396,8 @@ gboolean gst_camera_control_set_focus_level(GstCameraControl *control, gint manu
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_focus_level) {
+       if (iface->set_focus_level)
                return iface->set_focus_level(control, manual_level);
-       }
 
        return FALSE;
 }
@@ -428,9 +410,8 @@ gboolean gst_camera_control_get_focus_level(GstCameraControl *control, gint *man
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_focus_level) {
+       if (iface->get_focus_level)
                return iface->get_focus_level(control, manual_level);
-       }
 
        return FALSE;
 }
@@ -443,9 +424,8 @@ gboolean gst_camera_control_set_auto_focus_area(GstCameraControl *control, GstCa
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_auto_focus_area) {
+       if (iface->set_auto_focus_area)
                return iface->set_auto_focus_area(control, rect);
-       }
 
        return FALSE;
 }
@@ -458,9 +438,8 @@ gboolean gst_camera_control_get_auto_focus_area(GstCameraControl *control, GstCa
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_auto_focus_area) {
+       if (iface->get_auto_focus_area)
                return iface->get_auto_focus_area(control, rect);
-       }
 
        return FALSE;
 }
@@ -473,9 +452,8 @@ gboolean gst_camera_control_set_wdr(GstCameraControl *control, gint value)
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_wdr) {
+       if (iface->set_wdr)
                return iface->set_wdr(control, value);
-       }
 
        return FALSE;
 }
@@ -488,9 +466,8 @@ gboolean gst_camera_control_get_wdr(GstCameraControl *control, gint *value)
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_wdr) {
+       if (iface->get_wdr)
                return iface->get_wdr(control, value);
-       }
 
        return FALSE;
 }
@@ -503,9 +480,8 @@ gboolean gst_camera_control_set_ahs(GstCameraControl *control, gint value)
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_ahs) {
+       if (iface->set_ahs)
                return iface->set_ahs(control, value);
-       }
 
        return FALSE;
 }
@@ -518,9 +494,8 @@ gboolean gst_camera_control_get_ahs(GstCameraControl *control, gint *value)
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_ahs) {
+       if (iface->get_ahs)
                return iface->get_ahs(control, value);
-       }
 
        return FALSE;
 }
@@ -533,9 +508,8 @@ gboolean gst_camera_control_set_part_color(GstCameraControl *control, gint type,
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_part_color) {
+       if (iface->set_part_color)
                return iface->set_part_color(control, type, value);
-       }
 
        return FALSE;
 }
@@ -548,9 +522,8 @@ gboolean gst_camera_control_get_part_color(GstCameraControl *control, gint type,
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_part_color) {
+       if (iface->get_part_color)
                return iface->get_part_color(control, type, value);
-       }
 
        return FALSE;
 }
@@ -564,9 +537,8 @@ gst_camera_control_get_exif_info(GstCameraControl *control, GstCameraControlExif
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_exif_info) {
+       if (iface->get_exif_info)
                return iface->get_exif_info(control, info);
-       }
 
        return FALSE;
 }
@@ -580,9 +552,8 @@ gboolean gst_camera_control_get_basic_dev_info(GstCameraControl *control, gint d
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_basic_dev_info) {
+       if (iface->get_basic_dev_info)
                return iface->get_basic_dev_info(control, dev_id, info);
-       }
 
        return FALSE;
 }
@@ -595,9 +566,8 @@ gboolean gst_camera_control_get_misc_dev_info(GstCameraControl *control, gint de
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_misc_dev_info) {
-               return iface->get_misc_dev_info( control, dev_id, info );
-       }
+       if (iface->get_misc_dev_info)
+               return iface->get_misc_dev_info(control, dev_id, info);
 
        return FALSE;
 }
@@ -610,9 +580,8 @@ gboolean gst_camera_control_get_extra_dev_info(GstCameraControl *control, gint d
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_extra_dev_info) {
+       if (iface->get_extra_dev_info)
                return iface->get_extra_dev_info(control, dev_id, info);
-       }
 
        return FALSE;
 }
@@ -625,9 +594,8 @@ void gst_camera_control_set_capture_command(GstCameraControl *control, GstCamera
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_capture_command) {
+       if (iface->set_capture_command)
                iface->set_capture_command(control, cmd);
-       }
 
        return;
 }
@@ -640,9 +608,8 @@ void gst_camera_control_set_record_command(GstCameraControl *control, GstCameraC
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_record_command) {
+       if (iface->set_record_command)
                iface->set_record_command(control, cmd);
-       }
 
        return;
 }
@@ -655,9 +622,8 @@ gboolean gst_camera_control_start_face_zoom(GstCameraControl *control, gint x, g
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->start_face_zoom) {
+       if (iface->start_face_zoom)
                return iface->start_face_zoom(control, x, y, zoom_level);
-       }
 
        return FALSE;
 }
@@ -670,9 +636,8 @@ gboolean gst_camera_control_stop_face_zoom(GstCameraControl *control)
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->stop_face_zoom) {
+       if (iface->stop_face_zoom)
                return iface->stop_face_zoom(control);
-       }
 
        return FALSE;
 }
@@ -685,9 +650,8 @@ gboolean gst_camera_control_set_ae_lock(GstCameraControl *control, gboolean lock
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_ae_lock) {
+       if (iface->set_ae_lock)
                return iface->set_ae_lock(control, lock);
-       }
 
        return FALSE;
 }
@@ -700,9 +664,8 @@ gboolean gst_camera_control_get_ae_lock(GstCameraControl *control, gboolean *loc
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_ae_lock) {
+       if (iface->get_ae_lock)
                return iface->get_ae_lock(control, lock);
-       }
 
        return FALSE;
 }
@@ -715,9 +678,8 @@ gboolean gst_camera_control_set_awb_lock(GstCameraControl *control, gboolean loc
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_awb_lock) {
+       if (iface->set_awb_lock)
                return iface->set_awb_lock(control, lock);
-       }
 
        return FALSE;
 }
@@ -730,9 +692,8 @@ gboolean gst_camera_control_get_awb_lock(GstCameraControl *control, gboolean *lo
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->get_awb_lock) {
+       if (iface->get_awb_lock)
                return iface->get_awb_lock(control, lock);
-       }
 
        return FALSE;
 }
@@ -745,9 +706,36 @@ gboolean gst_camera_control_set_user_buffer_fd(GstCameraControl *control, int *f
 
        iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
 
-       if (iface->set_user_buffer_fd) {
+       if (iface->set_user_buffer_fd)
                return iface->set_user_buffer_fd(control, fds, number);
-       }
+
+       return FALSE;
+}
+
+gboolean gst_camera_control_set_extra_preview_stream_format(GstCameraControl *control, int stream_id, GstCameraControlImageFormat img_fmt, int width, int height, int fps)
+{
+       GstCameraControlInterface *iface;
+
+       g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE);
+
+       iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
+
+       if (iface->set_extra_preview_stream_format)
+               return iface->set_extra_preview_stream_format(control, stream_id, img_fmt, width, height, fps);
+
+       return FALSE;
+}
+
+gboolean gst_camera_control_get_extra_preview_stream_format(GstCameraControl *control, int stream_id, GstCameraControlImageFormat *img_fmt, int *width, int *height, int *fps)
+{
+       GstCameraControlInterface *iface;
+
+       g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE);
+
+       iface = GST_CAMERA_CONTROL_GET_INTERFACE(control);
+
+       if (iface->get_extra_preview_stream_format)
+               return iface->get_extra_preview_stream_format(control, stream_id, img_fmt, width, height, fps);
 
        return FALSE;
 }
index 868f32f..f900651 100644 (file)
@@ -134,6 +134,29 @@ typedef enum
        GST_CAMERA_CONTROL_RECORD_COMMAND_STOP
 } GstCameraControlRecordCommand;
 
+typedef enum
+{
+       /* YUV */
+       GST_CAMERA_CONTROL_IMAGE_FORMAT_NV12,
+       GST_CAMERA_CONTROL_IMAGE_FORMAT_NV21,
+       GST_CAMERA_CONTROL_IMAGE_FORMAT_I420,
+       GST_CAMERA_CONTROL_IMAGE_FORMAT_YV12,
+       GST_CAMERA_CONTROL_IMAGE_FORMAT_YUYV,
+       GST_CAMERA_CONTROL_IMAGE_FORMAT_UYVY,
+
+       /* RGB */
+       GST_CAMERA_CONTROL_IMAGE_FORMAT_BGRA,
+       GST_CAMERA_CONTROL_IMAGE_FORMAT_ARGB,
+
+       /* ENCODED */
+       GST_CAMERA_CONTROL_IMAGE_FORMAT_JPEG,
+       GST_CAMERA_CONTROL_IMAGE_FORMAT_H264,
+       GST_CAMERA_CONTROL_IMAGE_FORMAT_MJPEG,
+       GST_CAMERA_CONTROL_IMAGE_FORMAT_VP8,
+       GST_CAMERA_CONTROL_IMAGE_FORMAT_VP9
+} GstCameraControlImageFormat;
+
+
 /////////////////////////////////
 //  For Query functionalities  //
 //  For Querying capabilities  //
@@ -375,6 +398,8 @@ struct _GstCameraControlInterface {
        gboolean        (*set_awb_lock)                (GstCameraControl *control, gboolean lock);
        gboolean        (*get_awb_lock)                (GstCameraControl *control, gboolean *lock);
        gboolean        (*set_user_buffer_fd)          (GstCameraControl *control, int *fds, int number);
+       gboolean        (*set_extra_preview_stream_format) (GstCameraControl *control, int stream_id, GstCameraControlImageFormat img_fmt, int width, int height, int fps);
+       gboolean        (*get_extra_preview_stream_format) (GstCameraControl *control, int stream_id, GstCameraControlImageFormat *img_fmt, int *width, int *height, int *fps);
 
        /* signals */
        void (* value_changed)                          (GstCameraControl *control, GstCameraControlChannel *channel, gint value);
@@ -503,6 +528,12 @@ gboolean   gst_camera_control_get_awb_lock         (GstCameraControl *control, gbo
 GST_VIDEO_API
 gboolean       gst_camera_control_set_user_buffer_fd   (GstCameraControl *control, int *fds, int number);
 
+GST_VIDEO_API
+gboolean       gst_camera_control_set_extra_preview_stream_format  (GstCameraControl *control, int stream_id, GstCameraControlImageFormat img_fmt, int width, int height, int fps);
+
+GST_VIDEO_API
+gboolean       gst_camera_control_get_extra_preview_stream_format  (GstCameraControl *control, int stream_id, GstCameraControlImageFormat *img_fmt, int *width, int *height, int *fps);
+
 /* trigger signal */
 GST_VIDEO_API
 void           gst_camera_control_value_changed        (GstCameraControl *control, GstCameraControlChannel *control_channel, gint value);
index 2a104d7..4a05f4d 100644 (file)
@@ -5,7 +5,7 @@
 
 Name:           gst-plugins-base
 Version:        1.16.2
-Release:        13
+Release:        14
 License:        LGPL-2.0+
 Summary:        GStreamer Streaming-Media Framework Plug-Ins
 Url:            http://gstreamer.freedesktop.org/