tmedia_codec.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. /*
  2. * Copyright (C) 2010-2015 Mamadou DIOP.
  3. *
  4. * This file is part of Open Source Doubango Framework.
  5. *
  6. * DOUBANGO is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * DOUBANGO is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with DOUBANGO.
  18. *
  19. */
  20. /**@file tmedia_codec.h
  21. * @brief Base codec object.
  22. *
  23. */
  24. #ifndef TINYMEDIA_CODEC_H
  25. #define TINYMEDIA_CODEC_H
  26. #include "tinymedia_config.h"
  27. #include "tmedia_common.h"
  28. #include "tsk_list.h"
  29. TMEDIA_BEGIN_DECLS
  30. /* =====
  31. * http://www.iana.org/assignments/rtp-parameters
  32. * http://www.networksorcery.com/enp/protocol/rtp.htm
  33. =====*/
  34. /******* Fixed Payload Type *************/
  35. #define TMEDIA_CODEC_FORMAT_G711u "0"
  36. #define TMEDIA_CODEC_FORMAT_1016 "1"
  37. #define TMEDIA_CODEC_FORMAT_G721 "2"
  38. #define TMEDIA_CODEC_FORMAT_GSM "3"
  39. #define TMEDIA_CODEC_FORMAT_G723 "4"
  40. #define TMEDIA_CODEC_FORMAT_DVI4_8000 "5"
  41. #define TMEDIA_CODEC_FORMAT_DVI4_16000 "6"
  42. #define TMEDIA_CODEC_FORMAT_LPC "7"
  43. #define TMEDIA_CODEC_FORMAT_G711a "8"
  44. #define TMEDIA_CODEC_FORMAT_G722 "9"
  45. #define TMEDIA_CODEC_FORMAT_L16_STEREO "10"
  46. #define TMEDIA_CODEC_FORMAT_L16 "11"
  47. #define TMEDIA_CODEC_FORMAT_QCELP "12"
  48. #define TMEDIA_CODEC_FORMAT_CN "13"
  49. #define TMEDIA_CODEC_FORMAT_MPA "14"
  50. #define TMEDIA_CODEC_FORMAT_G728 "15"
  51. #define TMEDIA_CODEC_FORMAT_DVI4_11025 "16"
  52. #define TMEDIA_CODEC_FORMAT_DVI4_22050 "17"
  53. #define TMEDIA_CODEC_FORMAT_G729 "18"
  54. #define TMEDIA_CODEC_FORMAT_CELLB "25"
  55. #define TMEDIA_CODEC_FORMAT_JPEG "26"
  56. #define TMEDIA_CODEC_FORMAT_NV "28"
  57. #define TMEDIA_CODEC_FORMAT_H261 "31"
  58. #define TMEDIA_CODEC_FORMAT_MPV "32"
  59. #define TMEDIA_CODEC_FORMAT_MP2T "33"
  60. #define TMEDIA_CODEC_FORMAT_H263 "34"
  61. /******* Dynamic Payload Type
  62. Must starts at 96 to be conform to RFC 5761 (rtcp-mux)
  63. **********/
  64. #define TMEDIA_CODEC_FORMAT_ILBC "96"
  65. #define TMEDIA_CODEC_FORMAT_SPEEX_NB "97"
  66. #define TMEDIA_CODEC_FORMAT_SPEEX_WB "98"
  67. #define TMEDIA_CODEC_FORMAT_SPEEX_UWB "99"
  68. #define TMEDIA_CODEC_FORMAT_VP8 "100" /* Must to ease neg. with chrome and Asterisk */
  69. #define TMEDIA_CODEC_FORMAT_DTMF "101"
  70. #define TMEDIA_CODEC_FORMAT_H263_2000 "102"
  71. #define TMEDIA_CODEC_FORMAT_H263_1998 "103"
  72. #define TMEDIA_CODEC_FORMAT_H264_BP "104"
  73. #define TMEDIA_CODEC_FORMAT_H264_MP "105"
  74. #define TMEDIA_CODEC_FORMAT_H264_HP "106"
  75. #define TMEDIA_CODEC_FORMAT_AMR_WBP_BE "107"
  76. #define TMEDIA_CODEC_FORMAT_AMR_WBP_OA "108"
  77. #define TMEDIA_CODEC_FORMAT_AAC "109"
  78. #define TMEDIA_CODEC_FORMAT_AACPLUS "110"
  79. #define TMEDIA_CODEC_FORMAT_OPUS "111"
  80. #define TMEDIA_CODEC_FORMAT_AMR_NB_BE "112"
  81. #define TMEDIA_CODEC_FORMAT_AMR_NB_OA "113"
  82. #define TMEDIA_CODEC_FORMAT_AMR_WB_BE "114"
  83. #define TMEDIA_CODEC_FORMAT_AMR_WB_OA "115"
  84. #define TMEDIA_CODEC_FORMAT_BV16 "116"
  85. #define TMEDIA_CODEC_FORMAT_MP4V_ES "121"
  86. #define TMEDIA_CODEC_FORMAT_ULPFEC "122"
  87. #define TMEDIA_CODEC_FORMAT_RED "123"
  88. #define TMEDIA_CODEC_FORMAT_T140 "124"
  89. #define TMEDIA_CODEC_FORMAT_THEORA "125"
  90. #define TMEDIA_CODEC_FORMAT_MSRP "*"
  91. #define TMEDIA_CODEC_FORMAT_BFCP "*"
  92. // @tinyWRAP
  93. typedef enum tmedia_codec_id_e {
  94. tmedia_codec_id_none = 0x00000000,
  95. tmedia_codec_id_amr_nb_oa = 0x00000001<<0,
  96. tmedia_codec_id_amr_nb_be = 0x00000001<<1,
  97. tmedia_codec_id_amr_wb_oa = 0x00000001<<2,
  98. tmedia_codec_id_amr_wb_be = 0x00000001<<3,
  99. tmedia_codec_id_gsm = 0x00000001<<4,
  100. tmedia_codec_id_pcma = 0x00000001<<5,
  101. tmedia_codec_id_pcmu = 0x00000001<<6,
  102. tmedia_codec_id_ilbc = 0x00000001<<7,
  103. tmedia_codec_id_speex_nb = 0x00000001<<8,
  104. tmedia_codec_id_speex_wb = 0x00000001<<9,
  105. tmedia_codec_id_speex_uwb = 0x00000001<<10,
  106. tmedia_codec_id_bv16 = 0x00000001<<11,
  107. tmedia_codec_id_bv32 = 0x00000001<<12,
  108. tmedia_codec_id_opus = 0x00000001<<13,
  109. tmedia_codec_id_g729ab = 0x00000001<<14,
  110. tmedia_codec_id_g722 = 0x00000001<<15,
  111. /* room for new Audio codecs */
  112. tmedia_codec_id_h261 = 0x00010000<<0,
  113. tmedia_codec_id_h263 = 0x00010000<<1,
  114. tmedia_codec_id_h263p = 0x00010000<<2,
  115. tmedia_codec_id_h263pp = 0x00010000<<3,
  116. tmedia_codec_id_h264_bp = 0x00010000<<4,
  117. tmedia_codec_id_h264_mp = 0x00010000<<5,
  118. tmedia_codec_id_h264_hp = 0x00010000<<6,
  119. tmedia_codec_id_h264_bp10 = tmedia_codec_id_h264_bp, // @deprecated
  120. tmedia_codec_id_h264_bp20 = tmedia_codec_id_h264_bp, // @deprecated
  121. tmedia_codec_id_h264_bp30 = tmedia_codec_id_h264_bp, // @deprecated
  122. tmedia_codec_id_h264_svc = 0x00010000<<7,
  123. tmedia_codec_id_theora = 0x00010000<<8,
  124. tmedia_codec_id_mp4ves_es = 0x00010000<<9,
  125. tmedia_codec_id_vp8 = 0x00010000<<10,
  126. /* room for new Video codecs */
  127. tmedia_codec_id_t140 = 0x00010000<<14,
  128. tmedia_codec_id_red = 0x00010000<<15,
  129. tmedia_codec_id_all = 0xffffffff,
  130. }
  131. tmedia_codec_id_t;
  132. /**Max number of plugins (codec types) we can create */
  133. #if !defined(TMED_CODEC_MAX_PLUGINS)
  134. # define TMED_CODEC_MAX_PLUGINS 0xFF
  135. #endif
  136. /** cast any pointer to @ref tmedia_codec_t* object */
  137. #define TMEDIA_CODEC(self) ((tmedia_codec_t*)(self))
  138. #define TMEDIA_CODEC_RATE_DECODING(self) (TMEDIA_CODEC((self))->in.rate)
  139. #define TMEDIA_CODEC_RATE_ENCODING(self) (TMEDIA_CODEC((self))->out.rate)
  140. #define TMEDIA_CODEC_PTIME_AUDIO_DECODING(self) (TMEDIA_CODEC_AUDIO((self))->in.ptime)
  141. #define TMEDIA_CODEC_PTIME_AUDIO_ENCODING(self) (TMEDIA_CODEC_AUDIO((self))->out.ptime)
  142. #define TMEDIA_CODEC_CHANNELS_AUDIO_DECODING(self) (TMEDIA_CODEC_AUDIO((self))->in.channels)
  143. #define TMEDIA_CODEC_CHANNELS_AUDIO_ENCODING(self) (TMEDIA_CODEC_AUDIO((self))->out.channels)
  144. #define TMEDIA_CODEC_PCM_FRAME_SIZE_AUDIO_DECODING(self) ((TMEDIA_CODEC_PTIME_AUDIO_DECODING((self)) * TMEDIA_CODEC_RATE_DECODING((self)))/1000)
  145. #define TMEDIA_CODEC_PCM_FRAME_SIZE_AUDIO_ENCODING(self) ((TMEDIA_CODEC_PTIME_AUDIO_ENCODING((self)) * TMEDIA_CODEC_RATE_ENCODING((self)))/1000)
  146. #define TMEDIA_CODEC_FRAME_DURATION_AUDIO_ENCODING(self) (int32_t)((float)TMEDIA_CODEC_PCM_FRAME_SIZE_AUDIO_ENCODING(self) * (float)TMEDIA_CODEC_AUDIO((self))->out.timestamp_multiplier)
  147. /** callbacks for video codecs */
  148. typedef int (*tmedia_codec_video_enc_cb_f)(const tmedia_video_encode_result_xt* result);
  149. typedef int (*tmedia_codec_video_dec_cb_f)(const tmedia_video_decode_result_xt* result);
  150. struct tmedia_param_s;
  151. struct tsdp_header_M_s;
  152. typedef enum tmedia_codec_action_e {
  153. tmedia_codec_action_encode_idr,
  154. tmedia_codec_action_bw_down,
  155. tmedia_codec_action_bw_up,
  156. }
  157. tmedia_codec_action_t;
  158. /** Base object for all Codecs */
  159. typedef struct tmedia_codec_s {
  160. TSK_DECLARE_OBJECT;
  161. //! the type of the codec
  162. tmedia_type_t type;
  163. //! the codec identifier
  164. tmedia_codec_id_t id;
  165. //! whether the codec is opened
  166. tsk_bool_t opened;
  167. //! whether the pay. type is dyn. or not
  168. tsk_bool_t dyn;
  169. //! the name of the codec. e.g. "G.711U" or "G.711A" etc used in the sdp
  170. char* name;
  171. //! full description
  172. char* desc;
  173. //! the format. e.g. "0" for PCMU or "8" for PCMA or "*" for MSRP.
  174. char* format;
  175. //! bandwidth level
  176. tmedia_bandwidth_level_t bl; // @deprecated
  177. //! maximum bandwidth to use for outgoing RTP (INT_MAX or <=0 means undefined)
  178. int32_t bandwidth_max_upload;
  179. //! maximum bandwidth to use for incoming RTP (INT_MAX or <=0 means undefined)
  180. int32_t bandwidth_max_download;
  181. //! the negociated format (only useful for codecs with dyn. payload type)
  182. char* neg_format;
  183. //! whether this is a passthrough codec
  184. tsk_bool_t passthrough;
  185. struct {
  186. // !negotiated decoding rate (for codecs with dynamic rate, e.g. opus)
  187. uint32_t rate;
  188. } in; //decoding direction
  189. struct {
  190. // !negotiated encoding rate (for codecs with dynamic rate, e.g. opus)
  191. uint32_t rate;
  192. } out; //encoding direction
  193. //! plugin used to create the codec
  194. const struct tmedia_codec_plugin_def_s* plugin;
  195. }
  196. tmedia_codec_t;
  197. #define TMEDIA_CODEC(self) ((tmedia_codec_t*)(self))
  198. /** Virtual table used to define a codec plugin */
  199. typedef struct tmedia_codec_plugin_def_s {
  200. //! object definition used to create an instance of the codec
  201. const tsk_object_def_t* objdef;
  202. //! the type of the codec
  203. tmedia_type_t type;
  204. //! the codec identifier
  205. tmedia_codec_id_t codec_id;
  206. //! the name of the codec. e.g. "G.711U" or "G.711A" etc using in the sdp.
  207. const char* name;
  208. //! full description
  209. const char* desc;
  210. //! the format. e.g. "0" for PCMU or "8" for PCMA or "*" for MSRP.
  211. const char* format;
  212. //! whether the pay. type is dyn. or not
  213. tsk_bool_t dyn;
  214. uint32_t rate;
  215. /* default values could be updated at any time */
  216. struct {
  217. int8_t channels;
  218. uint8_t ptime;
  219. /* ...to be continued */
  220. } audio;
  221. /* default values could be updated at any time */
  222. struct {
  223. unsigned width;
  224. unsigned height;
  225. unsigned fps;
  226. /* ...to be continued */
  227. } video;
  228. //! set parameters
  229. int (*set) (tmedia_codec_t* , const struct tmedia_param_s*);
  230. //! open the codec
  231. int (*open) (tmedia_codec_t*);
  232. //! close the codec
  233. int (*close) (tmedia_codec_t*);
  234. //! encode data
  235. 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);
  236. //! decode data
  237. 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);
  238. //! whether the codec can handle this sdp attribute
  239. tsk_bool_t (* sdp_att_match) (const tmedia_codec_t*, const char* att_name, const char* att_value);
  240. //! gets sdp attribute value. e.g. "mode-set=0,2,5,7; mode-change-period=2; mode-change-neighbor=1"
  241. char* (* sdp_att_get) (const tmedia_codec_t*, const char* att_name);
  242. }
  243. tmedia_codec_plugin_def_t;
  244. /** List of @ref tmedia_codec_t elements */
  245. typedef tsk_list_t tmedia_codecs_L_t;
  246. /**< Declare base class as codec */
  247. #define TMEDIA_DECLARE_CODEC tmedia_codec_t __codec__
  248. TINYMEDIA_API int tmedia_codec_init(tmedia_codec_t* self, tmedia_type_t type, const char* name, const char* desc, const char* format);
  249. TINYMEDIA_API int tmedia_codec_set(tmedia_codec_t* self, const struct tmedia_param_s* param);
  250. TINYMEDIA_API int tmedia_codec_open(tmedia_codec_t* self);
  251. TINYMEDIA_API int tmedia_codec_close(tmedia_codec_t* self);
  252. TINYMEDIA_API int tmedia_codec_cmp(const tsk_object_t* codec1, const tsk_object_t* codec2);
  253. TINYMEDIA_API int tmedia_codec_plugin_register(const tmedia_codec_plugin_def_t* plugin);
  254. TINYMEDIA_API int tmedia_codec_plugin_register_2(const tmedia_codec_plugin_def_t* plugin, int prio);
  255. TINYMEDIA_API tsk_bool_t tmedia_codec_plugin_is_registered(const tmedia_codec_plugin_def_t* plugin);
  256. TINYMEDIA_API tsk_bool_t tmedia_codec_plugin_is_registered_2(tmedia_codec_id_t codec_id);
  257. TINYMEDIA_API int tmedia_codec_plugin_registered_get_all(const struct tmedia_codec_plugin_def_s*(** plugins)[TMED_CODEC_MAX_PLUGINS], tsk_size_t* count);
  258. TINYMEDIA_API const struct tmedia_codec_plugin_def_s* tmedia_codec_plugin_registered_get_const(tmedia_codec_id_t codec_id);
  259. TINYMEDIA_API tsk_size_t tmedia_codec_plugin_registered_count(const struct tmedia_codec_plugin_def_s** plugins, tsk_size_t count);
  260. TINYMEDIA_API int tmedia_codec_plugin_unregister(const tmedia_codec_plugin_def_t* plugin);
  261. TINYMEDIA_API int tmedia_codec_plugin_unregister_all();
  262. TINYMEDIA_API tmedia_codec_t* tmedia_codec_create(const char* format);
  263. TINYMEDIA_API char* tmedia_codec_get_rtpmap(const tmedia_codec_t* self);
  264. TINYMEDIA_API tsk_bool_t tmedia_codec_sdp_att_match(const tmedia_codec_t* self, const char* att_name, const char* att_value);
  265. TINYMEDIA_API char* tmedia_codec_sdp_att_get(const tmedia_codec_t* self, const char* att_name);
  266. TINYMEDIA_API int tmedia_codec_removeAll_exceptThese(tmedia_codecs_L_t* codecs, const tmedia_codecs_L_t * codecs2keep);
  267. TINYMEDIA_API int tmedia_codec_to_sdp(const tmedia_codecs_L_t* codecs, struct tsdp_header_M_s* m);
  268. TINYMEDIA_API tmedia_codec_t* tmedia_codec_find_by_format(tmedia_codecs_L_t* codecs, const char* format);
  269. TINYMEDIA_API int tmedia_codec_parse_fmtp(const char* fmtp, unsigned* maxbr, unsigned* fps, unsigned *width, unsigned *height);
  270. TINYMEDIA_API int tmedia_codec_deinit(tmedia_codec_t* self);
  271. /** Audio codec */
  272. typedef struct tmedia_codec_audio_s {
  273. TMEDIA_DECLARE_CODEC;
  274. struct {
  275. // !negotiated decoding ptime
  276. uint8_t ptime;
  277. // !negotiated decoding channels
  278. int8_t channels;
  279. // ! timestamp multiplier
  280. float timestamp_multiplier;
  281. } in; //decoding direction
  282. struct {
  283. // !negotiated decoding ptime
  284. uint8_t ptime;
  285. // !negotiated encoding channels
  286. int8_t channels;
  287. // ! timestamp multiplier
  288. float timestamp_multiplier;
  289. } out; //encoding direction
  290. }
  291. tmedia_codec_audio_t;
  292. /**@def TMEDIA_DECLARE_CODEC_AUDIO
  293. * Declares base class as audio codec.
  294. */
  295. /**@def TMEDIA_CODEC_AUDIO
  296. * Cast any pointer as @ref tmedia_codec_audio_t* object.
  297. */
  298. /**@def tmedia_codec_audio_init
  299. * Initialize a audio codec.
  300. */
  301. /**@def tmedia_codec_audio_deinit
  302. * DeInitialize a audio codec.
  303. */
  304. #define TMEDIA_DECLARE_CODEC_AUDIO tmedia_codec_audio_t __audio__
  305. #define TMEDIA_CODEC_AUDIO(self) ((tmedia_codec_audio_t*)(self))
  306. #define tmedia_codec_audio_init(self, name, desc, format) tmedia_codec_init(TMEDIA_CODEC(self), tmedia_audio, name, desc, format)
  307. #define tmedia_codec_audio_deinit(self) tmedia_codec_deinit(TMEDIA_CODEC(self))
  308. TINYMEDIA_API float tmedia_codec_audio_get_timestamp_multiplier(tmedia_codec_id_t id, uint32_t sample_rate);
  309. /** Video codec */
  310. typedef struct tmedia_codec_video_s {
  311. TMEDIA_DECLARE_CODEC;
  312. struct {
  313. unsigned width;
  314. unsigned height;
  315. unsigned fps;
  316. unsigned max_br;
  317. unsigned max_mbps;
  318. tmedia_chroma_t chroma;
  319. tsk_bool_t flip;
  320. tmedia_codec_video_dec_cb_f callback;
  321. tmedia_video_decode_result_xt result;
  322. } in; // decoded
  323. struct {
  324. unsigned width;
  325. unsigned height;
  326. unsigned fps;
  327. unsigned max_br;
  328. unsigned max_mbps;
  329. tmedia_chroma_t chroma;
  330. tsk_bool_t flip;
  331. tmedia_codec_video_enc_cb_f callback;
  332. tmedia_video_encode_result_xt result;
  333. } out; // encoded
  334. //! preferred video size
  335. tmedia_pref_video_size_t pref_size;
  336. }
  337. tmedia_codec_video_t;
  338. /**@def TMEDIA_DECLARE_CODEC_VIDEO
  339. * Declares base class as video codec.
  340. */
  341. /**@def TMEDIA_CODEC_VIDEO
  342. * Cast any pointer as @ref tmedia_codec_video_t* object.
  343. */
  344. /**@def tmedia_codec_video_init
  345. * Initialize a video codec.
  346. */
  347. /**@def tmedia_codec_video_deinit
  348. * DeInitialize a video codec.
  349. */
  350. #define TMEDIA_DECLARE_CODEC_VIDEO tmedia_codec_video_t __video__
  351. #define TMEDIA_CODEC_VIDEO(self) ((tmedia_codec_video_t*)(self))
  352. #define tmedia_codec_video_init(self, name, desc, format) tmedia_codec_init(TMEDIA_CODEC(self), tmedia_video, name, desc, format)
  353. 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);
  354. 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);
  355. TINYMEDIA_API int tmedia_codec_video_clamp_out_size_to_range_max(tmedia_codec_video_t *self);
  356. #define tmedia_codec_video_deinit(self) tmedia_codec_deinit(TMEDIA_CODEC(self))
  357. /** MSRP codec */
  358. typedef struct tmedia_codec_msrp_s {
  359. TMEDIA_DECLARE_CODEC;
  360. }
  361. tmedia_codec_msrp_t;
  362. /**@def TMEDIA_DECLARE_CODEC_MSRP
  363. * Declares base class as msrp codec.
  364. */
  365. /**@def TMEDIA_CODEC_MSRP
  366. * Cast any pointer as @ref tmedia_codec_msrp_t* object.
  367. */
  368. /**@def tmedia_codec_msrp_init
  369. * Initialize a msrp codec.
  370. */
  371. /**@def tmedia_codec_msrp_deinit
  372. * DeInitialize a msrp codec.
  373. */
  374. #define TMEDIA_DECLARE_CODEC_MSRP tmedia_codec_msrp_t __msrp__
  375. #define TMEDIA_CODEC_MSRP(self) ((tmedia_codec_msrp_t*)(self))
  376. #define tmedia_codec_msrp_init(self, name, desc) tmedia_codec_init(TMEDIA_CODEC(self), tmedia_msrp, name, desc, "*")
  377. #define tmedia_codec_msrp_deinit(self) tmedia_codec_deinit(TMEDIA_CODEC(self))
  378. /** BFCP codec */
  379. typedef struct tmedia_codec_bfcp_s {
  380. TMEDIA_DECLARE_CODEC;
  381. }
  382. tmedia_codec_bfcp_t;
  383. #define TMEDIA_DECLARE_CODEC_BFCP tmedia_codec_bfcp_t __bfcp__
  384. #define TMEDIA_CODEC_BFCP(self) ((tmedia_codec_bfcp_t*)(self))
  385. #define tmedia_codec_bfcp_init(self, name, desc) tmedia_codec_init(TMEDIA_CODEC(self), tmedia_bfcp, name, desc, "*")
  386. #define tmedia_codec_bfcp_deinit(self) tmedia_codec_deinit(TMEDIA_CODEC(self))
  387. TMEDIA_END_DECLS
  388. #endif /* TINYMEDIA_CODEC_H */