• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GST_STATE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GST_STATE函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_STATE函数的具体用法?C++ GST_STATE怎么用?C++ GST_STATE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GST_STATE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: gst_win_inet_src_set_property

static void
gst_win_inet_src_set_property (GObject * object, guint prop_id,
    const GValue * value, GParamSpec * pspec)
{
  GstWinInetSrc *self = GST_WIN_INET_SRC (object);

  switch (prop_id) {
    case PROP_LOCATION:
      if (GST_STATE (self) == GST_STATE_PLAYING ||
          GST_STATE (self) == GST_STATE_PAUSED) {
        GST_WARNING_OBJECT (self, "element must be in stopped or paused state "
            "in order to change location");
        break;
      }

      g_free (self->location);
      self->location = g_value_dup_string (value);
      break;

    case PROP_POLL_MODE:
      self->poll_mode = g_value_get_boolean (value);
      break;

    case PROP_IRADIO_MODE:
      self->iradio_mode = g_value_get_boolean (value);
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}
开发者ID:LCW523,项目名称:gst-plugins-bad,代码行数:32,代码来源:gstwininetsrc.c


示例2: gst_audio_echo_set_property

static void
gst_audio_echo_set_property (GObject * object, guint prop_id,
    const GValue * value, GParamSpec * pspec)
{
  GstAudioEcho *self = GST_AUDIO_ECHO (object);

  switch (prop_id) {
    case PROP_DELAY:{
      guint64 max_delay, delay;

      GST_BASE_TRANSFORM_LOCK (self);
      delay = g_value_get_uint64 (value);
      max_delay = self->max_delay;

      if (delay > max_delay && GST_STATE (self) > GST_STATE_READY) {
        GST_WARNING_OBJECT (self, "New delay (%" GST_TIME_FORMAT ") "
            "is larger than maximum delay (%" GST_TIME_FORMAT ")",
            GST_TIME_ARGS (delay), GST_TIME_ARGS (max_delay));
        self->delay = max_delay;
      } else {
        self->delay = delay;
        self->max_delay = MAX (delay, max_delay);
      }
      GST_BASE_TRANSFORM_UNLOCK (self);
    }
      break;
    case PROP_MAX_DELAY:{
      guint64 max_delay, delay;

      GST_BASE_TRANSFORM_LOCK (self);
      max_delay = g_value_get_uint64 (value);
      delay = self->delay;

      if (GST_STATE (self) > GST_STATE_READY) {
        GST_ERROR_OBJECT (self, "Can't change maximum delay in"
            " PLAYING or PAUSED state");
      } else {
        self->delay = delay;
        self->max_delay = max_delay;
      }
      GST_BASE_TRANSFORM_UNLOCK (self);
    }
      break;
    case PROP_INTENSITY:{
      GST_BASE_TRANSFORM_LOCK (self);
      self->intensity = g_value_get_float (value);
      GST_BASE_TRANSFORM_UNLOCK (self);
    }
      break;
    case PROP_FEEDBACK:{
      GST_BASE_TRANSFORM_LOCK (self);
      self->feedback = g_value_get_float (value);
      GST_BASE_TRANSFORM_UNLOCK (self);
    }
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}
开发者ID:TheBigW,项目名称:gst-plugins-good,代码行数:60,代码来源:audioecho.c


示例3: preview_draw_cb

G_MODULE_EXPORT gboolean
preview_draw_cb(
    GtkWidget *widget,
    cairo_t *cr,
    signal_user_data_t *ud)
{
#if defined(_ENABLE_GST)
#if GST_CHECK_VERSION(1, 0, 0)
    if (ud->preview->live_enabled && ud->preview->state == PREVIEW_STATE_LIVE)
    {
        if (GST_STATE(ud->preview->play) >= GST_STATE_PAUSED)
        {
            GstElement *vsink;
            GstVideoOverlay *vover;

            g_object_get(ud->preview->play, "video-sink", &vsink, NULL);
            if (GST_IS_BIN(vsink))
                vover = GST_VIDEO_OVERLAY(gst_bin_get_by_interface(
                                    GST_BIN(vsink), GST_TYPE_VIDEO_OVERLAY));
            else
                vover = GST_VIDEO_OVERLAY(vsink);
            gst_video_overlay_expose(vover);
            // For some reason, the exposed region doesn't always get
            // cleaned up here. But a delayed gst_x_overlay_expose()
            // takes care of it.
            g_idle_add((GSourceFunc)delayed_expose_cb, ud);
        }
        return FALSE;
    }
#else
    if (ud->preview->live_enabled && ud->preview->state == PREVIEW_STATE_LIVE)
    {
        if (GST_STATE(ud->preview->play) >= GST_STATE_PAUSED)
        {
            GstElement *vsink;
            GstXOverlay *xover;

            g_object_get(ud->preview->play, "video-sink", &vsink, NULL);
            if (GST_IS_BIN(vsink))
                xover = GST_X_OVERLAY(gst_bin_get_by_interface(
                                        GST_BIN(vsink), GST_TYPE_X_OVERLAY));
            else
                xover = GST_X_OVERLAY(vsink);
            gst_x_overlay_expose(xover);
            // For some reason, the exposed region doesn't always get
            // cleaned up here. But a delayed gst_x_overlay_expose()
            // takes care of it.
            g_idle_add((GSourceFunc)delayed_expose_cb, ud);
        }
        return FALSE;
    }
#endif
#endif

    if (ud->preview->pix != NULL)
    {
        _draw_pixbuf(cr, ud->preview->pix);
    }
    return FALSE;
}
开发者ID:TotalCaesar659,项目名称:HandBrake,代码行数:60,代码来源:preview.c


示例4: gst_gio_base_src_set_stream

void
gst_gio_base_src_set_stream (GstGioBaseSrc * src, GInputStream * stream)
{
  gboolean success;

  GError *err = NULL;

  g_return_if_fail (G_IS_INPUT_STREAM (stream));
  g_return_if_fail ((GST_STATE (src) != GST_STATE_PLAYING &&
          GST_STATE (src) != GST_STATE_PAUSED));

  if (G_IS_INPUT_STREAM (src->stream)) {
    GST_DEBUG_OBJECT (src, "closing old stream");

    /* FIXME: can block but unfortunately we can't use async operations
     * here because they require a running main loop */
    success = g_input_stream_close (src->stream, src->cancel, &err);

    if (!success && !gst_gio_error (src, "g_input_stream_close", &err, NULL)) {
      GST_ELEMENT_WARNING (src, RESOURCE, CLOSE, (NULL),
          ("g_input_stream_close failed: %s", err->message));
      g_clear_error (&err);
    } else if (!success) {
      GST_ELEMENT_WARNING (src, RESOURCE, CLOSE, (NULL),
          ("g_input_stream_close failed"));
    } else {
      GST_DEBUG_OBJECT (src, "g_input_stream_close succeeded");
    }

    g_object_unref (src->stream);
    src->stream = NULL;
  }

  src->stream = stream;
}
开发者ID:prajnashi,项目名称:gst-plugins-base,代码行数:35,代码来源:gstgiobasesrc.c


示例5: gst_jack_audio_src_set_property

static void
gst_jack_audio_src_set_property (GObject * object, guint prop_id,
    const GValue * value, GParamSpec * pspec)
{
  GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (object);

  switch (prop_id) {
    case PROP_CLIENT_NAME:
      g_free (src->client_name);
      src->client_name = g_value_dup_string (value);
      break;
    case PROP_CONNECT:
      src->connect = g_value_get_enum (value);
      break;
    case PROP_SERVER:
      g_free (src->server);
      src->server = g_value_dup_string (value);
      break;
    case PROP_CLIENT:
      if (GST_STATE (src) == GST_STATE_NULL ||
          GST_STATE (src) == GST_STATE_READY) {
        src->jclient = g_value_get_boxed (value);
      }
      break;
    case PROP_TRANSPORT:
      src->transport = g_value_get_flags (value);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}
开发者ID:matsu,项目名称:gst-plugins-good,代码行数:32,代码来源:gstjackaudiosrc.c


示例6: gst_gio_stream_sink_set_property

static void
gst_gio_stream_sink_set_property (GObject * object, guint prop_id,
    const GValue * value, GParamSpec * pspec)
{
  GstGioStreamSink *sink = GST_GIO_STREAM_SINK (object);

  switch (prop_id) {
    case PROP_STREAM:{
      GObject *stream;

      if (GST_STATE (sink) == GST_STATE_PLAYING ||
          GST_STATE (sink) == GST_STATE_PAUSED) {
        GST_WARNING
            ("Setting a new stream not supported in PLAYING or PAUSED state");
        break;
      }

      stream = g_value_dup_object (value);
      if (sink->stream)
        g_object_unref (sink->stream);
      sink->stream = G_OUTPUT_STREAM (stream);
      break;
    }
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}
开发者ID:Lachann,项目名称:gst-plugins-base,代码行数:28,代码来源:gstgiostreamsink.c


示例7: gst_imx_v4l2src_set_focus_mode

static gboolean gst_imx_v4l2src_set_focus_mode(GstPhotography *photo,
		GstPhotographyFocusMode focus_mode)
{
	GstImxV4l2VideoSrc *v4l2src = GST_IMX_V4L2SRC(photo);

	GST_LOG_OBJECT(v4l2src, "setting focus mode to %d", focus_mode);

	switch (focus_mode) {
	case GST_PHOTOGRAPHY_FOCUS_MODE_AUTO:
	case GST_PHOTOGRAPHY_FOCUS_MODE_MACRO:
	case GST_PHOTOGRAPHY_FOCUS_MODE_PORTRAIT:
	case GST_PHOTOGRAPHY_FOCUS_MODE_INFINITY:
		break;
	case GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL:
	case GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_EXTENDED:
		focus_mode = GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL;
		break;
	default:
		GST_WARNING_OBJECT(v4l2src, "focus mode %d is not supported", focus_mode);
		return FALSE;
	}

	g_mutex_lock(&v4l2src->af_mutex);

	if (v4l2src->focus_mode != focus_mode) {
		v4l2src->focus_mode = focus_mode;

		if (GST_STATE(v4l2src) == GST_STATE_PAUSED || GST_STATE(v4l2src) == GST_STATE_PLAYING)
			gst_imx_v4l2src_apply_focus_settings(v4l2src, TRUE);
	}

	g_mutex_unlock(&v4l2src->af_mutex);

	return TRUE;
}
开发者ID:kernevil,项目名称:gstreamer-imx,代码行数:35,代码来源:v4l2src.c


示例8: do_toggle_element

static gboolean
do_toggle_element (GstGConfVideoSrc * src)
{
  GstPad *targetpad;
  gchar *new_gconf_str;
  GstState cur, next;

  new_gconf_str = gst_gconf_get_string (GST_GCONF_AUDIOSRC_KEY);
  if (new_gconf_str != NULL && src->gconf_str != NULL &&
      (strlen (new_gconf_str) == 0 ||
          strcmp (src->gconf_str, new_gconf_str) == 0)) {
    g_free (new_gconf_str);
    GST_DEBUG_OBJECT (src, "GConf key was updated, but it didn't change");
    return TRUE;
  }

  GST_OBJECT_LOCK (src);
  cur = GST_STATE (src);
  next = GST_STATE_PENDING (src);
  GST_OBJECT_UNLOCK (src);

  if (cur >= GST_STATE_READY || next == GST_STATE_PAUSED) {
    GST_DEBUG_OBJECT (src, "already running, ignoring GConf change");
    g_free (new_gconf_str);
    return TRUE;
  }

  g_free (src->gconf_str);
  src->gconf_str = new_gconf_str;

  /* kill old element */
  if (src->kid) {
    GST_DEBUG_OBJECT (src, "Removing old kid");
    gst_element_set_state (src->kid, GST_STATE_NULL);
    gst_bin_remove (GST_BIN (src), src->kid);
    src->kid = NULL;
  }

  GST_DEBUG_OBJECT (src, "Creating new kid");
  if (!(src->kid = gst_gconf_get_default_video_src ())) {
    GST_ELEMENT_ERROR (src, LIBRARY, SETTINGS, (NULL),
        ("Failed to render video source from GConf"));
    g_free (src->gconf_str);
    src->gconf_str = NULL;
    return FALSE;
  }
  gst_element_set_state (src->kid, GST_STATE (src));
  gst_bin_add (GST_BIN (src), src->kid);

  /* re-attach ghostpad */
  GST_DEBUG_OBJECT (src, "Creating new ghostpad");
  targetpad = gst_element_get_static_pad (src->kid, "src");
  gst_ghost_pad_set_target (GST_GHOST_PAD (src->pad), targetpad);
  gst_object_unref (targetpad);
  GST_DEBUG_OBJECT (src, "done changing gconf video source");

  return TRUE;
}
开发者ID:JJCG,项目名称:gst-plugins-good,代码行数:58,代码来源:gstgconfvideosrc.c


示例9: gst_gio_src_set_property

static void
gst_gio_src_set_property (GObject * object, guint prop_id,
    const GValue * value, GParamSpec * pspec)
{
  GstGioSrc *src = GST_GIO_SRC (object);

  switch (prop_id) {
    case PROP_LOCATION:{
      const gchar *uri = NULL;

      if (GST_STATE (src) == GST_STATE_PLAYING ||
          GST_STATE (src) == GST_STATE_PAUSED) {
        GST_WARNING
            ("Setting a new location or GFile not supported in PLAYING or PAUSED state");
        break;
      }

      GST_OBJECT_LOCK (GST_OBJECT (src));
      if (src->file)
        g_object_unref (src->file);

      uri = g_value_get_string (value);

      if (uri) {
        src->file = g_file_new_for_uri (uri);

        if (!src->file) {
          GST_ERROR ("Could not create GFile for URI '%s'", uri);
        }
      } else {
        src->file = NULL;
      }
      GST_OBJECT_UNLOCK (GST_OBJECT (src));
      break;
    }
    case PROP_FILE:
      if (GST_STATE (src) == GST_STATE_PLAYING ||
          GST_STATE (src) == GST_STATE_PAUSED) {
        GST_WARNING
            ("Setting a new location or GFile not supported in PLAYING or PAUSED state");
        break;
      }

      GST_OBJECT_LOCK (GST_OBJECT (src));
      if (src->file)
        g_object_unref (src->file);

      src->file = g_value_dup_object (value);

      GST_OBJECT_UNLOCK (GST_OBJECT (src));
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}
开发者ID:ConfusedReality,项目名称:pkg_multimedia_gst-plugins-base,代码行数:56,代码来源:gstgiosrc.c


示例10: gst_gnome_vfs_src_set_property

static void
gst_gnome_vfs_src_set_property (GObject * object, guint prop_id,
    const GValue * value, GParamSpec * pspec)
{
  GstGnomeVFSSrc *src;

  src = GST_GNOME_VFS_SRC (object);

  switch (prop_id) {
    case ARG_LOCATION:{
      const gchar *new_location;

      /* the element must be stopped or paused in order to do this */
      if (GST_STATE (src) == GST_STATE_PLAYING ||
          GST_STATE (src) == GST_STATE_PAUSED)
        break;

      if (src->uri) {
        gnome_vfs_uri_unref (src->uri);
        src->uri = NULL;
      }
      if (src->uri_name) {
        g_free (src->uri_name);
        src->uri_name = NULL;
      }

      new_location = g_value_get_string (value);
      if (new_location) {
        src->uri_name = gst_gnome_vfs_location_to_uri_string (new_location);
        src->uri = gnome_vfs_uri_new (src->uri_name);
      }
      break;
    }
    case ARG_HANDLE:
      if (GST_STATE (src) == GST_STATE_NULL ||
          GST_STATE (src) == GST_STATE_READY) {
        if (src->uri) {
          gnome_vfs_uri_unref (src->uri);
          src->uri = NULL;
        }
        if (src->uri_name) {
          g_free (src->uri_name);
          src->uri_name = NULL;
        }
        src->handle = g_value_get_boxed (value);
      }
      break;
    case ARG_IRADIO_MODE:
      src->iradio_mode = g_value_get_boolean (value);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}
开发者ID:genesi,项目名称:gst-base-plugins,代码行数:55,代码来源:gstgnomevfssrc.c


示例11: gst_gnome_vfs_src_uri_set_uri

static gboolean
gst_gnome_vfs_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
{
  GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (handler);

  if (GST_STATE (src) == GST_STATE_PLAYING ||
      GST_STATE (src) == GST_STATE_PAUSED)
    return FALSE;

  g_object_set (G_OBJECT (src), "location", uri, NULL);

  return TRUE;
}
开发者ID:genesi,项目名称:gst-base-plugins,代码行数:13,代码来源:gstgnomevfssrc.c


示例12: rb_daap_src_uri_set_uri

static gboolean
rb_daap_src_uri_set_uri (GstURIHandler *handler,
			 const gchar *uri)
{
	RBDAAPSrc *src = RB_DAAP_SRC (handler);

	if (GST_STATE (src) == GST_STATE_PLAYING || GST_STATE (src) == GST_STATE_PAUSED) {
		return FALSE;
	}

	g_object_set (G_OBJECT (src), "location", uri, NULL);

	return TRUE;
}
开发者ID:AdamZ,项目名称:rhythmbox-magnatune,代码行数:14,代码来源:rb-daap-src.c


示例13: gst_auto_audio_sink_detect

static gboolean
gst_auto_audio_sink_detect (GstAutoAudioSink * sink)
{
  GstElement *esink;
  GstPad *targetpad;

  gst_auto_audio_sink_clear_kid (sink);

  /* find element */
  GST_DEBUG_OBJECT (sink, "Creating new kid");
  if (!(esink = gst_auto_audio_sink_find_best (sink)))
    goto no_sink;

  g_object_set (G_OBJECT (esink), "ts-offset", sink->ts_offset, NULL);

  sink->kid = esink;
  /* Ensure the child is brought up to the right state to match the parent
   * although it's currently always in READY and 
   * we're always doing NULL->READY. */
  if (GST_STATE (sink->kid) < GST_STATE (sink))
    gst_element_set_state (sink->kid, GST_STATE (sink));

  gst_bin_add (GST_BIN (sink), esink);

  /* attach ghost pad */
  GST_DEBUG_OBJECT (sink, "Re-assigning ghostpad");
  targetpad = gst_element_get_static_pad (sink->kid, "sink");
  if (!gst_ghost_pad_set_target (GST_GHOST_PAD (sink->pad), targetpad))
    goto target_failed;

  gst_object_unref (targetpad);
  GST_DEBUG_OBJECT (sink, "done changing auto audio sink");

  return TRUE;

  /* ERRORS */
no_sink:
  {
    GST_ELEMENT_ERROR (sink, LIBRARY, INIT, (NULL),
        ("Failed to find a supported audio sink"));
    return FALSE;
  }
target_failed:
  {
    GST_ELEMENT_ERROR (sink, LIBRARY, INIT, (NULL),
        ("Failed to set target pad"));
    gst_object_unref (targetpad);
    return FALSE;
  }
}
开发者ID:PeterXu,项目名称:gst-mobile,代码行数:50,代码来源:gstautoaudiosink.c


示例14: rbspotifysrc_uri_set_uri

static gboolean
rbspotifysrc_uri_set_uri (GstURIHandler *handler,
			 const gchar *uri)
{
	RBSpotifySrc *src = RBSPOTIFYSRC (handler);

	if (GST_STATE (src) == GST_STATE_PLAYING || GST_STATE (src) == GST_STATE_PAUSED) {
		return FALSE;
	}

	g_object_set (G_OBJECT (src), "uri", uri, NULL);

	return TRUE;
}
开发者ID:ivankelly,项目名称:Rhythmbox-Spotify-Plugin,代码行数:14,代码来源:rb-spotify-src.c


示例15: rb_mtp_src_uri_set_uri

static gboolean
rb_mtp_src_uri_set_uri (GstURIHandler *handler, const gchar *uri)
{
	RBMTPSrc *src = RB_MTP_SRC (handler);

	if (GST_STATE (src) == GST_STATE_PLAYING || GST_STATE (src) == GST_STATE_PAUSED) {
		return FALSE;
	}

	if (g_str_has_prefix (uri, "xrbmtp://") == FALSE) {
		return FALSE;
	}

	return rb_mtp_src_set_uri (src, uri);
}
开发者ID:dardevelin,项目名称:rhythmbox-gnome-fork,代码行数:15,代码来源:rb-mtp-gst-src.c


示例16: kms_audio_mixer_remove_sometimes_src_pad

static void
kms_audio_mixer_remove_sometimes_src_pad (KmsAudioMixer * self,
    GstElement * adder)
{
  GstProxyPad *internal;
  GstPad *srcpad, *peer;

  srcpad = gst_element_get_static_pad (adder, "src");
  peer = gst_pad_get_peer (srcpad);
  if (peer == NULL)
    goto end_phase_1;

  internal = gst_proxy_pad_get_internal ((GstProxyPad *) peer);
  if (internal == NULL)
    goto end_phase_2;

  gst_ghost_pad_set_target (GST_GHOST_PAD (internal), NULL);

  if (GST_STATE (self) < GST_STATE_PAUSED
      || GST_STATE_PENDING (self) < GST_STATE_PAUSED
      || GST_STATE_TARGET (self) < GST_STATE_PAUSED) {
    gst_pad_set_active (GST_PAD (internal), FALSE);
  }

  GST_DEBUG ("Removing source pad %" GST_PTR_FORMAT, internal);

  gst_element_remove_pad (GST_ELEMENT (self), GST_PAD (internal));
  gst_object_unref (internal);

end_phase_2:
  gst_object_unref (peer);

end_phase_1:
  gst_object_unref (srcpad);
}
开发者ID:KennyDark,项目名称:kms-core,代码行数:35,代码来源:kmsaudiomixer.c


示例17: gst_rtmp_sink_uri_set_uri

static gboolean
gst_rtmp_sink_uri_set_uri (GstURIHandler * handler, const gchar * uri)
{
  GstRTMPSink *sink = GST_RTMP_SINK (handler);

  if (GST_STATE (sink) >= GST_STATE_PAUSED)
    return FALSE;

  g_free (sink->uri);
  sink->uri = NULL;

  if (uri != NULL) {
    int protocol;
    AVal host;
    unsigned int port;
    AVal playpath, app;

    if (!RTMP_ParseURL (uri, &protocol, &host, &port, &playpath, &app) ||
        !host.av_len || !playpath.av_len) {
      GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
          ("Failed to parse URI %s", uri), (NULL));
      return FALSE;
    }
    sink->uri = g_strdup (uri);
  }

  GST_DEBUG_OBJECT (sink, "Changed URI to %s", GST_STR_NULL (uri));

  return TRUE;
}
开发者ID:dylansong77,项目名称:gstreamer,代码行数:30,代码来源:gstrtmpsink.c


示例18: do_toggle_element

static gboolean
do_toggle_element (GstHalAudioSink * sink)
{
  GstPad *targetpad;

  /* kill old element */
  if (sink->kid) {
    GST_DEBUG_OBJECT (sink, "Removing old kid");
    gst_element_set_state (sink->kid, GST_STATE_NULL);
    gst_bin_remove (GST_BIN (sink), sink->kid);
    sink->kid = NULL;
  }

  GST_DEBUG_OBJECT (sink, "Creating new kid");
  if (!sink->udi)
    GST_INFO_OBJECT (sink, "No UDI set for device, using default one");

  if (!(sink->kid = gst_hal_get_audio_sink (sink->udi))) {
    GST_ELEMENT_ERROR (sink, LIBRARY, SETTINGS, (NULL),
        ("Failed to render audio sink from Hal"));
    return FALSE;
  }
  gst_element_set_state (sink->kid, GST_STATE (sink));
  gst_bin_add (GST_BIN (sink), sink->kid);

  /* re-attach ghostpad */
  GST_DEBUG_OBJECT (sink, "Creating new ghostpad");
  targetpad = gst_element_get_static_pad (sink->kid, "sink");
  gst_ghost_pad_set_target (GST_GHOST_PAD (sink->pad), targetpad);
  gst_object_unref (targetpad);
  GST_DEBUG_OBJECT (sink, "done changing hal audio sink");

  return TRUE;
}
开发者ID:dgerlach,项目名称:gst-plugins-good,代码行数:34,代码来源:gsthalaudiosink.c


示例19: kms_hub_port_generate_sink_pad

static GstPad *
kms_hub_port_generate_sink_pad (GstElement * element,
    GstPadTemplate * templ, const gchar * name, const GstCaps * caps,
    GstElement * output)
{
  GstPad *output_pad, *pad;

  output_pad = gst_element_get_static_pad (output, "sink");
  pad = gst_ghost_pad_new_from_template (name, output_pad, templ);
  g_object_unref (output_pad);

  if (GST_STATE (element) >= GST_STATE_PAUSED
      || GST_STATE_PENDING (element) >= GST_STATE_PAUSED
      || GST_STATE_TARGET (element) >= GST_STATE_PAUSED) {
    gst_pad_set_active (pad, TRUE);
  }

  if (gst_element_add_pad (element, pad))
    return pad;

  GST_ERROR_OBJECT (element, "Cannot add pad %" GST_PTR_FORMAT, pad);
  g_object_unref (pad);

  return NULL;
}
开发者ID:Kurento,项目名称:kms-core,代码行数:25,代码来源:kmshubport.c


示例20: shmdata_base_reader_clean_element

//FIXME this should be part of the library
void
shmdata_base_reader_clean_element (GstElement *element)
{
    if (element != NULL && GST_IS_ELEMENT(element)
            && GST_STATE_CHANGE_FAILURE != GST_STATE_RETURN(element)) {
        {   // unlinking pads
            GstIterator *pad_iter = gst_element_iterate_pads(element);
            gst_iterator_foreach(pad_iter, (GFunc) shmdata_base_reader_unlink_pad, NULL);
            gst_iterator_free(pad_iter);
        }
        {   // releasing request pads
            GstIterator *pad_iter = gst_element_iterate_pads(element);
            gst_iterator_foreach(pad_iter,
                                 (GFunc) shmdata_base_reader_release_request_pad,
                                 element);
            gst_iterator_free(pad_iter);
        }

        GstState state = GST_STATE_TARGET(element);
        if (state != GST_STATE_NULL) {
            if (GST_STATE_CHANGE_ASYNC ==
                    gst_element_set_state(element, GST_STATE_NULL)) {
                while (GST_STATE(element) != GST_STATE_NULL) {
                    // warning this may be blocking
                    gst_element_get_state(element, NULL, NULL,
                                          GST_CLOCK_TIME_NONE);
                }
            }
        }
        if (GST_IS_BIN(gst_element_get_parent(element)))
            gst_bin_remove(GST_BIN(gst_element_get_parent(element)), element);
        else
            gst_object_unref(element);
    }
}
开发者ID:step21,项目名称:shmdata,代码行数:36,代码来源:base-reader.c



注:本文中的GST_STATE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GST_STATIC_CAPS函数代码示例发布时间:2022-05-30
下一篇:
C++ GST_RTSP_MEDIA_FACTORY_LOCK函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap