rpicamsrc: Re-flow element source code with gst-indent

This commit is contained in:
Jan Schmidt 2013-10-13 18:01:00 +11:00 committed by Tim-Philipp Müller
parent 5f871311c1
commit 1b9a614272

View file

@ -117,7 +117,7 @@ enum
PROP_ROI_H,
};
#define BITRATE_DEFAULT 17000000 /* 17Mbit/s default for 1080p */
#define BITRATE_DEFAULT 17000000 /* 17Mbit/s default for 1080p */
#define BITRATE_HIGHEST 25000000
#define SHARPNESS_DEFAULT 0
@ -160,11 +160,10 @@ enum
"alignment = (string) { au }, " \
"profile = (string) { baseline, main, high }"
static GstStaticPadTemplate video_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
static GstStaticPadTemplate video_src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (/*RAW_AND_JPEG_CAPS "; "*/ H264_CAPS)
GST_STATIC_CAPS ( /*RAW_AND_JPEG_CAPS "; " */ H264_CAPS)
);
#define gst_rpi_cam_src_parent_class parent_class
@ -174,13 +173,14 @@ static void gst_rpi_cam_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_rpi_cam_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static gboolean gst_rpi_cam_src_start (GstBaseSrc *parent);
static gboolean gst_rpi_cam_src_stop (GstBaseSrc *parent);
static gboolean gst_rpi_cam_src_start (GstBaseSrc * parent);
static gboolean gst_rpi_cam_src_stop (GstBaseSrc * parent);
static gboolean gst_rpi_cam_src_decide_allocation (GstBaseSrc * src,
GstQuery * query);
static GstFlowReturn gst_rpi_cam_src_create (GstPushSrc *parent, GstBuffer **buf);
static GstFlowReturn gst_rpi_cam_src_create (GstPushSrc * parent,
GstBuffer ** buf);
static GstCaps *gst_rpi_cam_src_get_caps (GstBaseSrc * src, GstCaps * filter);
static gboolean gst_rpi_cam_src_set_caps (GstBaseSrc * src, GstCaps *caps);
static gboolean gst_rpi_cam_src_set_caps (GstBaseSrc * src, GstCaps * caps);
static GstCaps *gst_rpi_cam_src_fixate (GstBaseSrc * basesrc, GstCaps * caps);
static void
@ -216,17 +216,16 @@ gst_rpi_cam_src_class_init (GstRpiCamSrcClass * klass)
"Preview Encoded", "Display encoder output in the preview",
TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PREVIEW_OPACITY,
g_param_spec_int ("preview-opacity", "Preview Opacity", "Opacity to use for the preview window",
0, 255, 255,
g_param_spec_int ("preview-opacity", "Preview Opacity",
"Opacity to use for the preview window", 0, 255, 255,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SHARPNESS,
g_param_spec_int ("sharpness", "Sharpness", "Image capture sharpness",
-100, 100, SHARPNESS_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_CONTRAST,
g_param_spec_int ("contrast", "Contrast", "Image capture contrast",
-100, 100, CONTRAST_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_param_spec_int ("contrast", "Contrast", "Image capture contrast", -100,
100, CONTRAST_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_BRIGHTNESS,
g_param_spec_int ("brightness", "Brightness", "Image capture brightness",
0, 100, BRIGHTNESS_DEFAULT,
@ -236,16 +235,16 @@ gst_rpi_cam_src_class_init (GstRpiCamSrcClass * klass)
-100, 100, SATURATION_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_ISO,
g_param_spec_int ("iso", "ISO", "ISO value to use (0 = Auto)",
0, 3200, 0,
g_param_spec_int ("iso", "ISO", "ISO value to use (0 = Auto)", 0, 3200, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_VIDEO_STABILISATION,
g_param_spec_boolean ("video-stabilisation",
"Video Stabilisation", "Enable or disable video stabilisation",
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_param_spec_boolean ("video-stabilisation", "Video Stabilisation",
"Enable or disable video stabilisation", FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_EXPOSURE_COMPENSATION,
g_param_spec_int ("exposure-compensation", "EV compensation", "Exposure Value compensation",
-10, 10, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_param_spec_int ("exposure-compensation", "EV compensation",
"Exposure Value compensation", -10, 10, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_EXPOSURE_MODE,
g_param_spec_enum ("exposure-mode", "Exposure Mode",
"Camera exposure mode to use",
@ -254,72 +253,75 @@ gst_rpi_cam_src_class_init (GstRpiCamSrcClass * klass)
g_object_class_install_property (gobject_class, PROP_EXPOSURE_METERING_MODE,
g_param_spec_enum ("metering-mode", "Exposure Metering Mode",
"Camera exposure metering mode to use",
GST_RPI_CAM_TYPE_RPI_CAM_SRC_EXPOSURE_METERING_MODE, EXPOSURE_METERING_MODE_DEFAULT,
GST_RPI_CAM_TYPE_RPI_CAM_SRC_EXPOSURE_METERING_MODE,
EXPOSURE_METERING_MODE_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_AWB_MODE,
g_param_spec_enum ("awb-mode", "Automatic White Balance Mode",
"White Balance mode",
GST_RPI_CAM_TYPE_RPI_CAM_SRC_AWB_MODE, GST_RPI_CAM_SRC_AWB_MODE_AUTO,
"White Balance mode", GST_RPI_CAM_TYPE_RPI_CAM_SRC_AWB_MODE,
GST_RPI_CAM_SRC_AWB_MODE_AUTO,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
#if 0
PROP_IMAGE_EFFECT,
PROP_IMAGE_EFFECT_PARAMS,
PROP_COLOUR_EFFECTS,
PROP_IMAGE_EFFECT, PROP_IMAGE_EFFECT_PARAMS, PROP_COLOUR_EFFECTS,
#endif
g_object_class_install_property (gobject_class, PROP_ROTATION,
g_param_spec_int ("rotation", "Rotation", "Rotate captured image (0, 90, 180, 270 degrees)",
0, 270, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_ROTATION,
g_param_spec_int ("rotation", "Rotation",
"Rotate captured image (0, 90, 180, 270 degrees)", 0, 270, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_HFLIP,
g_param_spec_boolean ("hflip",
"Horizontal Flip", "Flip capture horizontally",
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_param_spec_boolean ("hflip", "Horizontal Flip",
"Flip capture horizontally", FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_VFLIP,
g_param_spec_boolean ("vflip",
"Vertical Flip", "Flip capture vertically",
g_param_spec_boolean ("vflip", "Vertical Flip", "Flip capture vertically",
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_ROI_X,
g_param_spec_float ("roi-x", "ROI X", "Normalised region-of-interest X coord",
0, 1.0, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_param_spec_float ("roi-x", "ROI X",
"Normalised region-of-interest X coord", 0, 1.0, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_ROI_Y,
g_param_spec_float ("roi-y", "ROI Y", "Normalised region-of-interest Y coord",
0, 1.0, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_param_spec_float ("roi-y", "ROI Y",
"Normalised region-of-interest Y coord", 0, 1.0, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_ROI_W,
g_param_spec_float ("roi-w", "ROI W", "Normalised region-of-interest W coord",
0, 1.0, 1.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_param_spec_float ("roi-w", "ROI W",
"Normalised region-of-interest W coord", 0, 1.0, 1.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_ROI_H,
g_param_spec_float ("roi-h", "ROI H", "Normalised region-of-interest H coord",
0, 1.0, 1.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_param_spec_float ("roi-h", "ROI H",
"Normalised region-of-interest H coord", 0, 1.0, 1.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_static_metadata (gstelement_class,
"Raspberry Pi Camera Source",
"Source/Video",
"Raspberry Pi camera module source",
"Jan Schmidt <jan@centricular.com>");
"Raspberry Pi camera module source", "Jan Schmidt <jan@centricular.com>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&video_src_template));
basesrc_class->start = GST_DEBUG_FUNCPTR(gst_rpi_cam_src_start);
basesrc_class->stop = GST_DEBUG_FUNCPTR(gst_rpi_cam_src_stop);
basesrc_class->decide_allocation = GST_DEBUG_FUNCPTR(gst_rpi_cam_src_decide_allocation);
basesrc_class->get_caps = GST_DEBUG_FUNCPTR(gst_rpi_cam_src_get_caps);
basesrc_class->set_caps = GST_DEBUG_FUNCPTR(gst_rpi_cam_src_set_caps);
basesrc_class->fixate = GST_DEBUG_FUNCPTR(gst_rpi_cam_src_fixate);
pushsrc_class->create = GST_DEBUG_FUNCPTR(gst_rpi_cam_src_create);
basesrc_class->start = GST_DEBUG_FUNCPTR (gst_rpi_cam_src_start);
basesrc_class->stop = GST_DEBUG_FUNCPTR (gst_rpi_cam_src_stop);
basesrc_class->decide_allocation =
GST_DEBUG_FUNCPTR (gst_rpi_cam_src_decide_allocation);
basesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_rpi_cam_src_get_caps);
basesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_rpi_cam_src_set_caps);
basesrc_class->fixate = GST_DEBUG_FUNCPTR (gst_rpi_cam_src_fixate);
pushsrc_class->create = GST_DEBUG_FUNCPTR (gst_rpi_cam_src_create);
raspicapture_init();
raspicapture_init ();
}
static void
gst_rpi_cam_src_init (GstRpiCamSrc *src)
gst_rpi_cam_src_init (GstRpiCamSrc * src)
{
gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
raspicapture_default_config(&src->capture_config);
gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
raspicapture_default_config (&src->capture_config);
src->capture_config.verbose = 1;
/* do-timestamping by default for now. FIXME: Implement proper timestamping */
gst_base_src_set_do_timestamp(GST_BASE_SRC(src), TRUE);
gst_base_src_set_do_timestamp (GST_BASE_SRC (src), TRUE);
}
static void
@ -330,70 +332,78 @@ gst_rpi_cam_src_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_BITRATE:
src->capture_config.bitrate = g_value_get_int(value);
src->capture_config.bitrate = g_value_get_int (value);
break;
case PROP_PREVIEW:
src->capture_config.preview_parameters.wantPreview = g_value_get_boolean(value);
src->capture_config.preview_parameters.wantPreview =
g_value_get_boolean (value);
break;
case PROP_PREVIEW_ENCODED:
src->capture_config.immutableInput = g_value_get_boolean(value);
src->capture_config.immutableInput = g_value_get_boolean (value);
break;
case PROP_FULLSCREEN:
src->capture_config.preview_parameters.wantFullScreenPreview = g_value_get_boolean(value);
src->capture_config.preview_parameters.wantFullScreenPreview =
g_value_get_boolean (value);
break;
case PROP_PREVIEW_OPACITY:
src->capture_config.preview_parameters.opacity = g_value_get_int(value);
src->capture_config.preview_parameters.opacity = g_value_get_int (value);
break;
case PROP_SHARPNESS:
src->capture_config.camera_parameters.sharpness = g_value_get_int(value);
src->capture_config.camera_parameters.sharpness = g_value_get_int (value);
break;
case PROP_CONTRAST:
src->capture_config.camera_parameters.contrast = g_value_get_int(value);
src->capture_config.camera_parameters.contrast = g_value_get_int (value);
break;
case PROP_BRIGHTNESS:
src->capture_config.camera_parameters.brightness = g_value_get_int(value);
src->capture_config.camera_parameters.brightness =
g_value_get_int (value);
break;
case PROP_SATURATION:
src->capture_config.camera_parameters.saturation = g_value_get_int(value);
src->capture_config.camera_parameters.saturation =
g_value_get_int (value);
break;
case PROP_ISO:
src->capture_config.camera_parameters.ISO = g_value_get_int(value);
src->capture_config.camera_parameters.ISO = g_value_get_int (value);
break;
case PROP_VIDEO_STABILISATION:
src->capture_config.camera_parameters.videoStabilisation = g_value_get_boolean(value);
src->capture_config.camera_parameters.videoStabilisation =
g_value_get_boolean (value);
break;
case PROP_EXPOSURE_COMPENSATION:
src->capture_config.camera_parameters.exposureCompensation = g_value_get_int(value);
src->capture_config.camera_parameters.exposureCompensation =
g_value_get_int (value);
break;
case PROP_EXPOSURE_MODE:
src->capture_config.camera_parameters.exposureMode = g_value_get_enum(value);
src->capture_config.camera_parameters.exposureMode =
g_value_get_enum (value);
break;
case PROP_EXPOSURE_METERING_MODE:
src->capture_config.camera_parameters.exposureMeterMode = g_value_get_enum(value);
src->capture_config.camera_parameters.exposureMeterMode =
g_value_get_enum (value);
break;
case PROP_ROTATION:
src->capture_config.camera_parameters.rotation = g_value_get_int(value);
src->capture_config.camera_parameters.rotation = g_value_get_int (value);
break;
case PROP_AWB_MODE:
src->capture_config.camera_parameters.awbMode = g_value_get_enum(value);
src->capture_config.camera_parameters.awbMode = g_value_get_enum (value);
break;
case PROP_HFLIP:
src->capture_config.camera_parameters.hflip = g_value_get_boolean(value);
src->capture_config.camera_parameters.hflip = g_value_get_boolean (value);
break;
case PROP_VFLIP:
src->capture_config.camera_parameters.vflip = g_value_get_boolean(value);
src->capture_config.camera_parameters.vflip = g_value_get_boolean (value);
break;
case PROP_ROI_X:
src->capture_config.camera_parameters.roi.x = g_value_get_float(value);
src->capture_config.camera_parameters.roi.x = g_value_get_float (value);
break;
case PROP_ROI_Y:
src->capture_config.camera_parameters.roi.y = g_value_get_float(value);
src->capture_config.camera_parameters.roi.y = g_value_get_float (value);
break;
case PROP_ROI_W:
src->capture_config.camera_parameters.roi.w = g_value_get_float(value);
src->capture_config.camera_parameters.roi.w = g_value_get_float (value);
break;
case PROP_ROI_H:
src->capture_config.camera_parameters.roi.h = g_value_get_float(value);
src->capture_config.camera_parameters.roi.h = g_value_get_float (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -409,70 +419,78 @@ gst_rpi_cam_src_get_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_BITRATE:
g_value_set_int(value, src->capture_config.bitrate);
g_value_set_int (value, src->capture_config.bitrate);
break;
case PROP_PREVIEW:
g_value_set_boolean(value, src->capture_config.preview_parameters.wantPreview);
g_value_set_boolean (value,
src->capture_config.preview_parameters.wantPreview);
break;
case PROP_PREVIEW_ENCODED:
g_value_set_boolean(value, src->capture_config.immutableInput);
g_value_set_boolean (value, src->capture_config.immutableInput);
break;
case PROP_FULLSCREEN:
g_value_set_boolean(value, src->capture_config.preview_parameters.wantFullScreenPreview);
g_value_set_boolean (value,
src->capture_config.preview_parameters.wantFullScreenPreview);
break;
case PROP_PREVIEW_OPACITY:
g_value_set_int(value, src->capture_config.preview_parameters.opacity);
g_value_set_int (value, src->capture_config.preview_parameters.opacity);
break;
case PROP_SHARPNESS:
g_value_set_int(value, src->capture_config.camera_parameters.sharpness);
g_value_set_int (value, src->capture_config.camera_parameters.sharpness);
break;
case PROP_CONTRAST:
g_value_set_int(value, src->capture_config.camera_parameters.contrast);
g_value_set_int (value, src->capture_config.camera_parameters.contrast);
break;
case PROP_BRIGHTNESS:
g_value_set_int(value, src->capture_config.camera_parameters.brightness);
g_value_set_int (value, src->capture_config.camera_parameters.brightness);
break;
case PROP_SATURATION:
g_value_set_int(value, src->capture_config.camera_parameters.saturation);
g_value_set_int (value, src->capture_config.camera_parameters.saturation);
break;
case PROP_ISO:
g_value_set_int(value, src->capture_config.camera_parameters.ISO);
g_value_set_int (value, src->capture_config.camera_parameters.ISO);
break;
case PROP_VIDEO_STABILISATION:
g_value_set_boolean(value, !!(src->capture_config.camera_parameters.videoStabilisation));
g_value_set_boolean (value,
! !(src->capture_config.camera_parameters.videoStabilisation));
break;
case PROP_EXPOSURE_COMPENSATION:
g_value_set_int(value, src->capture_config.camera_parameters.exposureCompensation);
g_value_set_int (value,
src->capture_config.camera_parameters.exposureCompensation);
break;
case PROP_EXPOSURE_MODE:
g_value_set_enum(value, src->capture_config.camera_parameters.exposureMode);
g_value_set_enum (value,
src->capture_config.camera_parameters.exposureMode);
break;
case PROP_EXPOSURE_METERING_MODE:
g_value_set_enum(value, src->capture_config.camera_parameters.exposureMeterMode);
g_value_set_enum (value,
src->capture_config.camera_parameters.exposureMeterMode);
break;
case PROP_ROTATION:
g_value_set_int(value, src->capture_config.camera_parameters.rotation);
g_value_set_int (value, src->capture_config.camera_parameters.rotation);
break;
case PROP_AWB_MODE:
g_value_set_enum(value, src->capture_config.camera_parameters.awbMode);
g_value_set_enum (value, src->capture_config.camera_parameters.awbMode);
break;
case PROP_HFLIP:
g_value_set_boolean(value, !!(src->capture_config.camera_parameters.hflip));
g_value_set_boolean (value,
! !(src->capture_config.camera_parameters.hflip));
break;
case PROP_VFLIP:
g_value_set_boolean(value, !!(src->capture_config.camera_parameters.vflip));
g_value_set_boolean (value,
! !(src->capture_config.camera_parameters.vflip));
break;
case PROP_ROI_X:
g_value_set_float(value, src->capture_config.camera_parameters.roi.x);
g_value_set_float (value, src->capture_config.camera_parameters.roi.x);
break;
case PROP_ROI_Y:
g_value_set_float(value, src->capture_config.camera_parameters.roi.y);
g_value_set_float (value, src->capture_config.camera_parameters.roi.y);
break;
case PROP_ROI_W:
g_value_set_float(value, src->capture_config.camera_parameters.roi.w);
g_value_set_float (value, src->capture_config.camera_parameters.roi.w);
break;
case PROP_ROI_H:
g_value_set_float(value, src->capture_config.camera_parameters.roi.h);
g_value_set_float (value, src->capture_config.camera_parameters.roi.h);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -481,11 +499,11 @@ gst_rpi_cam_src_get_property (GObject * object, guint prop_id,
}
static gboolean
gst_rpi_cam_src_start (GstBaseSrc *parent)
gst_rpi_cam_src_start (GstBaseSrc * parent)
{
GstRpiCamSrc *src = GST_RPICAMSRC(parent);
GstRpiCamSrc *src = GST_RPICAMSRC (parent);
g_print ("In src_start()\n");
src->capture_state = raspi_capture_setup(&src->capture_config);
src->capture_state = raspi_capture_setup (&src->capture_config);
if (src->capture_state == NULL)
return FALSE;
@ -493,65 +511,65 @@ gst_rpi_cam_src_start (GstBaseSrc *parent)
}
static gboolean
gst_rpi_cam_src_stop (GstBaseSrc *parent)
gst_rpi_cam_src_stop (GstBaseSrc * parent)
{
GstRpiCamSrc *src = GST_RPICAMSRC(parent);
GstRpiCamSrc *src = GST_RPICAMSRC (parent);
if (src->started)
raspi_capture_stop(src->capture_state);
raspi_capture_free(src->capture_state);
raspi_capture_stop (src->capture_state);
raspi_capture_free (src->capture_state);
src->capture_state = NULL;
return TRUE;
}
static GstCaps *
gst_rpi_cam_src_get_caps (GstBaseSrc *bsrc, GstCaps * filter)
gst_rpi_cam_src_get_caps (GstBaseSrc * bsrc, GstCaps * filter)
{
GstRpiCamSrc *src = GST_RPICAMSRC(bsrc);
GstRpiCamSrc *src = GST_RPICAMSRC (bsrc);
GstCaps *caps;
caps = gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (bsrc));
if (src->capture_state == NULL)
goto done;
/* FIXME: Retrieve limiting parameters from the camera module, max width/height fps-range */
caps = gst_caps_make_writable(caps);
caps = gst_caps_make_writable (caps);
gst_caps_set_simple (caps,
"width", GST_TYPE_INT_RANGE, 1, 1920,
"height", GST_TYPE_INT_RANGE, 1, 1080,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 60, 1,
NULL);
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 60, 1, NULL);
done:
GST_DEBUG_OBJECT(src, "get_caps returning %" GST_PTR_FORMAT, caps);
GST_DEBUG_OBJECT (src, "get_caps returning %" GST_PTR_FORMAT, caps);
return caps;
}
static gboolean
gst_rpi_cam_src_set_caps (GstBaseSrc *bsrc, GstCaps *caps)
gst_rpi_cam_src_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
{
GstRpiCamSrc *src = GST_RPICAMSRC(bsrc);
GstRpiCamSrc *src = GST_RPICAMSRC (bsrc);
GstVideoInfo info;
GST_DEBUG_OBJECT (src, "In set_caps %" GST_PTR_FORMAT, caps);
if (!gst_video_info_from_caps (&info, caps))
return FALSE;
src->capture_config.width = info.width;
src->capture_config.height = info.height;
src->capture_config.fps_n = info.fps_n;
src->capture_config.fps_d = info.fps_d;
return TRUE;
}
static gboolean gst_rpi_cam_src_decide_allocation (GstBaseSrc *bsrc,
GstQuery * query)
static gboolean
gst_rpi_cam_src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
{
g_print ("In decide_allocation\n");
return GST_BASE_SRC_CLASS (parent_class)->decide_allocation (bsrc, query);
}
static GstCaps *gst_rpi_cam_src_fixate (GstBaseSrc * basesrc, GstCaps * caps)
static GstCaps *
gst_rpi_cam_src_fixate (GstBaseSrc * basesrc, GstCaps * caps)
{
GstStructure *structure;
gint i;
@ -578,21 +596,22 @@ static GstCaps *gst_rpi_cam_src_fixate (GstBaseSrc * basesrc, GstCaps * caps)
}
static GstFlowReturn
gst_rpi_cam_src_create (GstPushSrc *parent, GstBuffer **buf)
gst_rpi_cam_src_create (GstPushSrc * parent, GstBuffer ** buf)
{
GstRpiCamSrc *src = GST_RPICAMSRC(parent);
GstRpiCamSrc *src = GST_RPICAMSRC (parent);
GstFlowReturn ret;
if (!src->started) {
if (!raspi_capture_start(src->capture_state))
if (!raspi_capture_start (src->capture_state))
return GST_FLOW_ERROR;
src->started = TRUE;
}
/* FIXME: Use custom allocator */
ret = raspi_capture_fill_buffer(src->capture_state, buf);
ret = raspi_capture_fill_buffer (src->capture_state, buf);
if (*buf)
GST_LOG_OBJECT(src, "Made buffer of size %" G_GSIZE_FORMAT "\n", gst_buffer_get_size(*buf));
GST_LOG_OBJECT (src, "Made buffer of size %" G_GSIZE_FORMAT "\n",
gst_buffer_get_size (*buf));
return ret;
}
@ -611,14 +630,8 @@ plugin_init (GstPlugin * rpicamsrc)
#define PACKAGE "gstrpicamsrc"
#endif
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
rpicamsrc,
"Raspberry Pi Camera Source",
plugin_init,
VERSION,
"LGPL",
"GStreamer",
"http://gstreamer.net/"
)
plugin_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/")