camerabin

camerabin — Handle lot of features present in DSC

Synopsis

                    GstCameraBin;
enum                GstCameraBinMode;

Object Hierarchy

  GObject
   +----GstObject
         +----GstElement
               +----GstBin
                     +----GstPipeline
                           +----GstCameraBin

Implemented Interfaces

GstCameraBin implements GstChildProxy, GstImplementsInterface, GstColorBalance, GstTagSetter and GstPhotography.

Properties

  "audioenc"                 GstElement*           : Read / Write
  "audiosrc"                 GstElement*           : Read / Write
  "filename"                 gchar*                : Read / Write
  "filter-caps"              GstCaps*              : Read / Write
  "imageenc"                 GstElement*           : Read / Write
  "imagepp"                  GstElement*           : Read / Write
  "inputcaps"                GstCaps*              : Read
  "mode"                     GstCameraBinMode      : Read / Write
  "mute"                     gboolean              : Read / Write
  "vfsink"                   GstElement*           : Read / Write
  "videoenc"                 GstElement*           : Read / Write
  "videomux"                 GstElement*           : Read / Write
  "videopp"                  GstElement*           : Read / Write
  "videosrc"                 GstElement*           : Read / Write
  "zoom"                     gint                  : Read / Write
  "preview-caps"             GstCaps*              : Read / Write

Signals

  "img-done"                                       : Run Last
  "user-image-res"                                 : Run Last / Action
  "user-pause"                                     : Run Last / Action
  "user-res-fps"                                   : Run Last / Action
  "user-start"                                     : Run Last / Action
  "user-stop"                                      : Run Last / Action

Description

GstCameraBin is a high-level camera object that encapsulates the gstreamer internals and provides a task based API for the application. It consists of three main data paths: view-finder, image capture and video capture.

CameraBin structure

Structural decomposition of CameraBin object.

Example launch line

gst-launch -v -m camerabin


Image capture

Taking still images is initiated with the "capture-start" action signal. Once the image has been captured, "image-captured" gst message is posted to the bus and capturing another image is possible. If application has set "preview-caps" property, then a "preview-image" gst message is posted to bus containing preview image formatted according to specified caps. Eventually when image has been saved "image-done" signal is emitted.

Available resolutions can be taken from the "video-source-caps" property. Image capture resolution can be set with "set-image-resolution" action signal.


Video capture

Video capture is started with the "capture-start" action signal too. In addition to image capture one can use "capture-pause" to pause recording and "capture-stop" to end recording.

Available resolutions and fps can be taken from the "video-source-caps" property. "set-video-resolution-fps" action signal can be used to set frame rate and resolution for the video recording and view finder as well.


Photography interface

GstCameraBin implements GstPhotography interface, which can be used to set and get different settings related to digital imaging. Since currently many of these settings require low-level support the photography interface support is dependent on video src element. In practice photography interface settings cannot be used successfully until in PAUSED state when the video src has opened the video device. However it is possible to configure photography settings in NULL state and camerabin will try applying them later.


States

Elements within GstCameraBin are created and destroyed when switching between NULL and READY states. Therefore element properties should be set in NULL state. User set elements are not unreffed until GstCameraBin is unreffed or replaced by a new user set element. Initially only elements needed for view finder mode are created to speed up startup. Image bin and video bin elements are created when setting the mode or starting capture.


Video and image previews

GstCameraBin contains "preview-caps" property, which is used to determine whether the application wants a preview image of the captured picture or video. When set, a GstMessage named "preview-image" will be sent. This message will contain a GstBuffer holding the preview image, converted to a format defined by those preview caps. The ownership of the preview image is kept in GstCameraBin, so application should ref the preview buffer object if it needs to use it elsewhere than in message handler.

Defining preview caps is done by selecting the capturing mode first and then setting the property. Camerabin remembers caps separately for both modes, so it is not necessary to set the caps again after changing the mode.


Note

Since the muxers tested so far have problems with discontinous buffers, QoS has been disabled, and then in order to record video, you MUST ensure that there is enough CPU to encode the video. Thus choose smart resolution and frames per second values. It is also highly recommended to avoid color conversions; make sure all the elements involved work with the same colorspace (i.e. rgb or yuv i420 or whatelse).

Synopsis

Element Information

plugin

camerabin

author

Nokia Corporation <multimedia@maemo.org> Edgard Lima <edgard.lima@indt.org.br>

class

Generic/Bin/Camera

Element Pads

Details

GstCameraBin

typedef struct _GstCameraBin GstCameraBin;

The opaque GstCameraBin structure.


enum GstCameraBinMode

typedef enum
{
  MODE_IMAGE = 0,
  MODE_VIDEO
} GstCameraBinMode;

Capture mode to use.

MODE_IMAGE

image capture

MODE_VIDEO

video capture

Property Details

The "audioenc" property

  "audioenc"                 GstElement*           : Read / Write

Audio encoder GStreamer element (default is vorbisenc).


The "audiosrc" property

  "audiosrc"                 GstElement*           : Read / Write

Audio source GStreamer element (default is pulsesrc).


The "filename" property

  "filename"                 gchar*                : Read / Write

Set filename for the still image capturing or video capturing.

Default value: ""


The "filter-caps" property

  "filter-caps"              GstCaps*              : Read / Write

Caps applied to capsfilter element after videosrc [ ! ffmpegcsp ]. You can use this e.g. to make sure video color format matches with encoders and other elements configured to camerabin and/or change resolution and frame rate.


The "imageenc" property

  "imageenc"                 GstElement*           : Read / Write

Image encoder GStreamer element (default is jpegenc).


The "imagepp" property

  "imagepp"                  GstElement*           : Read / Write

Image Post-Processing GStreamer element (default is NULL).


The "inputcaps" property

  "inputcaps"                GstCaps*              : Read

The allowed modes of the video source operation.


The "mode" property

  "mode"                     GstCameraBinMode      : Read / Write

Set the mode of operation: still image capturing or video recording. Setting the mode will create and destroy image bin or video bin elements according to the mode. You can set this property at any time, changing the mode will stop ongoing capture.

Default value: Still image capture (default)


The "mute" property

  "mute"                     gboolean              : Read / Write

Mute audio in video recording mode. Set this property only when GstCameraBin is in READY, PAUSED or PLAYING.

Default value: FALSE


The "vfsink" property

  "vfsink"                   GstElement*           : Read / Write

View finder sink GStreamer element (default is autovideosink).


The "videoenc" property

  "videoenc"                 GstElement*           : Read / Write

Video encoder GStreamer element (default is theoraenc).


The "videomux" property

  "videomux"                 GstElement*           : Read / Write

Video muxer GStreamer element (default is oggmux).


The "videopp" property

  "videopp"                  GstElement*           : Read / Write

Video post processing GStreamer element (default is NULL).


The "videosrc" property

  "videosrc"                 GstElement*           : Read / Write

Video source GStreamer element (default is v4l2src).


The "zoom" property

  "zoom"                     gint                  : Read / Write

Set up the zoom applied to the frames. Set this property only when GstCameraBin is in READY, PAUSED or PLAYING.

Allowed values: [100,1000]

Default value: 100


The "preview-caps" property

  "preview-caps"             GstCaps*              : Read / Write

If application wants to receive a preview image, it needs to set this property to depict the desired image format caps. When this property is not set (NULL), message containing the preview image is not sent.

Signal Details

The "img-done" signal

gboolean            user_function                      (GstCameraBin *gstcamerabin,
                                                        gchar        *arg1,
                                                        gpointer      user_data)         : Run Last

gstcamerabin :

the object which received the signal.

arg1 :

user_data :

user data set when the signal handler was connected.

Returns :


The "user-image-res" signal

void                user_function                      (GstCameraBin *gstcamerabin,
                                                        gint          arg1,
                                                        gint          arg2,
                                                        gpointer      user_data)         : Run Last / Action

gstcamerabin :

the object which received the signal.

arg1 :

arg2 :

user_data :

user data set when the signal handler was connected.

The "user-pause" signal

void                user_function                      (GstCameraBin *gstcamerabin,
                                                        gpointer      user_data)         : Run Last / Action

gstcamerabin :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "user-res-fps" signal

void                user_function                      (GstCameraBin *gstcamerabin,
                                                        gint          arg1,
                                                        gint          arg2,
                                                        gint          arg3,
                                                        gint          arg4,
                                                        gpointer      user_data)         : Run Last / Action

gstcamerabin :

the object which received the signal.

arg1 :

arg2 :

arg3 :

arg4 :

user_data :

user data set when the signal handler was connected.

The "user-start" signal

void                user_function                      (GstCameraBin *gstcamerabin,
                                                        gpointer      user_data)         : Run Last / Action

gstcamerabin :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "user-stop" signal

void                user_function                      (GstCameraBin *gstcamerabin,
                                                        gpointer      user_data)         : Run Last / Action

gstcamerabin :

the object which received the signal.

user_data :

user data set when the signal handler was connected.