Mercurial > pidgin
changeset 26350:064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
is not defined.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Mon, 23 Mar 2009 04:00:11 +0000 |
parents | 1ae3af12095a |
children | 0dfd05966e09 |
files | Doxyfile.in libpurple/media-gst.h libpurple/media.c libpurple/media.h libpurple/mediamanager.c libpurple/mediamanager.h |
diffstat | 6 files changed, 189 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/Doxyfile.in Mon Mar 23 02:59:18 2009 +0000 +++ b/Doxyfile.in Mon Mar 23 04:00:11 2009 +0000 @@ -1070,7 +1070,7 @@ # undefined via #undef or recursively expanded use the := operator # instead of the = operator. -PREDEFINED = USE_VV +PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded.
--- a/libpurple/media-gst.h Mon Mar 23 02:59:18 2009 +0000 +++ b/libpurple/media-gst.h Mon Mar 23 04:00:11 2009 +0000 @@ -27,8 +27,6 @@ #ifndef __MEDIA_GST_H_ #define __MEDIA_GST_H_ -#ifdef USE_VV - #include "media.h" #include "mediamanager.h" @@ -141,6 +139,4 @@ G_END_DECLS -#endif /* USE_VV */ - #endif /* __MEDIA_GST_H_ */
--- a/libpurple/media.c Mon Mar 23 02:59:18 2009 +0000 +++ b/libpurple/media.c Mon Mar 23 04:00:11 2009 +0000 @@ -79,9 +79,11 @@ gulong window_id; guint connected_cb_id; }; +#endif struct _PurpleMediaPrivate { +#ifdef USE_VV PurpleMediaManager *manager; PurpleConnection *pc; FsConference *conference; @@ -94,8 +96,12 @@ GList *streams; /* PurpleMediaStream table */ GstElement *confbin; +#else + gpointer dummy; +#endif }; +#ifdef USE_VV #define PURPLE_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA, PurpleMediaPrivate)) static void purple_media_class_init (PurpleMediaClass *klass); @@ -139,10 +145,12 @@ PROP_INITIATOR, PROP_PRPL_DATA, }; +#endif GType purple_media_get_type() { +#ifdef USE_VV static GType type = 0; if (type == 0) { @@ -161,6 +169,9 @@ type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0); } return type; +#else + return G_TYPE_NONE; +#endif } GType @@ -203,6 +214,7 @@ return type; } +#ifdef USE_VV static void purple_media_class_init (PurpleMediaClass *klass) { @@ -505,6 +517,7 @@ } } +#endif PurpleMediaCandidate * purple_media_candidate_new(const gchar *foundation, guint component_id, @@ -560,6 +573,7 @@ g_free(candidate); } +#ifdef USE_VV static FsCandidate * purple_media_candidate_to_fs(PurpleMediaCandidate *candidate) { @@ -630,6 +644,7 @@ new_list = g_list_reverse(new_list); return new_list; } +#endif GList * purple_media_candidate_list_copy(GList *candidates) @@ -669,6 +684,7 @@ return type; } +#ifdef USE_VV static FsMediaType purple_media_to_fs_media_type(PurpleMediaSessionType type) { @@ -713,6 +729,7 @@ } return result; } +#endif void purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec, @@ -818,6 +835,7 @@ g_free(codec); } +#ifdef USE_VV static FsCodec * purple_media_codec_to_fs(const PurpleMediaCodec *codec) { @@ -864,16 +882,22 @@ return new_codec; } +#endif gchar * purple_media_codec_to_string(const PurpleMediaCodec *codec) { +#ifdef USE_VV FsCodec *fscodec = purple_media_codec_to_fs(codec); gchar *str = fs_codec_to_string(fscodec); fs_codec_destroy(fscodec); return str; +#else + return g_strdup(""); +#endif } +#ifdef USE_VV static GList * purple_media_codec_list_from_fs(GList *codecs) { @@ -903,6 +927,7 @@ new_list = g_list_reverse(new_list); return new_list; } +#endif GList * purple_media_codec_list_copy(GList *codecs) @@ -942,6 +967,7 @@ return type; } +#ifdef USE_VV static PurpleMediaSession* purple_media_get_session(PurpleMedia *media, const gchar *sess_id) { @@ -1083,15 +1109,21 @@ stream = purple_media_get_stream(session->media, session->id, name); stream->local_candidates = g_list_append(stream->local_candidates, candidate); } +#endif GList * purple_media_get_session_names(PurpleMedia *media) { +#ifdef USE_VV g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); return media->priv->sessions != NULL ? g_hash_table_get_keys(media->priv->sessions) : NULL; +#else + return NULL; +#endif } +#ifdef USE_VV static void purple_media_set_src(PurpleMedia *media, const gchar *sess_id, GstElement *src) { @@ -1128,6 +1160,7 @@ ? "success" : "failure"); gst_element_set_locked_state(session->src, FALSE); } +#endif #if 0 static void @@ -1157,12 +1190,17 @@ GstElement * purple_media_get_src(PurpleMedia *media, const gchar *sess_id) { +#ifdef USE_VV PurpleMediaSession *session; g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); session = purple_media_get_session(media, sess_id); return (session != NULL) ? session->src : NULL; +#else + return NULL; +#endif } +#ifdef USE_VV static PurpleMediaSession * purple_media_session_from_fs_stream(PurpleMedia *media, FsStream *stream) { @@ -1294,43 +1332,59 @@ return TRUE; } +#endif GstElement * purple_media_get_pipeline(PurpleMedia *media) { +#ifdef USE_VV g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); return purple_media_manager_get_pipeline(media->priv->manager); +#else + return NULL; +#endif } PurpleConnection * purple_media_get_connection(PurpleMedia *media) { +#ifdef USE_VV PurpleConnection *pc; g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); g_object_get(G_OBJECT(media), "connection", &pc, NULL); return pc; +#else + return NULL; +#endif } gpointer purple_media_get_prpl_data(PurpleMedia *media) { +#ifdef USE_VV gpointer prpl_data; g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); g_object_get(G_OBJECT(media), "prpl-data", &prpl_data, NULL); return prpl_data; +#else + return NULL; +#endif } void purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data) { +#ifdef USE_VV g_return_if_fail(PURPLE_IS_MEDIA(media)); g_object_set(G_OBJECT(media), "prpl-data", prpl_data, NULL); +#endif } void purple_media_error(PurpleMedia *media, const gchar *error, ...) { +#ifdef USE_VV va_list args; gchar *message; @@ -1344,11 +1398,13 @@ g_signal_emit(media, purple_media_signals[ERROR], 0, message); g_free(message); +#endif } void purple_media_accept(PurpleMedia *media) { +#ifdef USE_VV GList *streams; g_return_if_fail(PURPLE_IS_MEDIA(media)); @@ -1365,32 +1421,38 @@ g_signal_emit(media, purple_media_signals[ACCEPTED], 0, NULL, NULL); +#endif } void purple_media_hangup(PurpleMedia *media) { +#ifdef USE_VV g_return_if_fail(PURPLE_IS_MEDIA(media)); g_signal_emit(media, purple_media_signals[STREAM_INFO], 0, PURPLE_MEDIA_INFO_HANGUP, NULL, NULL); purple_media_end(media, NULL, NULL); +#endif } void purple_media_reject(PurpleMedia *media) { +#ifdef USE_VV g_return_if_fail(PURPLE_IS_MEDIA(media)); g_signal_emit(media, purple_media_signals[STREAM_INFO], 0, PURPLE_MEDIA_INFO_REJECT, NULL, NULL); purple_media_end(media, NULL, NULL); +#endif } void purple_media_end(PurpleMedia *media, const gchar *session_id, const gchar *participant) { +#ifdef USE_VV g_return_if_fail(PURPLE_IS_MEDIA(media)); if (session_id == NULL && participant == NULL) { g_signal_emit(media, purple_media_signals[STATE_CHANGED], @@ -1398,8 +1460,10 @@ NULL, NULL); g_object_unref(media); } +#endif } +#ifdef USE_VV static void purple_media_new_local_candidate_cb(FsStream *stream, FsCandidate *local_candidate, @@ -1789,6 +1853,7 @@ return TRUE; } +#endif gboolean purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who, @@ -1796,6 +1861,7 @@ const gchar *transmitter, guint num_params, GParameter *params) { +#ifdef USE_VV FsStreamDirection type_direction; g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); @@ -1819,6 +1885,9 @@ } } return TRUE; +#else + return FALSE; +#endif } void @@ -1830,15 +1899,20 @@ PurpleMediaSessionType purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id) { +#ifdef USE_VV PurpleMediaSession *session; g_return_val_if_fail(PURPLE_IS_MEDIA(media), PURPLE_MEDIA_NONE); session = purple_media_get_session(media, sess_id); return session->type; +#else + return PURPLE_MEDIA_NONE; +#endif } /* XXX: Should wait until codecs-ready is TRUE before using this function */ GList * purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id) { +#ifdef USE_VV GList *fscodecs; GList *codecs; PurpleMediaSession *session; @@ -1855,21 +1929,29 @@ codecs = purple_media_codec_list_from_fs(fscodecs); fs_codec_list_destroy(fscodecs); return codecs; +#else + return NULL; +#endif } GList * purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id, const gchar *name) { +#ifdef USE_VV PurpleMediaStream *stream; g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); stream = purple_media_get_stream(media, sess_id, name); return purple_media_candidate_list_from_fs(stream->local_candidates); +#else + return NULL; +#endif } void purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id, const gchar *name, GList *remote_candidates) { +#ifdef USE_VV PurpleMediaStream *stream; GError *err = NULL; @@ -1887,33 +1969,43 @@ " candidates: %s\n", err->message); g_error_free(err); } +#endif } GList * purple_media_get_active_local_candidates(PurpleMedia *media, const gchar *sess_id, const gchar *name) { +#ifdef USE_VV PurpleMediaStream *stream; g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); stream = purple_media_get_stream(media, sess_id, name); return purple_media_candidate_list_from_fs( stream->active_local_candidates); +#else + return NULL; +#endif } GList * purple_media_get_active_remote_candidates(PurpleMedia *media, const gchar *sess_id, const gchar *name) { +#ifdef USE_VV PurpleMediaStream *stream; g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); stream = purple_media_get_stream(media, sess_id, name); return purple_media_candidate_list_from_fs( stream->active_remote_candidates); +#else + return NULL; +#endif } gboolean purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id, const gchar *name, GList *codecs) { +#ifdef USE_VV PurpleMediaStream *stream; FsStream *fsstream; GList *fscodecs; @@ -1937,12 +2029,16 @@ return FALSE; } return TRUE; +#else + return FALSE; +#endif } gboolean purple_media_candidates_prepared(PurpleMedia *media, const gchar *session_id, const gchar *participant) { +#ifdef USE_VV GList *streams; gboolean prepared = TRUE; @@ -1960,11 +2056,15 @@ } return prepared; +#else + return FALSE; +#endif } gboolean purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec) { +#ifdef USE_VV PurpleMediaSession *session; FsCodec *fscodec; GError *err = NULL; @@ -1986,11 +2086,15 @@ return FALSE; } return TRUE; +#else + return FALSE; +#endif } gboolean purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id) { +#ifdef USE_VV gboolean ret; g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); @@ -2016,12 +2120,16 @@ g_list_free(values); } return ret; +#else + return FALSE; +#endif } gboolean purple_media_accepted(PurpleMedia *media, const gchar *sess_id, const gchar *participant) { +#ifdef USE_VV gboolean accepted = TRUE; g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); @@ -2056,10 +2164,14 @@ } return accepted; +#else + return FALSE; +#endif } void purple_media_mute(PurpleMedia *media, gboolean active) { +#ifdef USE_VV GList *sessions; g_return_if_fail(PURPLE_IS_MEDIA(media)); @@ -2076,11 +2188,13 @@ g_object_set(volume, "mute", active, NULL); } } +#endif } void purple_media_set_input_volume(PurpleMedia *media, const gchar *session_id, double level) { +#ifdef USE_VV GList *sessions; g_return_if_fail(PURPLE_IS_MEDIA(media)); @@ -2101,12 +2215,14 @@ g_object_set(volume, "volume", level, NULL); } } +#endif } void purple_media_set_output_volume(PurpleMedia *media, const gchar *session_id, const gchar *participant, double level) { +#ifdef USE_VV GList *streams; g_return_if_fail(PURPLE_IS_MEDIA(media)); @@ -2141,21 +2257,27 @@ gst_iterator_free(iter); } } +#endif } gulong purple_media_set_output_window(PurpleMedia *media, const gchar *session_id, const gchar *participant, gulong window_id) { +#ifdef USE_VV g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); return purple_media_manager_set_output_window(media->priv->manager, media, session_id, participant, window_id); +#else + return 0; +#endif } void purple_media_remove_output_windows(PurpleMedia *media) { +#ifdef USE_VV GList *iter = media->priv->streams; for (; iter; iter = g_list_next(iter)) { PurpleMediaStream *stream = iter->data; @@ -2171,12 +2293,14 @@ media->priv->manager, media, session_name, NULL); } +#endif } GstElement * purple_media_get_tee(PurpleMedia *media, const gchar *session_id, const gchar *participant) { +#ifdef USE_VV g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); if (session_id != NULL && participant == NULL) { @@ -2190,6 +2314,8 @@ return (stream != NULL) ? stream->tee : NULL; } g_return_val_if_reached(NULL); +#else + return NULL; +#endif } -#endif /* USE_VV */
--- a/libpurple/media.h Mon Mar 23 02:59:18 2009 +0000 +++ b/libpurple/media.h Mon Mar 23 04:00:11 2009 +0000 @@ -27,8 +27,6 @@ #ifndef __MEDIA_H_ #define __MEDIA_H_ -#ifdef USE_VV - #include <glib.h> #include <glib-object.h> @@ -59,12 +57,6 @@ /** @copydoc _PurpleMediaCodecParameter */ typedef struct _PurpleMediaCodecParameter PurpleMediaCodecParameter; -#else - -typedef void PurpleMedia; - -#endif /* USE_VV */ - /** Media caps */ typedef enum { PURPLE_MEDIA_CAPS_NONE = 0, @@ -122,8 +114,6 @@ PURPLE_MEDIA_NETWORK_PROTOCOL_TCP, } PurpleMediaNetworkProtocol; -#ifdef USE_VV - /** The media class */ struct _PurpleMediaClass { @@ -596,7 +586,4 @@ G_END_DECLS -#endif /* USE_VV */ - - #endif /* __MEDIA_H_ */
--- a/libpurple/mediamanager.c Mon Mar 23 02:59:18 2009 +0000 +++ b/libpurple/mediamanager.c Mon Mar 23 04:00:11 2009 +0000 @@ -49,6 +49,7 @@ gulong window_id; GstElement *sink; }; +#endif struct _PurpleMediaManagerPrivate { @@ -155,13 +156,18 @@ PurpleMediaManager * purple_media_manager_get() { +#ifdef USE_VV static PurpleMediaManager *manager = NULL; if (manager == NULL) manager = PURPLE_MEDIA_MANAGER(g_object_new(purple_media_manager_get_type(), NULL)); return manager; +#else + return NULL; +#endif } +#ifdef USE_VV static gboolean pipeline_bus_call(GstBus *bus, GstMessage *msg, PurpleMediaManager *manager) { @@ -192,10 +198,12 @@ } return TRUE; } +#endif GstElement * purple_media_manager_get_pipeline(PurpleMediaManager *manager) { +#ifdef USE_VV g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); if (manager->priv->pipeline == NULL) { @@ -216,6 +224,9 @@ } return manager->priv->pipeline; +#else + return NULL; +#endif } PurpleMedia * @@ -225,6 +236,7 @@ const char *remote_user, gboolean initiator) { +#ifdef USE_VV PurpleMedia *media; FsConference *conference = FS_CONFERENCE(gst_element_factory_make(conference_type, NULL)); GstStateChangeReturn ret; @@ -266,18 +278,26 @@ manager->priv->medias = g_list_append(manager->priv->medias, media); return media; +#else + return NULL; +#endif } GList * purple_media_manager_get_media(PurpleMediaManager *manager) { +#ifdef USE_VV return manager->priv->medias; +#else + return NULL; +#endif } GList * purple_media_manager_get_media_by_connection(PurpleMediaManager *manager, PurpleConnection *pc) { +#ifdef USE_VV GList *media = NULL; GList *iter; @@ -291,22 +311,28 @@ } return media; +#else + return NULL; +#endif } void purple_media_manager_remove_media(PurpleMediaManager *manager, PurpleMedia *media) { +#ifdef USE_VV GList *list = g_list_find(manager->priv->medias, media); if (list) manager->priv->medias = g_list_delete_link(manager->priv->medias, list); +#endif } GstElement * purple_media_manager_get_element(PurpleMediaManager *manager, PurpleMediaSessionType type) { +#ifdef USE_VV GstElement *ret = NULL; /* TODO: If src, retrieve current src */ @@ -329,12 +355,16 @@ purple_debug_error("media", "Error creating source or sink\n"); return ret; +#else + return NULL; +#endif } PurpleMediaElementInfo * purple_media_manager_get_element_info(PurpleMediaManager *manager, const gchar *id) { +#ifdef USE_VV GList *iter; g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); @@ -346,6 +376,7 @@ if (!strcmp(info->id, id)) return info; } +#endif return NULL; } @@ -354,6 +385,7 @@ purple_media_manager_register_element(PurpleMediaManager *manager, PurpleMediaElementInfo *info) { +#ifdef USE_VV g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); g_return_val_if_fail(info != NULL, FALSE); @@ -363,12 +395,16 @@ manager->priv->elements = g_list_prepend(manager->priv->elements, info); return TRUE; +#else + return FALSE; +#endif } gboolean purple_media_manager_unregister_element(PurpleMediaManager *manager, const gchar *id) { +#ifdef USE_VV PurpleMediaElementInfo *info; g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); @@ -390,12 +426,16 @@ manager->priv->elements = g_list_remove( manager->priv->elements, info); return TRUE; +#else + return FALSE; +#endif } gboolean purple_media_manager_set_active_element(PurpleMediaManager *manager, PurpleMediaElementInfo *info) { +#ifdef USE_VV gboolean ret = FALSE; g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); @@ -426,12 +466,16 @@ } return ret; +#else + return FALSE; +#endif } PurpleMediaElementInfo * purple_media_manager_get_active_element(PurpleMediaManager *manager, PurpleMediaElementType type) { +#ifdef USE_VV g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); if (type & PURPLE_MEDIA_ELEMENT_SRC) { @@ -445,10 +489,12 @@ else if (type & PURPLE_MEDIA_ELEMENT_VIDEO) return manager->priv->video_sink; } +#endif return NULL; } +#ifdef USE_VV static void window_id_cb(GstBus *bus, GstMessage *msg, PurpleMediaOutputWindow *ow) { @@ -466,12 +512,14 @@ GST_MESSAGE_SRC(msg)), ow->window_id); } } +#endif gboolean purple_media_manager_create_output_window(PurpleMediaManager *manager, PurpleMedia *media, const gchar *session_id, const gchar *participant) { +#ifdef USE_VV GList *iter; g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); @@ -529,6 +577,9 @@ } } return TRUE; +#else + return FALSE; +#endif } gulong @@ -536,6 +587,7 @@ PurpleMedia *media, const gchar *session_id, const gchar *participant, gulong window_id) { +#ifdef USE_VV PurpleMediaOutputWindow *output_window; g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); @@ -556,12 +608,16 @@ media, session_id, participant); return output_window->id; +#else + return 0; +#endif } gboolean purple_media_manager_remove_output_window(PurpleMediaManager *manager, gulong output_window_id) { +#ifdef USE_VV PurpleMediaOutputWindow *output_window = NULL; GList *iter; @@ -605,6 +661,9 @@ g_free(output_window); return TRUE; +#else + return FALSE; +#endif } void @@ -612,6 +671,7 @@ PurpleMedia *media, const gchar *session_id, const gchar *participant) { +#ifdef USE_VV GList *iter; g_return_if_fail(PURPLE_IS_MEDIA(media)); @@ -632,6 +692,6 @@ purple_media_manager_remove_output_window( manager, ow->id); } +#endif } -#endif /* USE_VV */
--- a/libpurple/mediamanager.h Mon Mar 23 02:59:18 2009 +0000 +++ b/libpurple/mediamanager.h Mon Mar 23 04:00:11 2009 +0000 @@ -27,8 +27,6 @@ #ifndef __MEDIA_MANAGER_H_ #define __MEDIA_MANAGER_H_ -#ifdef USE_VV - #include <glib.h> #include <glib-object.h> @@ -155,7 +153,4 @@ G_END_DECLS -#endif /* USE_VV */ - - #endif /* __MEDIA_MANAGER_H_ */