annotate libpurple/media/backend-fs2.c @ 29154:2f8151fed0ae

Various tweaks, fixes, and added debug output. Attached some media signals, and created a temporary function to help test out integrating with PurpleMedia.
author maiku@pidgin.im
date Fri, 23 Oct 2009 01:55:39 +0000
parents 4aa30863743b
children ae81f8baa148
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
1 /**
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
2 * @file backend-fs2.c Farsight 2 backend for media API
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
3 * @ingroup core
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
4 */
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
5
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
6 /* purple
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
7 *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
10 * source distribution.
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
11 *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
15 * (at your option) any later version.
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
16 *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
20 * GNU General Public License for more details.
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
21 *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
25 */
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
26
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
27 #include "backend-fs2.h"
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
28
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
29 #include "backend-iface.h"
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
30 #include "debug.h"
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
31 #include "media-gst.h"
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
32
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
33 #include <gst/farsight/fs-conference-iface.h>
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
34
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
35 /** @copydoc _PurpleMediaBackendFs2Class */
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
36 typedef struct _PurpleMediaBackendFs2Class PurpleMediaBackendFs2Class;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
37 /** @copydoc _PurpleMediaBackendFs2Private */
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
38 typedef struct _PurpleMediaBackendFs2Private PurpleMediaBackendFs2Private;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
39
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
40 #define PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj) \
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
41 (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
42 PURPLE_TYPE_MEDIA_BACKEND_FS2, PurpleMediaBackendFs2Private))
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
43
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
44 static void purple_media_backend_iface_init(PurpleMediaBackendIface *iface);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
45
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
46 static gboolean
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
47 _gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackend *self);
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
48 static void
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
49 _state_changed_cb(PurpleMedia *media, PurpleMediaState state,
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
50 gchar *sid, gchar *name, PurpleMediaBackendFs2 *self);
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
51 static void
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
52 _stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
53 gchar *sid, gchar *name, gboolean local,
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
54 PurpleMediaBackendFs2 *self);
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
55
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
56 static gboolean purple_media_backend_fs2_add_stream(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
57 const gchar *sess_id, const gchar *who,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
58 PurpleMediaSessionType type, gboolean initiator,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
59 const gchar *transmitter,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
60 guint num_params, GParameter *params);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
61 static void purple_media_backend_fs2_add_remote_candidates(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
62 PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
63 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
64 GList *remote_candidates);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
65 static GList *purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
66 const gchar *sess_id);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
67 static GList *purple_media_backend_fs2_get_local_candidates(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
68 PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
69 const gchar *sess_id, const gchar *participant);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
70 static void purple_media_backend_fs2_set_remote_codecs(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
71 PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
72 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
73 GList *codecs);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
74 static void purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
75 const gchar *sess_id, PurpleMediaCodec *codec);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
76
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
77 struct _PurpleMediaBackendFs2Class
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
78 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
79 GObjectClass parent_class;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
80 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
81
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
82 struct _PurpleMediaBackendFs2
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
83 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
84 GObject parent;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
85 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
86
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
87 G_DEFINE_TYPE_WITH_CODE(PurpleMediaBackendFs2, purple_media_backend_fs2,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
88 G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
89 PURPLE_TYPE_MEDIA_BACKEND, purple_media_backend_iface_init));
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
90
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
91 struct _PurpleMediaBackendFs2Private
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
92 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
93 PurpleMedia *media;
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
94 GstElement *confbin;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
95 FsConference *conference;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
96 gchar *conference_type;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
97 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
98
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
99 enum {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
100 PROP_0,
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
101 PROP_CONFERENCE_TYPE,
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
102 PROP_MEDIA,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
103 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
104
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
105 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
106 purple_media_backend_fs2_init(PurpleMediaBackendFs2 *self)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
107 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
108 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
109
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
110 static void
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
111 purple_media_backend_fs2_dispose(GObject *obj)
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
112 {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
113 PurpleMediaBackendFs2Private *priv =
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
114 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
115
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
116 purple_debug_info("backend-fs2", "purple_media_backend_fs2_dispose\n");
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
117
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
118 if (priv->confbin) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
119 GstElement *pipeline;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
120
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
121 pipeline = purple_media_manager_get_pipeline(
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
122 purple_media_get_manager(priv->media));
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
123
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
124 gst_element_set_locked_state(priv->confbin, TRUE);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
125 gst_element_set_state(GST_ELEMENT(priv->confbin),
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
126 GST_STATE_NULL);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
127
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
128 if (pipeline) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
129 GstBus *bus;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
130 gst_bin_remove(GST_BIN(pipeline), priv->confbin);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
131 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
132 g_signal_handlers_disconnect_matched(G_OBJECT(bus),
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
133 G_SIGNAL_MATCH_FUNC |
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
134 G_SIGNAL_MATCH_DATA,
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
135 0, 0, 0, _gst_bus_cb, obj);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
136 gst_object_unref(bus);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
137 } else {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
138 purple_debug_warning("backend-fs2", "Unable to "
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
139 "properly dispose the conference. "
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
140 "Couldn't get the pipeline.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
141 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
142
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
143 priv->confbin = NULL;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
144 priv->conference = NULL;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
145
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
146 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
147
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
148 if (priv->media) {
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
149 g_object_remove_weak_pointer(G_OBJECT(priv->media),
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
150 (gpointer*)&priv->media);
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
151 priv->media = NULL;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
152 }
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
153
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
154 G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->dispose(obj);
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
155 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
156
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
157 static void
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
158 purple_media_backend_fs2_finalize(GObject *obj)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
159 {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
160 PurpleMediaBackendFs2Private *priv =
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
161 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj);
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
162
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
163 purple_debug_info("backend-fs2", "purple_media_backend_fs2_finalize\n");
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
164
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
165 g_free(priv->conference_type);
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
166
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
167 G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->finalize(obj);
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
168 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
169
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
170 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
171 purple_media_backend_fs2_set_property(GObject *object, guint prop_id,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
172 const GValue *value, GParamSpec *pspec)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
173 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
174 PurpleMediaBackendFs2Private *priv;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
175 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(object));
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
176
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
177 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
178
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
179 switch (prop_id) {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
180 case PROP_CONFERENCE_TYPE:
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
181 priv->conference_type = g_value_dup_string(value);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
182 break;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
183 case PROP_MEDIA:
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
184 priv->media = g_value_get_object(value);
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
185
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
186 if (priv->media == NULL)
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
187 break;
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
188
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
189 g_object_add_weak_pointer(G_OBJECT(priv->media),
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
190 (gpointer*)&priv->media);
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
191
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
192 g_signal_connect(G_OBJECT(priv->media),
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
193 "state-changed",
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
194 G_CALLBACK(_state_changed_cb),
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
195 PURPLE_MEDIA_BACKEND_FS2(object));
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
196 g_signal_connect(G_OBJECT(priv->media), "stream-info",
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
197 G_CALLBACK(_stream_info_cb),
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
198 PURPLE_MEDIA_BACKEND_FS2(object));
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
199 break;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
200 default:
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
201 G_OBJECT_WARN_INVALID_PROPERTY_ID(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
202 object, prop_id, pspec);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
203 break;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
204 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
205 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
206
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
207 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
208 purple_media_backend_fs2_get_property(GObject *object, guint prop_id,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
209 GValue *value, GParamSpec *pspec)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
210 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
211 PurpleMediaBackendFs2Private *priv;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
212 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(object));
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
213
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
214 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
215
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
216 switch (prop_id) {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
217 case PROP_CONFERENCE_TYPE:
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
218 g_value_set_string(value, priv->conference_type);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
219 break;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
220 case PROP_MEDIA:
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
221 g_value_set_object(value, priv->media);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
222 break;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
223 default:
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
224 G_OBJECT_WARN_INVALID_PROPERTY_ID(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
225 object, prop_id, pspec);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
226 break;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
227 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
228 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
229
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
230 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
231 purple_media_backend_fs2_class_init(PurpleMediaBackendFs2Class *klass)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
232 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
233 GObjectClass *gobject_class = (GObjectClass*)klass;
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
234
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
235 gobject_class->dispose = purple_media_backend_fs2_dispose;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
236 gobject_class->finalize = purple_media_backend_fs2_finalize;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
237 gobject_class->set_property = purple_media_backend_fs2_set_property;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
238 gobject_class->get_property = purple_media_backend_fs2_get_property;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
239
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
240 g_object_class_override_property(gobject_class, PROP_CONFERENCE_TYPE,
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
241 "conference-type");
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
242 g_object_class_override_property(gobject_class, PROP_MEDIA, "media");
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
243
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
244 g_type_class_add_private(klass, sizeof(PurpleMediaBackendFs2Private));
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
245 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
246
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
247 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
248 purple_media_backend_iface_init(PurpleMediaBackendIface *iface)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
249 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
250 iface->add_stream = purple_media_backend_fs2_add_stream;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
251 iface->add_remote_candidates =
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
252 purple_media_backend_fs2_add_remote_candidates;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
253 iface->get_codecs = purple_media_backend_fs2_get_codecs;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
254 iface->get_local_candidates =
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
255 purple_media_backend_fs2_get_local_candidates;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
256 iface->set_remote_codecs = purple_media_backend_fs2_set_remote_codecs;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
257 iface->set_send_codec = purple_media_backend_fs2_set_send_codec;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
258 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
259
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
260 static gboolean
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
261 _gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackend *self)
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
262 {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
263 return TRUE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
264 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
265
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
266 static void
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
267 _state_changed_cb(PurpleMedia *media, PurpleMediaState state,
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
268 gchar *sid, gchar *name, PurpleMediaBackendFs2 *self)
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
269 {
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
270 }
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
271
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
272 static void
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
273 _stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
274 gchar *sid, gchar *name, gboolean local,
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
275 PurpleMediaBackendFs2 *self)
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
276 {
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
277 }
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
278
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
279 static gboolean
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
280 _init_conference(PurpleMediaBackend *self)
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
281 {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
282 PurpleMediaBackendFs2Private *priv =
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
283 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
284 GstElement *pipeline;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
285 GstBus *bus;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
286 gchar *name;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
287
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
288 priv->conference = FS_CONFERENCE(
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
289 gst_element_factory_make(priv->conference_type, NULL));
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
290
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
291 if (priv->conference == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
292 purple_debug_error("backend-fs2", "Conference == NULL\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
293 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
294 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
295
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
296 pipeline = purple_media_manager_get_pipeline(
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
297 purple_media_get_manager(priv->media));
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
298
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
299 if (pipeline == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
300 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
301 "Couldn't retrieve pipeline.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
302 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
303 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
304
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
305 name = g_strdup_printf("conf_%p", priv->conference);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
306 priv->confbin = gst_bin_new(name);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
307 if (priv->confbin == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
308 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
309 "Couldn't create confbin.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
310 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
311 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
312
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
313 g_free(name);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
314
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
315 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
316 if (bus == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
317 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
318 "Couldn't get the pipeline's bus.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
319 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
320 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
321
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
322 g_signal_connect(G_OBJECT(bus), "message",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
323 G_CALLBACK(_gst_bus_cb), self);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
324 gst_object_unref(bus);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
325
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
326 if (!gst_bin_add(GST_BIN(pipeline),
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
327 GST_ELEMENT(priv->confbin))) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
328 purple_debug_error("backend-fs2", "Couldn't add confbin "
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
329 "element to the pipeline\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
330 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
331 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
332
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
333 if (!gst_bin_add(GST_BIN(priv->confbin),
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
334 GST_ELEMENT(priv->conference))) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
335 purple_debug_error("backend-fs2", "Couldn't add conference "
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
336 "element to the confbin\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
337 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
338 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
339
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
340 if (gst_element_set_state(GST_ELEMENT(priv->confbin),
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
341 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
342 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
343 "Failed to start conference.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
344 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
345 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
346
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
347 return TRUE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
348 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
349
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
350 static gboolean
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
351 purple_media_backend_fs2_add_stream(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
352 const gchar *sess_id, const gchar *who,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
353 PurpleMediaSessionType type, gboolean initiator,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
354 const gchar *transmitter,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
355 guint num_params, GParameter *params)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
356 {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
357 PurpleMediaBackendFs2Private *priv =
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
358 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
359
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
360 if (priv->conference == NULL && !_init_conference(self)) {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
361 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
362 "Error initializing the conference.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
363 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
364 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
365
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
366 return TRUE;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
367 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
368
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
369 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
370 purple_media_backend_fs2_add_remote_candidates(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
371 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
372 GList *remote_candidates)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
373 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
374 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
375
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
376 static GList *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
377 purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
378 const gchar *sess_id)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
379 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
380 return NULL;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
381 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
382
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
383 static GList *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
384 purple_media_backend_fs2_get_local_candidates(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
385 const gchar *sess_id, const gchar *participant)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
386 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
387 return NULL;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
388 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
389
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
390 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
391 purple_media_backend_fs2_set_remote_codecs(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
392 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
393 GList *codecs)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
394 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
395 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
396
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
397 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
398 purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
399 const gchar *sess_id, PurpleMediaCodec *codec)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
400 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
401 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
402
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
403 FsConference *
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
404 purple_media_backend_fs2_get_conference(PurpleMediaBackendFs2 *self)
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
405 {
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
406 PurpleMediaBackendFs2Private *priv =
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
407 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
408 return priv->conference;
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
409 }
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
410