Example #1
0
static void
gst_base_camera_src_start_capture (GstBaseCameraSrc * src)
{
  GstBaseCameraSrcClass *klass = GST_BASE_CAMERA_SRC_GET_CLASS (src);

  g_return_if_fail (klass->start_capture != NULL);

  GST_DEBUG_OBJECT (src, "Starting capture");

  g_mutex_lock (src->capturing_mutex);
  if (src->capturing) {
    GST_WARNING_OBJECT (src, "Capturing already ongoing");
    g_mutex_unlock (src->capturing_mutex);
    return;
  }

  src->capturing = TRUE;
  g_object_notify (G_OBJECT (src), "ready-for-capture");
  if (klass->start_capture (src)) {
    GST_DEBUG_OBJECT (src, "Capture started");
  } else {
    src->capturing = FALSE;
    g_object_notify (G_OBJECT (src), "ready-for-capture");
    GST_WARNING_OBJECT (src, "Failed to start capture");
  }
  g_mutex_unlock (src->capturing_mutex);
}
Example #2
0
static gboolean
setup_pipeline (GstBaseCameraSrc * self)
{
  GstBaseCameraSrcClass *bclass = GST_BASE_CAMERA_SRC_GET_CLASS (self);
  if (bclass->setup_pipeline)
    return bclass->setup_pipeline (self);
  return TRUE;
}
Example #3
0
/**
 * gst_base_camera_src_get_allowed_input_caps:
 * @self: the camerasrc bin
 *
 * Retrieve caps from videosrc describing formats it supports
 *
 * Returns: caps object from videosrc
 */
GstCaps *
gst_base_camera_src_get_allowed_input_caps (GstBaseCameraSrc * self)
{
  GstBaseCameraSrcClass *bclass = GST_BASE_CAMERA_SRC_GET_CLASS (self);

  g_return_val_if_fail (bclass->get_allowed_input_caps, NULL);

  return bclass->get_allowed_input_caps (self);
}
/**
 * gst_base_camera_src_setup_zoom:
 * @self: camerasrc object
 *
 * Apply zoom configured to camerabin to capture.
 */
void
gst_base_camera_src_setup_zoom (GstBaseCameraSrc * self)
{
  GstBaseCameraSrcClass *bclass = GST_BASE_CAMERA_SRC_GET_CLASS (self);

  g_return_if_fail (self->zoom);
  g_return_if_fail (bclass->set_zoom);

  bclass->set_zoom (self, self->zoom);
}
Example #5
0
/**
 * gst_base_camera_src_setup_zoom:
 * @self: camerasrc object
 *
 * Apply zoom configured to camerabin to capture.
 */
void
gst_base_camera_src_setup_zoom (GstBaseCameraSrc * self)
{
  GstBaseCameraSrcClass *bclass = GST_BASE_CAMERA_SRC_GET_CLASS (self);
  gint zoom;

  zoom = g_atomic_int_get (&self->zoom);

  g_return_if_fail (zoom);
  g_return_if_fail (bclass->set_zoom);

  bclass->set_zoom (self, zoom);
}
Example #6
0
/**
 * gst_base_camera_src_set_mode:
 * @self: the camerasrc bin
 * @mode: the mode
 *
 * Set the chosen #GstCameraBinMode capture mode.
 */
gboolean
gst_base_camera_src_set_mode (GstBaseCameraSrc * self, GstCameraBinMode mode)
{
  GstBaseCameraSrcClass *bclass = GST_BASE_CAMERA_SRC_GET_CLASS (self);

  g_return_val_if_fail (bclass->set_mode, FALSE);

  if (bclass->set_mode (self, mode)) {
    self->mode = mode;
    return TRUE;
  }
  return FALSE;
}
Example #7
0
static gboolean
construct_pipeline (GstBaseCameraSrc * self)
{
  GstBaseCameraSrcClass *bclass = GST_BASE_CAMERA_SRC_GET_CLASS (self);

  if (bclass->construct_pipeline) {
    if (!bclass->construct_pipeline (self)) {
      GST_ERROR_OBJECT (self, "pipeline construction failed");
      return FALSE;
    }
  }

  return TRUE;
}
/**
 * gst_base_camera_src_setup_preview:
 * @self: camerasrc bin
 * @preview_caps: preview caps to set
 *
 * Apply preview caps to preview pipeline and to video source.
 */
void
gst_base_camera_src_setup_preview (GstBaseCameraSrc * self,
    GstCaps * preview_caps)
{
  GstBaseCameraSrcClass *bclass = GST_BASE_CAMERA_SRC_GET_CLASS (self);

  if (self->preview_pipeline) {
    GST_DEBUG_OBJECT (self,
        "Setting preview pipeline caps %" GST_PTR_FORMAT, self->preview_caps);
    gst_camerabin_preview_set_caps (self->preview_pipeline, preview_caps);
  }

  if (bclass->set_preview)
    bclass->set_preview (self, preview_caps);
}
Example #9
0
static void
gst_base_camera_src_stop_capture (GstBaseCameraSrc * src)
{
  GstBaseCameraSrcClass *klass = GST_BASE_CAMERA_SRC_GET_CLASS (src);

  g_return_if_fail (klass->stop_capture != NULL);

  g_mutex_lock (src->capturing_mutex);
  if (!src->capturing) {
    GST_DEBUG_OBJECT (src, "No ongoing capture");
    g_mutex_unlock (src->capturing_mutex);
    return;
  }
  klass->stop_capture (src);
  g_mutex_unlock (src->capturing_mutex);
}