test.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*
  2. * Copyright (C) 2009 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
  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. #include "tinymedia/tmedia.h"
  23. //#include "dummy.h"
  24. #include "tinymedia.h"
  25. #include "test_codecs.h"
  26. #include "test_sessions.h"
  27. #include "test_image_attr.h"
  28. #include "test_qos.h"
  29. #include "test_contents.h"
  30. #define RUN_TEST_LOOP 1
  31. #define RUN_TEST_ALL 0
  32. #define RUN_TEST_CODECS 0
  33. #define RUN_TEST_SESSIONS 0
  34. #define RUN_TEST_QOS 0
  35. #define RUN_TEST_IMAGEATTR 1
  36. #define RUN_TEST_CONTENTS 0
  37. static void test_register_dummy_plugins();
  38. static void test_register_contents_plugins();
  39. #ifdef _WIN32_WCE
  40. int _tmain(int argc, _TCHAR* argv[])
  41. #else
  42. int main()
  43. #endif
  44. {
  45. /* Register dummy plugins */
  46. test_register_dummy_plugins();
  47. /* Register content plugins */
  48. test_register_contents_plugins();
  49. do {
  50. #if RUN_TEST_ALL || RUN_TEST_CODECS
  51. test_codecs();
  52. #endif
  53. #if RUN_TEST_ALL || RUN_TEST_SESSIONS
  54. test_sessions();
  55. #endif
  56. #if RUN_TEST_ALL || RUN_TEST_QOS
  57. test_qos();
  58. #endif
  59. #if RUN_TEST_ALL || RUN_TEST_IMAGEATTR
  60. test_qos_imageattr();
  61. #endif
  62. #if RUN_TEST_ALL || RUN_TEST_CONTENTS
  63. test_contents();
  64. #endif
  65. }
  66. while(RUN_TEST_LOOP);
  67. return 0;
  68. }
  69. void test_register_contents_plugins()
  70. {
  71. tmedia_content_plugin_register("text/html", tmedia_content_dummy_plugin_def_t);
  72. tmedia_content_plugin_register("text/plain", tmedia_content_dummy_plugin_def_t);
  73. tmedia_content_plugin_register("message/CPIM", tmedia_content_cpim_plugin_def_t);
  74. }
  75. void test_register_dummy_plugins()
  76. {
  77. int ret;
  78. /* === Sessions === */
  79. if((ret = tmedia_session_plugin_register(tmedia_session_daudio_plugin_def_t))) {
  80. TSK_DEBUG_ERROR("Failed to register audio plugin");
  81. }
  82. if((ret = tmedia_session_plugin_register(tmedia_session_dvideo_plugin_def_t))) {
  83. TSK_DEBUG_ERROR("Failed to register video plugin");
  84. }
  85. if((ret = tmedia_session_plugin_register(tmedia_session_dmsrp_plugin_def_t))) {
  86. TSK_DEBUG_ERROR("Failed to register msrp plugin");
  87. }
  88. if((ret = tmedia_session_plugin_register(tmedia_session_ghost_plugin_def_t))) {
  89. TSK_DEBUG_ERROR("Failed to register ghost plugin");
  90. }
  91. /* === Codecs === */
  92. if((ret = tmedia_codec_plugin_register(tmedia_codec_dpcma_plugin_def_t))) {
  93. TSK_DEBUG_ERROR("Failed to register G.711a plugin");
  94. }
  95. if((ret = tmedia_codec_plugin_register(tmedia_codec_dpcmu_plugin_def_t))) {
  96. TSK_DEBUG_ERROR("Failed to register G.711u plugin");
  97. }
  98. if((ret = tmedia_codec_plugin_register(tmedia_codec_dh263_plugin_def_t))) {
  99. TSK_DEBUG_ERROR("Failed to register H.263-1996 plugin");
  100. }
  101. if((ret = tmedia_codec_plugin_register(tmedia_codec_dh264_plugin_def_t))) {
  102. TSK_DEBUG_ERROR("Failed to register H.264 (Base profile 10) plugin");
  103. }
  104. }
  105. //#ifdef _WIN32_WCE
  106. //int _tmain(int argc, _TCHAR* argv[])
  107. //#else
  108. //int main()
  109. //#endif
  110. //{
  111. // while(1)
  112. // {
  113. // tmedia_t* dummy = tsk_null;
  114. //
  115. // // Register dummy media
  116. // tmedia_plugin_register(dummy_plugin_def_t);
  117. // // ...if you have another one to register
  118. // // ...and another
  119. // // ...again and again
  120. //
  121. // // Create dummy media
  122. // if((dummy = tmedia_factory_create("dummy plugin", "127.0.0.1", tnet_socket_type_udp_ipv4))){
  123. //
  124. // tmedia_get_local_offer(dummy,
  125. // TSDP_HEADER_A_VA_ARGS("file-disposition", "attachment"),
  126. //
  127. // tsk_null
  128. // );
  129. // tmedia_get_negotiated_offer(dummy);
  130. // tmedia_set_remote_offer(dummy, tsk_null);
  131. //
  132. // tmedia_start(dummy);
  133. // tmedia_pause(dummy);
  134. //
  135. // tmedia_perform(dummy, tma_dummy_say_hello,
  136. // TSK_PARAM_VA_ARGS("to", "doubango"),
  137. //
  138. // tsk_null);
  139. //
  140. // tmedia_stop(dummy);
  141. //
  142. // TSK_OBJECT_SAFE_FREE(dummy);
  143. // }
  144. // }
  145. //
  146. // return 0;
  147. //}