annotate libpurple/media/backend-fs2.c @ 29158:ae81f8baa148

Transfer some GStreamer message handling to the Farsight 2 media backend.
author maiku@pidgin.im
date Fri, 23 Oct 2009 19:59:12 +0000
parents 2f8151fed0ae
children efeb21092ed2
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
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
29 #include "internal.h"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
30
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
31 #include "backend-iface.h"
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
32 #include "debug.h"
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
33 #include "media-gst.h"
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
34
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
35 #include <gst/farsight/fs-conference-iface.h>
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
36
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
37 /** @copydoc _PurpleMediaBackendFs2Class */
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
38 typedef struct _PurpleMediaBackendFs2Class PurpleMediaBackendFs2Class;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
39 /** @copydoc _PurpleMediaBackendFs2Private */
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
40 typedef struct _PurpleMediaBackendFs2Private PurpleMediaBackendFs2Private;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
41
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
42 #define PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj) \
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
43 (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
44 PURPLE_TYPE_MEDIA_BACKEND_FS2, PurpleMediaBackendFs2Private))
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
45
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
46 static void purple_media_backend_iface_init(PurpleMediaBackendIface *iface);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
47
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
48 static gboolean
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
49 _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
50 static void
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
51 _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
52 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
53 static void
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
54 _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
55 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
56 PurpleMediaBackendFs2 *self);
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
57
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
58 static gboolean purple_media_backend_fs2_add_stream(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
59 const gchar *sess_id, const gchar *who,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
60 PurpleMediaSessionType type, gboolean initiator,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
61 const gchar *transmitter,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
62 guint num_params, GParameter *params);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
63 static void purple_media_backend_fs2_add_remote_candidates(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
64 PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
65 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
66 GList *remote_candidates);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
67 static GList *purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
68 const gchar *sess_id);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
69 static GList *purple_media_backend_fs2_get_local_candidates(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
70 PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
71 const gchar *sess_id, const gchar *participant);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
72 static void purple_media_backend_fs2_set_remote_codecs(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
73 PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
74 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
75 GList *codecs);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
76 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
77 const gchar *sess_id, PurpleMediaCodec *codec);
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 struct _PurpleMediaBackendFs2Class
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 GObjectClass parent_class;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
82 };
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 struct _PurpleMediaBackendFs2
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 GObject parent;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
87 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
88
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
89 G_DEFINE_TYPE_WITH_CODE(PurpleMediaBackendFs2, purple_media_backend_fs2,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
90 G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
91 PURPLE_TYPE_MEDIA_BACKEND, purple_media_backend_iface_init));
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 struct _PurpleMediaBackendFs2Private
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
94 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
95 PurpleMedia *media;
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
96 GstElement *confbin;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
97 FsConference *conference;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
98 gchar *conference_type;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
99 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
100
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
101 enum {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
102 PROP_0,
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
103 PROP_CONFERENCE_TYPE,
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
104 PROP_MEDIA,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
105 };
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
106
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
107 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
108 purple_media_backend_fs2_init(PurpleMediaBackendFs2 *self)
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 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
111
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
112 static void
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
113 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
114 {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
115 PurpleMediaBackendFs2Private *priv =
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
116 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
117
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
118 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
119
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
120 if (priv->confbin) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
121 GstElement *pipeline;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
122
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
123 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
124 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
125
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
126 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
127 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
128 GST_STATE_NULL);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
129
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
130 if (pipeline) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
131 GstBus *bus;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
132 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
133 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
134 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
135 G_SIGNAL_MATCH_FUNC |
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
136 G_SIGNAL_MATCH_DATA,
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
137 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
138 gst_object_unref(bus);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
139 } else {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
140 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
141 "properly dispose the conference. "
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
142 "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
143 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
144
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
145 priv->confbin = NULL;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
146 priv->conference = NULL;
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 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
150 if (priv->media) {
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
151 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
152 (gpointer*)&priv->media);
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
153 priv->media = NULL;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
154 }
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
155
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
156 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
157 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
158
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
159 static void
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
160 purple_media_backend_fs2_finalize(GObject *obj)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
161 {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
162 PurpleMediaBackendFs2Private *priv =
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
163 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
164
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
165 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
166
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
167 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
168
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
169 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
170 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
171
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
172 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
173 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
174 const GValue *value, GParamSpec *pspec)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
175 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
176 PurpleMediaBackendFs2Private *priv;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
177 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(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 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
180
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
181 switch (prop_id) {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
182 case PROP_CONFERENCE_TYPE:
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
183 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
184 break;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
185 case PROP_MEDIA:
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
186 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
187
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
188 if (priv->media == NULL)
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
189 break;
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
190
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
191 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
192 (gpointer*)&priv->media);
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
193
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
194 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
195 "state-changed",
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
196 G_CALLBACK(_state_changed_cb),
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
197 PURPLE_MEDIA_BACKEND_FS2(object));
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
198 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
199 G_CALLBACK(_stream_info_cb),
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
200 PURPLE_MEDIA_BACKEND_FS2(object));
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
201 break;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
202 default:
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
203 G_OBJECT_WARN_INVALID_PROPERTY_ID(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
204 object, prop_id, pspec);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
205 break;
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 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
208
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
209 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
210 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
211 GValue *value, GParamSpec *pspec)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
212 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
213 PurpleMediaBackendFs2Private *priv;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
214 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(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 priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(object);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
217
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
218 switch (prop_id) {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
219 case PROP_CONFERENCE_TYPE:
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
220 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
221 break;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
222 case PROP_MEDIA:
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
223 g_value_set_object(value, priv->media);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
224 break;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
225 default:
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
226 G_OBJECT_WARN_INVALID_PROPERTY_ID(
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
227 object, prop_id, pspec);
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
228 break;
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 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
231
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
232 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
233 purple_media_backend_fs2_class_init(PurpleMediaBackendFs2Class *klass)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
234 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
235 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
236
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
237 gobject_class->dispose = purple_media_backend_fs2_dispose;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
238 gobject_class->finalize = purple_media_backend_fs2_finalize;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
239 gobject_class->set_property = purple_media_backend_fs2_set_property;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
240 gobject_class->get_property = purple_media_backend_fs2_get_property;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
241
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
242 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
243 "conference-type");
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
244 g_object_class_override_property(gobject_class, PROP_MEDIA, "media");
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 g_type_class_add_private(klass, sizeof(PurpleMediaBackendFs2Private));
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
247 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
248
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
249 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
250 purple_media_backend_iface_init(PurpleMediaBackendIface *iface)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
251 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
252 iface->add_stream = purple_media_backend_fs2_add_stream;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
253 iface->add_remote_candidates =
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
254 purple_media_backend_fs2_add_remote_candidates;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
255 iface->get_codecs = purple_media_backend_fs2_get_codecs;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
256 iface->get_local_candidates =
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
257 purple_media_backend_fs2_get_local_candidates;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
258 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
259 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
260 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
261
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
262 static void
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
263 _gst_handle_message_element(GstBus *bus, GstMessage *msg,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
264 PurpleMediaBackend *self)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
265 {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
266 PurpleMediaBackendFs2Private *priv =
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
267 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
268 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(msg));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
269
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
270 if (!FS_IS_CONFERENCE(src) || !PURPLE_IS_MEDIA_BACKEND(self) ||
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
271 priv->conference != FS_CONFERENCE(src))
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
272 return;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
273
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
274 if (gst_structure_has_name(msg->structure, "farsight-error")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
275 FsError error_no;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
276 gst_structure_get_enum(msg->structure, "error-no",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
277 FS_TYPE_ERROR, (gint*)&error_no);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
278 switch (error_no) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
279 case FS_ERROR_NO_CODECS:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
280 purple_media_error(priv->media, _("No codecs"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
281 " found. Install some"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
282 " GStreamer codecs found"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
283 " in GStreamer plugins"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
284 " packages."));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
285 purple_media_end(priv->media, NULL, NULL);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
286 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
287 case FS_ERROR_NO_CODECS_LEFT:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
288 purple_media_error(priv->media, _("No codecs"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
289 " left. Your codec"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
290 " preferences in"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
291 " fs-codecs.conf are too"
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
292 " strict."));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
293 purple_media_end(priv->media, NULL, NULL);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
294 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
295 case FS_ERROR_UNKNOWN_CNAME:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
296 /*
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
297 * Unknown CName is only a problem for the
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
298 * multicast transmitter which isn't used.
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
299 * It is also deprecated.
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
300 */
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
301 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
302 default:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
303 purple_debug_error("backend-fs2",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
304 "farsight-error: %i: %s\n",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
305 error_no,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
306 gst_structure_get_string(
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
307 msg->structure, "error-msg"));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
308 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
309 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
310
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
311 if (FS_ERROR_IS_FATAL(error_no)) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
312 purple_media_error(priv->media, _("A non-recoverable "
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
313 "Farsight2 error has occurred."));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
314 purple_media_end(priv->media, NULL, NULL);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
315 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
316 } else if (gst_structure_has_name(msg->structure,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
317 "farsight-new-local-candidate")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
318 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
319 FsStream *stream;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
320 FsCandidate *local_candidate;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
321 #if 0
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
322 PurpleMediaSession *session;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
323 #endif
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
324
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
325 value = gst_structure_get_value(msg->structure, "stream");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
326 stream = g_value_get_object(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
327 value = gst_structure_get_value(msg->structure, "candidate");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
328 local_candidate = g_value_get_boxed(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
329 #if 0
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
330 session = purple_media_session_from_fs_stream(media, stream);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
331 _new_local_candidate_cb(stream, local_candidate, session);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
332 #endif
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
333 } else if (gst_structure_has_name(msg->structure,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
334 "farsight-local-candidates-prepared")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
335 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
336 FsStream *stream;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
337 #if 0
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
338 PurpleMediaSession *session;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
339 #endif
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
340
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
341 value = gst_structure_get_value(msg->structure, "stream");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
342 stream = g_value_get_object(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
343 #if 0
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
344 session = purple_media_session_from_fs_stream(media, stream);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
345 _candidates_prepared_cb(stream, session);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
346 #endif
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
347 } else if (gst_structure_has_name(msg->structure,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
348 "farsight-new-active-candidate-pair")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
349 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
350 FsStream *stream;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
351 FsCandidate *local_candidate;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
352 FsCandidate *remote_candidate;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
353 #if 0
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
354 PurpleMediaSession *session;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
355 #endif
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
356
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
357 value = gst_structure_get_value(msg->structure, "stream");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
358 stream = g_value_get_object(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
359 value = gst_structure_get_value(msg->structure,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
360 "local-candidate");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
361 local_candidate = g_value_get_boxed(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
362 value = gst_structure_get_value(msg->structure,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
363 "remote-candidate");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
364 remote_candidate = g_value_get_boxed(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
365 #if 0
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
366 session = purple_media_session_from_fs_stream(media, stream);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
367 _candidate_pair_established_cb(stream, local_candidate,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
368 remote_candidate, session);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
369 #endif
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
370 } else if (gst_structure_has_name(msg->structure,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
371 "farsight-recv-codecs-changed")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
372 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
373 GList *codecs;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
374 FsCodec *codec;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
375
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
376 value = gst_structure_get_value(msg->structure, "codecs");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
377 codecs = g_value_get_boxed(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
378 codec = codecs->data;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
379
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
380 purple_debug_info("backend-fs2",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
381 "farsight-recv-codecs-changed: %s\n",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
382 codec->encoding_name);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
383 } else if (gst_structure_has_name(msg->structure,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
384 "farsight-component-state-changed")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
385 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
386 FsStreamState fsstate;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
387 guint component;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
388 const gchar *state;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
389
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
390 value = gst_structure_get_value(msg->structure, "state");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
391 fsstate = g_value_get_enum(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
392 value = gst_structure_get_value(msg->structure, "component");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
393 component = g_value_get_uint(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
394
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
395 switch (fsstate) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
396 case FS_STREAM_STATE_FAILED:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
397 state = "FAILED";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
398 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
399 case FS_STREAM_STATE_DISCONNECTED:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
400 state = "DISCONNECTED";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
401 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
402 case FS_STREAM_STATE_GATHERING:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
403 state = "GATHERING";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
404 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
405 case FS_STREAM_STATE_CONNECTING:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
406 state = "CONNECTING";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
407 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
408 case FS_STREAM_STATE_CONNECTED:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
409 state = "CONNECTED";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
410 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
411 case FS_STREAM_STATE_READY:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
412 state = "READY";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
413 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
414 default:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
415 state = "UNKNOWN";
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
416 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
417 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
418
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
419 purple_debug_info("backend-fs2",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
420 "farsight-component-state-changed: "
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
421 "component: %u state: %s\n",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
422 component, state);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
423 } else if (gst_structure_has_name(msg->structure,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
424 "farsight-send-codec-changed")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
425 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
426 FsCodec *codec;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
427 gchar *codec_str;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
428
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
429 value = gst_structure_get_value(msg->structure, "codec");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
430 codec = g_value_get_boxed(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
431 codec_str = fs_codec_to_string(codec);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
432
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
433 purple_debug_info("backend-fs2",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
434 "farsight-send-codec-changed: codec: %s\n",
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
435 codec_str);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
436
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
437 g_free(codec_str);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
438 } else if (gst_structure_has_name(msg->structure,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
439 "farsight-codecs-changed")) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
440 const GValue *value;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
441 FsSession *fssession;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
442 #if 0
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
443 GList *sessions;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
444 #endif
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
445
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
446 value = gst_structure_get_value(msg->structure, "session");
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
447 fssession = g_value_get_object(value);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
448 #if 0
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
449 sessions = g_hash_table_get_values(priv->sessions);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
450
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
451 for (; sessions; sessions =
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
452 g_list_delete_link(sessions, sessions)) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
453 PurpleMediaBackendFs2Session *session = sessions->data;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
454 gchar *session_id;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
455
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
456 if (session->session != fssession)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
457 continue;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
458
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
459 session_id = g_strdup(session->id);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
460 g_signal_emit(media,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
461 purple_media_backend_fs2_signals[
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
462 CODECS_CHANGED], 0, session_id);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
463 g_free(session_id);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
464 g_list_free(sessions);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
465 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
466 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
467 #endif
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
468 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
469 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
470
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
471 static void
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
472 _gst_handle_message_error(GstBus *bus, GstMessage *msg,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
473 PurpleMediaBackend *self)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
474 {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
475 PurpleMediaBackendFs2Private *priv =
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
476 PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
477 GstElement *element = GST_ELEMENT(GST_MESSAGE_SRC(msg));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
478 GstElement *lastElement = NULL;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
479 GList *sessions;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
480
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
481 while (!GST_IS_PIPELINE(element)) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
482 if (element == priv->confbin)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
483 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
484
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
485 lastElement = element;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
486 element = GST_ELEMENT_PARENT(element);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
487 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
488
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
489 if (!GST_IS_PIPELINE(element))
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
490 return;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
491
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
492 sessions = purple_media_get_session_ids(priv->media);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
493
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
494 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
495 if (purple_media_get_src(priv->media, sessions->data)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
496 != lastElement)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
497 continue;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
498
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
499 if (purple_media_get_session_type(priv->media, sessions->data)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
500 & PURPLE_MEDIA_AUDIO)
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
501 purple_media_error(priv->media,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
502 _("Error with your microphone"));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
503 else
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
504 purple_media_error(priv->media,
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
505 _("Error with your webcam"));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
506
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
507 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
508 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
509
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
510 g_list_free(sessions);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
511
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
512 purple_media_error(priv->media, _("Conference error"));
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
513 purple_media_end(priv->media, NULL, NULL);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
514 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
515
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
516 static gboolean
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
517 _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
518 {
29158
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
519 switch(GST_MESSAGE_TYPE(msg)) {
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
520 case GST_MESSAGE_ELEMENT:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
521 _gst_handle_message_element(bus, msg, self);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
522 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
523 case GST_MESSAGE_ERROR:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
524 _gst_handle_message_error(bus, msg, self);
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
525 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
526 default:
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
527 break;
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
528 }
ae81f8baa148 Transfer some GStreamer message handling to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29154
diff changeset
529
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
530 return TRUE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
531 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
532
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
533 static void
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
534 _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
535 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
536 {
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
537 }
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
538
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
539 static void
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
540 _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
541 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
542 PurpleMediaBackendFs2 *self)
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
543 {
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
544 }
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
545
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
546 static gboolean
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
547 _init_conference(PurpleMediaBackend *self)
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
548 {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
549 PurpleMediaBackendFs2Private *priv =
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
550 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
551 GstElement *pipeline;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
552 GstBus *bus;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
553 gchar *name;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
554
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
555 priv->conference = FS_CONFERENCE(
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
556 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
557
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
558 if (priv->conference == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
559 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
560 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
561 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
562
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
563 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
564 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
565
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
566 if (pipeline == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
567 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
568 "Couldn't retrieve pipeline.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
569 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
570 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
571
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
572 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
573 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
574 if (priv->confbin == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
575 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
576 "Couldn't create confbin.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
577 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
578 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
579
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
580 g_free(name);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
581
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
582 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
583 if (bus == NULL) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
584 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
585 "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
586 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
587 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
588
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
589 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
590 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
591 gst_object_unref(bus);
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
592
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
593 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
594 GST_ELEMENT(priv->confbin))) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
595 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
596 "element to the pipeline\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
597 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
598 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
599
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
600 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
601 GST_ELEMENT(priv->conference))) {
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
602 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
603 "element to the confbin\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
604 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
605 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
606
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
607 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
608 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
609 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
610 "Failed to start conference.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
611 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
612 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
613
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
614 return TRUE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
615 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
616
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
617 static gboolean
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
618 purple_media_backend_fs2_add_stream(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
619 const gchar *sess_id, const gchar *who,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
620 PurpleMediaSessionType type, gboolean initiator,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
621 const gchar *transmitter,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
622 guint num_params, GParameter *params)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
623 {
29149
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
624 PurpleMediaBackendFs2Private *priv =
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
625 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
626
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
627 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
628 purple_debug_error("backend-fs2",
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
629 "Error initializing the conference.\n");
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
630 return FALSE;
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
631 }
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
632
4aa30863743b Create and dispose the conference in the Farsight 2 media backend.
maiku@pidgin.im
parents: 29146
diff changeset
633 return TRUE;
29146
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
634 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
635
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
636 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
637 purple_media_backend_fs2_add_remote_candidates(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
638 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
639 GList *remote_candidates)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
640 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
641 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
642
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
643 static GList *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
644 purple_media_backend_fs2_get_codecs(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
645 const gchar *sess_id)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
646 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
647 return NULL;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
648 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
649
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
650 static GList *
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
651 purple_media_backend_fs2_get_local_candidates(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
652 const gchar *sess_id, const gchar *participant)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
653 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
654 return NULL;
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
655 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
656
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
657 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
658 purple_media_backend_fs2_set_remote_codecs(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
659 const gchar *sess_id, const gchar *participant,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
660 GList *codecs)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
661 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
662 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
663
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
664 static void
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
665 purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self,
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
666 const gchar *sess_id, PurpleMediaCodec *codec)
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
667 {
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
668 }
f46979436c78 Skeleton of the Farsight 2 media backend.
maiku@pidgin.im
parents:
diff changeset
669
29154
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
670 FsConference *
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
671 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
672 {
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
673 PurpleMediaBackendFs2Private *priv =
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
674 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
675 return priv->conference;
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
676 }
2f8151fed0ae Various tweaks, fixes, and added debug output. Attached some media signals,
maiku@pidgin.im
parents: 29149
diff changeset
677