No issues found
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2 *
3 * Copyright (C) 2006 James Livingston <doclivingston@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * The Rhythmbox authors hereby grant permission for non-GPL compatible
11 * GStreamer plugins to be used and distributed together with GStreamer
12 * and Rhythmbox. This permission is above and beyond the permissions granted
13 * by the GPL license by which Rhythmbox is covered. If you modify this code
14 * you may extend this exception to your version of the code, but you are not
15 * obligated to do so. If you do not wish to do so, delete this exception
16 * statement from your version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 *
27 */
28
29 #include <config.h>
30
31 #include "rb-player-gst-data-tee.h"
32 #include "rb-marshal.h"
33
34
35 enum {
36 DATA_TEE_INSERTED,
37 DATA_TEE_PRE_REMOVE,
38 LAST_SIGNAL
39 };
40
41 static guint signals[LAST_SIGNAL] = { 0 };
42
43 /**
44 * SECTION:rb-player-gst-data-tee
45 * @short_description: player interface for processing raw data
46 * @include: rb-player-gst-data-tee.h
47 *
48 * This interface allows a caller to add a branch to the GStreamer playback
49 * pipeline that receives a copy of the raw data from the playback source
50 * element.
51 *
52 * This interface is not currently implemented by either playback backend.
53 */
54
55 static void
56 rb_player_gst_data_tee_interface_init (RBPlayerGstDataTeeIface *iface)
57 {
58 /**
59 * RBPlayerGstDataTee::data-tee-inserted:
60 * @player: the #RBPlayerGstDataTee implementation
61 * @data_tee: the element which has been inserted
62 *
63 * The 'data_tee-inserted' signal is emitted when the tee element has been
64 * inserted into the pipeline and fully linked
65 **/
66 signals[DATA_TEE_INSERTED] =
67 g_signal_new ("data-tee-inserted",
68 G_TYPE_FROM_INTERFACE (iface),
69 G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE,
70 G_STRUCT_OFFSET (RBPlayerGstDataTeeIface, data_tee_inserted),
71 NULL, NULL,
72 g_cclosure_marshal_VOID__OBJECT,
73 G_TYPE_NONE,
74 1, G_TYPE_OBJECT);
75
76 /**
77 * RBPlayerGstDataTee::data-tee-pre-remove:
78 * @player: the #RBPlayerGstDataTee implementation
79 * @data_tee: the element which is about to be removed
80 *
81 * The 'data_tee-pre-remove' signal is emitted immediately before the element
82 * is unlinked and removed from the pipeline
83 **/
84 signals[DATA_TEE_PRE_REMOVE] =
85 g_signal_new ("data-tee-pre-remove",
86 G_TYPE_FROM_INTERFACE (iface),
87 G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE,
88 G_STRUCT_OFFSET (RBPlayerGstDataTeeIface, data_tee_pre_remove),
89 NULL, NULL,
90 g_cclosure_marshal_VOID__OBJECT,
91 G_TYPE_NONE,
92 1, G_TYPE_OBJECT);
93 }
94
95 GType
96 rb_player_gst_data_tee_get_type (void)
97 {
98 static GType our_type = 0;
99
100 if (!our_type) {
101 static const GTypeInfo our_info = {
102 sizeof (RBPlayerGstDataTeeIface),
103 NULL, /* base_init */
104 NULL, /* base_finalize */
105 (GClassInitFunc)rb_player_gst_data_tee_interface_init,
106 NULL, /* class_finalize */
107 NULL, /* class_data */
108 0,
109 0,
110 NULL
111 };
112
113 our_type = g_type_register_static (G_TYPE_INTERFACE, "RBPlayerGstDataTee", &our_info, 0);
114 }
115
116 return our_type;
117 }
118
119 /**
120 * rb_player_gst_data_tee_add_data_tee:
121 * @player: a #RBPlayerGstDataTee implementation
122 * @element: data tee branch to add
123 *
124 * Adds a raw data tee branch to the playback pipeline.
125 *
126 * Return value: TRUE if the tee branch was added successfully
127 */
128 gboolean
129 rb_player_gst_data_tee_add_data_tee (RBPlayerGstDataTee *player, GstElement *element)
130 {
131 RBPlayerGstDataTeeIface *iface = RB_PLAYER_GST_DATA_TEE_GET_IFACE (player);
132
133 return iface->add_data_tee (player, element);
134 }
135
136 /**
137 * rb_player_gst_data_tee_remove_data_tee:
138 * @player: a #RBPlayerGstDataTee implementation
139 * @element: data tee branch to add
140 *
141 * Removes a raw data tee branch.
142 *
143 * Return value: TRUE if the tee branch was found and removed
144 */
145 gboolean
146 rb_player_gst_data_tee_remove_data_tee (RBPlayerGstDataTee *player, GstElement *element)
147 {
148 RBPlayerGstDataTeeIface *iface = RB_PLAYER_GST_DATA_TEE_GET_IFACE (player);
149
150 return iface->remove_data_tee (player, element);
151 }
152
153 void
154 _rb_player_gst_data_tee_emit_data_tee_inserted (RBPlayerGstDataTee *player, GstElement *data_tee)
155 {
156 g_signal_emit (player, signals[DATA_TEE_INSERTED], 0, data_tee);
157 }
158
159 void
160 _rb_player_gst_data_tee_emit_data_tee_pre_remove (RBPlayerGstDataTee *player, GstElement *data_tee)
161 {
162 g_signal_emit (player, signals[DATA_TEE_PRE_REMOVE], 0, data_tee);
163 }