Blame gst/gststreams.c

Packit f546b1
/* GStreamer
Packit f546b1
 *
Packit f546b1
 * Copyright (C) 2015 Centricular Ltd
Packit f546b1
 *  @author: Edward Hervey <edward@centricular.com>
Packit f546b1
 *  @author: Jan Schmidt <jan@centricular.com>
Packit f546b1
 *
Packit f546b1
 * gststreams.c: GstStream and GstStreamCollection object and methods
Packit f546b1
 *
Packit f546b1
 * This library is free software; you can redistribute it and/or
Packit f546b1
 * modify it under the terms of the GNU Library General Public
Packit f546b1
 * License as published by the Free Software Foundation; either
Packit f546b1
 * version 2 of the License, or (at your option) any later version.
Packit f546b1
 *
Packit f546b1
 * This library is distributed in the hope that it will be useful,
Packit f546b1
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit f546b1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit f546b1
 * Library General Public License for more details.
Packit f546b1
 *
Packit f546b1
 * You should have received a copy of the GNU Library General Public
Packit f546b1
 * License along with this library; if not, write to the
Packit f546b1
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit f546b1
 * Boston, MA 02110-1301, USA.
Packit f546b1
 *
Packit f546b1
 * MT safe.
Packit f546b1
 */
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * SECTION:gststreams
Packit f546b1
 * @title: GstStreams
Packit f546b1
 * @short_description: Base class for stream objects
Packit f546b1
 *
Packit f546b1
 * A #GstStream is a high-level object defining a stream of data which is, or
Packit f546b1
 * can be, present in a #GstPipeline.
Packit f546b1
 *
Packit f546b1
 * It is defined by a unique identifier, a "Stream ID". A #GstStream does not
Packit f546b1
 * automatically imply the stream is present within a pipeline or element.
Packit f546b1
 *
Packit f546b1
 * Any element that can introduce new streams in a pipeline should create the
Packit f546b1
 * appropriate #GstStream object, and can convey that object via the
Packit f546b1
 * %GST_EVENT_STREAM_START event and/or the #GstStreamCollection.
Packit f546b1
 *
Packit f546b1
 * Elements that do not modify the nature of the stream can add extra information
Packit f546b1
 * on it (such as enrich the #GstCaps, or #GstTagList). This is typically done
Packit f546b1
 * by parsing elements.
Packit f546b1
 *
Packit f546b1
 * Since: 1.10
Packit f546b1
 */
Packit f546b1
Packit f546b1
#include "gst_private.h"
Packit f546b1
Packit f546b1
#include "gstenumtypes.h"
Packit f546b1
#include "gstevent.h"
Packit f546b1
#include "gststreams.h"
Packit f546b1
Packit f546b1
GST_DEBUG_CATEGORY_STATIC (streams_debug);
Packit f546b1
#define GST_CAT_DEFAULT streams_debug
Packit f546b1
Packit f546b1
#define GST_STREAM_GET_PRIVATE(obj)  \
Packit f546b1
   (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_STREAM, GstStreamPrivate))
Packit f546b1
Packit f546b1
struct _GstStreamPrivate
Packit f546b1
{
Packit f546b1
  GstStreamFlags flags;
Packit f546b1
  GstStreamType type;
Packit f546b1
  GstTagList *tags;
Packit f546b1
  GstCaps *caps;
Packit f546b1
};
Packit f546b1
Packit f546b1
/* stream signals and properties */
Packit f546b1
enum
Packit f546b1
{
Packit f546b1
  LAST_SIGNAL
Packit f546b1
};
Packit f546b1
Packit f546b1
enum
Packit f546b1
{
Packit f546b1
  PROP_0,
Packit f546b1
  PROP_STREAM_ID,
Packit f546b1
  PROP_STREAM_FLAGS,
Packit f546b1
  PROP_STREAM_TYPE,
Packit f546b1
  PROP_TAGS,
Packit f546b1
  PROP_CAPS,
Packit f546b1
  PROP_LAST
Packit f546b1
};
Packit f546b1
Packit f546b1
static GParamSpec *gst_stream_pspecs[PROP_LAST] = { 0 };
Packit f546b1
Packit f546b1
#if 0
Packit f546b1
static guint gst_stream_signals[LAST_SIGNAL] = { 0 };
Packit f546b1
#endif
Packit f546b1
Packit f546b1
static void gst_stream_finalize (GObject * object);
Packit f546b1
Packit f546b1
static void gst_stream_set_property (GObject * object, guint prop_id,
Packit f546b1
    const GValue * value, GParamSpec * pspec);
Packit f546b1
static void gst_stream_get_property (GObject * object, guint prop_id,
Packit f546b1
    GValue * value, GParamSpec * pspec);
Packit f546b1
Packit f546b1
#define _do_init				\
Packit f546b1
{ \
Packit f546b1
  GST_DEBUG_CATEGORY_INIT (streams_debug, "streams", GST_DEBUG_BOLD, \
Packit f546b1
      "debugging info for the stream and stream collection objects"); \
Packit f546b1
  \
Packit f546b1
}
Packit f546b1
Packit f546b1
#define gst_stream_parent_class parent_class
Packit f546b1
G_DEFINE_TYPE_WITH_CODE (GstStream, gst_stream, GST_TYPE_OBJECT, _do_init);
Packit f546b1
Packit f546b1
static void
Packit f546b1
gst_stream_class_init (GstStreamClass * klass)
Packit f546b1
{
Packit f546b1
  GObjectClass *gobject_class;
Packit f546b1
Packit f546b1
  gobject_class = (GObjectClass *) klass;
Packit f546b1
Packit f546b1
  g_type_class_add_private (klass, sizeof (GstStreamPrivate));
Packit f546b1
Packit f546b1
  gobject_class->set_property = gst_stream_set_property;
Packit f546b1
  gobject_class->get_property = gst_stream_get_property;
Packit f546b1
Packit f546b1
  /**
Packit f546b1
   * GstStream:stream-id:
Packit f546b1
   *
Packit f546b1
   * The unique identifier of the #GstStream. Can only be set at construction
Packit f546b1
   * time.
Packit f546b1
   */
Packit f546b1
  g_object_class_install_property (gobject_class, PROP_STREAM_ID,
Packit f546b1
      g_param_spec_string ("stream-id", "Stream ID",
Packit f546b1
          "The stream ID of the stream",
Packit f546b1
          NULL,
Packit f546b1
          G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
Packit f546b1
Packit f546b1
  /**
Packit f546b1
   * GstStream:flags:
Packit f546b1
   *
Packit f546b1
   * The #GstStreamFlags of the #GstStream. Can only be set at construction time.
Packit f546b1
   **/
Packit f546b1
  gst_stream_pspecs[PROP_STREAM_FLAGS] =
Packit f546b1
      g_param_spec_flags ("stream-flags", "Stream Flags", "The stream flags",
Packit f546b1
      GST_TYPE_STREAM_FLAGS, GST_STREAM_FLAG_NONE,
Packit f546b1
      G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
Packit f546b1
  g_object_class_install_property (gobject_class, PROP_STREAM_FLAGS,
Packit f546b1
      gst_stream_pspecs[PROP_STREAM_FLAGS]);
Packit f546b1
Packit f546b1
  /**
Packit f546b1
   * GstStream:stream-type:
Packit f546b1
   *
Packit f546b1
   * The #GstStreamType of the #GstStream. Can only be set at construction time.
Packit f546b1
   **/
Packit f546b1
  gst_stream_pspecs[PROP_STREAM_TYPE] =
Packit f546b1
      g_param_spec_flags ("stream-type", "Stream Type", "The type of stream",
Packit f546b1
      GST_TYPE_STREAM_TYPE, GST_STREAM_TYPE_UNKNOWN,
Packit f546b1
      G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
Packit f546b1
  g_object_class_install_property (gobject_class, PROP_STREAM_TYPE,
Packit f546b1
      gst_stream_pspecs[PROP_STREAM_TYPE]);
Packit f546b1
Packit f546b1
  /**
Packit f546b1
   * GstStream:caps:
Packit f546b1
   *
Packit f546b1
   * The #GstCaps of the #GstStream.
Packit f546b1
   **/
Packit f546b1
  gst_stream_pspecs[PROP_CAPS] =
Packit f546b1
      g_param_spec_boxed ("caps", "Caps", "The caps of the stream",
Packit f546b1
      GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
Packit f546b1
  g_object_class_install_property (gobject_class, PROP_CAPS,
Packit f546b1
      gst_stream_pspecs[PROP_CAPS]);
Packit f546b1
Packit f546b1
  /**
Packit f546b1
   * GstStream:tags:
Packit f546b1
   *
Packit f546b1
   * The #GstTagList of the #GstStream.
Packit f546b1
   **/
Packit f546b1
  gst_stream_pspecs[PROP_TAGS] =
Packit f546b1
      g_param_spec_boxed ("tags", "Tags", "The tags of the stream",
Packit f546b1
      GST_TYPE_TAG_LIST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
Packit f546b1
  g_object_class_install_property (gobject_class, PROP_TAGS,
Packit f546b1
      gst_stream_pspecs[PROP_TAGS]);
Packit f546b1
Packit f546b1
  gobject_class->finalize = gst_stream_finalize;
Packit f546b1
}
Packit f546b1
Packit f546b1
static void
Packit f546b1
gst_stream_init (GstStream * stream)
Packit f546b1
{
Packit f546b1
  stream->priv = GST_STREAM_GET_PRIVATE (stream);
Packit f546b1
  stream->priv->type = GST_STREAM_TYPE_UNKNOWN;
Packit f546b1
}
Packit f546b1
Packit f546b1
static void
Packit f546b1
gst_stream_finalize (GObject * object)
Packit f546b1
{
Packit f546b1
  GstStream *stream = GST_STREAM_CAST (object);
Packit f546b1
Packit f546b1
  gst_mini_object_replace ((GstMiniObject **) & stream->priv->tags,
Packit f546b1
      (GstMiniObject *) NULL);
Packit f546b1
  gst_caps_replace (&stream->priv->caps, NULL);
Packit f546b1
  g_free ((gchar *) stream->stream_id);
Packit f546b1
Packit f546b1
  G_OBJECT_CLASS (parent_class)->finalize (object);
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_stream_new:
Packit f546b1
 * @stream_id: (allow-none): the id for the new stream. If %NULL,
Packit f546b1
 * a new one will be automatically generated
Packit f546b1
 * @caps: (allow-none) (transfer none): the #GstCaps of the stream
Packit f546b1
 * @type: the #GstStreamType of the stream
Packit f546b1
 * @flags: the #GstStreamFlags of the stream
Packit f546b1
 *
Packit f546b1
 * Create a new #GstStream for the given @stream_id, @caps, @type
Packit f546b1
 * and @flags
Packit f546b1
 *
Packit f546b1
 * Returns: (transfer full): The new #GstStream
Packit f546b1
 *
Packit f546b1
 * Since: 1.10
Packit f546b1
 */
Packit f546b1
GstStream *
Packit f546b1
gst_stream_new (const gchar * stream_id, GstCaps * caps, GstStreamType type,
Packit f546b1
    GstStreamFlags flags)
Packit f546b1
{
Packit f546b1
  GstStream *stream;
Packit f546b1
Packit f546b1
  stream = g_object_new (GST_TYPE_STREAM, "stream-id", stream_id, "caps", caps,
Packit f546b1
      "stream-type", type, "stream-flags", flags, NULL);
Packit f546b1
Packit f546b1
  /* Clear floating flag */
Packit f546b1
  gst_object_ref_sink (stream);
Packit f546b1
Packit f546b1
  return stream;
Packit f546b1
}
Packit f546b1
Packit f546b1
static void
Packit f546b1
gst_stream_set_stream_id (GstStream * stream, const gchar * stream_id)
Packit f546b1
{
Packit f546b1
  GST_OBJECT_LOCK (stream);
Packit f546b1
  g_assert (stream->stream_id == NULL);
Packit f546b1
  if (stream_id)
Packit f546b1
    stream->stream_id = g_strdup (stream_id);
Packit f546b1
  else {
Packit f546b1
    /* Create a randoom stream_id if NULL */
Packit f546b1
    GST_FIXME_OBJECT (stream, "Creating random stream-id, consider "
Packit f546b1
        "implementing a deterministic way of creating a stream-id");
Packit f546b1
    stream->stream_id =
Packit f546b1
        g_strdup_printf ("%08x%08x%08x%08x", g_random_int (), g_random_int (),
Packit f546b1
        g_random_int (), g_random_int ());
Packit f546b1
  }
Packit f546b1
Packit f546b1
  GST_OBJECT_UNLOCK (stream);
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_stream_get_stream_id:
Packit f546b1
 * @stream: a #GstStream
Packit f546b1
 *
Packit f546b1
 * Returns the stream ID of @stream.
Packit f546b1
 *
Packit f546b1
 * Returns: (transfer none) (nullable): the stream ID of @stream. Only valid
Packit f546b1
 * during the lifetime of @stream.
Packit f546b1
 *
Packit f546b1
 * Since: 1.10
Packit f546b1
 */
Packit f546b1
const gchar *
Packit f546b1
gst_stream_get_stream_id (GstStream * stream)
Packit f546b1
{
Packit f546b1
  return stream->stream_id;
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_stream_set_stream_flags:
Packit f546b1
 * @stream: a #GstStream
Packit f546b1
 * @flags: the flags to set on @stream
Packit f546b1
 *
Packit f546b1
 * Set the @flags for the @stream.
Packit f546b1
 *
Packit f546b1
 * Since: 1.10
Packit f546b1
 */
Packit f546b1
void
Packit f546b1
gst_stream_set_stream_flags (GstStream * stream, GstStreamFlags flags)
Packit f546b1
{
Packit f546b1
  GST_OBJECT_LOCK (stream);
Packit f546b1
  stream->priv->flags = flags;
Packit f546b1
  GST_OBJECT_UNLOCK (stream);
Packit f546b1
Packit f546b1
  g_object_notify_by_pspec (G_OBJECT (stream),
Packit f546b1
      gst_stream_pspecs[PROP_STREAM_FLAGS]);
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_stream_get_stream_flags:
Packit f546b1
 * @stream: a #GstStream
Packit f546b1
 *
Packit f546b1
 * Retrieve the current stream flags for @stream
Packit f546b1
 *
Packit f546b1
 * Returns: The #GstStreamFlags for @stream
Packit f546b1
 *
Packit f546b1
 * Since: 1.10
Packit f546b1
 */
Packit f546b1
GstStreamFlags
Packit f546b1
gst_stream_get_stream_flags (GstStream * stream)
Packit f546b1
{
Packit f546b1
  GstStreamFlags res;
Packit f546b1
Packit f546b1
  GST_OBJECT_LOCK (stream);
Packit f546b1
  res = stream->priv->flags;
Packit f546b1
  GST_OBJECT_UNLOCK (stream);
Packit f546b1
Packit f546b1
  return res;
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_stream_set_stream_type:
Packit f546b1
 * @stream: a #GstStream
Packit f546b1
 * @stream_type: the type to set on @stream
Packit f546b1
 *
Packit f546b1
 * Set the stream type of @stream
Packit f546b1
 *
Packit f546b1
 * Since: 1.10
Packit f546b1
 */
Packit f546b1
void
Packit f546b1
gst_stream_set_stream_type (GstStream * stream, GstStreamType stream_type)
Packit f546b1
{
Packit f546b1
  GST_OBJECT_LOCK (stream);
Packit f546b1
  stream->priv->type = stream_type;
Packit f546b1
  GST_OBJECT_UNLOCK (stream);
Packit f546b1
Packit f546b1
  g_object_notify_by_pspec (G_OBJECT (stream),
Packit f546b1
      gst_stream_pspecs[PROP_STREAM_TYPE]);
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_stream_get_stream_type:
Packit f546b1
 * @stream: a #GstStream
Packit f546b1
 *
Packit f546b1
 * Retrieve the stream type for @stream
Packit f546b1
 *
Packit f546b1
 * Returns: The #GstStreamType for @stream
Packit f546b1
 *
Packit f546b1
 * Since: 1.10
Packit f546b1
 */
Packit f546b1
GstStreamType
Packit f546b1
gst_stream_get_stream_type (GstStream * stream)
Packit f546b1
{
Packit f546b1
  GstStreamType res;
Packit f546b1
Packit f546b1
  GST_OBJECT_LOCK (stream);
Packit f546b1
  res = stream->priv->type;
Packit f546b1
  GST_OBJECT_UNLOCK (stream);
Packit f546b1
Packit f546b1
  return res;
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_stream_set_tags:
Packit f546b1
 * @stream: a #GstStream
Packit f546b1
 * @tags: (transfer none) (allow-none): a #GstTagList
Packit f546b1
 *
Packit f546b1
 * Set the tags for the #GstStream
Packit f546b1
 *
Packit f546b1
 * Since: 1.10
Packit f546b1
 */
Packit f546b1
void
Packit f546b1
gst_stream_set_tags (GstStream * stream, GstTagList * tags)
Packit f546b1
{
Packit f546b1
  gboolean notify = FALSE;
Packit f546b1
Packit f546b1
  GST_OBJECT_LOCK (stream);
Packit f546b1
  if (stream->priv->tags == NULL || tags == NULL
Packit f546b1
      || !gst_tag_list_is_equal (stream->priv->tags, tags)) {
Packit f546b1
    gst_mini_object_replace ((GstMiniObject **) & stream->priv->tags,
Packit f546b1
        (GstMiniObject *) tags);
Packit f546b1
    notify = TRUE;
Packit f546b1
  }
Packit f546b1
  GST_OBJECT_UNLOCK (stream);
Packit f546b1
Packit f546b1
  if (notify)
Packit f546b1
    g_object_notify_by_pspec (G_OBJECT (stream), gst_stream_pspecs[PROP_TAGS]);
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_stream_get_tags:
Packit f546b1
 * @stream: a #GstStream
Packit f546b1
 *
Packit f546b1
 * Retrieve the tags for @stream, if any
Packit f546b1
 *
Packit f546b1
 * Returns: (transfer full) (nullable): The #GstTagList for @stream
Packit f546b1
 *
Packit f546b1
 * Since: 1.10
Packit f546b1
 */
Packit f546b1
GstTagList *
Packit f546b1
gst_stream_get_tags (GstStream * stream)
Packit f546b1
{
Packit f546b1
  GstTagList *res = NULL;
Packit f546b1
Packit f546b1
  GST_OBJECT_LOCK (stream);
Packit f546b1
  if (stream->priv->tags)
Packit f546b1
    res = gst_tag_list_ref (stream->priv->tags);
Packit f546b1
  GST_OBJECT_UNLOCK (stream);
Packit f546b1
Packit f546b1
  return res;
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_stream_set_caps:
Packit f546b1
 * @stream: a #GstStream
Packit f546b1
 * @caps: (transfer none) (allow-none): a #GstCaps
Packit f546b1
 *
Packit f546b1
 * Set the caps for the #GstStream
Packit f546b1
 *
Packit f546b1
 * Since: 1.10
Packit f546b1
 */
Packit f546b1
void
Packit f546b1
gst_stream_set_caps (GstStream * stream, GstCaps * caps)
Packit f546b1
{
Packit f546b1
  gboolean notify = FALSE;
Packit f546b1
Packit f546b1
  GST_OBJECT_LOCK (stream);
Packit f546b1
  if (stream->priv->caps == NULL || (caps
Packit f546b1
          && !gst_caps_is_equal (stream->priv->caps, caps))) {
Packit f546b1
    gst_caps_replace (&stream->priv->caps, caps);
Packit f546b1
    notify = TRUE;
Packit f546b1
  }
Packit f546b1
  GST_OBJECT_UNLOCK (stream);
Packit f546b1
Packit f546b1
  if (notify)
Packit f546b1
    g_object_notify_by_pspec (G_OBJECT (stream), gst_stream_pspecs[PROP_CAPS]);
Packit f546b1
}
Packit f546b1
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_stream_get_caps:
Packit f546b1
 * @stream: a #GstStream
Packit f546b1
 *
Packit f546b1
 * Retrieve the caps for @stream, if any
Packit f546b1
 *
Packit f546b1
 * Returns: (transfer full) (nullable): The #GstCaps for @stream
Packit f546b1
 *
Packit f546b1
 * Since: 1.10
Packit f546b1
 */
Packit f546b1
GstCaps *
Packit f546b1
gst_stream_get_caps (GstStream * stream)
Packit f546b1
{
Packit f546b1
  GstCaps *res = NULL;
Packit f546b1
Packit f546b1
  GST_OBJECT_LOCK (stream);
Packit f546b1
  if (stream->priv->caps)
Packit f546b1
    res = gst_caps_ref (stream->priv->caps);
Packit f546b1
  GST_OBJECT_UNLOCK (stream);
Packit f546b1
Packit f546b1
  return res;
Packit f546b1
}
Packit f546b1
Packit f546b1
static void
Packit f546b1
gst_stream_set_property (GObject * object, guint prop_id,
Packit f546b1
    const GValue * value, GParamSpec * pspec)
Packit f546b1
{
Packit f546b1
  GstStream *stream;
Packit f546b1
Packit f546b1
  stream = GST_STREAM_CAST (object);
Packit f546b1
Packit f546b1
  switch (prop_id) {
Packit f546b1
    case PROP_STREAM_ID:
Packit f546b1
      gst_stream_set_stream_id (stream, g_value_get_string (value));
Packit f546b1
      break;
Packit f546b1
    case PROP_STREAM_FLAGS:
Packit f546b1
      GST_OBJECT_LOCK (stream);
Packit f546b1
      stream->priv->flags = g_value_get_flags (value);
Packit f546b1
      GST_OBJECT_UNLOCK (stream);
Packit f546b1
      break;
Packit f546b1
    case PROP_STREAM_TYPE:
Packit f546b1
      GST_OBJECT_LOCK (stream);
Packit f546b1
      stream->priv->type = g_value_get_flags (value);
Packit f546b1
      GST_OBJECT_UNLOCK (stream);
Packit f546b1
      break;
Packit f546b1
    case PROP_TAGS:
Packit f546b1
      GST_OBJECT_LOCK (stream);
Packit f546b1
      gst_mini_object_replace ((GstMiniObject **) & stream->priv->tags,
Packit f546b1
          (GstMiniObject *) g_value_get_boxed (value));
Packit f546b1
      GST_OBJECT_UNLOCK (stream);
Packit f546b1
      break;
Packit f546b1
    case PROP_CAPS:
Packit f546b1
      GST_OBJECT_LOCK (stream);
Packit f546b1
      gst_mini_object_replace ((GstMiniObject **) & stream->priv->caps,
Packit f546b1
          (GstMiniObject *) g_value_get_boxed (value));
Packit f546b1
      GST_OBJECT_UNLOCK (stream);
Packit f546b1
      break;
Packit f546b1
    default:
Packit f546b1
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
Packit f546b1
      break;
Packit f546b1
  }
Packit f546b1
}
Packit f546b1
Packit f546b1
static void
Packit f546b1
gst_stream_get_property (GObject * object, guint prop_id,
Packit f546b1
    GValue * value, GParamSpec * pspec)
Packit f546b1
{
Packit f546b1
  GstStream *stream;
Packit f546b1
Packit f546b1
  stream = GST_STREAM_CAST (object);
Packit f546b1
Packit f546b1
  switch (prop_id) {
Packit f546b1
    case PROP_STREAM_ID:
Packit f546b1
      g_value_set_string (value, gst_stream_get_stream_id (stream));
Packit f546b1
      break;
Packit f546b1
    case PROP_STREAM_FLAGS:
Packit f546b1
      g_value_set_flags (value, gst_stream_get_stream_flags (stream));
Packit f546b1
      break;
Packit f546b1
    case PROP_STREAM_TYPE:
Packit f546b1
      g_value_set_flags (value, gst_stream_get_stream_type (stream));
Packit f546b1
      break;
Packit f546b1
    case PROP_TAGS:
Packit f546b1
      g_value_take_boxed (value, gst_stream_get_tags (stream));
Packit f546b1
      break;
Packit f546b1
    case PROP_CAPS:
Packit f546b1
      g_value_take_boxed (value, gst_stream_get_caps (stream));
Packit f546b1
      break;
Packit f546b1
    default:
Packit f546b1
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
Packit f546b1
      break;
Packit f546b1
  }
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_stream_type_get_name:
Packit f546b1
 * @stype: a #GstStreamType
Packit f546b1
 *
Packit f546b1
 * Get a descriptive string for a given #GstStreamType
Packit f546b1
 *
Packit f546b1
 * Returns: (nullable): A string describing the stream type
Packit f546b1
 *
Packit f546b1
 * Since: 1.10
Packit f546b1
 */
Packit f546b1
const gchar *
Packit f546b1
gst_stream_type_get_name (GstStreamType stype)
Packit f546b1
{
Packit f546b1
  /* FIXME : Make this more flexible */
Packit f546b1
  switch (stype) {
Packit f546b1
    case GST_STREAM_TYPE_UNKNOWN:
Packit f546b1
      return "unknown";
Packit f546b1
    case GST_STREAM_TYPE_AUDIO:
Packit f546b1
      return "audio";
Packit f546b1
    case GST_STREAM_TYPE_VIDEO:
Packit f546b1
      return "video";
Packit f546b1
    case GST_STREAM_TYPE_CONTAINER:
Packit f546b1
      return "container";
Packit f546b1
    case GST_STREAM_TYPE_TEXT:
Packit f546b1
      return "text";
Packit f546b1
    default:
Packit f546b1
      return NULL;
Packit f546b1
  }
Packit f546b1
Packit f546b1
  return NULL;
Packit f546b1
}