2 * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #include "rtsp-media.h"
22 static void gst_rtsp_media_bin_finalize (GObject * obj);
24 G_DEFINE_TYPE (GstRTSPMediaBin, gst_rtsp_media_bin, G_TYPE_OBJECT);
27 gst_rtsp_media_bin_class_init (GstRTSPMediaBinClass * klass)
29 GObjectClass *gobject_class;
31 gobject_class = G_OBJECT_CLASS (klass);
33 gobject_class->finalize = gst_rtsp_media_bin_finalize;
37 gst_rtsp_media_bin_init (GstRTSPMediaBin * bin)
39 bin->streams = g_array_new (FALSE, TRUE, sizeof (GstRTSPMediaStream *));
43 gst_rtsp_media_stream_free (GstRTSPMediaStream *stream)
48 gst_rtsp_media_bin_finalize (GObject * obj)
53 bin = GST_RTSP_MEDIA_BIN (obj);
55 for (i = 0; i < bin->streams->len; i++) {
56 GstRTSPMediaStream *stream;
58 stream = g_array_index (bin->streams, GstRTSPMediaStream *, i);
60 gst_rtsp_media_stream_free (stream);
62 g_array_free (bin->streams, TRUE);
64 G_OBJECT_CLASS (gst_rtsp_media_bin_parent_class)->finalize (obj);
68 * gst_rtsp_media_bin_n_streams:
69 * @media: a #GstRTSPMediaBin
71 * Get the number of streams in this mediabin.
73 * Returns: The number of streams.
76 gst_rtsp_media_bin_n_streams (GstRTSPMediaBin *bin)
78 g_return_val_if_fail (GST_IS_RTSP_MEDIA_BIN (bin), 0);
80 return bin->streams->len;
84 * gst_rtsp_media_bin_get_stream:
85 * @bin: a #GstRTSPMediaBin
86 * @idx: the stream index
88 * Retrieve the stream with index @idx from @bin.
90 * Returns: the #GstRTSPMediaStream at index @idx.
93 gst_rtsp_media_bin_get_stream (GstRTSPMediaBin *bin, guint idx)
95 GstRTSPMediaStream *res;
97 g_return_val_if_fail (GST_IS_RTSP_MEDIA_BIN (bin), NULL);
98 g_return_val_if_fail (idx < bin->streams->len, NULL);
100 res = g_array_index (bin->streams, GstRTSPMediaStream *, idx);