Frameworks/libpurple.framework/Versions/0.6.2/Headers/media-gst.h
author Zachary West <zacw@adium.im>
Fri Aug 21 13:25:11 2009 -0700 (2009-08-21)
changeset 2592 e8d15275025e
parent 1759 Frameworks/libpurple.framework/Versions/0.6.0/Headers/media-gst.h@1c4953467918
permissions -rw-r--r--
im.pidgin.adium.1-4 at 267c6165e02e34318a1823960bd04c0639952f73
     1 /**
     2  * @file media-gst.h Media API
     3  * @ingroup core
     4  */
     5 
     6 /* purple
     7  *
     8  * Purple is the legal property of its developers, whose names are too numerous
     9  * to list here.  Please refer to the COPYRIGHT file distributed with this
    10  * source distribution.
    11  *
    12  * This program is free software; you can redistribute it and/or modify
    13  * it under the terms of the GNU General Public License as published by
    14  * the Free Software Foundation; either version 2 of the License, or
    15  * (at your option) any later version.
    16  *
    17  * This program is distributed in the hope that it will be useful,
    18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    20  * GNU General Public License for more details.
    21  *
    22  * You should have received a copy of the GNU General Public License
    23  * along with this program; if not, write to the Free Software
    24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    25  */
    26 
    27 #ifndef _PURPLE_MEDIA_GST_H_
    28 #define _PURPLE_MEDIA_GST_H_
    29 
    30 #include "media.h"
    31 #include "mediamanager.h"
    32 
    33 #include <gst/gst.h>
    34 
    35 G_BEGIN_DECLS
    36 
    37 #define PURPLE_TYPE_MEDIA_ELEMENT_TYPE           (purple_media_element_type_get_type())
    38 #define PURPLE_TYPE_MEDIA_ELEMENT_INFO           (purple_media_element_info_get_type())
    39 #define PURPLE_MEDIA_ELEMENT_INFO(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo))
    40 #define PURPLE_MEDIA_ELEMENT_INFO_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo))
    41 #define PURPLE_IS_MEDIA_ELEMENT_INFO(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO))
    42 #define PURPLE_IS_MEDIA_ELEMENT_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA_ELEMENT_INFO))
    43 #define PURPLE_MEDIA_ELEMENT_INFO_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo))
    44 
    45 /** @copydoc _PurpleMediaElementInfo */
    46 typedef struct _PurpleMediaElementInfo PurpleMediaElementInfo;
    47 typedef struct _PurpleMediaElementInfoClass PurpleMediaElementInfoClass;
    48 typedef GstElement *(*PurpleMediaElementCreateCallback)(PurpleMedia *media,
    49 			const gchar *session_id, const gchar *participant);
    50 
    51 typedef enum {
    52 	PURPLE_MEDIA_ELEMENT_NONE = 0,			/** empty element */
    53 	PURPLE_MEDIA_ELEMENT_AUDIO = 1,			/** supports audio */
    54 	PURPLE_MEDIA_ELEMENT_VIDEO = 1 << 1,		/** supports video */
    55 	PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO = PURPLE_MEDIA_ELEMENT_AUDIO
    56 			| PURPLE_MEDIA_ELEMENT_VIDEO, 	/** supports audio and video */
    57 
    58 	PURPLE_MEDIA_ELEMENT_NO_SRCS = 0,		/** has no src pads */
    59 	PURPLE_MEDIA_ELEMENT_ONE_SRC = 1 << 2,		/** has one src pad */
    60 	PURPLE_MEDIA_ELEMENT_MULTI_SRC = 1 << 3, 	/** has multiple src pads */
    61 	PURPLE_MEDIA_ELEMENT_REQUEST_SRC = 1 << 4, 	/** src pads must be requested */
    62 
    63 	PURPLE_MEDIA_ELEMENT_NO_SINKS = 0,		/** has no sink pads */
    64 	PURPLE_MEDIA_ELEMENT_ONE_SINK = 1 << 5, 	/** has one sink pad */
    65 	PURPLE_MEDIA_ELEMENT_MULTI_SINK = 1 << 6, 	/** has multiple sink pads */
    66 	PURPLE_MEDIA_ELEMENT_REQUEST_SINK = 1 << 7, 	/** sink pads must be requested */
    67 
    68 	PURPLE_MEDIA_ELEMENT_UNIQUE = 1 << 8,		/** This element is unique and
    69 							 only one instance of it should
    70 							 be created at a time */
    71 
    72 	PURPLE_MEDIA_ELEMENT_SRC = 1 << 9,		/** can be set as an active src */
    73 	PURPLE_MEDIA_ELEMENT_SINK = 1 << 10,		/** can be set as an active sink */
    74 } PurpleMediaElementType;
    75 
    76 #ifdef __cplusplus
    77 extern "C" {
    78 #endif
    79 
    80 /**
    81  * Gets the element type's GType.
    82  *
    83  * @return The element type's GType.
    84  *
    85  * @since 2.6.0
    86  */
    87 GType purple_media_element_type_get_type(void);
    88 
    89 /**
    90  * Gets the element info's GType.
    91  *
    92  * @return The element info's GType.
    93  *
    94  * @since 2.6.0
    95  */
    96 GType purple_media_element_info_get_type(void);
    97 
    98 /**
    99  * Gets the source from a session
   100  *
   101  * @param media The media object the session is in.
   102  * @param sess_id The session id of the session to get the source from.
   103  *
   104  * @return The source retrieved.
   105  *
   106  * @since 2.6.0
   107  */
   108 GstElement *purple_media_get_src(PurpleMedia *media, const gchar *sess_id);
   109 
   110 /**
   111  * Gets the tee from a given session/stream.
   112  *
   113  * @param media The instance to get the tee from.
   114  * @param session_id The id of the session to get the tee from.
   115  * @param participant Optionally, the participant of the stream to get the tee from.
   116  *
   117  * @return The GstTee element from the chosen session/stream.
   118  *
   119  * @since 2.6.0
   120  */
   121 GstElement *purple_media_get_tee(PurpleMedia *media,
   122 		const gchar *session_id, const gchar *participant);
   123 
   124 
   125 /**
   126  * Gets the pipeline from the media manager.
   127  *
   128  * @param manager The media manager to get the pipeline from.
   129  *
   130  * @return The pipeline.
   131  *
   132  * @since 2.6.0
   133  */
   134 GstElement *purple_media_manager_get_pipeline(PurpleMediaManager *manager);
   135 
   136 /**
   137  * Returns a GStreamer source or sink for audio or video.
   138  *
   139  * @param manager The media manager to use to obtain the source/sink.
   140  * @param type The type of source/sink to get.
   141  *
   142  * @since 2.6.0
   143  */
   144 GstElement *purple_media_manager_get_element(PurpleMediaManager *manager,
   145 		PurpleMediaSessionType type, PurpleMedia *media,
   146 		const gchar *session_id, const gchar *participant);
   147 
   148 PurpleMediaElementInfo *purple_media_manager_get_element_info(
   149 		PurpleMediaManager *manager, const gchar *name);
   150 gboolean purple_media_manager_register_element(PurpleMediaManager *manager,
   151 		PurpleMediaElementInfo *info);
   152 gboolean purple_media_manager_unregister_element(PurpleMediaManager *manager,
   153 		const gchar *name);
   154 gboolean purple_media_manager_set_active_element(PurpleMediaManager *manager,
   155 		PurpleMediaElementInfo *info);
   156 PurpleMediaElementInfo *purple_media_manager_get_active_element(
   157 		PurpleMediaManager *manager, PurpleMediaElementType type);
   158 
   159 gchar *purple_media_element_info_get_id(PurpleMediaElementInfo *info);
   160 gchar *purple_media_element_info_get_name(PurpleMediaElementInfo *info);
   161 PurpleMediaElementType purple_media_element_info_get_element_type(
   162 		PurpleMediaElementInfo *info);
   163 GstElement *purple_media_element_info_call_create(
   164 		PurpleMediaElementInfo *info, PurpleMedia *media,
   165 		const gchar *session_id, const gchar *participant);
   166 
   167 #ifdef __cplusplus
   168 }
   169 #endif
   170 
   171 G_END_DECLS
   172 
   173 #endif  /* _PURPLE_MEDIA_GST_H_ */