# element basecamerasrc

Base class for the camera source bin used by camerabin for capture. Sophisticated camera hardware can derive from this baseclass and map the features to this interface.

The design mandates that the subclasses implement the following features and behaviour:

- 3 pads: viewfinder, image capture, video capture

During `construct_pipeline()` vmethod a subclass can add several elements into the bin and expose 3 srcs pads as ghostpads implementing the 3 pad templates.

However the subclass is responsible for adding the pad templates for the source pads and they must be named "vidsrc", "imgsrc" and "vfsrc". The pad templates should be installed in the subclass' class_init function, like so:

     static void
     my_element_class_init (GstMyElementClass *klass)
     {
       GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
       // pad templates should be a #GstStaticPadTemplate with direction
       // #GST_PAD_SRC and name "vidsrc", "imgsrc" and "vfsrc"
       gst_element_class_add_static_pad_template (gstelement_class,
           &amp;vidsrc_template);
       gst_element_class_add_static_pad_template (gstelement_class,
           &amp;imgsrc_template);
       gst_element_class_add_static_pad_template (gstelement_class,
           &amp;vfsrc_template);
       // see #GstElementDetails
       gst_element_class_set_details (gstelement_class, &amp;details);
     }

It is also possible to add regular pads from the subclass and implement the dataflow methods on these pads. This way all functionality can be implemented directly in the subclass without extra elements.

The src will receive the capture mode from `GstCameraBin2` on the mode property. Possible capture modes are defined in GstCameraBinMode.

## GstBaseCameraSrc

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstBin
                        ╰──GstBaseCameraSrc

### Members

`parent` (GstBin) –
No description available
`mode` (GstCameraBinMode) –
No description available
`auto_start` (gboolean) –
No description available
`capturing` (gboolean) –
No description available
`capturing_mutex` (GMutex) –
No description available
`preview_caps` (GstCaps *) –
No description available
`post_preview` (gboolean) –
No description available
`preview_filter` (GstElement *) –
No description available
`preview_pipeline` (GstCameraBinPreviewPipelineData *) –
No description available
`width` (gint) –
No description available
`height` (gint) –
No description available
`zoom` (gfloat) –
No description available
`max_zoom` (gfloat) –
No description available
`_gst_reserved` (gpointer *) –
No description available

### Class structure

#### GstBaseCameraSrcClass

##### Fields

`parent` (GstBinClass) –
No description available
`_gst_reserved` (gpointer *) –
No description available

### GstBadBaseCameraBin.BaseCameraSrcClass

##### Attributes

`parent` (Gst.BinClass) –
No description available
`_gst_reserved` ([ Object ]) –
No description available

### GstBadBaseCameraBin.BaseCameraSrcClass

##### Attributes

`parent` (Gst.BinClass) –
No description available
`_gst_reserved` ([ object ]) –
No description available

## GstBadBaseCameraBin.BaseCameraSrc

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Element
                    ╰──Gst.Bin
                        ╰──GstBadBaseCameraBin.BaseCameraSrc

### Members

`parent` (Gst.Bin) –
No description available
`mode` (GstBadBaseCameraBin.CameraBinMode) –
No description available
`auto_start` (Number) –
No description available
`capturing` (Number) –
No description available
`capturing_mutex` (GLib.Mutex) –
No description available
`preview_caps` (Gst.Caps) –
No description available
`post_preview` (Number) –
No description available
`preview_filter` (Gst.Element) –
No description available
`preview_pipeline (not introspectable)` (GstCameraBinPreviewPipelineData (not introspectable)) –
No description available
`width` (Number) –
No description available
`height` (Number) –
No description available
`zoom` (Number) –
No description available
`max_zoom` (Number) –
No description available
`_gst_reserved` ([ Object ]) –
No description available

## GstBadBaseCameraBin.BaseCameraSrc

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Element
                    ╰──Gst.Bin
                        ╰──GstBadBaseCameraBin.BaseCameraSrc

### Members

`parent` (Gst.Bin) –
No description available
`mode` (GstBadBaseCameraBin.CameraBinMode) –
No description available
`auto_start` (bool) –
No description available
`capturing` (bool) –
No description available
`capturing_mutex` (GLib.Mutex) –
No description available
`preview_caps` (Gst.Caps) –
No description available
`post_preview` (bool) –
No description available
`preview_filter` (Gst.Element) –
No description available
`preview_pipeline (not introspectable)` (GstCameraBinPreviewPipelineData (not introspectable)) –
No description available
`width` (int) –
No description available
`height` (int) –
No description available
`zoom` (float) –
No description available
`max_zoom` (float) –
No description available
`_gst_reserved` ([ object ]) –
No description available

### Methods

#### gst_base_camera_src_finish_capture

    gst_base_camera_src_finish_capture (GstBaseCameraSrc * self)

Parameters:

`self` –
No description available

#### GstBadBaseCameraBin.BaseCameraSrc.prototype.finish_capture

    function GstBadBaseCameraBin.BaseCameraSrc.prototype.finish_capture(): {
        // javascript wrapper for 'gst_base_camera_src_finish_capture'
    }

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available

#### GstBadBaseCameraBin.BaseCameraSrc.finish_capture

    def GstBadBaseCameraBin.BaseCameraSrc.finish_capture (self):
        #python wrapper for 'gst_base_camera_src_finish_capture'

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available

#### gst_base_camera_src_post_preview

    gst_base_camera_src_post_preview (GstBaseCameraSrc * self,
                                      GstSample * sample)

Parameters:

`self` –
No description available
`sample` –
No description available

#### GstBadBaseCameraBin.BaseCameraSrc.prototype.post_preview

    function GstBadBaseCameraBin.BaseCameraSrc.prototype.post_preview(sample: Gst.Sample): {
        // javascript wrapper for 'gst_base_camera_src_post_preview'
    }

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
`sample` ( Gst.Sample ) –
No description available

#### GstBadBaseCameraBin.BaseCameraSrc.post_preview

    def GstBadBaseCameraBin.BaseCameraSrc.post_preview (self, sample):
        #python wrapper for 'gst_base_camera_src_post_preview'

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
`sample` ( Gst.Sample ) –
No description available

#### gst_base_camera_src_set_mode

    gboolean
    gst_base_camera_src_set_mode (GstBaseCameraSrc * self,
                                  GstCameraBinMode mode)

Set the chosen GstCameraBinMode capture mode.

Parameters:

`self` –

the camerasrc bin

`mode` –

the mode

Returns –
No description available

#### GstBadBaseCameraBin.BaseCameraSrc.prototype.set_mode

    function GstBadBaseCameraBin.BaseCameraSrc.prototype.set_mode(mode: GstBadBaseCameraBin.CameraBinMode): {
        // javascript wrapper for 'gst_base_camera_src_set_mode'
    }

Set the chosen GstBadBaseCameraBin.CameraBinMode capture mode.

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –

the camerasrc bin

`mode` ( GstBadBaseCameraBin.CameraBinMode ) –

the mode

Returns ( Number ) –
No description available

#### GstBadBaseCameraBin.BaseCameraSrc.set_mode

    def GstBadBaseCameraBin.BaseCameraSrc.set_mode (self, mode):
        #python wrapper for 'gst_base_camera_src_set_mode'

Set the chosen GstBadBaseCameraBin.CameraBinMode capture mode.

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –

the camerasrc bin

`mode` ( GstBadBaseCameraBin.CameraBinMode ) –

the mode

Returns ( bool ) –
No description available

#### gst_base_camera_src_setup_preview

    gst_base_camera_src_setup_preview (GstBaseCameraSrc * self,
                                       GstCaps * preview_caps)

Apply preview caps to preview pipeline and to video source.

Parameters:

`self` –

camerasrc bin

`preview_caps` –

preview caps to set

#### GstBadBaseCameraBin.BaseCameraSrc.prototype.setup_preview

    function GstBadBaseCameraBin.BaseCameraSrc.prototype.setup_preview(preview_caps: Gst.Caps): {
        // javascript wrapper for 'gst_base_camera_src_setup_preview'
    }

Apply preview caps to preview pipeline and to video source.

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –

camerasrc bin

`preview_caps` ( Gst.Caps ) –

preview caps to set

#### GstBadBaseCameraBin.BaseCameraSrc.setup_preview

    def GstBadBaseCameraBin.BaseCameraSrc.setup_preview (self, preview_caps):
        #python wrapper for 'gst_base_camera_src_setup_preview'

Apply preview caps to preview pipeline and to video source.

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –

camerasrc bin

`preview_caps` ( Gst.Caps ) –

preview caps to set

#### gst_base_camera_src_setup_zoom

    gst_base_camera_src_setup_zoom (GstBaseCameraSrc * self)

Apply zoom configured to camerabin to capture.

Parameters:

`self` –

camerasrc object

#### GstBadBaseCameraBin.BaseCameraSrc.prototype.setup_zoom

    function GstBadBaseCameraBin.BaseCameraSrc.prototype.setup_zoom(): {
        // javascript wrapper for 'gst_base_camera_src_setup_zoom'
    }

Apply zoom configured to camerabin to capture.

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –

camerasrc object

#### GstBadBaseCameraBin.BaseCameraSrc.setup_zoom

    def GstBadBaseCameraBin.BaseCameraSrc.setup_zoom (self):
        #python wrapper for 'gst_base_camera_src_setup_zoom'

Apply zoom configured to camerabin to capture.

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –

camerasrc object

### Action Signals

#### start-capture

    g_signal_emit_by_name (self, "start-capture", user_data);

Parameters:

`self` ( GstBaseCameraSrc * ) –
No description available
`user_data` ( gpointer ) –
No description available

Flags: Run Last / Action

#### start-capture

    let ret = self.emit ("start-capture", user_data);

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
`user_data` ( Object ) –
No description available

Flags: Run Last / Action

#### start-capture

    ret = self.emit ("start-capture", user_data)

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
`user_data` ( variadic ) –
No description available

Flags: Run Last / Action

#### stop-capture

    g_signal_emit_by_name (self, "stop-capture", user_data);

Parameters:

`self` ( GstBaseCameraSrc * ) –
No description available
`user_data` ( gpointer ) –
No description available

Flags: Run Last / Action

#### stop-capture

    let ret = self.emit ("stop-capture", user_data);

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
`user_data` ( Object ) –
No description available

Flags: Run Last / Action

#### stop-capture

    ret = self.emit ("stop-capture", user_data)

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
`user_data` ( variadic ) –
No description available

Flags: Run Last / Action

### Properties

#### auto-start

    “auto-start” gboolean

Flags : Read / Write

#### auto-start

    “auto-start” Number

Flags : Read / Write

#### auto_start

    “self.props.auto_start” bool

Flags : Read / Write

#### max-zoom

    “max-zoom” gfloat

Flags : Read

#### max-zoom

    “max-zoom” Number

Flags : Read

#### max_zoom

    “self.props.max_zoom” float

Flags : Read

#### mode

    “mode” GstCameraBin2Mode *

Flags : Read / Write

#### mode

    “mode” GstBadBaseCameraBin.CameraBin2Mode

Flags : Read / Write

#### mode

    “self.props.mode” GstBadBaseCameraBin.CameraBin2Mode

Flags : Read / Write

#### post-previews

    “post-previews” gboolean

When TRUE, preview images should be posted to the bus when captures are made

Flags : Read / Write

#### post-previews

    “post-previews” Number

When true, preview images should be posted to the bus when captures are made

Flags : Read / Write

#### post_previews

    “self.props.post_previews” bool

When True, preview images should be posted to the bus when captures are made

Flags : Read / Write

#### preview-caps

    “preview-caps” GstCaps *

Flags : Read / Write

#### preview-caps

    “preview-caps” Gst.Caps

Flags : Read / Write

#### preview_caps

    “self.props.preview_caps” Gst.Caps

Flags : Read / Write

#### preview-filter

    “preview-filter” GstElement *

Flags : Read / Write

#### preview-filter

    “preview-filter” Gst.Element

Flags : Read / Write

#### preview_filter

    “self.props.preview_filter” Gst.Element

Flags : Read / Write

#### ready-for-capture

    “ready-for-capture” gboolean

When TRUE new capture can be prepared. If FALSE capturing is ongoing and starting a new capture immediately is not possible.

Note that calling start-capture from the notify callback of this property will cause a deadlock. If you need to react like this on the notify function, please schedule a new thread to do it. If you're using glib's mainloop you can use g_idle_add for example.

Flags : Read

#### ready-for-capture

    “ready-for-capture” Number

When TRUE new capture can be prepared. If FALSE capturing is ongoing and starting a new capture immediately is not possible.

Note that calling start-capture from the notify callback of this property will cause a deadlock. If you need to react like this on the notify function, please schedule a new thread to do it. If you're using glib's mainloop you can use g_idle_add (not introspectable) for example.

Flags : Read

#### ready_for_capture

    “self.props.ready_for_capture” bool

When TRUE new capture can be prepared. If FALSE capturing is ongoing and starting a new capture immediately is not possible.

Note that calling start-capture from the notify callback of this property will cause a deadlock. If you need to react like this on the notify function, please schedule a new thread to do it. If you're using glib's mainloop you can use g_idle_add (not introspectable) for example.

Flags : Read

#### zoom

    “zoom” gfloat

Flags : Read / Write

#### zoom

    “zoom” Number

Flags : Read / Write

#### zoom

    “self.props.zoom” float

Flags : Read / Write

### Virtual Methods

#### construct_pipeline

    gboolean
    construct_pipeline (GstBaseCameraSrc * self)

construct pipeline

Parameters:

`self` –
No description available
Returns –
No description available

#### vfunc_construct_pipeline

    function vfunc_construct_pipeline(self: GstBadBaseCameraBin.BaseCameraSrc): {
        // javascript implementation of the 'construct_pipeline' virtual method
    }

construct pipeline

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
Returns ( Number ) –
No description available

#### do_construct_pipeline

    def do_construct_pipeline (self):
        #python implementation of the 'construct_pipeline' virtual method

construct pipeline

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
Returns ( bool ) –
No description available

#### set_mode

    gboolean
    set_mode (GstBaseCameraSrc * self,
              GstCameraBinMode mode)

set the mode

Parameters:

`self` –
No description available
`mode` –
No description available
Returns –
No description available

#### vfunc_set_mode

    function vfunc_set_mode(self: GstBadBaseCameraBin.BaseCameraSrc, mode: GstBadBaseCameraBin.CameraBinMode): {
        // javascript implementation of the 'set_mode' virtual method
    }

set the mode

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
`mode` ( GstBadBaseCameraBin.CameraBinMode ) –
No description available
Returns ( Number ) –
No description available

#### do_set_mode

    def do_set_mode (self, mode):
        #python implementation of the 'set_mode' virtual method

set the mode

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
`mode` ( GstBadBaseCameraBin.CameraBinMode ) –
No description available
Returns ( bool ) –
No description available

#### set_preview

    gboolean
    set_preview (GstBaseCameraSrc * self,
                 GstCaps * preview_caps)

Parameters:

`self` –
No description available
`preview_caps` –
No description available
Returns –
No description available

#### vfunc_set_preview

    function vfunc_set_preview(self: GstBadBaseCameraBin.BaseCameraSrc, preview_caps: Gst.Caps): {
        // javascript implementation of the 'set_preview' virtual method
    }

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
`preview_caps` ( Gst.Caps ) –
No description available
Returns ( Number ) –
No description available

#### do_set_preview

    def do_set_preview (self, preview_caps):
        #python implementation of the 'set_preview' virtual method

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
`preview_caps` ( Gst.Caps ) –
No description available
Returns ( bool ) –
No description available

#### set_zoom

    set_zoom (GstBaseCameraSrc * self,
              gfloat zoom)

set the zoom

Parameters:

`self` –
No description available
`zoom` –
No description available

#### vfunc_set_zoom

    function vfunc_set_zoom(self: GstBadBaseCameraBin.BaseCameraSrc, zoom: Number): {
        // javascript implementation of the 'set_zoom' virtual method
    }

set the zoom

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
`zoom` ( Number ) –
No description available

#### do_set_zoom

    def do_set_zoom (self, zoom):
        #python implementation of the 'set_zoom' virtual method

set the zoom

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
`zoom` ( float ) –
No description available

#### setup_pipeline

    gboolean
    setup_pipeline (GstBaseCameraSrc * self)

configure pipeline for the chosen settings

Parameters:

`self` –
No description available
Returns –
No description available

#### vfunc_setup_pipeline

    function vfunc_setup_pipeline(self: GstBadBaseCameraBin.BaseCameraSrc): {
        // javascript implementation of the 'setup_pipeline' virtual method
    }

configure pipeline for the chosen settings

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
Returns ( Number ) –
No description available

#### do_setup_pipeline

    def do_setup_pipeline (self):
        #python implementation of the 'setup_pipeline' virtual method

configure pipeline for the chosen settings

Parameters:

`self` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
Returns ( bool ) –
No description available

#### start_capture

    gboolean
    start_capture (GstBaseCameraSrc * src)

Parameters:

`src` –
No description available
Returns –
No description available

#### vfunc_start_capture

    function vfunc_start_capture(src: GstBadBaseCameraBin.BaseCameraSrc): {
        // javascript implementation of the 'start_capture' virtual method
    }

Parameters:

`src` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
Returns ( Number ) –
No description available

#### do_start_capture

    def do_start_capture (src):
        #python implementation of the 'start_capture' virtual method

Parameters:

`src` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available
Returns ( bool ) –
No description available

#### stop_capture

    stop_capture (GstBaseCameraSrc * src)

Parameters:

`src` –
No description available

#### vfunc_stop_capture

    function vfunc_stop_capture(src: GstBadBaseCameraBin.BaseCameraSrc): {
        // javascript implementation of the 'stop_capture' virtual method
    }

Parameters:

`src` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available

#### do_stop_capture

    def do_stop_capture (src):
        #python implementation of the 'stop_capture' virtual method

Parameters:

`src` ( GstBadBaseCameraBin.BaseCameraSrc ) –
No description available

## Function Macros

### GST_BASE_CAMERA_SRC_CAST

    #define GST_BASE_CAMERA_SRC_CAST(obj) \
      ((GstBaseCameraSrc *) (obj))

## Constants

### GST_BASE_CAMERA_SRC_IMAGE_PAD_NAME

    #define GST_BASE_CAMERA_SRC_IMAGE_PAD_NAME "imgsrc"

### GstBadBaseCameraBin.BASE_CAMERA_SRC_IMAGE_PAD_NAME

### GST_BASE_CAMERA_SRC_PREVIEW_MESSAGE_NAME

    #define GST_BASE_CAMERA_SRC_PREVIEW_MESSAGE_NAME "preview-image"

### GstBadBaseCameraBin.BASE_CAMERA_SRC_PREVIEW_MESSAGE_NAME

### GST_BASE_CAMERA_SRC_VIDEO_PAD_NAME

    #define GST_BASE_CAMERA_SRC_VIDEO_PAD_NAME "vidsrc"

### GstBadBaseCameraBin.BASE_CAMERA_SRC_VIDEO_PAD_NAME

### GST_BASE_CAMERA_SRC_VIEWFINDER_PAD_NAME

    #define GST_BASE_CAMERA_SRC_VIEWFINDER_PAD_NAME "vfsrc"

### GstBadBaseCameraBin.BASE_CAMERA_SRC_VIEWFINDER_PAD_NAME

### GST_TYPE_BASE_CAMERA_SRC

    #define GST_TYPE_BASE_CAMERA_SRC \
      (gst_base_camera_src_get_type())

### MAX_ZOOM

    #define MAX_ZOOM 10.0f

### MIN_ZOOM

    #define MIN_ZOOM 1.0f

### ZOOM_1X

    #define ZOOM_1X MIN_ZOOM

The results of the search are