diff options
author | Mamadou DIOP <bossiel@yahoo.fr> | 2015-08-17 01:56:35 +0200 |
---|---|---|
committer | Mamadou DIOP <bossiel@yahoo.fr> | 2015-08-17 01:56:35 +0200 |
commit | 631fffee8a28b1bec5ed1f1d26a20e0135967f99 (patch) | |
tree | 74afe3bf3efe15aa82bcd0272b2b0f4d48c2d837 /tinyMEDIA/include/tinymedia | |
parent | 7908865936604036e6f200f1b5e069f8752f3a3a (diff) | |
download | doubango-631fffee8a28b1bec5ed1f1d26a20e0135967f99.zip doubango-631fffee8a28b1bec5ed1f1d26a20e0135967f99.tar.gz |
-
Diffstat (limited to 'tinyMEDIA/include/tinymedia')
22 files changed, 3103 insertions, 0 deletions
diff --git a/tinyMEDIA/include/tinymedia/content/tmedia_content.h b/tinyMEDIA/include/tinymedia/content/tmedia_content.h new file mode 100644 index 0000000..41b1ecb --- /dev/null +++ b/tinyMEDIA/include/tinymedia/content/tmedia_content.h @@ -0,0 +1,126 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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 <diopmamadou(at)doubango[dot]org> + * + */ +#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..db1aa02 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/content/tmedia_content_cpim.h @@ -0,0 +1,59 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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 <diopmamadou(at)doubango[dot]org> + * + */ +#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 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/content/tmedia_content_multipart.h 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 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/content/tmedia_content_sip_frag.h diff --git a/tinyMEDIA/include/tinymedia/tmedia.h b/tinyMEDIA/include/tinymedia/tmedia.h new file mode 100644 index 0000000..d10ee69 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia.h @@ -0,0 +1,121 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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 <diopmamadou(at)doubango[dot]org> + * + + */ +#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..f29abf6 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_codec.h @@ -0,0 +1,468 @@ +/* +* Copyright (C) 2010-2015 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. + * + */ +#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 +Must starts at 96 to be conform to RFC 5761 (rtcp-mux) +**********/ + +#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_VP8 "100" /* Must to ease neg. with chrome and Asterisk */ +#define TMEDIA_CODEC_FORMAT_DTMF "101" + +#define TMEDIA_CODEC_FORMAT_H263_2000 "102" +#define TMEDIA_CODEC_FORMAT_H263_1998 "103" +#define TMEDIA_CODEC_FORMAT_H264_BP "104" +#define TMEDIA_CODEC_FORMAT_H264_MP "105" +#define TMEDIA_CODEC_FORMAT_H264_HP "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_OPUS "111" + +#define TMEDIA_CODEC_FORMAT_AMR_NB_BE "112" +#define TMEDIA_CODEC_FORMAT_AMR_NB_OA "113" +#define TMEDIA_CODEC_FORMAT_AMR_WB_BE "114" +#define TMEDIA_CODEC_FORMAT_AMR_WB_OA "115" + +#define TMEDIA_CODEC_FORMAT_BV16 "116" + +#define TMEDIA_CODEC_FORMAT_MP4V_ES "121" + +#define TMEDIA_CODEC_FORMAT_ULPFEC "122" +#define TMEDIA_CODEC_FORMAT_RED "123" +#define TMEDIA_CODEC_FORMAT_T140 "124" + +#define TMEDIA_CODEC_FORMAT_THEORA "125" + + +#define TMEDIA_CODEC_FORMAT_MSRP "*" +#define TMEDIA_CODEC_FORMAT_BFCP "*" + + + +// @tinyWRAP +typedef enum tmedia_codec_id_e +{ + tmedia_codec_id_none = 0x00000000, + + tmedia_codec_id_amr_nb_oa = 0x00000001<<0, + tmedia_codec_id_amr_nb_be = 0x00000001<<1, + tmedia_codec_id_amr_wb_oa = 0x00000001<<2, + tmedia_codec_id_amr_wb_be = 0x00000001<<3, + tmedia_codec_id_gsm = 0x00000001<<4, + tmedia_codec_id_pcma = 0x00000001<<5, + tmedia_codec_id_pcmu = 0x00000001<<6, + tmedia_codec_id_ilbc = 0x00000001<<7, + tmedia_codec_id_speex_nb = 0x00000001<<8, + tmedia_codec_id_speex_wb = 0x00000001<<9, + tmedia_codec_id_speex_uwb = 0x00000001<<10, + tmedia_codec_id_bv16 = 0x00000001<<11, + tmedia_codec_id_bv32 = 0x00000001<<12, + tmedia_codec_id_opus = 0x00000001<<13, + tmedia_codec_id_g729ab = 0x00000001<<14, + tmedia_codec_id_g722 = 0x00000001<<15, + + /* room for new Audio codecs */ + + tmedia_codec_id_h261 = 0x00010000<<0, + tmedia_codec_id_h263 = 0x00010000<<1, + tmedia_codec_id_h263p = 0x00010000<<2, + tmedia_codec_id_h263pp = 0x00010000<<3, + tmedia_codec_id_h264_bp = 0x00010000<<4, + tmedia_codec_id_h264_mp = 0x00010000<<5, + tmedia_codec_id_h264_hp = 0x00010000<<6, + tmedia_codec_id_h264_bp10 = tmedia_codec_id_h264_bp, // @deprecated + tmedia_codec_id_h264_bp20 = tmedia_codec_id_h264_bp, // @deprecated + tmedia_codec_id_h264_bp30 = tmedia_codec_id_h264_bp, // @deprecated + tmedia_codec_id_h264_svc = 0x00010000<<7, + tmedia_codec_id_theora = 0x00010000<<8, + tmedia_codec_id_mp4ves_es = 0x00010000<<9, + tmedia_codec_id_vp8 = 0x00010000<<10, + + /* room for new Video codecs */ + + tmedia_codec_id_t140 = 0x00010000<<14, + tmedia_codec_id_red = 0x00010000<<15, + + + tmedia_codec_id_all = 0xffffffff, +} +tmedia_codec_id_t; + + + +/**Max number of plugins (codec types) we can create */ +#if !defined(TMED_CODEC_MAX_PLUGINS) +# define TMED_CODEC_MAX_PLUGINS 0xFF +#endif + +/** cast any pointer to @ref tmedia_codec_t* object */ +#define TMEDIA_CODEC(self) ((tmedia_codec_t*)(self)) + + +#define TMEDIA_CODEC_RATE_DECODING(self) (TMEDIA_CODEC((self))->in.rate) +#define TMEDIA_CODEC_RATE_ENCODING(self) (TMEDIA_CODEC((self))->out.rate) + +#define TMEDIA_CODEC_PTIME_AUDIO_DECODING(self) (TMEDIA_CODEC_AUDIO((self))->in.ptime) +#define TMEDIA_CODEC_PTIME_AUDIO_ENCODING(self) (TMEDIA_CODEC_AUDIO((self))->out.ptime) + +#define TMEDIA_CODEC_CHANNELS_AUDIO_DECODING(self) (TMEDIA_CODEC_AUDIO((self))->in.channels) +#define TMEDIA_CODEC_CHANNELS_AUDIO_ENCODING(self) (TMEDIA_CODEC_AUDIO((self))->out.channels) + +#define TMEDIA_CODEC_PCM_FRAME_SIZE_AUDIO_DECODING(self) ((TMEDIA_CODEC_PTIME_AUDIO_DECODING((self)) * TMEDIA_CODEC_RATE_DECODING((self)))/1000) +#define TMEDIA_CODEC_PCM_FRAME_SIZE_AUDIO_ENCODING(self) ((TMEDIA_CODEC_PTIME_AUDIO_ENCODING((self)) * TMEDIA_CODEC_RATE_ENCODING((self)))/1000) + +#define TMEDIA_CODEC_FRAME_DURATION_AUDIO_ENCODING(self) (int32_t)((float)TMEDIA_CODEC_PCM_FRAME_SIZE_AUDIO_ENCODING(self) * (float)TMEDIA_CODEC_AUDIO((self))->out.timestamp_multiplier) + +/** callbacks for video codecs */ +typedef int (*tmedia_codec_video_enc_cb_f)(const tmedia_video_encode_result_xt* result); +typedef int (*tmedia_codec_video_dec_cb_f)(const tmedia_video_decode_result_xt* result); + + +struct tmedia_param_s; +struct tsdp_header_M_s; + +typedef enum tmedia_codec_action_e +{ + tmedia_codec_action_encode_idr, + tmedia_codec_action_bw_down, + tmedia_codec_action_bw_up, +} +tmedia_codec_action_t; + +/** Base object for all Codecs */ +typedef struct tmedia_codec_s +{ + TSK_DECLARE_OBJECT; + + //! the type of the codec + tmedia_type_t type; + //! the codec identifier + tmedia_codec_id_t id; + //! 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; // @deprecated + //! maximum bandwidth to use for outgoing RTP (INT_MAX or <=0 means undefined) + int32_t bandwidth_max_upload; + //! maximum bandwidth to use for incoming RTP (INT_MAX or <=0 means undefined) + int32_t bandwidth_max_download; + //! the negociated format (only useful for codecs with dyn. payload type) + char* neg_format; + //! whether this is a passthrough codec + tsk_bool_t passthrough; + + struct{ + // !negotiated decoding rate (for codecs with dynamic rate, e.g. opus) + uint32_t rate; + } in; //decoding direction + struct{ + // !negotiated encoding rate (for codecs with dynamic rate, e.g. opus) + uint32_t rate; + } out; //encoding direction + + //! plugin used to create the codec + const struct tmedia_codec_plugin_def_s* plugin; +} +tmedia_codec_t; +#define TMEDIA_CODEC(self) ((tmedia_codec_t*)(self)) + +/** 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 codec identifier + tmedia_codec_id_t codec_id; + //! 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; + + //! set parameters + int (*set) (tmedia_codec_t* , const struct tmedia_param_s*); + //! 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 this sdp attribute + tsk_bool_t (* sdp_att_match) (const tmedia_codec_t*, const char* att_name, const char* att_value); + //! gets sdp attribute value. e.g. "mode-set=0,2,5,7; mode-change-period=2; mode-change-neighbor=1" + char* (* sdp_att_get) (const tmedia_codec_t*, const char* att_name); +} +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_set(tmedia_codec_t* self, const struct tmedia_param_s* param); +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_register_2(const tmedia_codec_plugin_def_t* plugin, int prio); +TINYMEDIA_API tsk_bool_t tmedia_codec_plugin_is_registered(const tmedia_codec_plugin_def_t* plugin); +TINYMEDIA_API tsk_bool_t tmedia_codec_plugin_is_registered_2(tmedia_codec_id_t codec_id); +TINYMEDIA_API int tmedia_codec_plugin_registered_get_all(const struct tmedia_codec_plugin_def_s*(** plugins)[TMED_CODEC_MAX_PLUGINS], tsk_size_t* count); +TINYMEDIA_API const struct tmedia_codec_plugin_def_s* tmedia_codec_plugin_registered_get_const(tmedia_codec_id_t codec_id); +TINYMEDIA_API int tmedia_codec_plugin_unregister(const tmedia_codec_plugin_def_t* plugin); +TINYMEDIA_API int tmedia_codec_plugin_unregister_all(); +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 tsk_bool_t tmedia_codec_sdp_att_match(const tmedia_codec_t* self, const char* att_name, const char* att_value); +TINYMEDIA_API char* tmedia_codec_sdp_att_get(const tmedia_codec_t* self, const char* att_name); +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, struct tsdp_header_M_s* 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; + + struct{ + // !negotiated decoding ptime + uint8_t ptime; + // !negotiated decoding channels + int8_t channels; + // ! timestamp multiplier + float timestamp_multiplier; + } in; //decoding direction + struct{ + // !negotiated decoding ptime + uint8_t ptime; + // !negotiated encoding channels + int8_t channels; + // ! timestamp multiplier + float timestamp_multiplier; + } out; //encoding direction +} +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)) +TINYMEDIA_API float tmedia_codec_audio_get_timestamp_multiplier(tmedia_codec_id_t id, uint32_t sample_rate); + +/** Video codec */ +typedef struct tmedia_codec_video_s +{ + TMEDIA_DECLARE_CODEC; + + struct{ + unsigned width; + unsigned height; + unsigned fps; + unsigned max_br; + unsigned max_mbps; + tmedia_chroma_t chroma; + tsk_bool_t flip; + + tmedia_codec_video_dec_cb_f callback; + tmedia_video_decode_result_xt result; + }in;// decoded + struct{ + unsigned width; + unsigned height; + unsigned fps; + unsigned max_br; + unsigned max_mbps; + tmedia_chroma_t chroma; + tsk_bool_t flip; + + tmedia_codec_video_enc_cb_f callback; + tmedia_video_encode_result_xt result; + }out;// encoded + + //! preferred video size + tmedia_pref_video_size_t pref_size; +} +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_enc_callback(tmedia_codec_video_t *self, tmedia_codec_video_enc_cb_f callback, const void* callback_data); +TINYMEDIA_API int tmedia_codec_video_set_dec_callback(tmedia_codec_video_t *self, tmedia_codec_video_dec_cb_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)) + + +/** BFCP codec */ +typedef struct tmedia_codec_bfcp_s +{ + TMEDIA_DECLARE_CODEC; +} +tmedia_codec_bfcp_t; +#define TMEDIA_DECLARE_CODEC_BFCP tmedia_codec_bfcp_t __bfcp__ +#define TMEDIA_CODEC_BFCP(self) ((tmedia_codec_bfcp_t*)(self)) +#define tmedia_codec_bfcp_init(self, name, desc) tmedia_codec_init(TMEDIA_CODEC(self), tmedia_bfcp, name, desc, "*") +#define tmedia_codec_bfcp_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..9957eba --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_codec_dummy.h @@ -0,0 +1,78 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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 <diopmamadou(at)doubango[dot]org> + * + + */ +#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..411007b --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_common.h @@ -0,0 +1,285 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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 <diopmamadou(at)doubango[dot]org> + * + + */ +#ifndef TINYMEDIA_COMMON_H +#define TINYMEDIA_COMMON_H + +#include "tinymedia_config.h" + +#include "tsk_plugin.h" +#include "tsk_object.h" + +TMEDIA_BEGIN_DECLS + +struct tsdp_message_s; +struct tsdp_header_M_s; + +/** List of all supported media types */ +// @tinyWRAP +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_t140 = (0x01 << 6), + tmedia_bfcp = (0x01 << 7), + tmedia_bfcp_audio = (0x01 << 8)/*must*/ | tmedia_bfcp, /* do not add "| audio". Otherwise it will be impossible to start an "video+bfcp-audio" session. */ + tmedia_bfcp_video = (0x01 << 9)/*must*/ | tmedia_bfcp, /* do not add "| video". Otherwise it will be impossible to start an "audio+bfcp-video" session. */ + + tmedia_msrp = (tmedia_chat | tmedia_file), + tmedia_audiovideo = (tmedia_audio | tmedia_video), + + tmedia_all = 0xff +} +tmedia_type_t; + +// @tinyWRAP +typedef enum tmedia_mode_e +{ + tmedia_mode_none, + tmedia_mode_optional, + tmedia_mode_mandatory +} +tmedia_mode_t; + +// @tinyWRAP +typedef enum tmedia_srtp_mode_e +{ + tmedia_srtp_mode_none, + tmedia_srtp_mode_optional, + tmedia_srtp_mode_mandatory +} +tmedia_srtp_mode_t; + +// @tinyWRAP +typedef enum tmedia_srtp_type_e +{ + tmedia_srtp_type_none = 0x00, + tmedia_srtp_type_sdes = 0x01, + tmedia_srtp_type_dtls = 0x02, + tmedia_srtp_type_sdes_dtls = (tmedia_srtp_type_sdes | tmedia_srtp_type_dtls) +} +tmedia_srtp_type_t; + +// @tinyWRAP +typedef enum tmedia_t140_data_type_e +{ + tmedia_t140_data_type_utf8, + tmedia_t140_data_type_zero_width_no_break_space = 0xefbbbf, + tmedia_t140_data_type_backspace = 0x08, + tmedia_t140_data_type_esc = 0x1b, + tmedia_t140_data_type_cr = 0x0d, + tmedia_t140_data_type_lf = 0x0a, + tmedia_t140_data_type_cr_lf = 0x0d0a, + tmedia_t140_data_type_bell = 0x07, + tmedia_t140_data_type_sos = 0x98, + tmedia_t140_data_type_string_term = 0x9c, + tmedia_t140_data_type_graphic_start = 0x9b, + tmedia_t140_data_type_graphic_end = 0x6d, + tmedia_t140_data_type_loss_char_char = 0xfffd, + tmedia_t140_data_type_loss_utf8 = 0xefbfbd, +} +tmedia_t140_data_type_t; + +// @tinyWRAP +typedef enum tmedia_rtcp_event_type_e +{ + tmedia_rtcp_event_type_fir, // Full Intra Refresh +} +tmedia_rtcp_event_type_t; + +// @tinyWRAP +typedef enum tmedia_profile_e +{ + tmedia_profile_default, + // Enable all RTCWeb specifications: + // ICE, DTLS-SRTP, RTP/AVPF, FEC, RED, SDPCapNeg, RTCP-MUX, imageattr... + tmedia_profile_rtcweb +} +tmedia_profile_t; + +// @tinyWRAP +typedef enum tmedia_pref_video_size_s +{ /* must be sorted like this */ + tmedia_pref_video_size_sqcif, // 128 x 98 + tmedia_pref_video_size_qcif, // 176 x 144 + tmedia_pref_video_size_qvga, // 320 x 240 + tmedia_pref_video_size_cif, // 352 x 288 + tmedia_pref_video_size_hvga, // 480 x 320 + tmedia_pref_video_size_vga, // 640 x 480 + tmedia_pref_video_size_4cif, // 704 x 576 + tmedia_pref_video_size_wvga, // 800 x 480 + tmedia_pref_video_size_svga, // 800 x 600 + tmedia_pref_video_size_480p, // 852 x 480 + tmedia_pref_video_size_xga, // 1024 x 768 + tmedia_pref_video_size_720p, // 1280 x 720 + tmedia_pref_video_size_16cif, // 1408 x 1152 + tmedia_pref_video_size_1080p, // 1920 x 1080 + tmedia_pref_video_size_2160p, // 3840 x 2160 +} +tmedia_pref_video_size_t; + +typedef enum tmedia_rtcweb_type_e +{ + tmedia_rtcweb_type_none, + tmedia_rtcweb_type_firefox, + tmedia_rtcweb_type_chrome, + tmedia_rtcweb_type_ie, + tmedia_rtcweb_type_safari, + tmedia_rtcweb_type_opera, + tmedia_rtcweb_type_ericsson, + tmedia_rtcweb_type_doubango +} +tmedia_rtcweb_type_t; + +typedef enum tmedia_video_encode_result_type_e +{ + tmedia_video_encode_result_type_none = 0x00, + tmedia_video_encode_result_type_params = (0x01 << 0), // e.g. SPS or PPS, DCT coeff., Quant params.... + tmedia_video_encode_result_type_intra = (0x01 << 1), + tmedia_video_encode_result_type_key = tmedia_video_encode_result_type_intra, + tmedia_video_encode_result_type_gold = tmedia_video_encode_result_type_intra, + tmedia_video_encode_result_type_predicted = (0x01 << 2), + tmedia_video_encode_result_type_bipredicted = (0x01 << 3) +} +tmedia_video_encode_result_type_t; + +typedef struct tmedia_video_encode_result_xs +{ + tmedia_video_encode_result_type_t type; + const void* usr_data; + struct{ + const void* ptr; + tsk_size_t size; + } buffer; + uint32_t duration; + tsk_bool_t last_chunck; + const tsk_object_t* proto_hdr; +} +tmedia_video_encode_result_xt; + +#define tmedia_video_encode_result_reset(result) \ + (result)->type = tmedia_video_encode_result_type_none; \ + (result)->usr_data = tsk_null; \ + (result)->proto_hdr = tsk_null; \ + (result)->buffer.ptr = tsk_null; \ + (result)->buffer.size = 0; \ + (result)->duration = 0; \ + (result)->last_chunck = tsk_false; \ + (result)->proto_hdr = tsk_null; \ + +typedef enum tmedia_video_decode_result_type_e +{ + tmedia_video_decode_result_type_none, + + tmedia_video_decode_result_type_error, + tmedia_video_decode_result_type_idr, +} +tmedia_video_decode_result_type_t; + +typedef struct tmedia_video_decode_result_xs +{ + tmedia_video_decode_result_type_t type; + const void* usr_data; + const tsk_object_t* proto_hdr; // RTP, RTSP.... +} +tmedia_video_decode_result_xt; + +#define tmedia_video_decode_result_reset(result) \ + (result)->type = tmedia_video_decode_result_type_none; \ + (result)->usr_data = tsk_null; \ + (result)->proto_hdr = tsk_null; \ + + +// @tinyWRAP +typedef enum tmedia_chroma_e +{ + tmedia_chroma_none=0, + tmedia_chroma_rgb24, // will be stored as bgr24 on x86 (little endians) machines; e.g. WindowsPhone7 + tmedia_chroma_bgr24, // used by windows consumer (DirectShow) - + tmedia_chroma_rgb32, // used by iOS4 consumer (iPhone and iPod touch) + tmedia_chroma_rgb565le, // (used by both android and wince consumers) + tmedia_chroma_rgb565be, + tmedia_chroma_nv12, // used by iOS4 producer (iPhone and iPod Touch 3GS and 4) + tmedia_chroma_nv21, // Yuv420 SP (used by android producer) + tmedia_chroma_yuv422p, + tmedia_chroma_uyvy422, // used by iOS4 producer (iPhone and iPod Touch 3G) - Microsoft: MFVideoFormat_YUY2 + tmedia_chroma_yuv420p, // Default + tmedia_chroma_mjpeg, // VirtualBox default camera mode (Windows as host and Linux as guest) + tmedia_chroma_yuyv422, // YUYV422 (V4L2 preferred format) +} +tmedia_chroma_t; + +// @tinyWRAP +// @deprecated +// keep order (low->unrestricted) +typedef enum tmedia_bandwidth_level_e +{ + tmedia_bl_low, + tmedia_bl_medium, + tmedia_bl_hight, + tmedia_bl_unrestricted +} +tmedia_bandwidth_level_t; + +typedef enum tmedia_ro_type_e +{ + tmedia_ro_type_none = 0x00, + tmedia_ro_type_offer = (0x01 << 0), + tmedia_ro_type_answer = (0x01 << 1), + tmedia_ro_type_provisional = tmedia_ro_type_answer | (0x01 << 2), +} +tmedia_ro_type_t; + +TINYMEDIA_API tsk_size_t tmedia_plugin_register(struct tsk_plugin_s* plugin, enum tsk_plugin_def_type_e type, enum tsk_plugin_def_media_type_e media); +TINYMEDIA_API tsk_size_t tmedia_plugin_unregister(struct tsk_plugin_s* plugin, enum tsk_plugin_def_type_e type, enum tsk_plugin_def_media_type_e media); +TINYMEDIA_API tmedia_type_t tmedia_type_from_sdp(const struct tsdp_message_s* sdp); +TINYMEDIA_API tmedia_type_t tmedia_type_from_sdp_headerM(const struct tsdp_header_M_s* M); +TINYMEDIA_API int tmedia_parse_rtpmap(const char* rtpmap, char** name, int32_t* rate, int32_t* channels); +TINYMEDIA_API int tmedia_video_get_size(tmedia_pref_video_size_t pref_vs, unsigned *width, unsigned *height); +TINYMEDIA_API int tmedia_video_get_closest_cif_size(tmedia_pref_video_size_t pref_vs, tmedia_pref_video_size_t *cif_vs); +TINYMEDIA_API int tmedia_video_get_closest_pref_size(unsigned width, unsigned height, tmedia_pref_video_size_t *pref_vs); +TINYMEDIA_API int tmedia_parse_video_fmtp(const char* fmtp, tmedia_pref_video_size_t pref_vs, unsigned* width, unsigned* height, unsigned* fps); +TINYMEDIA_API int tmedia_parse_video_imageattr(const char* imageattr, tmedia_pref_video_size_t pref_vs, unsigned* in_width, unsigned* in_height, unsigned* out_width, unsigned* out_height); +TINYMEDIA_API char* tmedia_get_video_fmtp(tmedia_pref_video_size_t pref_vs); +TINYMEDIA_API char* tmedia_get_video_imageattr(tmedia_pref_video_size_t pref_vs, unsigned in_width, unsigned in_height, unsigned out_width, unsigned out_height); +TINYMEDIA_API int tmedia_get_video_quality(tmedia_bandwidth_level_t bl); +TINYMEDIA_API int32_t tmedia_get_video_bandwidth_kbps(unsigned width, unsigned height, unsigned fps, unsigned motion_rank); +TINYMEDIA_API int32_t tmedia_get_video_bandwidth_kbps_2(unsigned width, unsigned height, unsigned fps); +TINYMEDIA_API int32_t tmedia_get_video_bandwidth_kbps_3(); +#define tmedia_get_video_qscale tmedia_get_video_quality + +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..0e88f45 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_consumer.h @@ -0,0 +1,147 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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 <diopmamadou(at)doubango[dot]org> + * + */ +#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 + +#define TMEDIA_CONSUMER_BITS_PER_SAMPLE_DEFAULT 16 +#define TMEDIA_CONSUMER_CHANNELS_DEFAULT 2 +#define TMEDIA_CONSUMER_RATE_DEFAULT 8000 + + +/**Max number of plugins (consumer types) we can create */ +#if !defined(TMED_CONSUMER_MAX_PLUGINS) +# define TMED_CONSUMER_MAX_PLUGINS 0x0F +#endif + +/** cast any pointer to @ref tmedia_consumer_t* object */ +#define TMEDIA_CONSUMER(self) ((tmedia_consumer_t*)(self)) + +/** Default Video chroma */ +#if !defined(TMEDIA_CONSUMER_CHROMA_DEFAULT) +# define TMEDIA_CONSUMER_CHROMA_DEFAULT tmedia_chroma_yuv420p +#endif + +/** 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; + + struct{ + uint8_t bits_per_sample; + uint8_t ptime; + uint8_t gain; + struct{ + uint8_t channels; + uint32_t rate; + } in; + struct{ + uint8_t channels; + uint32_t rate; + } out; + int32_t volume; + } audio; + + tsk_bool_t is_started; + tsk_bool_t is_prepared; + uint64_t session_id; + + struct{ + enum tmedia_codec_id_e codec_id; + // other options to be added + } decoder; + + 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*, const 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, const 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_converter_video.h b/tinyMEDIA/include/tinymedia/tmedia_converter_video.h new file mode 100644 index 0000000..133dfab --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_converter_video.h @@ -0,0 +1,114 @@ +/* +* Copyright (C) 2012 Doubango Telecom <http://www.doubango.org> +* +* 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_converter_video.h + * @brief Video converter plugin (chroma, rotation, scaling, ...) + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + */ +#ifndef TINYMEDIA_CONVERTER_VIDEO_H +#define TINYMEDIA_CONVERTER_VIDEO_H + +#include "tinymedia_config.h" +#include "tmedia_common.h" + +TMEDIA_BEGIN_DECLS + +/** cast any pointer to @ref tmedia_converter_video_t* object */ +#define TMEDIA_CONVERTER_VIDEO(self) ((tmedia_converter_video_t*)(self)) + +/**Max number of plugins (consumer types) we can create */ +#if !defined(TMED_CONVERTER_VIDEO_MAX_PLUGINS) +# define TMED_CONVERTER_VIDEO_MAX_PLUGINS 0x0F +#endif + +typedef struct tmedia_converter_video_s +{ + TSK_DECLARE_OBJECT; + + tsk_size_t srcWidth; + tsk_size_t srcHeight; + + tsk_size_t dstWidth; + tsk_size_t dstHeight; + + tmedia_chroma_t srcChroma; + tmedia_chroma_t dstChroma; + + // one shot parameters + int rotation; + tsk_bool_t flip; + tsk_bool_t mirror; + tsk_bool_t scale_rotated_frames; + + const struct tmedia_converter_video_plugin_def_s* plugin; +} +tmedia_converter_video_t; + +#define TMEDIA_DECLARE_CONVERTER_VIDEO tmedia_converter_video_t __converter__ + +#define tmedia_converter_video_set(self, _rotation, _flip, _mirror, _scale_rotated_frames) \ + if((self)){ \ + (self)->rotation = (_rotation); \ + (self)->flip = (_flip); \ + (self)->mirror = (_mirror); \ + (self)->scale_rotated_frames = (_scale_rotated_frames); \ + } +#define tmedia_converter_video_set_rotation(self, _rotation) \ + if((self)){ \ + (self)->rotation = (_rotation); \ + } +#define tmedia_converter_video_set_flip(self, _flip) \ + if((self)){ \ + (self)->flip = (_flip); \ + } +#define tmedia_converter_video_set_mirror(self, _mirror) \ + if((self)){ \ + (self)->mirror = (_mirror); \ + } +#define tmedia_converter_video_set_scale_rotated_frames(self, _scale_rotated_frames) \ + if((self)){ \ + (self)->scale_rotated_frames = (_scale_rotated_frames); \ + } + +#define tmedia_converter_video_process(_self, _buffer, _size, _output, _output_max_size) \ + (_self)->plugin->process((_self), (_buffer), (_size), (_output), (_output_max_size)) + +/** Virtual table used to define a consumer plugin */ +typedef struct tmedia_converter_video_plugin_def_s +{ + //! object definition used to create an instance of the converter + const tsk_object_def_t* objdef; + + int (* init) ( struct tmedia_converter_video_s* self, tsk_size_t srcWidth, tsk_size_t srcHeight, tmedia_chroma_t srcChroma, tsk_size_t dstWidth, tsk_size_t dstHeight, tmedia_chroma_t dstChroma ); + tsk_size_t (* process) ( struct tmedia_converter_video_s* self, const void* buffer, tsk_size_t buffer_size, void** output, tsk_size_t* output_max_size ); +} +tmedia_converter_video_plugin_def_t; + +TINYMEDIA_API tmedia_converter_video_t* tmedia_converter_video_create(tsk_size_t srcWidth, tsk_size_t srcHeight, tmedia_chroma_t srcChroma, tsk_size_t dstWidth, tsk_size_t dstHeight, tmedia_chroma_t dstChroma); + +TINYMEDIA_API int tmedia_converter_video_plugin_register(const tmedia_converter_video_plugin_def_t* plugin); +TINYMEDIA_API tsk_size_t tmedia_converter_video_plugin_registry_count(); +TINYMEDIA_API int tmedia_converter_video_plugin_unregister(const tmedia_converter_video_plugin_def_t* plugin); + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_CONVERTER_VIDEO_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_defaults.h b/tinyMEDIA/include/tinymedia/tmedia_defaults.h new file mode 100644 index 0000000..324c241 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_defaults.h @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2010-2011 Mamadou Diop. + * + * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + * 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. + * + */ +#ifndef TINYMEDIA_DEFAULTS_H +#define TINYMEDIA_DEFAULTS_H + +#include "tinymedia_config.h" + +#include "tmedia_common.h" + +TMEDIA_BEGIN_DECLS + + +TINYMEDIA_API int tmedia_defaults_set_profile(tmedia_profile_t profile); +TINYMEDIA_API tmedia_profile_t tmedia_defaults_get_profile(); +TINYMEDIA_API int tmedia_defaults_set_bl(tmedia_bandwidth_level_t bl); // @deprecated +TINYMEDIA_API tmedia_bandwidth_level_t tmedia_defaults_get_bl(); // @deprecated +TINYMEDIA_API int tmedia_defaults_set_congestion_ctrl_enabled(tsk_bool_t enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_congestion_ctrl_enabled(); +TINYMEDIA_API int tmedia_defaults_set_video_fps(int32_t video_fps); +TINYMEDIA_API int32_t tmedia_defaults_get_video_fps(); +TINYMEDIA_API int tmedia_defaults_set_video_motion_rank(int32_t video_motion_rank); +TINYMEDIA_API int32_t tmedia_defaults_get_video_motion_rank(); +TINYMEDIA_API int tmedia_defaults_set_bandwidth_video_upload_max(int32_t bw_video_up_max_kbps); +TINYMEDIA_API int32_t tmedia_defaults_get_bandwidth_video_upload_max(); +TINYMEDIA_API int tmedia_defaults_set_bandwidth_video_download_max(int32_t bw_video_down_max_kbps); +TINYMEDIA_API int32_t tmedia_defaults_get_bandwidth_video_download_max(); +TINYMEDIA_API int tmedia_defaults_set_pref_video_size(tmedia_pref_video_size_t pref_video_size); +TINYMEDIA_API tmedia_pref_video_size_t tmedia_defaults_get_pref_video_size(); +TINYMEDIA_API int tmedia_defaults_set_jb_margin(int32_t jb_margin_ms); +TINYMEDIA_API int32_t tmedia_defaults_get_jb_margin(); +TINYMEDIA_API int tmedia_defaults_set_jb_max_late_rate(int32_t jb_max_late_rate_percent); +TINYMEDIA_API int32_t tmedia_defaults_get_jb_max_late_rate(); +TINYMEDIA_API int tmedia_defaults_set_echo_tail(uint32_t echo_tail); +TINYMEDIA_API int tmedia_defaults_set_echo_skew(uint32_t echo_skew); +TINYMEDIA_API uint32_t tmedia_defaults_get_echo_tail(); +TINYMEDIA_API uint32_t tmedia_defaults_get_echo_skew(); +TINYMEDIA_API int tmedia_defaults_set_echo_supp_enabled(tsk_bool_t echo_supp_enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_echo_supp_enabled(); +TINYMEDIA_API int tmedia_defaults_set_agc_enabled(tsk_bool_t agc_enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_agc_enabled(); +TINYMEDIA_API int tmedia_defaults_set_agc_level(float agc_level); +TINYMEDIA_API float tmedia_defaults_get_agc_level(); +TINYMEDIA_API int tmedia_defaults_set_vad_enabled(tsk_bool_t vad_enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_vad_enabled(); +TINYMEDIA_API int tmedia_defaults_set_noise_supp_enabled(tsk_bool_t noise_supp_enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_noise_supp_enabled(); +TINYMEDIA_API int tmedia_defaults_set_noise_supp_level(int32_t noise_supp_level); +TINYMEDIA_API int32_t tmedia_defaults_get_noise_supp_level(); +TINYMEDIA_API int tmedia_defaults_set_100rel_enabled(tsk_bool_t _100rel_enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_100rel_enabled(); +TINYMEDIA_API int tmedia_defaults_set_screen_size(int32_t sx, int32_t sy); +TINYMEDIA_API int32_t tmedia_defaults_get_screen_x(); +TINYMEDIA_API int32_t tmedia_defaults_get_screen_y(); +TINYMEDIA_API int tmedia_defaults_set_audio_ptime(int32_t audio_ptime); +TINYMEDIA_API int32_t tmedia_defaults_get_audio_ptime(); +TINYMEDIA_API int tmedia_defaults_set_audio_channels(int32_t channels_playback, int32_t channels_record); +TINYMEDIA_API int32_t tmedia_defaults_get_audio_channels_playback(); +TINYMEDIA_API int32_t tmedia_defaults_get_audio_channels_record(); +TINYMEDIA_API int tmedia_defaults_set_audio_gain(int32_t audio_producer_gain, int32_t audio_consumer_gain); +TINYMEDIA_API int32_t tmedia_defaults_get_audio_producer_gain(); +TINYMEDIA_API int32_t tmedia_defaults_get_audio_consumer_gain(); +TINYMEDIA_API uint16_t tmedia_defaults_get_rtp_port_range_start(); +TINYMEDIA_API uint16_t tmedia_defaults_get_rtp_port_range_stop(); +TINYMEDIA_API int tmedia_defaults_set_rtp_port_range(uint16_t start, uint16_t stop); +TINYMEDIA_API int tmedia_defaults_set_rtp_symetric_enabled(tsk_bool_t enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_rtp_symetric_enabled(); +TINYMEDIA_API tmedia_type_t tmedia_defaults_get_media_type(); +TINYMEDIA_API int tmedia_defaults_set_media_type(tmedia_type_t media_type); +TINYMEDIA_API int tmedia_defaults_set_volume(int32_t volume); +TINYMEDIA_API int32_t tmedia_defaults_get_volume(); +TINYMEDIA_API int tmedia_producer_set_friendly_name(tmedia_type_t media_type, const char* friendly_name); +TINYMEDIA_API const char* tmedia_producer_get_friendly_name(tmedia_type_t media_type); +TINYMEDIA_API int32_t tmedia_defaults_get_inv_session_expires(); +TINYMEDIA_API int tmedia_defaults_set_inv_session_expires(int32_t timeout); +TINYMEDIA_API const char* tmedia_defaults_get_inv_session_refresher(); +TINYMEDIA_API int tmedia_defaults_set_inv_session_refresher(const char* refresher); +TINYMEDIA_API tmedia_srtp_mode_t tmedia_defaults_get_srtp_mode(); +TINYMEDIA_API int tmedia_defaults_set_srtp_mode(tmedia_srtp_mode_t mode); +TINYMEDIA_API tmedia_srtp_type_t tmedia_defaults_get_srtp_type(); +TINYMEDIA_API int tmedia_defaults_set_srtp_type(tmedia_srtp_type_t srtp_type); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_rtcp_enabled(); +TINYMEDIA_API int tmedia_defaults_set_rtcp_enabled(tsk_bool_t rtcp_enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_rtcpmux_enabled(); +TINYMEDIA_API int tmedia_defaults_set_rtcpmux_enabled(tsk_bool_t rtcpmux_enabled); +TINYMEDIA_API int tmedia_defaults_set_stun_server(const char* server_ip, uint16_t server_port); +TINYMEDIA_API int tmedia_defaults_get_stun_server(const char** server_ip, uint16_t*const server_port); +TINYMEDIA_API int tmedia_defaults_set_stun_cred(const char* usr_name, const char* usr_pwd); +TINYMEDIA_API int tmedia_defaults_get_stun_cred(const char** usr_name, const char** usr_pwd); +TINYMEDIA_API int tmedia_defaults_set_stun_enabled(tsk_bool_t stun_enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_stun_enabled(); +TINYMEDIA_API int tmedia_defaults_set_icestun_enabled(tsk_bool_t icestun_enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_icestun_enabled(); +TINYMEDIA_API int tmedia_defaults_set_iceturn_enabled(tsk_bool_t iceturn_enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_iceturn_enabled(); +TINYMEDIA_API int tmedia_defaults_set_ice_enabled(tsk_bool_t ice_enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_ice_enabled(); +TINYMEDIA_API int tmedia_defaults_set_bypass_encoding(tsk_bool_t enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_bypass_encoding(); +TINYMEDIA_API int tmedia_defaults_set_bypass_decoding(tsk_bool_t enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_bypass_decoding(); +TINYMEDIA_API int tmedia_defaults_set_videojb_enabled(tsk_bool_t enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_videojb_enabled(); +TINYMEDIA_API int tmedia_defaults_set_video_zeroartifacts_enabled(tsk_bool_t enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_video_zeroartifacts_enabled(); +TINYMEDIA_API int tmedia_defaults_set_rtpbuff_size(tsk_size_t rtpbuff_size); +TINYMEDIA_API tsk_size_t tmedia_defaults_get_rtpbuff_size(); +TINYMEDIA_API int tmedia_defaults_set_avpf_tail(tsk_size_t tail_min, tsk_size_t tail_max); +TINYMEDIA_API int tmedia_defaults_set_avpf_mode(enum tmedia_mode_e mode); +TINYMEDIA_API enum tmedia_mode_e tmedia_defaults_get_avpf_mode(); +TINYMEDIA_API tsk_size_t tmedia_defaults_get_avpf_tail_min(); +TINYMEDIA_API tsk_size_t tmedia_defaults_get_avpf_tail_max(); +TINYMEDIA_API int tmedia_defaults_set_opus_maxcapturerate(uint32_t opus_maxcapturerate); +TINYMEDIA_API uint32_t tmedia_defaults_get_opus_maxcapturerate(); +TINYMEDIA_API int tmedia_defaults_set_opus_maxplaybackrate(uint32_t opus_maxplaybackrate); +TINYMEDIA_API uint32_t tmedia_defaults_get_opus_maxplaybackrate(); +TINYMEDIA_API int tmedia_defaults_set_ssl_certs(const char* priv_path, const char* pub_path, const char* ca_path, tsk_bool_t verify); +TINYMEDIA_API int tmedia_defaults_get_ssl_certs(const char** priv_path, const char** pub_path, const char** ca_path, tsk_bool_t *verify); +TINYMEDIA_API int tmedia_defaults_set_max_fds(int32_t max_fds); +TINYMEDIA_API tsk_size_t tmedia_defaults_get_max_fds(); +TINYMEDIA_API int tmedia_defaults_set_webproxy_auto_detect(tsk_bool_t auto_detect); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_webproxy_auto_detect(); +TINYMEDIA_API int tmedia_defaults_set_webproxy_info(const char* type, const char* host, unsigned short port, const char* login, const char* password); +TINYMEDIA_API int tmedia_defaults_get_webproxy_info(const char** type, const char** host, unsigned short* port, const char** login, const char** password); + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_DEFAULTS_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_denoise.h b/tinyMEDIA/include/tinymedia/tmedia_denoise.h new file mode 100644 index 0000000..d8818f4 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_denoise.h @@ -0,0 +1,97 @@ +/* +* Copyright (C) 2010-2015 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 + */ +#ifndef TINYMEDIA_DENOISE_H +#define TINYMEDIA_DENOISE_H + +#include "tinymedia_config.h" +#include "tinymedia/tmedia_params.h" + +#include "tsk_buffer.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; + + uint32_t echo_tail; + uint32_t echo_skew; + tsk_bool_t echo_supp_enabled; + tsk_bool_t agc_enabled ; + float agc_level; + tsk_bool_t vad_enabled; + tsk_bool_t noise_supp_enabled; + int32_t noise_supp_level; + tsk_buffer_t *record_frame; + tsk_buffer_t *playback_frame; + 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 (*set) (tmedia_denoise_t* , const tmedia_param_t*); + int (* open) (tmedia_denoise_t*, uint32_t record_frame_size_samples, uint32_t record_sampling_rate, uint32_t record_channels, uint32_t playback_frame_size_samples, uint32_t playback_sampling_rate, uint32_t playback_channels); + int (*echo_playback) (tmedia_denoise_t* self, const void* echo_frame, uint32_t echo_frame_size_bytes); + //! aec, vad, noise suppression, echo cancellation before sending packet over network + int (* process_record) (tmedia_denoise_t*, void* audio_frame, uint32_t audio_frame_size_bytes, tsk_bool_t* silence_or_noise); + //! noise suppression before playing sound + int (* process_playback) (tmedia_denoise_t*, void* audio_frame, uint32_t audio_frame_size_bytes); + 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_set(tmedia_denoise_t* self, const tmedia_param_t* param); +TINYMEDIA_API int tmedia_denoise_open(tmedia_denoise_t* self, uint32_t record_frame_size_samples, uint32_t record_sampling_rate, uint32_t record_channels, uint32_t playback_frame_size_samples, uint32_t playback_sampling_rate, uint32_t playback_channels); +TINYMEDIA_API int tmedia_denoise_echo_playback(tmedia_denoise_t* self, const void* echo_frame, uint32_t echo_frame_size_bytes); +TINYMEDIA_API int tmedia_denoise_process_record(tmedia_denoise_t* self, void* audio_frame, uint32_t audio_frame_size_bytes, tsk_bool_t* silence_or_noise); +TINYMEDIA_API int tmedia_denoise_process_playback(tmedia_denoise_t* self, void* audio_frame, uint32_t audio_frame_size_bytes); +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(const tmedia_denoise_plugin_def_t* plugin); +TINYMEDIA_API tmedia_denoise_t* tmedia_denoise_create(); + +TMEDIA_END_DECLS + + +#endif /* TINYMEDIA_DENOISE_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_imageattr.h b/tinyMEDIA/include/tinymedia/tmedia_imageattr.h new file mode 100644 index 0000000..c709a17 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_imageattr.h @@ -0,0 +1,108 @@ +/* +* Copyright (C) 2012 Doubango Telecom <http://www.doubango.org> +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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_imageattr.h + * @brief 'image-attr' parser as per RFC 6236 + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + */ +#ifndef TINYMEDIA_imageattr_H +#define TINYMEDIA_imageattr_H + +#include "tinymedia_config.h" + +#include "tmedia_common.h" + +TMEDIA_BEGIN_DECLS + +#define TMEDIA_imageattr_ARRAY_MAX_SIZE 16 + +typedef int32_t xyvalue_t; +typedef double qvalue_t; +typedef double spvalue_t; + +typedef struct tmedia_imageattr_srange_xs +{ + unsigned is_range:1; + union{ + struct{ + spvalue_t start; + spvalue_t end; + }range; + struct{ + spvalue_t values[TMEDIA_imageattr_ARRAY_MAX_SIZE + 1]; + tsk_size_t count; + }array; + }; +} +tmedia_imageattr_srange_xt; + +typedef struct tmedia_imageattr_xyrange_xs +{ + unsigned is_range:1; + union{ + struct{ + xyvalue_t start; + xyvalue_t step; + xyvalue_t end; + }range; + struct{ + xyvalue_t values[TMEDIA_imageattr_ARRAY_MAX_SIZE + 1]; + tsk_size_t count; + }array; + }; +} +tmedia_imageattr_xyrange_xt; + +typedef struct tmedia_imageattr_set_xs +{ + tmedia_imageattr_xyrange_xt xrange; + tmedia_imageattr_xyrange_xt yrange; + tmedia_imageattr_srange_xt srange; + struct{ + unsigned is_present:1; + spvalue_t start; + spvalue_t end; + }prange; + qvalue_t qvalue; +} +tmedia_imageattr_set_xt; + +typedef struct tmedia_imageattr_xs +{ + struct{ + tmedia_imageattr_set_xt sets[TMEDIA_imageattr_ARRAY_MAX_SIZE + 1]; + tsk_size_t count; + }send; + struct{ + tmedia_imageattr_set_xt sets[TMEDIA_imageattr_ARRAY_MAX_SIZE + 1]; + tsk_size_t count; + }recv; +} +tmedia_imageattr_xt; + +TINYMEDIA_API int tmedia_imageattr_parse(tmedia_imageattr_xt* self, const void* in_data, tsk_size_t in_size); + +TMEDIA_END_DECLS + +#endif /* TINYMEDIA_imageattr_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_jitterbuffer.h b/tinyMEDIA/include/tinymedia/tmedia_jitterbuffer.h new file mode 100644 index 0000000..fb0f8ef --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_jitterbuffer.h @@ -0,0 +1,102 @@ +/* +* Copyright (C) 2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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_jitterbuffer.h + * @brief Audio/Video JitterBuffer Plugin + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + */ +#ifndef TINYMEDIA_JITTER_BUFFER_H +#define TINYMEDIA_JITTER_BUFFER_H + +#include "tinymedia_config.h" + +#include "tinymedia/tmedia_params.h" +#include "tmedia_common.h" + + +#include "tsk_object.h" + +TMEDIA_BEGIN_DECLS + +/** cast any pointer to @ref tmedia_jitterbuffer_t* object */ +#define TMEDIA_JITTER_BUFFER(self) ((tmedia_jitterbuffer_t*)(self)) + +/**Max number of plugins (jb types) we can create */ +#if !defined(TMED_JITTER_BUFFER_MAX_PLUGINS) +# define TMED_JITTER_BUFFER_MAX_PLUGINS 0x0F +#endif + +/** Base object for all JitterBuffers */ +typedef struct tmedia_jitterbuffer_s +{ + TSK_DECLARE_OBJECT; + + tsk_bool_t opened; + + const struct tmedia_jitterbuffer_plugin_def_s* plugin; +} +tmedia_jitterbuffer_t; + +#define TMEDIA_DECLARE_JITTER_BUFFER tmedia_jitterbuffer_t __jitterbuffer__ + +/** Virtual table used to define a consumer plugin */ +typedef struct tmedia_jitterbuffer_plugin_def_s +{ + //! object definition used to create an instance of the jitterbufferr + const tsk_object_def_t* objdef; + + //! the type of the jitter buffer + tmedia_type_t type; + + //! full description (usefull for debugging) + const char* desc; + + int (*set) (tmedia_jitterbuffer_t* , const tmedia_param_t*); + int (* open) (tmedia_jitterbuffer_t*, uint32_t frame_duration, uint32_t rate, uint32_t channels); + int (* tick) (tmedia_jitterbuffer_t*); + int (* put) (tmedia_jitterbuffer_t*, void* data, tsk_size_t data_size, const tsk_object_t* proto_hdr); + tsk_size_t (* get) (tmedia_jitterbuffer_t*, void* out_data, tsk_size_t out_size); + int (* reset) (tmedia_jitterbuffer_t* ); + int (* close) (tmedia_jitterbuffer_t* ); +} +tmedia_jitterbuffer_plugin_def_t; + +TINYMEDIA_API int tmedia_jitterbuffer_init(tmedia_jitterbuffer_t* self); +TINYMEDIA_API int tmedia_jitterbuffer_set(tmedia_jitterbuffer_t *self, const tmedia_param_t* param); +TINYMEDIA_API int tmedia_jitterbuffer_open(tmedia_jitterbuffer_t* self, uint32_t frame_duration, uint32_t rate, uint32_t channels); +TINYMEDIA_API int tmedia_jitterbuffer_tick(tmedia_jitterbuffer_t* self); +TINYMEDIA_API int tmedia_jitterbuffer_put(tmedia_jitterbuffer_t* self, void* data, tsk_size_t data_size, const tsk_object_t* proto_hdr); +TINYMEDIA_API tsk_size_t tmedia_jitterbuffer_get(tmedia_jitterbuffer_t* self, void* out_data, tsk_size_t out_size); +TINYMEDIA_API int tmedia_jitterbuffer_reset(tmedia_jitterbuffer_t* self); +TINYMEDIA_API int tmedia_jitterbuffer_close(tmedia_jitterbuffer_t* self); +TINYMEDIA_API int tmedia_jitterbuffer_deinit(tmedia_jitterbuffer_t* self); + +TINYMEDIA_API int tmedia_jitterbuffer_plugin_register(const tmedia_jitterbuffer_plugin_def_t* plugin); +TINYMEDIA_API int tmedia_jitterbuffer_plugin_unregister(); +TINYMEDIA_API int tmedia_jitter_buffer_plugin_unregister_by_type(tmedia_type_t type); +TINYMEDIA_API tmedia_jitterbuffer_t* tmedia_jitterbuffer_create(tmedia_type_t type); + +TMEDIA_END_DECLS + + +#endif /* TINYMEDIA_JITTER_BUFFER_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_params.h b/tinyMEDIA/include/tinymedia/tmedia_params.h new file mode 100644 index 0000000..549552c --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_params.h @@ -0,0 +1,119 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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 <diopmamadou(at)doubango[dot]org> + * + + */ +#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_bool = 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); +#define tmedia_param_create_get(media_type, plugin_type, value_type, key, value) tmedia_param_create(tmedia_pat_get, (media_type), (plugin_type), (value_type), (key), (value)) +#define tmedia_param_create_get_session(media_type, value_type, key, value) tmedia_param_create_get((media_type), tmedia_ppt_session, (value_type), (key), (value)) +#define tmedia_param_create_get_codec(media_type, value_type, key, value) tmedia_param_create_get((media_type), tmedia_ppt_codec, (value_type), (key), (value)) +#define tmedia_param_create_set(media_type, plugin_type, value_type, key, value) tmedia_param_create(tmedia_pat_set, (media_type), (plugin_type), (value_type), (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..0817821 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_producer.h @@ -0,0 +1,144 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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 <diopmamadou(at)doubango[dot]org> + * + + */ +#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 + +#define TMEDIA_PRODUCER_BITS_PER_SAMPLE_DEFAULT 16 +#define TMEDIA_PRODUCER_CHANNELS_DEFAULT 2 +#define TMEDIA_PRODUCER_RATE_DEFAULT 8000 + +/**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 tmedia_video_encode_result_xt* chunck); + +/** Default Video chroma */ +#define TMEDIA_PRODUCER_CHROMA_DEFAULT tmedia_chroma_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_bool_t mirror; + tsk_size_t width; + tsk_size_t height; + } video; + + struct{ + uint8_t bits_per_sample; + uint8_t channels; + uint32_t rate; + uint8_t ptime; + uint8_t gain; + int32_t volume; + } audio; + + const struct tmedia_producer_plugin_def_s* plugin; + + tsk_bool_t is_prepared; + tsk_bool_t is_started; + uint64_t session_id; + + struct{ + enum tmedia_codec_id_e codec_id; + // other options to be added + } encoder; + + struct{ + tmedia_producer_enc_cb_f callback; + const void* callback_data; + } enc_cb; + + struct{ + tmedia_producer_raw_cb_f callback; + tmedia_video_encode_result_xt chunck_curr; + } 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..7ff8e97 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_qos.h @@ -0,0 +1,194 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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 <diopmamadou(at)doubango[dot]org> + * + + */ +#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_resampler.h b/tinyMEDIA/include/tinymedia/tmedia_resampler.h new file mode 100644 index 0000000..5093bc6 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_resampler.h @@ -0,0 +1,86 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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_resampler.h + * @brief Audio Resampler Plugin + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + */ +#ifndef TINYMEDIA_RESAMPLER_H +#define TINYMEDIA_RESAMPLER_H + +#include "tinymedia_config.h" + +#include "tsk_object.h" + +#ifndef TMEDIA_RESAMPLER_QUALITY +# define TMEDIA_RESAMPLER_QUALITY 5 +#endif + +TMEDIA_BEGIN_DECLS + +/** cast any pointer to @ref tmedia_resampler_t* object */ +#define TMEDIA_RESAMPLER(self) ((tmedia_resampler_t*)(self)) + +/** Base object for all resamplers */ +typedef struct tmedia_resampler_s +{ + TSK_DECLARE_OBJECT; + + tsk_bool_t opened; + + const struct tmedia_resampler_plugin_def_s* plugin; +} +tmedia_resampler_t; + +#define TMEDIA_DECLARE_RESAMPLER tmedia_resampler_t __resampler__ + +/** Virtual table used to define a consumer plugin */ +typedef struct tmedia_resampler_plugin_def_s +{ + //! object definition used to create an instance of the resamplerr + const tsk_object_def_t* objdef; + + //! full description (usefull for debugging) + const char* desc; + + // ! quality is from 0-10 + int (* open) (tmedia_resampler_t* self, uint32_t in_freq, uint32_t out_freq, uint32_t frame_duration, uint32_t in_channels, uint32_t out_channels, uint32_t quality, uint32_t bits_per_sample); + tsk_size_t (* process) (tmedia_resampler_t*, const void* in_data, tsk_size_t in_size_in_sample, void* out_data, tsk_size_t out_size_in_sample); + int (* close) (tmedia_resampler_t* ); +} +tmedia_resampler_plugin_def_t; + +TINYMEDIA_API int tmedia_resampler_init(tmedia_resampler_t* self); +TINYMEDIA_API int tmedia_resampler_open(tmedia_resampler_t* self, uint32_t in_freq, uint32_t out_freq, uint32_t frame_duration, uint32_t in_channels, uint32_t out_channels, uint32_t quality, uint32_t bits_per_sample); +TINYMEDIA_API tsk_size_t tmedia_resampler_process(tmedia_resampler_t* self, const void* in_data, tsk_size_t in_size_in_sample, void* out_data, tsk_size_t out_size_in_sample); +TINYMEDIA_API int tmedia_resampler_close(tmedia_resampler_t* self); +TINYMEDIA_API int tmedia_resampler_deinit(tmedia_resampler_t* self); + +TINYMEDIA_API int tmedia_resampler_plugin_register(const tmedia_resampler_plugin_def_t* plugin); +TINYMEDIA_API int tmedia_resampler_plugin_unregister(const tmedia_resampler_plugin_def_t* plugin); +TINYMEDIA_API tmedia_resampler_t* tmedia_resampler_create(); + +TMEDIA_END_DECLS + + +#endif /* TINYMEDIA_RESAMPLER_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_session.h b/tinyMEDIA/include/tinymedia/tmedia_session.h new file mode 100644 index 0000000..743a7a5 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_session.h @@ -0,0 +1,578 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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 <diopmamadou(at)doubango[dot]org> + * + + */ +#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 "tnet_nat.h" +#include "tnet_types.h" + +#include "tsk_list.h" +#include "tsk_debug.h" +#include "tsk_safeobj.h" + +TMEDIA_BEGIN_DECLS + +struct tmedia_session_s; + +// rfc5168 (XML Schema for Media Control) commands +typedef enum tmedia_session_rfc5168_cmd_e +{ + tmedia_session_rfc5168_cmd_picture_fast_update, +} +tmedia_session_rfc5168_cmd_t; +// BFCP (rfc4582) events +typedef enum tmedia_session_bfcp_evt_type_e +{ + tmedia_session_bfcp_evt_type_err, // Global error + tmedia_session_bfcp_evt_type_flreq_status, // FloorRequestStatus +} +tmedia_session_bfcp_evt_type_t; + +typedef struct tmedia_session_bfcp_evt_xs { + tmedia_session_bfcp_evt_type_t type; + const char* reason; + union { + struct { + int code; + } err; + struct { + uint16_t status; + } flreq; + }; +} tmedia_session_bfcp_evt_xt; + +#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)) + +typedef int (*tmedia_session_t140_ondata_cb_f)(const void* usrdata, tmedia_t140_data_type_t data_type, const void* data_ptr, unsigned data_size); +typedef int (*tmedia_session_rtcp_onevent_cb_f)(const void* usrdata, tmedia_rtcp_event_type_t event_type, uint32_t ssrc_media); +typedef int (*tmedia_session_onerror_cb_f)(const void* usrdata, const struct tmedia_session_s* session, const char* reason, tsk_bool_t is_fatal); +typedef int (*tmedia_session_rfc5168_cb_f)(const void* usrdata, const struct tmedia_session_s* session, const char* reason, enum tmedia_session_rfc5168_cmd_e command); +typedef int (*tmedia_session_bfcp_cb_f)(const void* usrdata, const struct tmedia_session_s* session, const tmedia_session_bfcp_evt_xt* evt); + +/**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. If you want to modifiy this field then you must use @ref tmedia_session_get_unique_id() + uint64_t id; + //! session type + tmedia_type_t type; + //! list of codec ids used as filter on the enabled codecs + tmedia_codec_id_t codecs_allowed; + //! list of codecs managed by this session (enabled) + 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; + //! whether the session is localy held + tsk_bool_t lo_held; + //! whether the session is remotely held + tsk_bool_t ro_held; + //! QoS + tmedia_qos_tline_t* qos; + //! bandwidth level + tmedia_bandwidth_level_t bl; + //! error callback function: not part of the plugin (likes .t140 or .rtcp) because it's not part of the API + struct{ + tmedia_session_onerror_cb_f fun; + const void* usrdata; + } onerror_cb; + //! rfc5168 (XML Schema for Media Control) callback function: not part of the plugin (likes .t140 or .rtcp) because it's not part of the API. + struct { + tmedia_session_rfc5168_cb_f fun; + const void* usrdata; + } rfc5168_cb; + //! BFCP (rfc4582) + struct { + tmedia_session_bfcp_cb_f fun; + const void* usrdata; + } bfcp_cb; + + tsk_bool_t bypass_encoding; + tsk_bool_t bypass_decoding; + + struct{ + char* file_ca; + char* file_pbk; + char* file_pvk; + tsk_bool_t verify; + } dtls; + + 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 (*get) (tmedia_session_t* , 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* ); + + struct{ /* Special case */ + int (* set_ondata_cbfn) (tmedia_session_t*, const void* usrdata, tmedia_session_t140_ondata_cb_f func); + int (* send_data) (tmedia_session_t*, enum tmedia_t140_data_type_e data_type, const void* data_ptr, unsigned data_size); + } t140; + + struct{ /* Handles both SIP INFO and RTCP-FB: should be called by end-user only when transcoding is disabled */ + int (* set_onevent_cbfn) (tmedia_session_t*, const void* usrdata, tmedia_session_rtcp_onevent_cb_f func); + int (* send_event) (tmedia_session_t*, enum tmedia_rtcp_event_type_e event_type, uint32_t ssrc_media); + int (* recv_event) (tmedia_session_t*, enum tmedia_rtcp_event_type_e event_type, uint32_t ssrc_media); + } rtcp; +} +tmedia_session_plugin_def_t; + +TINYMEDIA_API uint64_t tmedia_session_get_unique_id(); +TINYMEDIA_API int tmedia_session_init(tmedia_session_t* self, tmedia_type_t type); +TINYMEDIA_API int tmedia_session_set(tmedia_session_t* self, ...); +TINYMEDIA_API tsk_bool_t tmedia_session_set_2(tmedia_session_t* self, const tmedia_param_t* param); +TINYMEDIA_API int tmedia_session_get(tmedia_session_t* self, tmedia_param_t* param); +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_set_onrtcp_cbfn(tmedia_session_t* self, const void* usrdata, tmedia_session_rtcp_onevent_cb_f fun); +TINYMEDIA_API int tmedia_session_send_rtcp_event(tmedia_session_t* self, tmedia_rtcp_event_type_t event_type, uint32_t ssrc_media); +TINYMEDIA_API int tmedia_session_recv_rtcp_event(tmedia_session_t* self, tmedia_rtcp_event_type_t event_type, uint32_t ssrc_media); +TINYMEDIA_API int tmedia_session_set_onerror_cbfn(tmedia_session_t* self, const void* usrdata, tmedia_session_onerror_cb_f fun); +TINYMEDIA_API int tmedia_session_set_rfc5168_cbfn(tmedia_session_t* self, const void* usrdata, tmedia_session_rfc5168_cb_f fun); +TINYMEDIA_API int tmedia_session_set_bfcp_cbfn(tmedia_session_t* self, const void* usrdata, tmedia_session_bfcp_cb_f fun); +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), tmedia_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(tmedia_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), tmedia_video) +#define tmedia_session_video_deinit(self) tmedia_session_deinit(TMEDIA_SESSION(self)) +#define tmedia_session_video_create() tmedia_session_create(tmedia_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), tmedia_msrp) +#define tmedia_session_msrp_deinit(self) tmedia_session_deinit(TMEDIA_SESSION(self)) +#define tmedia_session_msrp_create() tmedia_session_create(tmedia_msrp) +#define TMEDIA_DECLARE_SESSION_MSRP tmedia_session_msrp_t __session_msrp__ + +/** BFCP Session */ +struct tmedia_session_bfcp_s; +struct tbfcp_event_s; +typedef struct tmedia_session_bfcp_s +{ + TMEDIA_DECLARE_SESSION; + + struct { + // use "struct tbfcp_event_s" instead of "tbfcp_event_t" to avoid linking aginst tinyBFCP + int (*fun)(const struct tbfcp_event_s* event); + const void* data; + } callback; + + // int (* share_file) (struct tmedia_session_bfcp_s*, const char* path, va_list *app); + // int (* share_screen) (struct tmedia_session_bfcp_s*, const tmedia_params_L_t *params); +} +tmedia_session_bfcp_t; +#define tmedia_session_bfcp_init(self) tmedia_session_init(TMEDIA_SESSION(self), tmedia_bfcp) +#define tmedia_session_bfcp_deinit(self) tmedia_session_deinit(TMEDIA_SESSION(self)) +#define tmedia_session_bfcp_create() tmedia_session_create(tmedia_bfcp) +#define TMEDIA_DECLARE_SESSION_BFCP tmedia_session_bfcp_t __session_bfcp__ + +/** T.140 session */ +int tmedia_session_t140_set_ondata_cbfn(tmedia_session_t* self, const void* context, tmedia_session_t140_ondata_cb_f func); +int tmedia_session_t140_send_data(tmedia_session_t* self, enum tmedia_t140_data_type_e data_type, const void* data_ptr, unsigned data_size); + +/** 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 ro_provisional; + tsk_bool_t state_changed; + tsk_bool_t mediaType_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 */ + struct tnet_nat_ctx_s* natt_ctx; + struct { + struct tnet_ice_ctx_s *ctx_audio; + struct tnet_ice_ctx_s *ctx_video; + struct tnet_ice_ctx_s *ctx_bfcpvid; + } ice; + + /* session error callback */ + struct{ + tmedia_session_onerror_cb_f fun; + const void* usrdata; + } onerror_cb; + + /* rfc5168 callback */ + struct { + tmedia_session_rfc5168_cb_f fun; + const void* usrdata; + } rfc5168_cb; + + //! List of all sessions + tmedia_sessions_L_t* sessions; + + //! User's parameters used to confugure plugins + tmedia_params_L_t* params; + + TSK_DECLARE_SAFEOBJ; +} +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_POBJECT(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PPOBJECT) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_pobject, KEY_STR, VALUE_PPOBJECT) +//#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) +/* BFCP Session */ +#define TMEDIA_SESSION_BFCP_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_INT32(tmedia_bfcp, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_BFCP_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_POBJECT(tmedia_bfcp, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_BFCP_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_STR(tmedia_bfcp, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_BFCP_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_SET_INT64(tmedia_bfcp, KEY_STR, VALUE_INT64) +#define TMEDIA_SESSION_BFCP_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_GET_INT32(tmedia_bfcp, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_BFCP_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PVOID(tmedia_bfcp, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_BFCP_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_STR(tmedia_bfcp, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_BFCP_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_INT64(tmedia_bfcp, 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) +/* BFCP Consumer */ +#define TMEDIA_SESSION_BFCP_CONSUMER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_CONSUMER_SET_INT32(tmedia_bfcp, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_BFCP_CONSUMER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_CONSUMER_SET_POBJECT(tmedia_bfcp, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_BFCP_CONSUMER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_CONSUMER_SET_STR(tmedia_bfcp, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_BFCP_CONSUMER_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_CONSUMER_SET_INT64(tmedia_bfcp, KEY_STR, VALUE_INT64) +#define TMEDIA_SESSION_BFCP_CONSUMER_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_CONSUMER_GET_INT32(tmedia_bfcp, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_BFCP_CONSUMER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_CONSUMER_GET_PVOID(tmedia_bfcp, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_BFCP_CONSUMER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_CONSUMER_GET_STR(tmedia_bfcp, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_BFCP_CONSUMER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_CONSUMER_GET_INT64(tmedia_bfcp, 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_POBJECT(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PTR) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_pobject, KEY_STR, VALUE_PTR) +//#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) +/* BFCP Producer */ +#define TMEDIA_SESSION_BFCP_PRODUCER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_PRODUCER_SET_INT32(tmedia_bfcp, KEY_STR, VALUE_INT32) +#define TMEDIA_SESSION_BFCP_PRODUCER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_PRODUCER_SET_POBJECT(tmedia_bfcp, KEY_STR, VALUE_PTR) +#define TMEDIA_SESSION_BFCP_PRODUCER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_AUDIO_PRODUCER_SET_STR(tmedia_bfcp, KEY_STR, VALUE_STR) +#define TMEDIA_SESSION_BFCP_PRODUCER_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_PRODUCER_SET_INT64(tmedia_bfcp, KEY_STR, VALUE_INT64) +#define TMEDIA_SESSION_BFCP_PRODUCER_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_PRODUCER_GET_INT32(tmedia_bfcp, KEY_STR, VALUE_PINT32) +//#define TMEDIA_SESSION_MSRP_PRODUCER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_PRODUCER_GET_PVOID(tmedia_bfcp, KEY_STR, VALUE_PPTR) +//#define TMEDIA_SESSION_MSRP_PRODUCER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_AUDIO_PRODUCER_GET_STR(tmedia_bfcp, KEY_STR, VALUE_PSTR) +//#define TMEDIA_SESSION_MSRP_PRODUCER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_PRODUCER_GET_INT64(tmedia_bfcp, 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 int tmedia_session_mgr_set_media_type(tmedia_session_mgr_t* self, tmedia_type_t type); +TINYMEDIA_API int tmedia_session_mgr_set_media_type_2(tmedia_session_mgr_t* self, tmedia_type_t type, tsk_bool_t force); +TINYMEDIA_API int tmedia_session_mgr_set_codecs_supported(tmedia_session_mgr_t* self, tmedia_codec_id_t codecs_supported); +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, struct tnet_nat_ctx_s* natt_ctx, const char* public_addr); +TINYMEDIA_API int tmedia_session_mgr_set_ice_ctx(tmedia_session_mgr_t* self, struct tnet_ice_ctx_s* ctx_audio, struct tnet_ice_ctx_s* ctx_video); +TINYMEDIA_API int tmedia_session_mgr_set_ice_ctx_2(tmedia_session_mgr_t* self, tmedia_type_t type, struct tnet_ice_ctx_s* ctx); +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_get(tmedia_session_mgr_t* self, ...); +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, tmedia_ro_type_t ro_type); +TINYMEDIA_API const tsdp_message_t* tmedia_session_mgr_get_ro(tmedia_session_mgr_t* self); +TINYMEDIA_API tsk_bool_t tmedia_session_mgr_is_new_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, tsk_bool_t local); +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_set_t140_ondata_cbfn(tmedia_session_mgr_t* self, const void* context, tmedia_session_t140_ondata_cb_f fun); +TINYMEDIA_API int tmedia_session_mgr_send_t140_data(tmedia_session_mgr_t* self, enum tmedia_t140_data_type_e data_type, const void* data_ptr, unsigned data_size); +TINYMEDIA_API int tmedia_session_mgr_set_onrtcp_cbfn(tmedia_session_mgr_t* self, tmedia_type_t media_type, const void* context, tmedia_session_rtcp_onevent_cb_f fun); +TINYMEDIA_API int tmedia_session_mgr_send_rtcp_event(tmedia_session_mgr_t* self, tmedia_type_t media_type, enum tmedia_rtcp_event_type_e event_type, uint32_t ssrc_media); +TINYMEDIA_API int tmedia_session_mgr_recv_rtcp_event(tmedia_session_mgr_t* self, tmedia_type_t media_type, tmedia_rtcp_event_type_t event_type, uint32_t ssrc_media); +TINYMEDIA_API int tmedia_session_mgr_recv_rtcp_event_2(tmedia_session_mgr_t* self, tmedia_rtcp_event_type_t event_type, uint64_t session_id); +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* usrdata, tmedia_session_msrp_cb_f func); +TINYMEDIA_API int tmedia_session_mgr_set_onerror_cbfn(tmedia_session_mgr_t* self, const void* usrdata, tmedia_session_onerror_cb_f fun); +TINYMEDIA_API int tmedia_session_mgr_set_rfc5168_cbfn(tmedia_session_mgr_t* self, const void* usrdata, tmedia_session_rfc5168_cb_f fun); +TINYMEDIA_API int tmedia_session_mgr_set_bfcp_cbfn(tmedia_session_mgr_t* self, const void* usrdata, tmedia_session_bfcp_cb_f fun); +TINYMEDIA_API int tmedia_session_mgr_lo_apply_changes(tmedia_session_mgr_t* self); + + +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..a795677 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_session_dummy.h @@ -0,0 +1,76 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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 <diopmamadou(at)doubango[dot]org> + * + + */ +#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..e4b0ac8 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_session_ghost.h @@ -0,0 +1,55 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org> +* +* 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 <diopmamadou(at)doubango[dot]org> + * + + */ +#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; + char* proto; + char* first_format; +} +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 --- /dev/null +++ b/tinyMEDIA/include/tinymedia/tmedia_vad.h |