Ejemplo n.º 1
0
static void
gst_gl_sink_bin_set_property (GObject * object, guint prop_id,
    const GValue * value, GParamSpec * pspec)
{
  GstGLSinkBin *self = GST_GL_SINK_BIN (object);

  switch (prop_id) {
    case PROP_SINK:
    {
      GstElement *sink = g_value_get_object (value);
      if (self->sink)
        gst_bin_remove (GST_BIN (self), self->sink);
      self->sink = sink;
      if (sink) {
        gst_object_ref_sink (sink);
        _connect_sink_element (self);
      }
      break;
    }
    case PROP_CONTRAST:
    case PROP_BRIGHTNESS:
    case PROP_HUE:
    case PROP_SATURATION:
      if (self->balance)
        g_object_set_property (G_OBJECT (self->balance), pspec->name, value);
      break;
    default:
      if (self->sink)
        g_object_set_property (G_OBJECT (self->sink), pspec->name, value);
      break;
  }
}
Ejemplo n.º 2
0
static void
gst_gl_sink_bin_set_property (GObject * object, guint prop_id,
    const GValue * value, GParamSpec * pspec)
{
  GstGLSinkBin *self = GST_GL_SINK_BIN (object);

  switch (prop_id) {
    case PROP_SINK:
    {
      GstElement *sink = g_value_get_object (value);
      if (self->sink)
        gst_bin_remove (GST_BIN (self), self->sink);
      self->sink = sink;
      if (sink)
        _connect_sink_element (self);
      break;
    }
    case PROP_FORCE_ASPECT_RATIO:
      if (self->sink)
        g_object_set_property (G_OBJECT (self->sink), pspec->name, value);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}
Ejemplo n.º 3
0
static void
gst_gl_sink_bin_overlay_expose (GstVideoOverlay * overlay)
{
  GstGLSinkBin *self = GST_GL_SINK_BIN (overlay);
  GstVideoOverlay *overlay_element = NULL;

  overlay_element =
      GST_VIDEO_OVERLAY (gst_bin_get_by_interface (GST_BIN (self),
          GST_TYPE_VIDEO_OVERLAY));

  if (overlay_element) {
    gst_video_overlay_expose (overlay_element);
    gst_object_unref (overlay_element);
  }
}
Ejemplo n.º 4
0
static void
gst_gl_sink_bin_color_balance_set_value (GstColorBalance * balance,
    GstColorBalanceChannel * channel, gint value)
{
  GstGLSinkBin *self = GST_GL_SINK_BIN (balance);
  GstColorBalance *balance_element = NULL;

  balance_element =
      GST_COLOR_BALANCE (gst_bin_get_by_interface (GST_BIN (self),
          GST_TYPE_COLOR_BALANCE));

  if (balance_element) {
    gst_color_balance_set_value (balance_element, channel, value);
    gst_object_unref (balance_element);
  }
}
Ejemplo n.º 5
0
static void
gst_gl_sink_bin_overlay_set_render_rectangle (GstVideoOverlay * overlay, gint x,
    gint y, gint width, gint height)
{
  GstGLSinkBin *self = GST_GL_SINK_BIN (overlay);
  GstVideoOverlay *overlay_element = NULL;

  overlay_element =
      GST_VIDEO_OVERLAY (gst_bin_get_by_interface (GST_BIN (self),
          GST_TYPE_VIDEO_OVERLAY));

  if (overlay_element) {
    gst_video_overlay_set_render_rectangle (overlay_element, x, y, width,
        height);
    gst_object_unref (overlay_element);
  }
}
Ejemplo n.º 6
0
static GstColorBalanceType
gst_gl_sink_bin_color_balance_get_balance_type (GstColorBalance * balance)
{
  GstGLSinkBin *self = GST_GL_SINK_BIN (balance);
  GstColorBalance *balance_element = NULL;
  GstColorBalanceType type = 0;

  balance_element =
      GST_COLOR_BALANCE (gst_bin_get_by_interface (GST_BIN (self),
          GST_TYPE_COLOR_BALANCE));

  if (balance_element) {
    type = gst_color_balance_get_balance_type (balance_element);
    gst_object_unref (balance_element);
  }

  return type;
}
Ejemplo n.º 7
0
static const GList *
gst_gl_sink_bin_color_balance_list_channels (GstColorBalance * balance)
{
  GstGLSinkBin *self = GST_GL_SINK_BIN (balance);
  GstColorBalance *balance_element = NULL;
  const GList *list = NULL;

  balance_element =
      GST_COLOR_BALANCE (gst_bin_get_by_interface (GST_BIN (self),
          GST_TYPE_COLOR_BALANCE));

  if (balance_element) {
    list = gst_color_balance_list_channels (balance_element);
    gst_object_unref (balance_element);
  }

  return list;
}
Ejemplo n.º 8
0
static void
gst_gl_sink_bin_navigation_send_event (GstNavigation * navigation, GstStructure
    * structure)
{
  GstGLSinkBin *self = GST_GL_SINK_BIN (navigation);
  GstElement *nav =
      gst_bin_get_by_interface (GST_BIN (self), GST_TYPE_NAVIGATION);

  if (nav) {
    gst_navigation_send_event (GST_NAVIGATION (nav), structure);
    structure = NULL;
    gst_object_unref (nav);
  } else {
    GstEvent *event = gst_event_new_navigation (structure);
    structure = NULL;
    gst_element_send_event (GST_ELEMENT (self), event);
  }
}
Ejemplo n.º 9
0
static GstStateChangeReturn
gst_gl_sink_bin_change_state (GstElement * element, GstStateChange transition)
{
  GstGLSinkBin *self = GST_GL_SINK_BIN (element);
  GstGLSinkBinClass *klass = GST_GL_SINK_BIN_GET_CLASS (self);
  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;

  GST_DEBUG ("changing state: %s => %s",
      gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
      gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));

  switch (transition) {
    case GST_STATE_CHANGE_NULL_TO_READY:
      if (!self->sink) {
        if (klass->create_element)
          self->sink = klass->create_element ();

        if (!self->sink)
          g_signal_emit (element,
              gst_gl_sink_bin_signals[SIGNAL_CREATE_ELEMENT], 0, &self->sink);

        if (!self->sink) {
          GST_ERROR_OBJECT (element, "Failed to retrieve element");
          return GST_STATE_CHANGE_FAILURE;
        }
        if (!_connect_sink_element (self))
          return GST_STATE_CHANGE_FAILURE;
      }
      break;
    default:
      break;
  }

  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
  if (ret == GST_STATE_CHANGE_FAILURE)
    return ret;

  switch (transition) {
    default:
      break;
  }

  return ret;
}
Ejemplo n.º 10
0
static void
gst_gl_sink_bin_get_property (GObject * object, guint prop_id,
    GValue * value, GParamSpec * pspec)
{
  GstGLSinkBin *self = GST_GL_SINK_BIN (object);

  switch (prop_id) {
    case PROP_SINK:
      g_value_set_object (value, self->sink);
      break;
    case PROP_FORCE_ASPECT_RATIO:
      if (self->sink)
        g_object_get_property (G_OBJECT (self->sink), pspec->name, value);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}
Ejemplo n.º 11
0
static void
gst_gl_sink_bin_get_property (GObject * object, guint prop_id,
    GValue * value, GParamSpec * pspec)
{
  GstGLSinkBin *self = GST_GL_SINK_BIN (object);

  switch (prop_id) {
    case PROP_SINK:
      g_value_set_object (value, self->sink);
      break;
    case PROP_CONTRAST:
    case PROP_BRIGHTNESS:
    case PROP_HUE:
    case PROP_SATURATION:
      if (self->balance)
        g_object_get_property (G_OBJECT (self->balance), pspec->name, value);
      break;
    default:
      if (self->sink)
        g_object_get_property (G_OBJECT (self->sink), pspec->name, value);
      break;
  }
}