From 1ebf5a5fcda0c9154e22ed02404fd46525a7fd9f Mon Sep 17 00:00:00 2001 From: bossiel Date: Wed, 10 Aug 2011 22:59:15 +0000 Subject: Move deprecated v1.0 from trunk to branches --- .../include/tinymedia/content/tmedia_content.h | 126 +++++++ .../tinymedia/content/tmedia_content_cpim.h | 59 ++++ .../tinymedia/content/tmedia_content_multipart.h | 0 .../tinymedia/content/tmedia_content_sip_frag.h | 0 tinyMEDIA/include/tinymedia/tmedia.h | 121 +++++++ tinyMEDIA/include/tinymedia/tmedia_codec.h | 310 ++++++++++++++++ tinyMEDIA/include/tinymedia/tmedia_codec_dummy.h | 78 ++++ tinyMEDIA/include/tinymedia/tmedia_common.h | 119 +++++++ tinyMEDIA/include/tinymedia/tmedia_consumer.h | 116 ++++++ tinyMEDIA/include/tinymedia/tmedia_denoise.h | 85 +++++ tinyMEDIA/include/tinymedia/tmedia_params.h | 114 ++++++ tinyMEDIA/include/tinymedia/tmedia_producer.h | 123 +++++++ tinyMEDIA/include/tinymedia/tmedia_qos.h | 194 ++++++++++ tinyMEDIA/include/tinymedia/tmedia_session.h | 392 +++++++++++++++++++++ tinyMEDIA/include/tinymedia/tmedia_session_dummy.h | 76 ++++ tinyMEDIA/include/tinymedia/tmedia_session_ghost.h | 53 +++ tinyMEDIA/include/tinymedia/tmedia_vad.h | 0 17 files changed, 1966 insertions(+) create mode 100644 tinyMEDIA/include/tinymedia/content/tmedia_content.h create mode 100644 tinyMEDIA/include/tinymedia/content/tmedia_content_cpim.h create mode 100644 tinyMEDIA/include/tinymedia/content/tmedia_content_multipart.h create mode 100644 tinyMEDIA/include/tinymedia/content/tmedia_content_sip_frag.h create mode 100644 tinyMEDIA/include/tinymedia/tmedia.h create mode 100644 tinyMEDIA/include/tinymedia/tmedia_codec.h create mode 100644 tinyMEDIA/include/tinymedia/tmedia_codec_dummy.h create mode 100644 tinyMEDIA/include/tinymedia/tmedia_common.h create mode 100644 tinyMEDIA/include/tinymedia/tmedia_consumer.h create mode 100644 tinyMEDIA/include/tinymedia/tmedia_denoise.h create mode 100644 tinyMEDIA/include/tinymedia/tmedia_params.h create mode 100644 tinyMEDIA/include/tinymedia/tmedia_producer.h create mode 100644 tinyMEDIA/include/tinymedia/tmedia_qos.h create mode 100644 tinyMEDIA/include/tinymedia/tmedia_session.h create mode 100644 tinyMEDIA/include/tinymedia/tmedia_session_dummy.h create mode 100644 tinyMEDIA/include/tinymedia/tmedia_session_ghost.h create mode 100644 tinyMEDIA/include/tinymedia/tmedia_vad.h (limited to 'tinyMEDIA/include/tinymedia') diff --git a/tinyMEDIA/include/tinymedia/content/tmedia_content.h b/tinyMEDIA/include/tinymedia/content/tmedia_content.h new file mode 100644 index 0000000..d030243 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/content/tmedia_content.h @@ -0,0 +1,126 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 DOUBANGO. +* +*/ + +/**@file tmedia_content.h + * @brief Base content object. + * + * @author Mamadou Diop + * + */ +#ifndef TINYMEDIA_CONTENT_H +#define TINYMEDIA_CONTENT_H + +#include "tinymedia_config.h" + +#include "tsk_buffer.h" +#include "tsk_list.h" +#include "tsk_params.h" + +TMEDIA_BEGIN_DECLS + +/**Max number of plugins (content types) we can create */ +#define TMEDIA_CONTENT_MAX_PLUGINS 0x0F + +/** cast any pointer to @ref tmedia_content_t* object */ +#define TMEDIA_CONTENT(self) ((tmedia_content_t*)(self)) + +/** Base object for all contents */ +typedef struct tmedia_content_s +{ + TSK_DECLARE_OBJECT; + + const char* type; + //! plugin used to create the codec + const struct tmedia_content_plugin_def_s* plugin; +} +tmedia_content_t; + +/** Virtual table used to define a content plugin */ +typedef struct tmedia_content_plugin_def_s +{ + //! object definition used to create an instance of the codec + const tsk_object_def_t* objdef; + + //! e.g. 'message/CPIM' + const char* type; + + int (*parse) (tmedia_content_t*, const void* in_data, tsk_size_t in_size); + tsk_buffer_t* (*get_data) (tmedia_content_t*); +} +tmedia_content_plugin_def_t; + +/** List of @ref tmedia_codec_t elements */ +typedef tsk_list_t tmedia_contents_L_t; + +/**< Declare base class as content */ +#define TMEDIA_DECLARE_CONTENT tmedia_content_t __content__ + +TINYMEDIA_API int tmedia_content_plugin_register(const char* type, const tmedia_content_plugin_def_t* plugin); +TINYMEDIA_API int tmedia_content_plugin_unregister(const char* type, const tmedia_content_plugin_def_t* plugin); +TINYMEDIA_API int tmedia_content_plugin_unregister_all(); + +TINYMEDIA_API tmedia_content_t* tmedia_content_create(const char* type); +TINYMEDIA_API tmedia_content_t* tmedia_content_parse(const void* data, tsk_size_t size, const char* type); + +TINYMEDIA_API int tmedia_content_init(tmedia_content_t* self); +TINYMEDIA_API int tmedia_content_deinit(tmedia_content_t* self); +TINYMEDIA_API tsk_buffer_t* tmedia_content_get_data(tmedia_content_t* self); + +/** dummy content */ +typedef struct tmedia_content_dummy_s +{ + TMEDIA_DECLARE_CONTENT; + + tsk_buffer_t* data; +} +tmedia_content_dummy_t; + +#define TMEDIA_CONTENT_DUMMY(self) ((tmedia_content_dummy_t*)(self)) +#define TMEDIA_CONTENT_IS_DUMMY(self) ( (self) && (TMEDIA_CONTENT((self))->plugin==tmedia_content_dummy_plugin_def_t) ) + +TINYMEDIA_GEXTERN const tmedia_content_plugin_def_t *tmedia_content_dummy_plugin_def_t; + + +/** content header */ +typedef struct tmedia_content_header_s +{ + TSK_DECLARE_OBJECT; + + char* name; + char* value; + tsk_params_L_t* params; +} +tmedia_content_header_t; + +tmedia_content_header_t* tmedia_content_header_create(const char* name, const char* value); +int tmedia_content_header_deinit(tmedia_content_header_t* self); +char* tmedia_content_header_tostring(const tmedia_content_header_t* self); + +#define TMEDIA_CONTENT_HEADER(self) ((tmedia_content_header_t*)(self)) +#define TMEDIA_DECLARE_CONTENT_HEADER tmedia_content_header_t __content_header__ +typedef tsk_list_t tmedia_content_headers_L_t; + +TINYMEDIA_GEXTERN const tsk_object_def_t *tmedia_content_header_def_t; + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_CONTENT_H */ diff --git a/tinyMEDIA/include/tinymedia/content/tmedia_content_cpim.h b/tinyMEDIA/include/tinymedia/content/tmedia_content_cpim.h new file mode 100644 index 0000000..b3538e9 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/content/tmedia_content_cpim.h @@ -0,0 +1,59 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 DOUBANGO. +* +*/ + +/**@file tmedia_content_cpim.h + * @brief Common Presence and Instant Messaging (CPIM): Message Format (RFC 3862) + * + * @author Mamadou Diop + * + */ +#ifndef TINYMEDIA_CONTENT_CPIM_H +#define TINYMEDIA_CONTENT_CPIM_H + +#include "tinymedia_config.h" + +#include "tmedia_content.h" + +TMEDIA_BEGIN_DECLS + +#define TMEDIA_CONTENT_CPIM_TYPE "message/CPIM" + +/** message/CPIM content */ +typedef struct tmedia_content_cpim_s +{ + TMEDIA_DECLARE_CONTENT; + + tmedia_content_headers_L_t* m_headers; /**< MIME headers for the overall message */ + tmedia_content_headers_L_t* h_headers; /**< message headers */ + tsk_buffer_t* e; /**< encapsulated MIME object containing the message content */ + tsk_buffer_t* x; /**< MIME security multipart message wrapper */ +} +tmedia_content_cpim_t; + +#define TMEDIA_CONTENT_CPIM(self) ((tmedia_content_cpim_t*)(self)) +#define TMEDIA_CONTENT_IS_CPIM(self) ( (self) && (TMEDIA_CONTENT((self))->plugin==tmedia_content_cpim_plugin_def_t) ) + +TINYMEDIA_GEXTERN const tmedia_content_plugin_def_t *tmedia_content_cpim_plugin_def_t; + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_CONTENT_CPIM_H */ diff --git a/tinyMEDIA/include/tinymedia/content/tmedia_content_multipart.h b/tinyMEDIA/include/tinymedia/content/tmedia_content_multipart.h new file mode 100644 index 0000000..e69de29 diff --git a/tinyMEDIA/include/tinymedia/content/tmedia_content_sip_frag.h b/tinyMEDIA/include/tinymedia/content/tmedia_content_sip_frag.h new file mode 100644 index 0000000..e69de29 diff --git a/tinyMEDIA/include/tinymedia/tmedia.h b/tinyMEDIA/include/tinymedia/tmedia.h new file mode 100644 index 0000000..5ebebbd --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia.h @@ -0,0 +1,121 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 DOUBANGO. +* +*/ + +/**@file tmedia.h + * @brief Base media object. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#ifndef TINYMEDIA_TMEDIA_H +#define TINYMEDIA_TMEDIA_H + +#include "tinymedia_config.h" + +#include "tinysdp/tsdp_message.h" + +#include "tnet_socket.h" + +#include "tsk_params.h" + +TMEDIA_BEGIN_DECLS + + +#if 0 + +#define TMEDIA_VA_ARGS(name, host, socket_type) tmedia_def_t, (const char*) name, (const char*) host, (tnet_socket_type_t) socket_type + +#define TMEDIA(self) ((tmedia_t*)(self)) + +typedef enum tmedia_action_e +{ + // Dummy + tma_dummy_say_hello, + + // MSRP + tma_msrp_send_data, + tma_msrp_send_file, + + // Audio / Video + + // T.38 +} +tmedia_action_t; + +typedef struct tmedia_s +{ + TSK_DECLARE_OBJECT; + + const struct tmedia_plugin_def_s* plugin; + + char* name; + uint32_t port; + char* protocol; +} +tmedia_t; +typedef tsk_list_t tmedias_L_t; + +#define TMED_DECLARE_MEDIA tmedia_t media + +typedef struct tmedia_plugin_def_s +{ + const tsk_object_def_t* objdef; + const char* name; + const char* media; + + int (* start) (tmedia_t* ); + int (* pause) (tmedia_t* ); + int (* stop) (tmedia_t* ); + + const tsdp_header_M_t* (* get_local_offer) (tmedia_t* , va_list* ); + const tsdp_header_M_t* (* get_negotiated_offer) (tmedia_t* ); + int (* set_remote_offer) (tmedia_t* , const tsdp_message_t* ); + + int (* perform) (tmedia_t* , tmedia_action_t action, const tsk_params_L_t* ); +} +tmedia_plugin_def_t; + +TINYMEDIA_API int tmedia_init(tmedia_t* self, const char* name); +TINYMEDIA_API int tmedia_deinit(tmedia_t* self); + +TINYMEDIA_API int tmedia_plugin_register(const tmedia_plugin_def_t* def); +TINYMEDIA_API tmedia_t* tmedia_factory_create(const char* name, const char* host, tnet_socket_type_t socket_type); + +TINYMEDIA_API int tmedia_start(tmedia_t* ); +TINYMEDIA_API int tmedia_pause(tmedia_t* ); +TINYMEDIA_API int tmedia_stop(tmedia_t* ); + +TINYMEDIA_API const tsdp_header_M_t* tmedia_get_local_offer(tmedia_t* , ...); +TINYMEDIA_API const tsdp_header_M_t* tmedia_get_negotiated_offer(tmedia_t* ); +TINYMEDIA_API int tmedia_set_remote_offer(tmedia_t* , const tsdp_message_t* ); + +TINYMEDIA_API int tmedia_perform(tmedia_t* , tmedia_action_t, ... ); + +TINYMEDIA_GEXTERN const void *tmedia_def_t; + +#endif + +TMEDIA_END_DECLS + + +#endif /* TINYMEDIA_TMEDIA_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_codec.h b/tinyMEDIA/include/tinymedia/tmedia_codec.h new file mode 100644 index 0000000..46435d9 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_codec.h @@ -0,0 +1,310 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 DOUBANGO. +* +*/ + +/**@file tmedia_codec.h + * @brief Base codec object. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#ifndef TINYMEDIA_CODEC_H +#define TINYMEDIA_CODEC_H + +#include "tinymedia_config.h" + +#include "tmedia_common.h" + +#include "tsk_list.h" + +TMEDIA_BEGIN_DECLS + +/* ===== +* http://www.iana.org/assignments/rtp-parameters +* http://www.networksorcery.com/enp/protocol/rtp.htm +=====*/ +/******* Fixed Payload Type *************/ +#define TMEDIA_CODEC_FORMAT_G711u "0" +#define TMEDIA_CODEC_FORMAT_1016 "1" +#define TMEDIA_CODEC_FORMAT_G721 "2" +#define TMEDIA_CODEC_FORMAT_GSM "3" +#define TMEDIA_CODEC_FORMAT_G723 "4" +#define TMEDIA_CODEC_FORMAT_DVI4_8000 "5" +#define TMEDIA_CODEC_FORMAT_DVI4_16000 "6" +#define TMEDIA_CODEC_FORMAT_LPC "7" +#define TMEDIA_CODEC_FORMAT_G711a "8" +#define TMEDIA_CODEC_FORMAT_G722 "9" +#define TMEDIA_CODEC_FORMAT_L16_STEREO "10" +#define TMEDIA_CODEC_FORMAT_L16 "11" +#define TMEDIA_CODEC_FORMAT_QCELP "12" +#define TMEDIA_CODEC_FORMAT_CN "13" +#define TMEDIA_CODEC_FORMAT_MPA "14" +#define TMEDIA_CODEC_FORMAT_G728 "15" +#define TMEDIA_CODEC_FORMAT_DVI4_11025 "16" +#define TMEDIA_CODEC_FORMAT_DVI4_22050 "17" +#define TMEDIA_CODEC_FORMAT_G729 "18" + +#define TMEDIA_CODEC_FORMAT_CELLB "25" +#define TMEDIA_CODEC_FORMAT_JPEG "26" +#define TMEDIA_CODEC_FORMAT_NV "28" + +#define TMEDIA_CODEC_FORMAT_H261 "31" +#define TMEDIA_CODEC_FORMAT_MPV "32" +#define TMEDIA_CODEC_FORMAT_MP2T "33" +#define TMEDIA_CODEC_FORMAT_H263 "34" + +/******* Dynamic Payload Type **********/ + +#define TMEDIA_CODEC_FORMAT_ILBC "96" + +#define TMEDIA_CODEC_FORMAT_SPEEX_NB "97" +#define TMEDIA_CODEC_FORMAT_SPEEX_WB "98" +#define TMEDIA_CODEC_FORMAT_SPEEX_UWB "99" + +#define TMEDIA_CODEC_FORMAT_DTMF "101" + +#define TMEDIA_CODEC_FORMAT_H263_2000 "102" +#define TMEDIA_CODEC_FORMAT_H263_1998 "103" // for stupid clients, should be equal to "103" +#define TMEDIA_CODEC_FORMAT_H264_BP10 "104" +#define TMEDIA_CODEC_FORMAT_H264_BP20 "105" +#define TMEDIA_CODEC_FORMAT_H264_BP30 "106" + + +#define TMEDIA_CODEC_FORMAT_AMR_WBP_BE "107" +#define TMEDIA_CODEC_FORMAT_AMR_WBP_OA "108" +#define TMEDIA_CODEC_FORMAT_AAC "109" +#define TMEDIA_CODEC_FORMAT_AACPLUS "110" + +#define TMEDIA_CODEC_FORMAT_AMR_NB_BE "111" +#define TMEDIA_CODEC_FORMAT_AMR_NB_OA "112" +#define TMEDIA_CODEC_FORMAT_AMR_WB_BE "113" +#define TMEDIA_CODEC_FORMAT_AMR_WB_OA "114" + +#define TMEDIA_CODEC_FORMAT_BV16 "115" + +#define TMEDIA_CODEC_FORMAT_MP4V_ES "121" +#define TMEDIA_CODEC_FORMAT_FFV1 "122" +#define TMEDIA_CODEC_FORMAT_FFVHUFF "123" +#define TMEDIA_CODEC_FORMAT_HUFFYUV "124" +//--> ONE MORE +#define TMEDIA_CODEC_FORMAT_THEORA "126" + + +#define TMEDIA_CODEC_FORMAT_MSRP "*" + +/**Max number of plugins (codec types) we can create */ +#define TMED_CODEC_MAX_PLUGINS 0xFF + +/** cast any pointer to @ref tmedia_codec_t* object */ +#define TMEDIA_CODEC(self) ((tmedia_codec_t*)(self)) + +#define TMEDIA_CODEC_PCM_FRAME_SIZE(self) ((TMEDIA_CODEC((self))->plugin->audio.ptime * TMEDIA_CODEC((self))->plugin->rate)/1000) +#define TMEDIA_CODEC_RATE(self) (TMEDIA_CODEC((self))->plugin->rate) +//#define TMEDIA_CODEC_FRAMES_COUNT(buff_size) (((buff_size))/TMEDIA_CODEC_FRAME_SIZE(self)) + +/** callback for video codecs */ +typedef int (*tmedia_codec_video_rtpcb_f)(const void* callback_data, const void* buffer, tsk_size_t size, uint32_t duration, tsk_bool_t marker); + +/** Base object for all Codecs */ +typedef struct tmedia_codec_s +{ + TSK_DECLARE_OBJECT; + + //! the type of the codec + tmedia_type_t type; + //! whether the codec is opened + tsk_bool_t opened; + //! whether the pay. type is dyn. or not + tsk_bool_t dyn; + //! the name of the codec. e.g. "G.711U" or "G.711A" etc used in the sdp + char* name; + //! full description + char* desc; + //! the format. e.g. "0" for PCMU or "8" for PCMA or "*" for MSRP. + char* format; + //! bandwidth level + tmedia_bandwidth_level_t bl; + //! the negociated format (only useful for codecs with dyn. payload type) + char* neg_format; + //! plugin used to create the codec + const struct tmedia_codec_plugin_def_s* plugin; +} +tmedia_codec_t; + +/** Virtual table used to define a codec plugin */ +typedef struct tmedia_codec_plugin_def_s +{ + //! object definition used to create an instance of the codec + const tsk_object_def_t* objdef; + + //! the type of the codec + tmedia_type_t type; + //! the name of the codec. e.g. "G.711U" or "G.711A" etc using in the sdp. + const char* name; + //! full description + const char* desc; + //! the format. e.g. "0" for PCMU or "8" for PCMA or "*" for MSRP. + const char* format; + //! whether the pay. type is dyn. or not + tsk_bool_t dyn; + uint32_t rate; + + /* default values could be updated at any time */ + struct{ + int8_t channels; + uint8_t ptime; + /* ...to be continued */ + } audio; + + /* default values could be updated at any time */ + struct{ + unsigned width; + unsigned height; + unsigned fps; + /* ...to be continued */ + } video; + + //! open the codec + int (*open) (tmedia_codec_t*); + //! close the codec + int (*close) (tmedia_codec_t*); + //! encode data + tsk_size_t (*encode) (tmedia_codec_t*, const void* in_data, tsk_size_t in_size, void** out_data, tsk_size_t* out_max_size); + //! decode data + tsk_size_t (*decode) (tmedia_codec_t*, const void* in_data, tsk_size_t in_size, void** out_data, tsk_size_t* out_max_size, const tsk_object_t* proto_hdr); + //! whether the codec can handle the fmtp + tsk_bool_t (* fmtp_match) (const tmedia_codec_t*, const char* ); + //! gets fmtp value. e.g. "mode-set=0,2,5,7; mode-change-period=2; mode-change-neighbor=1" + char* (* fmtp_get) (const tmedia_codec_t* ); + //! sets fmtp received from the remote party + int (* fmtp_set) (tmedia_codec_t*, const char* ); +} +tmedia_codec_plugin_def_t; + +/** List of @ref tmedia_codec_t elements */ +typedef tsk_list_t tmedia_codecs_L_t; + +/**< Declare base class as codec */ +#define TMEDIA_DECLARE_CODEC tmedia_codec_t __codec__ + +TINYMEDIA_API int tmedia_codec_init(tmedia_codec_t* self, tmedia_type_t type, const char* name, const char* desc, const char* format); +TINYMEDIA_API int tmedia_codec_open(tmedia_codec_t* self); +TINYMEDIA_API int tmedia_codec_close(tmedia_codec_t* self); +TINYMEDIA_API int tmedia_codec_cmp(const tsk_object_t* codec1, const tsk_object_t* codec2); +TINYMEDIA_API int tmedia_codec_plugin_register(const tmedia_codec_plugin_def_t* plugin); +TINYMEDIA_API int tmedia_codec_plugin_unregister(const tmedia_codec_plugin_def_t* plugin); +TINYMEDIA_API tmedia_codec_t* tmedia_codec_create(const char* format); +TINYMEDIA_API char* tmedia_codec_get_rtpmap(const tmedia_codec_t* self); +TINYMEDIA_API char* tmedia_codec_get_fmtp(const tmedia_codec_t* self); +TINYMEDIA_API tsk_bool_t tmedia_codec_match_fmtp(const tmedia_codec_t* self, const char* fmtp); +TINYMEDIA_API int tmedia_codec_set_remote_fmtp(tmedia_codec_t* self, const char* fmtp); +TINYMEDIA_API int tmedia_codec_removeAll_exceptThese(tmedia_codecs_L_t* codecs, const tmedia_codecs_L_t * codecs2keep); +TINYMEDIA_API int tmedia_codec_to_sdp(const tmedia_codecs_L_t* codecs, tsdp_header_M_t* m); +TINYMEDIA_API tmedia_codec_t* tmedia_codec_find_by_format(tmedia_codecs_L_t* codecs, const char* format); +TINYMEDIA_API int tmedia_codec_parse_fmtp(const char* fmtp, unsigned* maxbr, unsigned* fps, unsigned *width, unsigned *height); +TINYMEDIA_API int tmedia_codec_deinit(tmedia_codec_t* self); + +/** Audio codec */ +typedef struct tmedia_codec_audio_s +{ + TMEDIA_DECLARE_CODEC; +} +tmedia_codec_audio_t; + +/**@def TMEDIA_DECLARE_CODEC_AUDIO +* Declares base class as audio codec. +*/ +/**@def TMEDIA_CODEC_AUDIO +* Cast any pointer as @ref tmedia_codec_audio_t* object. +*/ +/**@def tmedia_codec_audio_init +* Initialize a audio codec. +*/ +/**@def tmedia_codec_audio_deinit +* DeInitialize a audio codec. +*/ +#define TMEDIA_DECLARE_CODEC_AUDIO tmedia_codec_audio_t __audio__ +#define TMEDIA_CODEC_AUDIO(self) ((tmedia_codec_audio_t*)(self)) +#define tmedia_codec_audio_init(self, name, desc, format) tmedia_codec_init(TMEDIA_CODEC(self), tmedia_audio, name, desc, format) +#define tmedia_codec_audio_deinit(self) tmedia_codec_deinit(TMEDIA_CODEC(self)) + +/** Video codec */ +typedef struct tmedia_codec_video_s +{ + TMEDIA_DECLARE_CODEC; + + unsigned width; + unsigned height; + unsigned fps; + unsigned max_br; + unsigned max_mbps; + + tmedia_codec_video_rtpcb_f callback; + const void* callback_data; +} +tmedia_codec_video_t; + +/**@def TMEDIA_DECLARE_CODEC_VIDEO +* Declares base class as video codec. +*/ +/**@def TMEDIA_CODEC_VIDEO +* Cast any pointer as @ref tmedia_codec_video_t* object. +*/ +/**@def tmedia_codec_video_init +* Initialize a video codec. +*/ +/**@def tmedia_codec_video_deinit +* DeInitialize a video codec. +*/ +#define TMEDIA_DECLARE_CODEC_VIDEO tmedia_codec_video_t __video__ +#define TMEDIA_CODEC_VIDEO(self) ((tmedia_codec_video_t*)(self)) +#define tmedia_codec_video_init(self, name, desc, format) tmedia_codec_init(TMEDIA_CODEC(self), tmedia_video, name, desc, format) +TINYMEDIA_API int tmedia_codec_video_set_callback(tmedia_codec_video_t *self, tmedia_codec_video_rtpcb_f callback, const void* callback_data); +#define tmedia_codec_video_deinit(self) tmedia_codec_deinit(TMEDIA_CODEC(self)) + +/** MSRP codec */ +typedef struct tmedia_codec_msrp_s +{ + TMEDIA_DECLARE_CODEC; +} +tmedia_codec_msrp_t; + +/**@def TMEDIA_DECLARE_CODEC_MSRP +* Declares base class as msrp codec. +*/ +/**@def TMEDIA_CODEC_MSRP +* Cast any pointer as @ref tmedia_codec_msrp_t* object. +*/ +/**@def tmedia_codec_msrp_init +* Initialize a msrp codec. +*/ +/**@def tmedia_codec_msrp_deinit +* DeInitialize a msrp codec. +*/ +#define TMEDIA_DECLARE_CODEC_MSRP tmedia_codec_msrp_t __msrp__ +#define TMEDIA_CODEC_MSRP(self) ((tmedia_codec_msrp_t*)(self)) +#define tmedia_codec_msrp_init(self, name, desc) tmedia_codec_init(TMEDIA_CODEC(self), tmedia_msrp, name, desc, "*") +#define tmedia_codec_msrp_deinit(self) tmedia_codec_deinit(TMEDIA_CODEC(self)) + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_CODEC_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_codec_dummy.h b/tinyMEDIA/include/tinymedia/tmedia_codec_dummy.h new file mode 100644 index 0000000..8e1d53e --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_codec_dummy.h @@ -0,0 +1,78 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 DOUBANGO. +* +*/ + +/**@file tmedia_codec_dummy.h + * @brief Dummy codecs used for test only. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#ifndef TINYMEDIA_CODEC_DUMMY_H +#define TINYMEDIA_CODEC_DUMMY_H + +#include "tinymedia_config.h" + +#include "tmedia_codec.h" + +#include "tsk_object.h" + +TMEDIA_BEGIN_DECLS + +/** Dummy PCMU codec */ +typedef struct tmedia_codec_dpcmu_s +{ + TMEDIA_DECLARE_CODEC_AUDIO; +} +tmedia_codec_dpcmu_t; + +/** Dummy PCMA codec */ +typedef struct tmedia_codec_dpcma_s +{ + TMEDIA_DECLARE_CODEC_AUDIO; +} +tmedia_codec_dpcma_t; + +/** Dummy H.263 codec */ +typedef struct tmedia_codec_dh263_s +{ + TMEDIA_DECLARE_CODEC_VIDEO; +} +tmedia_codec_dh263_t; + +/** Dummy H.264 codec */ +typedef struct tmedia_codec_dh264_s +{ + TMEDIA_DECLARE_CODEC_VIDEO; +} +tmedia_codec_dh264_t; + + +TINYMEDIA_GEXTERN const tmedia_codec_plugin_def_t *tmedia_codec_dpcma_plugin_def_t; +TINYMEDIA_GEXTERN const tmedia_codec_plugin_def_t *tmedia_codec_dpcmu_plugin_def_t; + +TINYMEDIA_GEXTERN const tmedia_codec_plugin_def_t *tmedia_codec_dh263_plugin_def_t; +TINYMEDIA_GEXTERN const tmedia_codec_plugin_def_t *tmedia_codec_dh264_plugin_def_t; + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_CODEC_DUMMY_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_common.h b/tinyMEDIA/include/tinymedia/tmedia_common.h new file mode 100644 index 0000000..54044be --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_common.h @@ -0,0 +1,119 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 DOUBANGO. +* +*/ + +/**@file tmedia_common.h + * @brief Common functions and definitions. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#ifndef TINYMEDIA_COMMON_H +#define TINYMEDIA_COMMON_H + +#include "tinymedia_config.h" + +#include "tinysdp/tsdp_message.h" + +TMEDIA_BEGIN_DECLS + +/** List of all supported media types */ +typedef enum tmedia_type_e +{ + tmedia_none = 0x00, + tmedia_ghost = (0x01 << 0), + + tmedia_audio = (0x01 << 1), + tmedia_video = (0x01 << 2), + tmedia_chat = (0x01 << 3), + tmedia_file = (0x01 << 4), + tmedia_t38 = (0x01 << 5), + + tmedia_msrp = (tmedia_chat | tmedia_file), + tmedia_audiovideo = (tmedia_audio | tmedia_video), + + tmedia_all = (tmedia_audio | tmedia_video | tmedia_msrp | tmedia_t38) +} +tmedia_type_t; + +typedef enum tmedia_video_size_type_e +{ + tmedia_vst_none, + tmedia_vst_sqcif, + tmedia_vst_qcif, + tmedia_vst_qvga, + tmedia_vst_cif, + tmedia_vst_vga, + tmedia_vst_4cif, + tmedia_vst_svga, + tmedia_vst_xga, + tmedia_vst_sxga, + tmedia_vst_16cif, + tmedia_vst_hd720p, + tmedia_vst_hd1080p, + + tmedia_vst_ios_low, + tmedia_vst_ios_high +} +tmedia_video_size_type_t; + +typedef struct tmedia_video_size_s +{ + tmedia_video_size_type_t type; + tsk_size_t width; + tsk_size_t height; +} +tmedia_video_size_t; + + +// used by tinyWRAP +typedef enum tmedia_chroma_e +{ + tmedia_rgb24, // will be stored as bgr24 on x86 (little endians) machines; e.g. WindowsPhone7 + tmedia_bgr24, // used by windows consumer (DirectShow) - + tmedia_rgb32, // used by iOS4 consumer (iPhone and iPod touch) + tmedia_rgb565le, // (used by both android and wince consumers) + tmedia_rgb565be, + tmedia_nv12, // used by iOS4 producer (iPhone and iPod Touch 3GS and 4) + tmedia_nv21, // Yuv420 SP (used by android producer) + tmedia_yuv422p, + tmedia_uyvy422, // used by iOS4 producer (iPhone and iPod Touch 3G) + tmedia_yuv420p, // Default +} +tmedia_chroma_t; + +// used by tinyWRAP +typedef enum tmedia_bandwidth_level_e +{ + tmedia_bl_low, + tmedia_bl_medium, + tmedia_bl_hight +} +tmedia_bandwidth_level_t; + +TINYMEDIA_API tmedia_type_t tmedia_type_from_sdp(const tsdp_message_t* sdp); +TINYMEDIA_API int tmedia_parse_rtpmap(const char* rtpmap, char** name, int32_t* rate, int32_t* channels); +TINYMEDIA_API const tmedia_video_size_t* tmedia_get_video_size(tmedia_chroma_t chroma, tsk_size_t size); + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_COMMON_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_consumer.h b/tinyMEDIA/include/tinymedia/tmedia_consumer.h new file mode 100644 index 0000000..3c8fb60 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_consumer.h @@ -0,0 +1,116 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 DOUBANGO. +* +*/ + +/**@file tmedia_consumer.h + * @brief Base consumer object. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#ifndef TINYMEDIA_CONSUMER_H +#define TINYMEDIA_CONSUMER_H + +#include "tinymedia_config.h" + +#include "tinymedia/tmedia_codec.h" +#include "tinymedia/tmedia_params.h" +#include "tmedia_common.h" + +TMEDIA_BEGIN_DECLS + +/**Max number of plugins (consumer types) we can create */ +#define TMED_CONSUMER_MAX_PLUGINS 0x0F + +/** cast any pointer to @ref tmedia_consumer_t* object */ +#define TMEDIA_CONSUMER(self) ((tmedia_consumer_t*)(self)) + +/** Default Video chroma */ +#define TMEDIA_CONSUMER_CHROMA_DEFAULT tmedia_yuv420p + +/** Base object for all Consumers */ +typedef struct tmedia_consumer_s +{ + TSK_DECLARE_OBJECT; + + tmedia_type_t type; + const char* desc; + + struct{ + int fps; + struct { + tmedia_chroma_t chroma; + tsk_size_t width; + tsk_size_t height; + } in; + struct { + tmedia_chroma_t chroma; + tsk_size_t width; + tsk_size_t height; + tsk_bool_t auto_resize; // auto_resize to "in.width, in.height" + } display; + } video; + + uint64_t session_id; + const struct tmedia_consumer_plugin_def_s* plugin; +} +tmedia_consumer_t; + +/** Virtual table used to define a consumer plugin */ +typedef struct tmedia_consumer_plugin_def_s +{ + //! object definition used to create an instance of the consumer + const tsk_object_def_t* objdef; + + //! the type of the consumer + tmedia_type_t type; + //! full description (usefull for debugging) + const char* desc; + + int (*set) (tmedia_consumer_t* , const tmedia_param_t*); + int (* prepare) (tmedia_consumer_t*, const tmedia_codec_t* ); + int (* start) (tmedia_consumer_t* ); + int (* consume) (tmedia_consumer_t*, void** buffer, tsk_size_t size, const tsk_object_t* proto_hdr); + int (* pause) (tmedia_consumer_t* ); + int (* stop) (tmedia_consumer_t* ); +} +tmedia_consumer_plugin_def_t; + +#define TMEDIA_DECLARE_CONSUMER tmedia_consumer_t __consumer__ + +TINYMEDIA_API tmedia_consumer_t* tmedia_consumer_create(tmedia_type_t type, uint64_t session_id); +TINYMEDIA_API int tmedia_consumer_init(tmedia_consumer_t* self); +TINYMEDIA_API int tmedia_consumer_set(tmedia_consumer_t *self, const tmedia_param_t* param); +TINYMEDIA_API int tmedia_consumer_prepare(tmedia_consumer_t *self, const tmedia_codec_t* codec); +TINYMEDIA_API int tmedia_consumer_start(tmedia_consumer_t *self); +TINYMEDIA_API int tmedia_consumer_consume(tmedia_consumer_t* self, void** buffer, tsk_size_t size, const tsk_object_t* proto_hdr); +TINYMEDIA_API int tmedia_consumer_pause(tmedia_consumer_t *self); +TINYMEDIA_API int tmedia_consumer_stop(tmedia_consumer_t *self); +TINYMEDIA_API int tmedia_consumer_deinit(tmedia_consumer_t* self); + +TINYMEDIA_API int tmedia_consumer_plugin_register(const tmedia_consumer_plugin_def_t* plugin); +TINYMEDIA_API int tmedia_consumer_plugin_unregister(const tmedia_consumer_plugin_def_t* plugin); +TINYMEDIA_API int tmedia_consumer_plugin_unregister_by_type(tmedia_type_t type); + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_CONSUMER_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_denoise.h b/tinyMEDIA/include/tinymedia/tmedia_denoise.h new file mode 100644 index 0000000..9fb3d20 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_denoise.h @@ -0,0 +1,85 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 DOUBANGO. +* +*/ + +/**@file tmedia_denoise.h + * @brief Denoiser (Noise suppression, AGC, AEC, VAD) Plugin + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#ifndef TINYMEDIA_DENOISE_H +#define TINYMEDIA_DENOISE_H + +#include "tinymedia_config.h" + +#include "tsk_object.h" + +TMEDIA_BEGIN_DECLS + +/** cast any pointer to @ref tmedia_denoise_t* object */ +#define TMEDIA_DENOISE(self) ((tmedia_denoise_t*)(self)) + +/** Base object for all Denoisers */ +typedef struct tmedia_denoise_s +{ + TSK_DECLARE_OBJECT; + + tsk_bool_t opened; + + const struct tmedia_denoise_plugin_def_s* plugin; +} +tmedia_denoise_t; + +#define TMEDIA_DECLARE_DENOISE tmedia_denoise_t __denoise__ + +/** Virtual table used to define a consumer plugin */ +typedef struct tmedia_denoise_plugin_def_s +{ + //! object definition used to create an instance of the denoiser + const tsk_object_def_t* objdef; + + //! full description (usefull for debugging) + const char* desc; + + int (* open) (tmedia_denoise_t*, uint32_t frame_size, uint32_t sampling_rate, tsk_bool_t denoise, float agc_level, tsk_bool_t aec, tsk_bool_t vad); + int (*echo_playback) (tmedia_denoise_t* self, const void* echo_frame); + int (* process) (tmedia_denoise_t*, void* audio_frame, tsk_bool_t* silence_or_noise); + int (* close) (tmedia_denoise_t* ); +} +tmedia_denoise_plugin_def_t; + +TINYMEDIA_API int tmedia_denoise_init(tmedia_denoise_t* self); +TINYMEDIA_API int tmedia_denoise_open(tmedia_denoise_t* self, uint32_t frame_size, uint32_t sampling_rate, tsk_bool_t denoise, float agc_level, tsk_bool_t aec, tsk_bool_t vad); +TINYMEDIA_API int tmedia_denoise_echo_playback(tmedia_denoise_t* self, const void* echo_frame); +TINYMEDIA_API int tmedia_denoise_process(tmedia_denoise_t* self, void* audio_frame, tsk_bool_t* silence_or_noise); +TINYMEDIA_API int tmedia_denoise_close(tmedia_denoise_t* self); +TINYMEDIA_API int tmedia_denoise_deinit(tmedia_denoise_t* self); + +TINYMEDIA_API int tmedia_denoise_plugin_register(const tmedia_denoise_plugin_def_t* plugin); +TINYMEDIA_API int tmedia_denoise_plugin_unregister(); +TINYMEDIA_API tmedia_denoise_t* tmedia_denoise_create(); + +TMEDIA_END_DECLS + + +#endif /* TINYMEDIA_DENOISE_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_params.h b/tinyMEDIA/include/tinymedia/tmedia_params.h new file mode 100644 index 0000000..2e12a22 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_params.h @@ -0,0 +1,114 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 DOUBANGO. +* +*/ + +/**@file tmedia_params.h + * @brief Media parameters used to configure any session or plugin. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#ifndef TINYMEDIA_PARAMS_H +#define TINYMEDIA_PARAMS_H + +#include "tinymedia_config.h" + +#include "tinymedia/tmedia_common.h" + +#include "tsk_list.h" + +TMEDIA_BEGIN_DECLS + +#define TMEDIA_PARAM(self) ((tmedia_param_t*)(self)) + +typedef enum tmedia_param_access_type_e +{ + //tmedia_pat_get, + tmedia_pat_set +} +tmedia_param_access_type_t; + +typedef enum tmedia_param_plugin_type_e +{ + tmedia_ppt_consumer, + tmedia_ppt_producer, + tmedia_ppt_codec, + tmedia_ppt_session, + tmedia_ppt_manager +} +tmedia_param_plugin_type_t; + +typedef enum tmedia_param_value_type_e +{ + tmedia_pvt_int32, + tmedia_pvt_pobject, + tmedia_pvt_pchar, + tmedia_pvt_int64, +} +tmedia_param_value_type_t; + +#define TMEDIA_PARAM_VALUE_TYPE_IS_PTR(self) ((self) == tmedia_pvt_pobject || (self) == tmedia_pvt_pchar) + +typedef struct tmedia_param_s +{ + TSK_DECLARE_OBJECT; + + tmedia_param_access_type_t access_type; + tmedia_type_t media_type; + tmedia_param_plugin_type_t plugin_type; + tmedia_param_value_type_t value_type; + + char* key; + /* Because setting parameters could be deferred + * ==> MUST copy the value for later use. + * e.g. TMEDIA_SESSION_MANAGER_SET_INT32("width", 1234); 1234 will be lost when we exit the block code + */ + void* value; +} +tmedia_param_t; + +typedef tsk_list_t tmedia_params_L_t; /**< List of @ref tsk_param_t elements. */ + +#define tmedia_params_create() tsk_list_create() + +TINYMEDIA_API tmedia_param_t* tmedia_param_create(tmedia_param_access_type_t access_type, + tmedia_type_t media_type, + tmedia_param_plugin_type_t plugin_type, + tmedia_param_value_type_t value_type, + const char* key, + void* value); + +TINYMEDIA_API tmedia_params_L_t* tmedia_params_create_2(va_list *app); + +TINYMEDIA_API int tmedia_params_add_param(tmedia_params_L_t **self, + tmedia_param_access_type_t access_type, + tmedia_type_t media_type, + tmedia_param_plugin_type_t plugin_type, + tmedia_param_value_type_t value_type, + const char* key, + void* value); + +TINYMEDIA_GEXTERN const tsk_object_def_t *tmedia_param_def_t; + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_PARAMS_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_producer.h b/tinyMEDIA/include/tinymedia/tmedia_producer.h new file mode 100644 index 0000000..418626a --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_producer.h @@ -0,0 +1,123 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 DOUBANGO. +* +*/ + +/**@file tmedia_producer.h + * @brief Base producer object. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#ifndef TINYMEDIA_PRODUCER_H +#define TINYMEDIA_PRODUCER_H + +#include "tinymedia_config.h" + +#include "tinymedia/tmedia_codec.h" +#include "tinymedia/tmedia_params.h" +#include "tmedia_common.h" + +TMEDIA_BEGIN_DECLS + +/**Max number of plugins (producer types) we can create */ +#define TMED_PRODUCER_MAX_PLUGINS 0x0F + +/** cast any pointer to @ref tmedia_producer_t* object */ +#define TMEDIA_PRODUCER(self) ((tmedia_producer_t*)(self)) + +typedef int (*tmedia_producer_enc_cb_f)(const void* callback_data, const void* buffer, tsk_size_t size); +typedef int (*tmedia_producer_raw_cb_f)(const void* callback_data, const void* buffer, tsk_size_t size, uint32_t duration, tsk_bool_t marker); + +/** Default Video chroma */ +#define TMEDIA_PRODUCER_CHROMA_DEFAULT tmedia_yuv420p + +/** Base object for all Producers */ +typedef struct tmedia_producer_s +{ + TSK_DECLARE_OBJECT; + + tmedia_type_t type; + const char* desc; + + struct{ + tmedia_chroma_t chroma; + int fps; + int rotation; + tsk_size_t width; + tsk_size_t height; + } video; + + const struct tmedia_producer_plugin_def_s* plugin; + + uint64_t session_id; + + struct{ + tmedia_producer_enc_cb_f callback; + const void* callback_data; + } enc_cb; + + struct{ + tmedia_producer_raw_cb_f callback; + const void* callback_data; + } raw_cb; +} +tmedia_producer_t; + +/** Virtual table used to define a producer plugin */ +typedef struct tmedia_producer_plugin_def_s +{ + //! object definition used to create an instance of the producer + const tsk_object_def_t* objdef; + + //! the type of the producer + tmedia_type_t type; + //! full description (usefull for debugging) + const char* desc; + + int (*set) (tmedia_producer_t* , const tmedia_param_t*); + int (* prepare) (tmedia_producer_t* , const tmedia_codec_t*); + int (* start) (tmedia_producer_t* ); + int (* pause) (tmedia_producer_t* ); + int (* stop) (tmedia_producer_t* ); +} +tmedia_producer_plugin_def_t; + +#define TMEDIA_DECLARE_PRODUCER tmedia_producer_t __producer__ + +TINYMEDIA_API tmedia_producer_t* tmedia_producer_create(tmedia_type_t type, uint64_t session_id); +TINYMEDIA_API int tmedia_producer_init(tmedia_producer_t* self); +TINYMEDIA_API int tmedia_producer_set_enc_callback(tmedia_producer_t *self, tmedia_producer_enc_cb_f callback, const void* callback_data); +TINYMEDIA_API int tmedia_producer_set_raw_callback(tmedia_producer_t *self, tmedia_producer_raw_cb_f callback, const void* callback_data); +TINYMEDIA_API int tmedia_producer_set(tmedia_producer_t* self, const tmedia_param_t* param); +TINYMEDIA_API int tmedia_producer_prepare(tmedia_producer_t *self, const tmedia_codec_t* codec); +TINYMEDIA_API int tmedia_producer_start(tmedia_producer_t *self); +TINYMEDIA_API int tmedia_producer_pause(tmedia_producer_t *self); +TINYMEDIA_API int tmedia_producer_stop(tmedia_producer_t *self); +TINYMEDIA_API int tmedia_producer_deinit(tmedia_producer_t* self); + +TINYMEDIA_API int tmedia_producer_plugin_register(const tmedia_producer_plugin_def_t* plugin); +TINYMEDIA_API int tmedia_producer_plugin_unregister(const tmedia_producer_plugin_def_t* plugin); +TINYMEDIA_API int tmedia_producer_plugin_unregister_by_type(tmedia_type_t type); + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_PRODUCER_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_qos.h b/tinyMEDIA/include/tinymedia/tmedia_qos.h new file mode 100644 index 0000000..2c9416d --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_qos.h @@ -0,0 +1,194 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 DOUBANGO. +* +*/ + +/**@file tmedia_qos.h + * @brief RFC 3312 (Preconditions) implementation. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#ifndef TINYMEDIA_QOS_H +#define TINYMEDIA_QOS_H + +#include "tinymedia_config.h" + +#include "tinysdp/tsdp_message.h" + +#include "tsk_object.h" + +TMEDIA_BEGIN_DECLS + +#define TMEDIA_QOS_TLINE(self) ((tmedia_qos_tline_t*)(self)) + +/** List of all supported statues*/ +typedef enum tmedia_qos_status_e +{ + //! current-status + tmedia_qos_status_curr, + //! desired-status + tmedia_qos_status_des, + //! confirm-status + tmedia_qos_status_conf +} +tmedia_qos_status_t; + +/** List of all supported precondition types */ +typedef enum tmedia_qos_ptype_e +{ + tmedia_qos_ptype_qos +} +tmedia_qos_ptype_t; + +/** List of all supported status types */ +typedef enum tmedia_qos_stype_e +{ + tmedia_qos_stype_none,/* not part of the RFC */ + + tmedia_qos_stype_segmented, + tmedia_qos_stype_e2e, +} +tmedia_qos_stype_t; + +/** strengths */ +typedef enum tmedia_qos_strength_e +{ + /* do no change the order (none -> optional -> manadatory) */ + tmedia_qos_strength_none, + tmedia_qos_strength_failure, + tmedia_qos_strength_unknown, + tmedia_qos_strength_optional, + tmedia_qos_strength_mandatory +} +tmedia_qos_strength_t; + +/** directions */ +typedef enum tmedia_qos_direction_e +{ + tmedia_qos_direction_none = 0x01, + tmedia_qos_direction_send = (0x01 << 1), + tmedia_qos_direction_recv = (0x01 << 2), + tmedia_qos_direction_sendrecv = (tmedia_qos_direction_send | tmedia_qos_direction_recv) +} +tmedia_qos_direction_t; + +/* QoS table-line */ +typedef struct tmedia_qos_tline_s +{ + TSK_DECLARE_OBJECT; + tmedia_qos_stype_t type; +} +tmedia_qos_tline_t; +#define TMEDIA_DECLARE_QOS_TLINE tmedia_qos_tline_t __tline__ + +TINYMEDIA_API tmedia_qos_tline_t* tmedia_qos_tline_create(tmedia_qos_stype_t type, tmedia_qos_strength_t strength); +TINYMEDIA_API tmedia_qos_stype_t tmedia_qos_get_type(const tsdp_header_M_t* m); +TINYMEDIA_API tmedia_qos_tline_t* tmedia_qos_tline_from_sdp(const tsdp_header_M_t* m); +TINYMEDIA_API int tmedia_qos_tline_to_sdp(const tmedia_qos_tline_t* self, tsdp_header_M_t* m); +TINYMEDIA_API int tmedia_qos_tline_set_ro(tmedia_qos_tline_t* self, const tmedia_qos_tline_t* ro); +TINYMEDIA_API tsk_bool_t tmedia_qos_tline_canresume(const tmedia_qos_tline_t* self); + +/* QoS table-line for E2E type*/ +typedef struct tmedia_qos_tline_e2e_s +{ + TMEDIA_DECLARE_QOS_TLINE; + + /* RFC 3312 - 5.1 Generating an offer + + Direction Current Desired Strength + ____________________________________ + send no mandatory + recv no mandatory + */ + struct{ + unsigned current:1; + unsigned confirm:1; + tmedia_qos_strength_t strength; + } send; + + struct{ + unsigned current:1; + unsigned confirm:1; + tmedia_qos_strength_t strength; + } recv; +} +tmedia_qos_tline_e2e_t; + +TINYMEDIA_API tmedia_qos_tline_e2e_t* tmedia_qos_tline_e2e_create(tmedia_qos_strength_t strength); +TINYMEDIA_API tmedia_qos_tline_e2e_t* tmedia_qos_tline_e2e_from_sdp(const tsdp_header_M_t* m); +TINYMEDIA_API int tmedia_qos_tline_e2e_to_sdp(const tmedia_qos_tline_e2e_t* self, tsdp_header_M_t* m); +TINYMEDIA_API int tmedia_qos_tline_e2e_set_ro(tmedia_qos_tline_e2e_t* self, const tmedia_qos_tline_e2e_t* ro); +TINYMEDIA_API tsk_bool_t tmedia_qos_tline_e2e_canresume(const tmedia_qos_tline_e2e_t* self); + +/* QoS table-line for Segented type*/ +typedef struct tmedia_qos_tline_segmented_s +{ + TMEDIA_DECLARE_QOS_TLINE; + + /* RFC 3312 - 5.1 Generating an offer + Direction Current Desired Strength + ______________________________________ + local send no none + local recv no none + remote send no optional + remote recv no none + */ + /* can be done in two lines but I prefer doing it like this (easier) */ + struct{ + unsigned current:1; + unsigned confirm:1; + tmedia_qos_strength_t strength; + } local_send; + + struct{ + unsigned current:1; + unsigned confirm:1; + tmedia_qos_strength_t strength; + } local_recv; + + struct{ + unsigned current:1; + unsigned confirm:1; + tmedia_qos_strength_t strength; + } remote_send; + + struct{ + unsigned current:1; + unsigned confirm:1; + tmedia_qos_strength_t strength; + } remote_recv; +} +tmedia_qos_tline_segmented_t; + + +TINYMEDIA_API tmedia_qos_tline_segmented_t* tmedia_qos_tline_segmented_create(tmedia_qos_strength_t strength); +TINYMEDIA_API tmedia_qos_tline_segmented_t* tmedia_qos_tline_segmented_from_sdp(const tsdp_header_M_t* m); +TINYMEDIA_API int tmedia_qos_tline_segmented_to_sdp(const tmedia_qos_tline_segmented_t* self, tsdp_header_M_t* m); +TINYMEDIA_API int tmedia_qos_tline_segmented_set_ro(tmedia_qos_tline_segmented_t* self, const tmedia_qos_tline_segmented_t* ro); +TINYMEDIA_API tsk_bool_t tmedia_qos_tline_segmented_canresume(const tmedia_qos_tline_segmented_t* self); + +TINYMEDIA_GEXTERN const tsk_object_def_t *tmedia_qos_tline_segmented_def_t; +TINYMEDIA_GEXTERN const tsk_object_def_t *tmedia_qos_tline_e2e_def_t; + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_QOS_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_session.h b/tinyMEDIA/include/tinymedia/tmedia_session.h new file mode 100644 index 0000000..3143204 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_session.h @@ -0,0 +1,392 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 DOUBANGO. +* +*/ + +/**@file tmedia_session.h + * @brief Base session object. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#ifndef TINYMEDIA_SESSION_H +#define TINYMEDIA_SESSION_H + +#include "tinymedia_config.h" + +#include "tinymedia/tmedia_codec.h" +#include "tinymedia/tmedia_qos.h" +#include "tinymedia/tmedia_params.h" + +#include "tinysdp/tsdp_message.h" + +#include "tinynet.h" + +#include "tsk_list.h" + +TMEDIA_BEGIN_DECLS + +#define TMEDIA_SESSION(self) ((tmedia_session_t*)(self)) +#define TMEDIA_SESSION_AUDIO(self) ((tmedia_session_audio_t*)(self)) +#define TMEDIA_SESSION_VIDEO(self) ((tmedia_session_video_t*)(self)) +#define TMEDIA_SESSION_MSRP(self) ((tmedia_session_msrp_t*)(self)) + +/**Max number of plugins (session types) we can create */ +#define TMED_SESSION_MAX_PLUGINS 0x0F + +/** Base objct used for all media sessions */ +typedef struct tmedia_session_s +{ + TSK_DECLARE_OBJECT; + + //! unique id + uint64_t id; + //! session type + tmedia_type_t type; + //! list of codecs managed by this session + tmedia_codecs_L_t* codecs; + //! negociated codec + tmedia_codecs_L_t* neg_codecs; + //! whether the ro have been prepared (up to the manager to update the value) + tsk_bool_t ro_changed; + //! whether the session have been initialized (up to the manager to update the value) + tsk_bool_t initialized; + //! whether the session have been prepared (up to the manager to update the value) + tsk_bool_t prepared; + //! QoS + tmedia_qos_tline_t* qos; + //! bandwidth level + tmedia_bandwidth_level_t bl; + + struct{ + tsdp_header_M_t* lo; + tsdp_header_M_t* ro; + } M; + + //! plugin used to create the session + const struct tmedia_session_plugin_def_s* plugin; +} +tmedia_session_t; + +/** Virtual table used to define a session plugin */ +typedef struct tmedia_session_plugin_def_s +{ + //! object definition used to create an instance of the session + const tsk_object_def_t* objdef; + + //! the type of the session + tmedia_type_t type; + //! the media name. e.g. "audio", "video", "message", "image" etc. + const char* media; + + int (*set) (tmedia_session_t* , const tmedia_param_t*); + int (* prepare) (tmedia_session_t* ); + int (* start) (tmedia_session_t* ); + int (* pause) (tmedia_session_t* ); + int (* stop) (tmedia_session_t* ); + + struct{ /* Special case */ + int (* send_dtmf) (tmedia_session_t*, uint8_t ); + } audio; + + const tsdp_header_M_t* (* get_local_offer) (tmedia_session_t* ); + /* return zero if can handle the ro and non-zero otherwise */ + int (* set_remote_offer) (tmedia_session_t* , const tsdp_header_M_t* ); +} +tmedia_session_plugin_def_t; + +TINYMEDIA_API int tmedia_session_init(tmedia_session_t* self, tmedia_type_t type); +TINYMEDIA_API int tmedia_session_cmp(const tsk_object_t* sess1, const tsk_object_t* sess2); +TINYMEDIA_API int tmedia_session_plugin_register(const tmedia_session_plugin_def_t* plugin); +TINYMEDIA_API const tmedia_session_plugin_def_t* tmedia_session_plugin_find_by_media(const char* media); +TINYMEDIA_API int tmedia_session_plugin_unregister(const tmedia_session_plugin_def_t* plugin); +TINYMEDIA_API tmedia_session_t* tmedia_session_create(tmedia_type_t type); +TINYMEDIA_API tmedia_codecs_L_t* tmedia_session_match_codec(tmedia_session_t* self, const tsdp_header_M_t* M); +TINYMEDIA_API int tmedia_session_deinit(tmedia_session_t* self); +typedef tsk_list_t tmedia_sessions_L_t; /**< List of @ref tmedia_session_t objects */ +#define TMEDIA_DECLARE_SESSION tmedia_session_t __session__ + +/** Audio Session */ +typedef struct tmedia_session_audio_s +{ + TMEDIA_DECLARE_SESSION; +} +tmedia_session_audio_t; +#define tmedia_session_audio_init(self) tmedia_session_init(TMEDIA_SESSION(self), tmed_sess_type_audio) +TINYMEDIA_API int tmedia_session_audio_send_dtmf(tmedia_session_audio_t* self, uint8_t event); +#define tmedia_session_audio_deinit(self) tmedia_session_deinit(TMEDIA_SESSION(self)) +#define tmedia_session_audio_create() tmedia_session_create(tmed_sess_type_audio) +#define TMEDIA_DECLARE_SESSION_AUDIO tmedia_session_audio_t __session_audio__ + +/** Video Session */ +typedef struct tmedia_session_video_s +{ + TMEDIA_DECLARE_SESSION; +} +tmedia_session_video_t; +#define tmedia_session_video_init(self) tmedia_session_init(TMEDIA_SESSION(self), tmed_sess_type_video) +#define tmedia_session_video_deinit(self) tmedia_session_deinit(TMEDIA_SESSION(self)) +#define tmedia_session_video_create() tmedia_session_create(tmed_sess_type_video) +#define TMEDIA_DECLARE_SESSION_VIDEO tmedia_session_video_t __session_video__ + +/** Msrp Session */ +struct tmedia_session_msrp_s; +struct tmsrp_event_s; +// use "struct tmsrp_event_s" instead of "tmsrp_event_t" to avoid linking aginst tinyMSRP +typedef int (*tmedia_session_msrp_cb_f)(const struct tmsrp_event_s* event); +typedef struct tmedia_session_msrp_s +{ + TMEDIA_DECLARE_SESSION; + + struct { + tmedia_session_msrp_cb_f func; + const void* data; + } callback; + + int (* send_file) (struct tmedia_session_msrp_s*, const char* path, va_list *app); + int (* send_message) (struct tmedia_session_msrp_s*, const void* data, tsk_size_t size, const tmedia_params_L_t *params); +} +tmedia_session_msrp_t; +#define tmedia_session_msrp_init(self) tmedia_session_init(TMEDIA_SESSION(self), tmed_sess_type_msrp) +#define tmedia_session_msrp_deinit(self) tmedia_session_deinit(TMEDIA_SESSION(self)) +#define tmedia_session_msrp_create() tmedia_session_create(tmed_sess_type_msrp) +#define TMEDIA_DECLARE_SESSION_MSRP tmedia_session_msrp_t __session_msrp__ + +/** Session manager */ +typedef struct tmedia_session_mgr_s +{ + TSK_DECLARE_OBJECT; + + //! whether we are the offerer or not + tsk_bool_t offerer; + //! local IP address or FQDN + char* addr; + //! public IP address or FQDN + char* public_addr; + //! whether the @a addr is IPv6 or not (useful when @addr is a FQDN) + tsk_bool_t ipv6; + + struct{ + uint32_t lo_ver; + tsdp_message_t* lo; + + int32_t ro_ver; + tsdp_message_t* ro; + } sdp; + + tsk_bool_t started; + tsk_bool_t ro_changed; + tsk_bool_t state_changed; + + //! session type + tmedia_type_t type; + //! QoS type + struct { + tmedia_qos_stype_t type; + tmedia_qos_strength_t strength; + } qos; + + //! bandwidth level + tmedia_bandwidth_level_t bl; + + /* NAT Traversal context */ + tnet_nat_context_handle_t* natt_ctx; + + //! List of all sessions + tmedia_sessions_L_t* sessions; + + //! User's parameters used to confugure plugins + tmedia_params_L_t* params; +} +tmedia_session_mgr_t; + +typedef enum tmedia_session_param_type_e +{ + tmedia_sptype_null = 0, + + tmedia_sptype_set, + //tmedia_sptype_get +} +tmedia_session_param_type_t; + +#define TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, PLUGIN_TYPE_ENUM, VALUE_TYPE_ENUM, KEY_STR, VALUE) \ + tmedia_sptype_set, (tmedia_type_t)MEDIA_TYPE_ENUM, (tmedia_param_plugin_type_t)PLUGIN_TYPE_ENUM, (tmedia_param_value_type_t)VALUE_TYPE_ENUM, \ + (const char*)KEY_STR, TMEDIA_PARAM_VALUE_TYPE_IS_PTR(VALUE_TYPE_ENUM) ? (void*)VALUE : (void*)&VALUE +//#define TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, PLUGIN_TYPE_ENUM, VALUE_TYPE_ENUM, KEY_STR, VALUE_PTR) \ +// tmedia_sptype_get, (tmedia_type_t)MEDIA_TYPE_ENUM, (tmedia_param_plugin_type_t)PLUGIN_TYPE_ENUM, (tmedia_param_value_type_t)VALUE_TYPE_ENUM, \ +// (const char*)KEY_STR, (void**)&VALUE_PTR +/* Manager */ +#define TMEDIA_SESSION_MANAGER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_PARAM(tmedia_none, tmedia_ppt_manager, tmedia_pvt_int32, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_MANAGER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_PARAM(tmedia_none, tmedia_ppt_manager, tmedia_pvt_pobject, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_MANAGER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_PARAM(tmedia_none, tmedia_ppt_manager, tmedia_pvt_pchar, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_MANAGER_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_SET_PARAM(tmedia_none, tmedia_ppt_manager, tmedia_pvt_int64, KEY_STR, VALUE_INT64) +//#define TMEDIA_SESSION_MANAGER_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_GET_PARAM(tmedia_none, tmedia_ppt_manager, tmedia_pvt_int32, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_MANAGER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PARAM(tmedia_none, tmedia_ppt_manager, tmedia_pvt_pobject, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_MANAGER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_PARAM(tmedia_none, tmedia_ppt_manager, tmedia_pvt_pchar, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_MANAGER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_PARAM(tmedia_none, tmedia_ppt_manager, tmedia_pvt_int64, KEY_STR, VALUE_PINT64) +/* Any Session */ +#define TMEDIA_SESSION_SET_INT32(MEDIA_TYPE_ENUM, KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_int32, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_SET_POBJECT(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_pobject, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_SET_STR(MEDIA_TYPE_ENUM, KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_pchar, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_SET_INT64(MEDIA_TYPE_ENUM, KEY_STR, VALUE_INT64) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_int64, KEY_STR, VALUE_INT64) +//#define TMEDIA_SESSION_GET_INT32(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PINT32) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_int32, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_GET_PVOID(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_pobject, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_GET_STR(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_pchar, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_GET_INT64(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_int64, KEY_STR, VALUE_PINT64) +/* Audio Session */ +#define TMEDIA_SESSION_AUDIO_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_INT32(tmedia_audio, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_AUDIO_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_POBJECT(tmedia_audio, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_AUDIO_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_STR(tmedia_audio, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_AUDIO_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_SET_INT64(tmedia_audio, KEY_STR, VALUE_INT64) +//#define TMEDIA_SESSION_AUDIO_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_GET_INT32(tmedia_audio, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_AUDIO_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PVOID(tmedia_audio, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_AUDIO_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_STR(tmedia_audio, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_AUDIO_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_INT64(tmedia_audio, KEY_STR, VALUE_PINT64) +/* Video Session */ +#define TMEDIA_SESSION_VIDEO_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_INT32(tmedia_video, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_VIDEO_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_POBJECT(tmedia_video, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_VIDEO_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_STR(tmedia_video, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_VIDEO_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_SET_INT64(tmedia_video, KEY_STR, VALUE_INT64) +//#define TMEDIA_SESSION_VIDEO_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_GET_INT32(tmedia_video, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_VIDEO_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PVOID(tmedia_video, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_VIDEO_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_STR(tmedia_video, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_VIDEO_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_INT64(tmedia_video, KEY_STR, VALUE_PINT64) +/* Msrp Session */ +#define TMEDIA_SESSION_MSRP_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_INT32(tmedia_msrp, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_MSRP_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_POBJECT(tmedia_msrp, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_MSRP_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_STR(tmedia_msrp, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_MSRP_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_SET_INT64(tmedia_msrp, KEY_STR, VALUE_INT64) +//#define TMEDIA_SESSION_MSRP_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_GET_INT32(tmedia_msrp, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_MSRP_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PVOID(tmedia_msrp, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_MSRP_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_STR(tmedia_msrp, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_MSRP_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_INT64(tmedia_msrp, KEY_STR, VALUE_PINT64) +/* Any Consumer */ +#define TMEDIA_SESSION_CONSUMER_SET_INT32(MEDIA_TYPE_ENUM, KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_consumer, tmedia_pvt_int32, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_CONSUMER_SET_POBJECT(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_consumer, tmedia_pvt_pobject, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_CONSUMER_SET_STR(MEDIA_TYPE_ENUM, KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_consumer, tmedia_pvt_pchar, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_CONSUMER_SET_INT64(MEDIA_TYPE_ENUM, KEY_STR, VALUE_INT64) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_consumer, tmedia_pvt_int64, KEY_STR, VALUE_INT64) +//#define TMEDIA_SESSION_CONSUMER_GET_INT32(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PINT32) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_consumer, tmedia_pvt_int32, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_CONSUMER_GET_PVOID(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_consumer, tmedia_pvt_pobject, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_CONSUMER_GET_STR(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_consumer, tmedia_pvt_pchar, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_CONSUMER_GET_INT64(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_consumer, tmedia_pvt_int64, KEY_STR, VALUE_PINT64) +/* Audio Consumer */ +#define TMEDIA_SESSION_AUDIO_CONSUMER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_CONSUMER_SET_INT32(tmedia_audio, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_AUDIO_CONSUMER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_CONSUMER_SET_POBJECT(tmedia_audio, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_AUDIO_CONSUMER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_CONSUMER_SET_STR(tmedia_audio, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_AUDIO_CONSUMER_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_CONSUMER_SET_INT64(tmedia_audio, KEY_STR, VALUE_INT64) +//#define TMEDIA_SESSION_AUDIO_CONSUMER_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_CONSUMER_GET_INT32(tmedia_audio, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_AUDIO_CONSUMER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_CONSUMER_GET_PVOID(tmedia_audio, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_AUDIO_CONSUMER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_CONSUMER_GET_STR(tmedia_audio, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_AUDIO_CONSUMER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_CONSUMER_GET_INT64(tmedia_audio, KEY_STR, VALUE_PINT64) +/* Video Consumer */ +#define TMEDIA_SESSION_VIDEO_CONSUMER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_CONSUMER_SET_INT32(tmedia_video, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_VIDEO_CONSUMER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_CONSUMER_SET_POBJECT(tmedia_video, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_VIDEO_CONSUMER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_CONSUMER_SET_STR(tmedia_video, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_VIDEO_CONSUMER_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_CONSUMER_SET_INT64(tmedia_video, KEY_STR, VALUE_INT64) +//#define TMEDIA_SESSION_VIDEO_CONSUMER_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_CONSUMER_GET_INT32(tmedia_video, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_VIDEO_CONSUMER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_CONSUMER_GET_PVOID(tmedia_video, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_VIDEO_CONSUMER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_CONSUMER_GET_STR(tmedia_video, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_VIDEO_CONSUMER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_CONSUMER_GET_INT64(tmedia_video, KEY_STR, VALUE_PINT64) +/* Msrp Consumer */ +#define TMEDIA_SESSION_MSRP_CONSUMER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_CONSUMER_SET_INT32(tmedia_msrp, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_MSRP_CONSUMER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_CONSUMER_SET_POBJECT(tmedia_msrp, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_MSRP_CONSUMER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_CONSUMER_SET_STR(tmedia_msrp, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_MSRP_CONSUMER_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_CONSUMER_SET_INT64(tmedia_msrp, KEY_STR, VALUE_INT64) +//#define TMEDIA_SESSION_MSRP_CONSUMER_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_CONSUMER_GET_INT32(tmedia_msrp, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_MSRP_CONSUMER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_CONSUMER_GET_PVOID(tmedia_msrp, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_MSRP_CONSUMER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_CONSUMER_GET_STR(tmedia_msrp, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_MSRP_CONSUMER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_CONSUMER_GET_INT64(tmedia_msrp, KEY_STR, VALUE_PINT64) +/* Any Producer */ +#define TMEDIA_SESSION_PRODUCER_SET_INT32(MEDIA_TYPE_ENUM, KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_int32, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_PRODUCER_SET_POBJECT(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_pobject, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_PRODUCER_SET_STR(MEDIA_TYPE_ENUM, KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_pchar, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_PRODUCER_SET_INT64(MEDIA_TYPE_ENUM, KEY_STR, VALUE_INT64) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_int64, KEY_STR, VALUE_INT64) +//#define TMEDIA_SESSION_PRODUCER_GET_INT32(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PINT32) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_int32, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_PRODUCER_GET_PVOID(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_pobject, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_PRODUCER_GET_STR(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_pchar, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_PRODUCER_GET_INT64(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_int64, KEY_STR, VALUE_PINT64) +/* Audio Producer */ +#define TMEDIA_SESSION_AUDIO_PRODUCER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_PRODUCER_SET_INT32(tmedia_audio, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_AUDIO_PRODUCER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_PRODUCER_SET_POBJECT(tmedia_audio, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_AUDIO_PRODUCER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_AUDIO_PRODUCER_SET_STR(tmedia_audio, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_AUDIO_PRODUCER_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_PRODUCER_SET_INT64(tmedia_audio, KEY_STR, VALUE_INT64) +//#define TMEDIA_SESSION_AUDIO_PRODUCER_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_PRODUCER_GET_INT32(tmedia_audio, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_AUDIO_PRODUCER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_PRODUCER_GET_PVOID(tmedia_audio, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_AUDIO_PRODUCER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_AUDIO_PRODUCER_GET_STR(tmedia_audio, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_AUDIO_PRODUCER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_PRODUCER_GET_INT64(tmedia_audio, KEY_STR, VALUE_PINT64) +/* Video Producer */ +#define TMEDIA_SESSION_VIDEO_PRODUCER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_PRODUCER_SET_INT32(tmedia_video, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_VIDEO_PRODUCER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_PRODUCER_SET_POBJECT(tmedia_video, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_VIDEO_PRODUCER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_AUDIO_PRODUCER_SET_STR(tmedia_video, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_VIDEO_PRODUCER_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_PRODUCER_SET_INT64(tmedia_video, KEY_STR, VALUE_INT64) +//#define TMEDIA_SESSION_VIDEO_PRODUCER_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_PRODUCER_GET_INT32(tmedia_video, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_VIDEO_PRODUCER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_PRODUCER_GET_PVOID(tmedia_video, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_VIDEO_PRODUCER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_AUDIO_PRODUCER_GET_STR(tmedia_video, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_VIDEO_PRODUCER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_PRODUCER_GET_INT64(tmedia_video, KEY_STR, VALUE_PINT64) +/* Msrp Producer */ +#define TMEDIA_SESSION_MSRP_PRODUCER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_PRODUCER_SET_INT32(tmedia_msrp, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_MSRP_PRODUCER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_PRODUCER_SET_POBJECT(tmedia_msrp, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_MSRP_PRODUCER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_AUDIO_PRODUCER_SET_STR(tmedia_msrp, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_MSRP_PRODUCER_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_PRODUCER_SET_INT64(tmedia_msrp, KEY_STR, VALUE_INT64) +//#define TMEDIA_SESSION_MSRP_PRODUCER_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_PRODUCER_GET_INT32(tmedia_msrp, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_MSRP_PRODUCER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_PRODUCER_GET_PVOID(tmedia_msrp, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_MSRP_PRODUCER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_AUDIO_PRODUCER_GET_STR(tmedia_msrp, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_MSRP_PRODUCER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_PRODUCER_GET_INT64(tmedia_msrp, KEY_STR, VALUE_PINT64) + + +#define TMEDIA_SESSION_SET_NULL() tmedia_sptype_null +//#define TMEDIA_SESSION_GET_NULL() tmedia_sptype_null + +//#define TMEDIA_SESSION_SET_REMOTE_IP(IP_STR) tmedia_sptype_remote_ip, (const char*) IP_STR +//#define TMEDIA_SESSION_SET_LOCAL_IP(IP_STR, IPv6_BOOL) tmedia_sptype_local_ip, (const char*) IP_STR, (tsk_bool_t)IPv6_BOOL +//#define TMEDIA_SESSION_SET_RTCP(ENABLED_BOOL) tmedia_sptype_set_rtcp, (tsk_bool_t)ENABLED_BOOL +//#define TMEDIA_SESSION_SET_QOS(TYPE_ENUM, STRENGTH_ENUM) tmedia_sptype_qos, (tmedia_qos_stype_t)TYPE_ENUM, (tmedia_qos_strength_t)STRENGTH_ENUM + + +TINYMEDIA_API tmedia_session_mgr_t* tmedia_session_mgr_create(tmedia_type_t type, const char* addr, tsk_bool_t ipv6, tsk_bool_t offerer); +TINYMEDIA_API tmedia_session_t* tmedia_session_mgr_find(tmedia_session_mgr_t* self, tmedia_type_t type); +TINYMEDIA_API int tmedia_session_mgr_set_natt_ctx(tmedia_session_mgr_t* self, tnet_nat_context_handle_t* natt_ctx, const char* public_addr); +TINYMEDIA_API int tmedia_session_mgr_start(tmedia_session_mgr_t* self); +TINYMEDIA_API int tmedia_session_mgr_set(tmedia_session_mgr_t* self, ...); +TINYMEDIA_API int tmedia_session_mgr_set_2(tmedia_session_mgr_t* self, va_list *app); +TINYMEDIA_API int tmedia_session_mgr_set_3(tmedia_session_mgr_t* self, const tmedia_params_L_t* params); +TINYMEDIA_API int tmedia_session_mgr_stop(tmedia_session_mgr_t* self); +TINYMEDIA_API const tsdp_message_t* tmedia_session_mgr_get_lo(tmedia_session_mgr_t* self); +TINYMEDIA_API int tmedia_session_mgr_set_ro(tmedia_session_mgr_t* self, const tsdp_message_t* sdp); +TINYMEDIA_API int tmedia_session_mgr_hold(tmedia_session_mgr_t* self, tmedia_type_t type); +TINYMEDIA_API tsk_bool_t tmedia_session_mgr_is_held(tmedia_session_mgr_t* self, tmedia_type_t type, tsk_bool_t local); +TINYMEDIA_API int tmedia_session_mgr_resume(tmedia_session_mgr_t* self, tmedia_type_t type); +TINYMEDIA_API int tmedia_session_mgr_add_media(tmedia_session_mgr_t* self, tmedia_type_t type); +TINYMEDIA_API int tmedia_session_mgr_remove_media(tmedia_session_mgr_t* self, tmedia_type_t type); +TINYMEDIA_API int tmedia_session_mgr_set_qos(tmedia_session_mgr_t* self, tmedia_qos_stype_t qos_type, tmedia_qos_strength_t qos_strength); +TINYMEDIA_API tsk_bool_t tmedia_session_mgr_canresume(tmedia_session_mgr_t* self); +TINYMEDIA_API tsk_bool_t tmedia_session_mgr_has_active_session(tmedia_session_mgr_t* self); +TINYMEDIA_API int tmedia_session_mgr_send_dtmf(tmedia_session_mgr_t* self, uint8_t event); +TINYMEDIA_API int tmedia_session_mgr_send_file(tmedia_session_mgr_t* self, const char* path, ...); +TINYMEDIA_API int tmedia_session_mgr_send_message(tmedia_session_mgr_t* self, const void* data, tsk_size_t size, const tmedia_params_L_t *params); +TINYMEDIA_API int tmedia_session_mgr_set_msrp_cb(tmedia_session_mgr_t* self, const void* callback_data, tmedia_session_msrp_cb_f func); + + +TINYMEDIA_GEXTERN const tsk_object_def_t *tmedia_session_mgr_def_t; + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_SESSION_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_session_dummy.h b/tinyMEDIA/include/tinymedia/tmedia_session_dummy.h new file mode 100644 index 0000000..58a0926 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_session_dummy.h @@ -0,0 +1,76 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 DOUBANGO. +* +*/ + +/**@file tmedia_session_dummy.h + * @brief Dummy sessions used for test only. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#ifndef TINYMEDIA_SESSION_DUMMY_H +#define TINYMEDIA_SESSION_DUMMY_H + +#include "tinymedia_config.h" + +#include "tmedia_session.h" + +#include "tsk_object.h" + +TMEDIA_BEGIN_DECLS + +/** Dummy Audio session */ +typedef struct tmedia_session_daudio_s +{ + TMEDIA_DECLARE_SESSION_AUDIO; + uint16_t local_port; + uint16_t remote_port; +} +tmedia_session_daudio_t; + +/** Dummy Video session */ +typedef struct tmedia_session_dvideo_s +{ + TMEDIA_DECLARE_SESSION_VIDEO; + uint16_t local_port; + uint16_t remote_port; +} +tmedia_session_dvideo_t; + +/** Dummy Msrp session */ +typedef struct tmedia_session_dmsrp_s +{ + TMEDIA_DECLARE_SESSION_MSRP; + uint16_t local_port; + uint16_t remote_port; +} +tmedia_session_dmsrp_t; + + +TINYMEDIA_GEXTERN const tmedia_session_plugin_def_t *tmedia_session_daudio_plugin_def_t; +TINYMEDIA_GEXTERN const tmedia_session_plugin_def_t *tmedia_session_dvideo_plugin_def_t; +TINYMEDIA_GEXTERN const tmedia_session_plugin_def_t *tmedia_session_dmsrp_plugin_def_t; + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_SESSION_DUMMY_H */ + diff --git a/tinyMEDIA/include/tinymedia/tmedia_session_ghost.h b/tinyMEDIA/include/tinymedia/tmedia_session_ghost.h new file mode 100644 index 0000000..8ae1a21 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_session_ghost.h @@ -0,0 +1,53 @@ +/* +* Copyright (C) 2009-2010 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO 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 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 DOUBANGO. +* +*/ + +/**@file tmedia_session_ghost.h + * @brief Ghost session. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#ifndef TINYMEDIA_SESSION_GHOST_H +#define TINYMEDIA_SESSION_GHOST_H + +#include "tinymedia_config.h" + +#include "tmedia_session.h" + +#include "tsk_object.h" + +TMEDIA_BEGIN_DECLS + +/** Ghost session */ +typedef struct tmedia_session_ghost_s +{ + TMEDIA_DECLARE_SESSION; + char* media; +} +tmedia_session_ghost_t; + +TINYMEDIA_GEXTERN const tmedia_session_plugin_def_t *tmedia_session_ghost_plugin_def_t; + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_SESSION_GHOST_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_vad.h b/tinyMEDIA/include/tinymedia/tmedia_vad.h new file mode 100644 index 0000000..e69de29 -- cgit v1.1