diff options
Diffstat (limited to 'tinyMEDIA/include')
21 files changed, 1071 insertions, 1124 deletions
diff --git a/tinyMEDIA/include/tinymedia.h b/tinyMEDIA/include/tinymedia.h index bdee2d8..f781014 100755 --- a/tinyMEDIA/include/tinymedia.h +++ b/tinyMEDIA/include/tinymedia.h @@ -2,19 +2,19 @@ * 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. * diff --git a/tinyMEDIA/include/tinymedia/content/tmedia_content.h b/tinyMEDIA/include/tinymedia/content/tmedia_content.h index 41b1ecb..d0d6f5c 100755 --- a/tinyMEDIA/include/tinymedia/content/tmedia_content.h +++ b/tinyMEDIA/include/tinymedia/content/tmedia_content.h @@ -2,19 +2,19 @@ * 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. * @@ -44,27 +44,25 @@ TMEDIA_BEGIN_DECLS #define TMEDIA_CONTENT(self) ((tmedia_content_t*)(self)) /** Base object for all contents */ -typedef struct tmedia_content_s -{ - TSK_DECLARE_OBJECT; +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; + 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; +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; + //! 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*); + 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; @@ -86,11 +84,10 @@ 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; +typedef struct tmedia_content_dummy_s { + TMEDIA_DECLARE_CONTENT; + + tsk_buffer_t* data; } tmedia_content_dummy_t; @@ -101,13 +98,12 @@ TINYMEDIA_GEXTERN const tmedia_content_plugin_def_t *tmedia_content_dummy_plugin /** content header */ -typedef struct tmedia_content_header_s -{ - TSK_DECLARE_OBJECT; +typedef struct tmedia_content_header_s { + TSK_DECLARE_OBJECT; - char* name; - char* value; - tsk_params_L_t* params; + char* name; + char* value; + tsk_params_L_t* params; } tmedia_content_header_t; diff --git a/tinyMEDIA/include/tinymedia/content/tmedia_content_cpim.h b/tinyMEDIA/include/tinymedia/content/tmedia_content_cpim.h index db1aa02..625ffc3 100755 --- a/tinyMEDIA/include/tinymedia/content/tmedia_content_cpim.h +++ b/tinyMEDIA/include/tinymedia/content/tmedia_content_cpim.h @@ -2,19 +2,19 @@ * 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. * @@ -38,14 +38,13 @@ 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 */ +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; diff --git a/tinyMEDIA/include/tinymedia/tmedia.h b/tinyMEDIA/include/tinymedia/tmedia.h index d10ee69..66afc80 100755 --- a/tinyMEDIA/include/tinymedia/tmedia.h +++ b/tinyMEDIA/include/tinymedia/tmedia.h @@ -2,19 +2,19 @@ * 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. * @@ -47,51 +47,48 @@ TMEDIA_BEGIN_DECLS #define TMEDIA(self) ((tmedia_t*)(self)) -typedef enum tmedia_action_e -{ - // Dummy - tma_dummy_say_hello, +typedef enum tmedia_action_e { + // Dummy + tma_dummy_say_hello, - // MSRP - tma_msrp_send_data, - tma_msrp_send_file, + // MSRP + tma_msrp_send_data, + tma_msrp_send_file, - // Audio / Video + // Audio / Video - // T.38 + // T.38 } tmedia_action_t; -typedef struct tmedia_s -{ - TSK_DECLARE_OBJECT; +typedef struct tmedia_s { + TSK_DECLARE_OBJECT; + + const struct tmedia_plugin_def_s* plugin; - const struct tmedia_plugin_def_s* plugin; - - char* name; - uint32_t port; - char* protocol; + 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* ); +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; diff --git a/tinyMEDIA/include/tinymedia/tmedia_codec.h b/tinyMEDIA/include/tinymedia/tmedia_codec.h index f29abf6..6dcd2be 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_codec.h +++ b/tinyMEDIA/include/tinymedia/tmedia_codec.h @@ -1,18 +1,18 @@ /* * 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. * @@ -35,7 +35,7 @@ TMEDIA_BEGIN_DECLS /* ===== -* http://www.iana.org/assignments/rtp-parameters +* http://www.iana.org/assignments/rtp-parameters * http://www.networksorcery.com/enp/protocol/rtp.htm =====*/ /******* Fixed Payload Type *************/ @@ -68,7 +68,7 @@ TMEDIA_BEGIN_DECLS #define TMEDIA_CODEC_FORMAT_MP2T "33" #define TMEDIA_CODEC_FORMAT_H263 "34" -/******* Dynamic Payload Type +/******* Dynamic Payload Type Must starts at 96 to be conform to RFC 5761 (rtcp-mux) **********/ @@ -115,51 +115,50 @@ Must starts at 96 to be conform to RFC 5761 (rtcp-mux) // @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, +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; @@ -196,108 +195,105 @@ typedef int (*tmedia_codec_video_dec_cb_f)(const tmedia_video_decode_result_xt* 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, +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; +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); +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; @@ -331,26 +327,25 @@ TINYMEDIA_API int tmedia_codec_parse_fmtp(const char* fmtp, unsigned* maxbr, uns 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 +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; @@ -373,37 +368,36 @@ tmedia_codec_audio_t; 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; +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; @@ -424,13 +418,13 @@ tmedia_codec_video_t; #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); +TINYMEDIA_API int tmedia_codec_video_clamp_out_size_to_range_max(tmedia_codec_video_t *self); #define tmedia_codec_video_deinit(self) tmedia_codec_deinit(TMEDIA_CODEC(self)) /** MSRP codec */ -typedef struct tmedia_codec_msrp_s -{ - TMEDIA_DECLARE_CODEC; +typedef struct tmedia_codec_msrp_s { + TMEDIA_DECLARE_CODEC; } tmedia_codec_msrp_t; @@ -453,9 +447,8 @@ tmedia_codec_msrp_t; /** BFCP codec */ -typedef struct tmedia_codec_bfcp_s -{ - TMEDIA_DECLARE_CODEC; +typedef struct tmedia_codec_bfcp_s { + TMEDIA_DECLARE_CODEC; } tmedia_codec_bfcp_t; #define TMEDIA_DECLARE_CODEC_BFCP tmedia_codec_bfcp_t __bfcp__ diff --git a/tinyMEDIA/include/tinymedia/tmedia_codec_dummy.h b/tinyMEDIA/include/tinymedia/tmedia_codec_dummy.h index 9957eba..f3d592e 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_codec_dummy.h +++ b/tinyMEDIA/include/tinymedia/tmedia_codec_dummy.h @@ -2,19 +2,19 @@ * 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. * @@ -39,30 +39,26 @@ TMEDIA_BEGIN_DECLS /** Dummy PCMU codec */ -typedef struct tmedia_codec_dpcmu_s -{ - TMEDIA_DECLARE_CODEC_AUDIO; +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; +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; +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; +typedef struct tmedia_codec_dh264_s { + TMEDIA_DECLARE_CODEC_VIDEO; } tmedia_codec_dh264_t; diff --git a/tinyMEDIA/include/tinymedia/tmedia_common.h b/tinyMEDIA/include/tinymedia/tmedia_common.h index 411007b..e786146 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_common.h +++ b/tinyMEDIA/include/tinymedia/tmedia_common.h @@ -2,19 +2,19 @@ * 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. * @@ -42,150 +42,140 @@ 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. */ +typedef enum tmedia_type_e { + tmedia_none = 0x00, + tmedia_ghost = (0x01 << 0), - tmedia_msrp = (tmedia_chat | tmedia_file), - tmedia_audiovideo = (tmedia_audio | tmedia_video), + 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_all = 0xff + 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 +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 +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) +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, +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 +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 +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 +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 +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) +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; +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; @@ -198,21 +188,19 @@ tmedia_video_encode_result_xt; (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, -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_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.... +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; @@ -220,45 +208,42 @@ tmedia_video_decode_result_xt; (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) +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 +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), +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; diff --git a/tinyMEDIA/include/tinymedia/tmedia_consumer.h b/tinyMEDIA/include/tinymedia/tmedia_consumer.h index 0e88f45..9d347f1 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_consumer.h +++ b/tinyMEDIA/include/tinymedia/tmedia_consumer.h @@ -4,17 +4,17 @@ * 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. * @@ -56,73 +56,71 @@ TMEDIA_BEGIN_DECLS #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; +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* ); +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; diff --git a/tinyMEDIA/include/tinymedia/tmedia_converter_video.h b/tinyMEDIA/include/tinymedia/tmedia_converter_video.h index 133dfab..6af98d6 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_converter_video.h +++ b/tinyMEDIA/include/tinymedia/tmedia_converter_video.h @@ -2,17 +2,17 @@ * 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. * @@ -40,26 +40,25 @@ TMEDIA_BEGIN_DECLS # 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; +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; + tsk_size_t dstWidth; + tsk_size_t dstHeight; - tmedia_chroma_t srcChroma; - tmedia_chroma_t dstChroma; + 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; + // 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; + const struct tmedia_converter_video_plugin_def_s* plugin; } tmedia_converter_video_t; @@ -93,13 +92,12 @@ tmedia_converter_video_t; (_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; +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 ); + 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; diff --git a/tinyMEDIA/include/tinymedia/tmedia_defaults.h b/tinyMEDIA/include/tinymedia/tmedia_defaults.h index 324c241..91a1ae8 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_defaults.h +++ b/tinyMEDIA/include/tinymedia/tmedia_defaults.h @@ -2,19 +2,19 @@ * 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. * @@ -45,6 +45,10 @@ TINYMEDIA_API int tmedia_defaults_set_bandwidth_video_download_max(int32_t bw_vi 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_pref_video_size_range(tmedia_pref_video_size_t min, tmedia_pref_video_size_t max); +TINYMEDIA_API int tmedia_defaults_get_pref_video_size_range(tmedia_pref_video_size_t *min, tmedia_pref_video_size_t* max); +TINYMEDIA_API int tmedia_defaults_set_adapt_video_size_range_enabled(tsk_bool_t enabled); +TINYMEDIA_API tsk_bool_t tmedia_defaults_get_adapt_video_size_range_enabled(); 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); diff --git a/tinyMEDIA/include/tinymedia/tmedia_denoise.h b/tinyMEDIA/include/tinymedia/tmedia_denoise.h index d8818f4..522ef48 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_denoise.h +++ b/tinyMEDIA/include/tinymedia/tmedia_denoise.h @@ -1,18 +1,18 @@ /* * 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. * @@ -36,45 +36,43 @@ TMEDIA_BEGIN_DECLS #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; +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; + 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* ); +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; @@ -94,4 +92,4 @@ TINYMEDIA_API tmedia_denoise_t* tmedia_denoise_create(); TMEDIA_END_DECLS -#endif /* TINYMEDIA_DENOISE_H */ +#endif /* TINYMEDIA_DENOISE_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_imageattr.h b/tinyMEDIA/include/tinymedia/tmedia_imageattr.h index c709a17..c187da3 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_imageattr.h +++ b/tinyMEDIA/include/tinymedia/tmedia_imageattr.h @@ -2,19 +2,19 @@ * 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. * @@ -41,63 +41,59 @@ 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; - }; +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; - }; +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; +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; +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; diff --git a/tinyMEDIA/include/tinymedia/tmedia_jitterbuffer.h b/tinyMEDIA/include/tinymedia/tmedia_jitterbuffer.h index fb0f8ef..3a62ae2 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_jitterbuffer.h +++ b/tinyMEDIA/include/tinymedia/tmedia_jitterbuffer.h @@ -2,19 +2,19 @@ * 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. * @@ -47,37 +47,35 @@ TMEDIA_BEGIN_DECLS #endif /** Base object for all JitterBuffers */ -typedef struct tmedia_jitterbuffer_s -{ - TSK_DECLARE_OBJECT; +typedef struct tmedia_jitterbuffer_s { + TSK_DECLARE_OBJECT; - tsk_bool_t opened; + tsk_bool_t opened; - const struct tmedia_jitterbuffer_plugin_def_s* plugin; + 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* ); +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; @@ -99,4 +97,4 @@ TINYMEDIA_API tmedia_jitterbuffer_t* tmedia_jitterbuffer_create(tmedia_type_t ty TMEDIA_END_DECLS -#endif /* TINYMEDIA_JITTER_BUFFER_H */ +#endif /* TINYMEDIA_JITTER_BUFFER_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_params.h b/tinyMEDIA/include/tinymedia/tmedia_params.h index 549552c..baec140 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_params.h +++ b/tinyMEDIA/include/tinymedia/tmedia_params.h @@ -2,19 +2,19 @@ * 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. * @@ -40,50 +40,46 @@ TMEDIA_BEGIN_DECLS #define TMEDIA_PARAM(self) ((tmedia_param_t*)(self)) -typedef enum tmedia_param_access_type_e -{ - tmedia_pat_get, - tmedia_pat_set +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 +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, +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; +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; @@ -91,12 +87,12 @@ typedef tsk_list_t tmedia_params_L_t; /**< List of @ref tsk_param_t elements. */ #define tmedia_params_create() tsk_list_create() -TINYMEDIA_API tmedia_param_t* tmedia_param_create(tmedia_param_access_type_t access_type, - tmedia_type_t media_type, - tmedia_param_plugin_type_t plugin_type, - tmedia_param_value_type_t value_type, - const char* key, - void* value); +TINYMEDIA_API tmedia_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)) @@ -104,13 +100,13 @@ TINYMEDIA_API tmedia_param_t* tmedia_param_create(tmedia_param_access_type_t acc 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_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; diff --git a/tinyMEDIA/include/tinymedia/tmedia_producer.h b/tinyMEDIA/include/tinymedia/tmedia_producer.h index 0817821..3cfc4c6 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_producer.h +++ b/tinyMEDIA/include/tinymedia/tmedia_producer.h @@ -2,19 +2,19 @@ * 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. * @@ -55,70 +55,68 @@ typedef int (*tmedia_producer_raw_cb_f)(const tmedia_video_encode_result_xt* chu #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; +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* ); +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; diff --git a/tinyMEDIA/include/tinymedia/tmedia_qos.h b/tinyMEDIA/include/tinymedia/tmedia_qos.h index 7ff8e97..a9f2b7c 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_qos.h +++ b/tinyMEDIA/include/tinymedia/tmedia_qos.h @@ -2,19 +2,19 @@ * 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. * @@ -41,61 +41,55 @@ 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 +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 +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 */ +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_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 +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) +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; +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__ @@ -108,28 +102,27 @@ TINYMEDIA_API int tmedia_qos_tline_set_ro(tmedia_qos_tline_t* self, const tmedia 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; +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; @@ -140,42 +133,41 @@ TINYMEDIA_API int tmedia_qos_tline_e2e_set_ro(tmedia_qos_tline_e2e_t* self, cons 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; +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; diff --git a/tinyMEDIA/include/tinymedia/tmedia_resampler.h b/tinyMEDIA/include/tinymedia/tmedia_resampler.h index 5093bc6..fd89b87 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_resampler.h +++ b/tinyMEDIA/include/tinymedia/tmedia_resampler.h @@ -2,19 +2,19 @@ * 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. * @@ -42,31 +42,29 @@ TMEDIA_BEGIN_DECLS #define TMEDIA_RESAMPLER(self) ((tmedia_resampler_t*)(self)) /** Base object for all resamplers */ -typedef struct tmedia_resampler_s -{ - TSK_DECLARE_OBJECT; +typedef struct tmedia_resampler_s { + TSK_DECLARE_OBJECT; - tsk_bool_t opened; + tsk_bool_t opened; - const struct tmedia_resampler_plugin_def_s* plugin; + 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* ); +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; @@ -83,4 +81,4 @@ TINYMEDIA_API tmedia_resampler_t* tmedia_resampler_create(); TMEDIA_END_DECLS -#endif /* TINYMEDIA_RESAMPLER_H */ +#endif /* TINYMEDIA_RESAMPLER_H */ diff --git a/tinyMEDIA/include/tinymedia/tmedia_session.h b/tinyMEDIA/include/tinymedia/tmedia_session.h index 743a7a5..698f61f 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_session.h +++ b/tinyMEDIA/include/tinymedia/tmedia_session.h @@ -2,19 +2,19 @@ * 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. * @@ -50,30 +50,28 @@ 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, +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 +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_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)) @@ -91,106 +89,123 @@ typedef int (*tmedia_session_bfcp_cb_f)(const void* usrdata, const struct tmedia #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; +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 { + float q1; /**< 2.1.Packet loss recovery */ + float q2; /**< 2.2.Global packet loss estimation */ + float q3; /**< 2.3.Receiver Estimated Maximum Bitrate */ + float q4; /**< 2.4.Latency estimation */ + float q5; /**< 2.5. Jitter buffer congestion estimation */ + float qvag; + unsigned bw_up_est_kbps; + unsigned bw_down_est_kbps; + unsigned video_out_width; + unsigned video_out_height; + unsigned video_in_width; + unsigned video_in_height; + unsigned video_in_avg_fps; + unsigned video_dec_avg_time; + unsigned video_enc_avg_time; + uint64_t last_update_time; + } qos_metrics; + + 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; +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; @@ -216,9 +231,8 @@ typedef tsk_list_t tmedia_sessions_L_t; /**< List of @ref tmedia_session_t objec #define TMEDIA_DECLARE_SESSION tmedia_session_t __session__ /** Audio Session */ -typedef struct tmedia_session_audio_s -{ - TMEDIA_DECLARE_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) @@ -228,9 +242,8 @@ TINYMEDIA_API int tmedia_session_audio_send_dtmf(tmedia_session_audio_t* self, u #define TMEDIA_DECLARE_SESSION_AUDIO tmedia_session_audio_t __session_audio__ /** Video Session */ -typedef struct tmedia_session_video_s -{ - TMEDIA_DECLARE_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) @@ -243,17 +256,16 @@ 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); +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) @@ -264,18 +276,17 @@ tmedia_session_msrp_t; /** 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); +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) @@ -288,80 +299,78 @@ int tmedia_session_t140_set_ondata_cbfn(tmedia_session_t* self, const void* cont 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; +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 +typedef enum tmedia_session_param_type_e { + tmedia_sptype_null = 0, + + tmedia_sptype_set, + tmedia_sptype_get } tmedia_session_param_type_t; diff --git a/tinyMEDIA/include/tinymedia/tmedia_session_dummy.h b/tinyMEDIA/include/tinymedia/tmedia_session_dummy.h index a795677..6c3b696 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_session_dummy.h +++ b/tinyMEDIA/include/tinymedia/tmedia_session_dummy.h @@ -2,19 +2,19 @@ * 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. * @@ -39,29 +39,26 @@ TMEDIA_BEGIN_DECLS /** Dummy Audio session */ -typedef struct tmedia_session_daudio_s -{ - TMEDIA_DECLARE_SESSION_AUDIO; - uint16_t local_port; - uint16_t remote_port; +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; +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; +typedef struct tmedia_session_dmsrp_s { + TMEDIA_DECLARE_SESSION_MSRP; + uint16_t local_port; + uint16_t remote_port; } tmedia_session_dmsrp_t; diff --git a/tinyMEDIA/include/tinymedia/tmedia_session_ghost.h b/tinyMEDIA/include/tinymedia/tmedia_session_ghost.h index e4b0ac8..46507da 100755 --- a/tinyMEDIA/include/tinymedia/tmedia_session_ghost.h +++ b/tinyMEDIA/include/tinymedia/tmedia_session_ghost.h @@ -2,19 +2,19 @@ * 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. * @@ -39,12 +39,11 @@ TMEDIA_BEGIN_DECLS /** Ghost session */ -typedef struct tmedia_session_ghost_s -{ - TMEDIA_DECLARE_SESSION; - char* media; - char* proto; - char* first_format; +typedef struct tmedia_session_ghost_s { + TMEDIA_DECLARE_SESSION; + char* media; + char* proto; + char* first_format; } tmedia_session_ghost_t; diff --git a/tinyMEDIA/include/tinymedia_config.h b/tinyMEDIA/include/tinymedia_config.h index 7416017..758d97b 100755 --- a/tinyMEDIA/include/tinymedia_config.h +++ b/tinyMEDIA/include/tinymedia_config.h @@ -2,19 +2,19 @@ * 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. * @@ -62,13 +62,13 @@ # define TINYMEDIA_GEXTERN extern #endif -/* Guards against C++ name mangling +/* Guards against C++ name mangling */ #ifdef __cplusplus # define TMEDIA_BEGIN_DECLS extern "C" { # define TMEDIA_END_DECLS } #else -# define TMEDIA_BEGIN_DECLS +# define TMEDIA_BEGIN_DECLS # define TMEDIA_END_DECLS #endif @@ -92,7 +92,7 @@ #endif #if HAVE_CONFIG_H - #include <config.h> +#include <config.h> #endif #endif // TINYMEDIA_CONFIG_H |