tmedia.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Copyright (C) 2010-2011 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with DOUBANGO.
  20. *
  21. */
  22. /**@file tmedia.h
  23. * @brief Base media object.
  24. *
  25. * @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
  26. *
  27. */
  28. #ifndef TINYMEDIA_TMEDIA_H
  29. #define TINYMEDIA_TMEDIA_H
  30. #include "tinymedia_config.h"
  31. #include "tinysdp/tsdp_message.h"
  32. #include "tnet_socket.h"
  33. #include "tsk_params.h"
  34. TMEDIA_BEGIN_DECLS
  35. #if 0
  36. #define TMEDIA_VA_ARGS(name, host, socket_type) tmedia_def_t, (const char*) name, (const char*) host, (tnet_socket_type_t) socket_type
  37. #define TMEDIA(self) ((tmedia_t*)(self))
  38. typedef enum tmedia_action_e {
  39. // Dummy
  40. tma_dummy_say_hello,
  41. // MSRP
  42. tma_msrp_send_data,
  43. tma_msrp_send_file,
  44. // Audio / Video
  45. // T.38
  46. }
  47. tmedia_action_t;
  48. typedef struct tmedia_s {
  49. TSK_DECLARE_OBJECT;
  50. const struct tmedia_plugin_def_s* plugin;
  51. char* name;
  52. uint32_t port;
  53. char* protocol;
  54. }
  55. tmedia_t;
  56. typedef tsk_list_t tmedias_L_t;
  57. #define TMED_DECLARE_MEDIA tmedia_t media
  58. typedef struct tmedia_plugin_def_s {
  59. const tsk_object_def_t* objdef;
  60. const char* name;
  61. const char* media;
  62. int (* start) (tmedia_t* );
  63. int (* pause) (tmedia_t* );
  64. int (* stop) (tmedia_t* );
  65. const tsdp_header_M_t* (* get_local_offer) (tmedia_t* , va_list* );
  66. const tsdp_header_M_t* (* get_negotiated_offer) (tmedia_t* );
  67. int (* set_remote_offer) (tmedia_t* , const tsdp_message_t* );
  68. int (* perform) (tmedia_t* , tmedia_action_t action, const tsk_params_L_t* );
  69. }
  70. tmedia_plugin_def_t;
  71. TINYMEDIA_API int tmedia_init(tmedia_t* self, const char* name);
  72. TINYMEDIA_API int tmedia_deinit(tmedia_t* self);
  73. TINYMEDIA_API int tmedia_plugin_register(const tmedia_plugin_def_t* def);
  74. TINYMEDIA_API tmedia_t* tmedia_factory_create(const char* name, const char* host, tnet_socket_type_t socket_type);
  75. TINYMEDIA_API int tmedia_start(tmedia_t* );
  76. TINYMEDIA_API int tmedia_pause(tmedia_t* );
  77. TINYMEDIA_API int tmedia_stop(tmedia_t* );
  78. TINYMEDIA_API const tsdp_header_M_t* tmedia_get_local_offer(tmedia_t* , ...);
  79. TINYMEDIA_API const tsdp_header_M_t* tmedia_get_negotiated_offer(tmedia_t* );
  80. TINYMEDIA_API int tmedia_set_remote_offer(tmedia_t* , const tsdp_message_t* );
  81. TINYMEDIA_API int tmedia_perform(tmedia_t* , tmedia_action_t, ... );
  82. TINYMEDIA_GEXTERN const void *tmedia_def_t;
  83. #endif
  84. TMEDIA_END_DECLS
  85. #endif /* TINYMEDIA_TMEDIA_H */