view libpurple/media/backend-iface.h @ 31822:6c660dc7cb6a

Moved the conversation attributes API and the IRC periodic WHO updates to i.p.p.next.minor, where they belong. applied changes from 3de680fff7ddd1b00149657afb7f6cd833000a90 through 7ee5e1d431651ed2b1a54bc942d63f35580af55c applied changes from e7c103fdfbc59bb2ca41a3c8813c4ff2847a673f through 22937ab220c41cd0c4a3f9e21e3db687db80da75 applied changes from 22937ab220c41cd0c4a3f9e21e3db687db80da75 through cba010d1c097d4e6599f08276ed9d894710c1074 applied changes from a694289accbec14c593b3636ef1f626fd8279805 through 8a43e3ddd7adacb208afe2d7ee3ea983c95901be
author Evan Schoenberg <evan.s@dreskin.net>
date Mon, 21 Feb 2011 23:08:47 +0000
parents 44f53d3fc54f
children a4ba3b194ce3
line wrap: on
line source

/**
 * @file backend-iface.h Interface for media backends
 * @ingroup core
 */

/* purple
 *
 * Purple is the legal property of its developers, whose names are too numerous
 * to list here.  Please refer to the COPYRIGHT file distributed with this
 * source distribution.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
 */

#ifndef _MEDIA_BACKEND_IFACE_H_
#define _MEDIA_BACKEND_IFACE_H_

#include "codec.h"
#include "enum-types.h"

#include <glib-object.h>

G_BEGIN_DECLS

#define PURPLE_TYPE_MEDIA_BACKEND		(purple_media_backend_get_type())
#define PURPLE_IS_MEDIA_BACKEND(obj)		(G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA_BACKEND))
#define PURPLE_MEDIA_BACKEND(obj)		(G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_BACKEND, PurpleMediaBackend))
#define PURPLE_MEDIA_BACKEND_GET_INTERFACE(inst)(G_TYPE_INSTANCE_GET_INTERFACE((inst), PURPLE_TYPE_MEDIA_BACKEND, PurpleMediaBackendIface))

/** A placeholder to represent any media backend */
typedef struct _PurpleMediaBackend PurpleMediaBackend;
/** A structure to derive media backends from. */
typedef struct _PurpleMediaBackendIface PurpleMediaBackendIface;

struct _PurpleMediaBackendIface
{
	GTypeInterface parent_iface; /**< The parent iface class */

	/** Implementable functions called with purple_media_backend_* */
	gboolean (*add_stream) (PurpleMediaBackend *self,
		const gchar *sess_id, const gchar *who,
		PurpleMediaSessionType type, gboolean initiator,
		const gchar *transmitter,
		guint num_params, GParameter *params);
	void (*add_remote_candidates) (PurpleMediaBackend *self,
		const gchar *sess_id, const gchar *participant,
		GList *remote_candidates);
	gboolean (*codecs_ready) (PurpleMediaBackend *self,
		const gchar *sess_id);
	GList *(*get_codecs) (PurpleMediaBackend *self,
		const gchar *sess_id);
	GList *(*get_local_candidates) (PurpleMediaBackend *self,
		const gchar *sess_id, const gchar *participant);
	gboolean (*set_remote_codecs) (PurpleMediaBackend *self,
		const gchar *sess_id, const gchar *participant,
		GList *codecs);
	gboolean (*set_send_codec) (PurpleMediaBackend *self,
		const gchar *sess_id, PurpleMediaCodec *codec);
};

/**
 * Gets the media backend's GType.
 *
 * @return The media backend's GType.
 *
 * @since 2.7.0
 */
GType purple_media_backend_get_type(void);

/**
 * Creates and adds a stream to the media backend.
 *
 * @param self The backend to add the stream to.
 * @param sess_id The session id of the stream to add.
 * @param who The remote participant of the stream to add.
 * @param type The media type and direction of the stream to add.
 * @param initiator True if the local user initiated the stream.
 * @param transmitter The string id of the tranmsitter to use.
 * @param num_params The number of parameters in the param parameter.
 * @param params The additional parameters to pass when creating the stream.
 *
 * @return True if the stream was successfully created, othewise False.
 *
 * @since 2.7.0
 */
gboolean purple_media_backend_add_stream(PurpleMediaBackend *self,
		const gchar *sess_id, const gchar *who,
		PurpleMediaSessionType type, gboolean initiator,
		const gchar *transmitter,
		guint num_params, GParameter *params);

/**
 * Add remote candidates to a stream.
 *
 * @param self The backend the stream is in.
 * @param sess_id The session id associated with the stream.
 * @param participant The participant associated with the stream.
 * @param remote_candidates The list of remote candidates to add.
 *
 * @since 2.7.0
 */
void purple_media_backend_add_remote_candidates(PurpleMediaBackend *self,
		const gchar *sess_id, const gchar *participant,
		GList *remote_candidates);

/**
 * Get whether or not a session's codecs are ready.
 *
 * A codec is ready if all of the attributes and additional
 * parameters have been collected.
 *
 * @param self The media backend the session is in.
 * @param sess_id The session id of the session to check.
 *
 * @return True if the codecs are ready, otherwise False.
 *
 * @since 2.7.0
 */
gboolean purple_media_backend_codecs_ready(PurpleMediaBackend *self,
		const gchar *sess_id);

/**
 * Gets the codec intersection list for a session.
 *
 * The intersection list consists of all codecs that are compatible
 * between the local and remote software.
 *
 * @param self The media backend the session is in.
 * @param sess_id The session id of the session to use.
 *
 * @return The codec intersection list.
 *
 * @since 2.7.0
 */
GList *purple_media_backend_get_codecs(PurpleMediaBackend *self,
		const gchar *sess_id);

/**
 * Gets the list of local candidates for a stream.
 *
 * @param self The media backend the stream is in.
 * @param sess_id The session id associated with the stream.
 * @param particilant The participant associated with the stream.
 *
 * @return The list of local candidates.
 *
 * @since 2.7.0
 */
GList *purple_media_backend_get_local_candidates(PurpleMediaBackend *self,
		const gchar *sess_id, const gchar *participant);

/**
 * Sets the remote codecs on a stream.
 *
 * @param self The media backend the stream is in.
 * @param sess_id The session id the stream is associated with.
 * @param participant The participant the stream is associated with.
 * @param codecs The list of remote codecs to set.
 *
 * @return True if the remote codecs were set successfully, otherwise False.
 *
 * @since 2.7.0
 */
gboolean purple_media_backend_set_remote_codecs(PurpleMediaBackend *self,
		const gchar *sess_id, const gchar *participant,
		GList *codecs);

/**
 * Sets which codec format to send media content in for a session.
 *
 * @param self The media backend the session is in.
 * @param sess_id The session id of the session to set the codec for.
 * @param codec The codec to set.
 *
 * @return True if set successfully, otherwise False.
 *
 * @since 2.7.0
 */
gboolean purple_media_backend_set_send_codec(PurpleMediaBackend *self,
		const gchar *sess_id, PurpleMediaCodec *codec);

G_END_DECLS

#endif /* _MEDIA_BACKEND_IFACE_H_ */