kopete-mediastreamer2.14.patch 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. diff --git a/CMakeLists.txt b/CMakeLists.txt
  2. --- a/CMakeLists.txt
  3. +++ b/CMakeLists.txt
  4. @@ -34,6 +34,7 @@
  5. find_package(KF5Contacts ${KCONTACTS_LIB_VERSION} CONFIG REQUIRED)
  6. find_package(KF5IdentityManagement ${KCONTACTS_LIB_VERSION} CONFIG REQUIRED)
  7. +find_package(Threads)
  8. include(KDEInstallDirs)
  9. include(KDECompilerSettings NO_POLICY_SCOPE)
  10. diff --git a/cmake/modules/FindLiboRTP.cmake b/cmake/modules/FindLiboRTP.cmake
  11. --- a/cmake/modules/FindLiboRTP.cmake
  12. +++ b/cmake/modules/FindLiboRTP.cmake
  13. @@ -11,7 +11,7 @@
  14. SET( LIBORTP_FOUND FALSE )
  15. -pkg_check_modules(ortp ortp)
  16. +pkg_check_modules(ORTP ortp)
  17. FIND_PATH( LIBORTP_INCLUDE_DIR
  18. ortp/ortp.h
  19. @@ -40,7 +40,13 @@
  20. if ( run_result EQUAL 0 )
  21. # Version OK
  22. SET( LIBORTP_FOUND TRUE )
  23. - MESSAGE( STATUS "Found libortp: ${LIBORTP_LIBRARY}" )
  24. + MESSAGE( STATUS "Found libortp: ${LIBORTP_LIBRARY} ${ORTP_VERSION}" )
  25. + IF (ORTP_VERSION VERSION_LESS 1.0.1)
  26. + SET(ORTP_LESS_1_0_1 TRUE)
  27. + ELSE (ORTP_VERSION VERSION_LESS 1.0.1)
  28. + SET(ORTP_LESS_1_0_1 FALSE)
  29. + ENDIF (ORTP_VERSION VERSION_LESS 1.0.1)
  30. +
  31. endif ( run_result EQUAL 0 )
  32. endif( compile_result )
  33. ENDIF( LIBORTP_INCLUDE_DIR AND LIBORTP_LIBRARY )
  34. diff --git a/cmake/modules/FindMediastreamer.cmake b/cmake/modules/FindMediastreamer.cmake
  35. --- a/cmake/modules/FindMediastreamer.cmake
  36. +++ b/cmake/modules/FindMediastreamer.cmake
  37. @@ -20,17 +20,25 @@
  38. IF (MEDIASTREAMER_FOUND)
  39. IF (NOT MEDIASTREAMER_FIND_QUIETLY)
  40. +
  41. MESSAGE(STATUS "Found Mediastreamer: ${MEDIASTREAMER_LIBRARIES} (version: ${MEDIASTREAMER_VERSION})")
  42. +
  43. + SET(MEDIASTREAMER_LESS_2_9 FALSE)
  44. + SET(MEDIASTREAMER_LESS_2_11 FALSE)
  45. + SET(MEDIASTREAMER_LESS_2_14 FALSE)
  46. +
  47. IF (MEDIASTREAMER_VERSION VERSION_LESS 2.9)
  48. SET(MEDIASTREAMER_LESS_2_9 TRUE)
  49. - SET(MEDIASTREAMER_LESS_2_11 TRUE)
  50. - ELSEIF (MEDIASTREAMER_VERSION VERSION_LESS 2.11)
  51. - SET(MEDIASTREAMER_LESS_2_9 FALSE)
  52. - SET(MEDIASTREAMER_LESS_2_11 TRUE)
  53. - ELSE (MEDIASTREAMER_VERSION VERSION_LESS 2.9)
  54. - SET(MEDIASTREAMER_LESS_2_9 FALSE)
  55. - SET(MEDIASTREAMER_LESS_2_11 FALSE)
  56. ENDIF (MEDIASTREAMER_VERSION VERSION_LESS 2.9)
  57. +
  58. + IF (MEDIASTREAMER_VERSION VERSION_LESS 2.11)
  59. + SET(MEDIASTREAMER_LESS_2_11 TRUE)
  60. + ENDIF (MEDIASTREAMER_VERSION VERSION_LESS 2.11)
  61. +
  62. + IF (MEDIASTREAMER_VERSION VERSION_LESS 2.14)
  63. + SET(MEDIASTREAMER_LESS_2_14 TRUE)
  64. + ENDIF (MEDIASTREAMER_VERSION VERSION_LESS 2.14)
  65. +
  66. ENDIF (NOT MEDIASTREAMER_FIND_QUIETLY)
  67. ELSE (MEDIASTREAMER_FOUND)
  68. IF (MEDIASTREAMER_FIND_REQUIRED)
  69. diff --git a/protocols/jabber/libjingle/CMakeLists.txt b/protocols/jabber/libjingle/CMakeLists.txt
  70. --- a/protocols/jabber/libjingle/CMakeLists.txt
  71. +++ b/protocols/jabber/libjingle/CMakeLists.txt
  72. @@ -51,6 +51,10 @@
  73. add_definitions ( -DMEDIASTREAMER_LESS_2_11 )
  74. endif ( MEDIASTREAMER_LESS_2_11 )
  75. +if ( MEDIASTREAMER_LESS_2_14 )
  76. + add_definitions ( -DMEDIASTREAMER_LESS_2_14 )
  77. +endif ( MEDIASTREAMER_LESS_2_14 )
  78. +
  79. if ( CMAKE_BUILD_TYPE STREQUAL "Debug" )
  80. add_definitions ( -D_DEBUG )
  81. endif ( CMAKE_BUILD_TYPE STREQUAL "Debug" )
  82. @@ -284,6 +288,7 @@
  83. ${EXPAT_LIBRARY}
  84. ${MEDIASTREAMER_LIBRARIES}
  85. ${LIBORTP_LIBRARY}
  86. + ${CMAKE_THREAD_LIBS_INIT}
  87. ${CMAKE_DL_LIBS}
  88. )
  89. diff --git a/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.h b/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.h
  90. --- a/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.h
  91. +++ b/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.h
  92. @@ -53,7 +53,11 @@
  93. class LinphoneMediaEngine : public MediaEngineInterface {
  94. public:
  95. LinphoneMediaEngine(const std::string& ringWav, const std::string& callWav);
  96. +#ifdef MEDIASTREAMER_LESS_2_14
  97. virtual ~LinphoneMediaEngine() {}
  98. +#else
  99. + ~LinphoneMediaEngine();
  100. +#endif
  101. // Implement pure virtual methods of MediaEngine.
  102. virtual bool Init() { return true; }
  103. @@ -97,6 +101,10 @@
  104. bool have_speex;
  105. bool have_gsm;
  106. +#ifndef MEDIASTREAMER_LESS_2_14
  107. + MSFactory *factory;
  108. +#endif
  109. +
  110. private:
  111. std::vector<AudioCodec> voice_codecs_;
  112. std::vector<VideoCodec> video_codecs_;
  113. @@ -110,7 +118,11 @@
  114. class LinphoneVoiceChannel : public VoiceMediaChannel {
  115. public:
  116. LinphoneVoiceChannel(LinphoneMediaEngine *eng);
  117. +#ifdef MEDIASTREAMER_LESS_2_14
  118. virtual ~LinphoneVoiceChannel();
  119. +#else
  120. + ~LinphoneVoiceChannel();
  121. +#endif
  122. // Implement pure virtual methods of VoiceMediaChannel.
  123. virtual bool SetRecvCodecs(const std::vector<AudioCodec>& codecs);
  124. diff --git a/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc b/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc
  125. --- a/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc
  126. +++ b/protocols/jabber/libjingle/talk/session/phone/linphonemediaengine.cc
  127. @@ -60,18 +60,34 @@
  128. ///////////////////////////////////////////////////////////////////////////
  129. LinphoneMediaEngine::LinphoneMediaEngine(const std::string& ringWav, const std::string& callWav) : ring_wav_(ringWav), call_wav_(callWav) {
  130. ortp_init();
  131. +#ifdef MEDIASTREAMER_LESS_2_14
  132. ms_init();
  133. +#else
  134. + factory = ms_factory_new();
  135. + ms_factory_init_voip(factory);
  136. + ms_factory_init_plugins(factory);
  137. +#endif
  138. #ifndef WIN32
  139. char * path = strdup(MSILBC_LIBRARY);
  140. char * dirc = dirname(path);
  141. +#ifdef MEDIASTREAMER_LESS_2_14
  142. ms_load_plugins(dirc);
  143. +#else
  144. + ms_factory_load_plugins(factory, dirc);
  145. +#endif
  146. free(path);
  147. #endif
  148. +#ifdef MEDIASTREAMER_LESS_2_14
  149. have_ilbc = ms_filter_codec_supported("iLBC");
  150. have_speex = ms_filter_codec_supported("speex");
  151. have_gsm = ms_filter_codec_supported("gsm");
  152. +#else
  153. + have_ilbc = ms_factory_codec_supported(factory, "iLBC");
  154. + have_speex = ms_factory_codec_supported(factory, "speex");
  155. + have_gsm = ms_factory_codec_supported(factory, "gsm");
  156. +#endif
  157. if (have_speex) {
  158. voice_codecs_.push_back(AudioCodec(110, payload_type_speex_wb.mime_type, payload_type_speex_wb.clock_rate, 0, 1, 8));
  159. @@ -88,6 +104,14 @@
  160. voice_codecs_.push_back(AudioCodec(101, payload_type_telephone_event.mime_type, payload_type_telephone_event.clock_rate, 0, 1, 1));
  161. }
  162. +#ifndef MEDIASTREAMER_LESS_2_14
  163. +LinphoneMediaEngine::~LinphoneMediaEngine() {
  164. + ms_factory_uninit_plugins(factory);
  165. + ms_factory_uninit_voip(factory);
  166. + ms_factory_destroy(factory);
  167. +}
  168. +#endif
  169. +
  170. void LinphoneMediaEngine::Terminate() {
  171. fflush(stdout);
  172. }
  173. @@ -149,15 +173,25 @@
  174. playport2 = PORT_UNUSED;
  175. #ifdef _DEBUG
  176. +#ifdef MEDIASTREAMER_LESS_2_14
  177. ortp_set_log_level_mask(ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
  178. #else
  179. + ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
  180. +#endif
  181. +#else
  182. +#ifdef MEDIASTREAMER_LESS_2_14
  183. ortp_set_log_level_mask(ORTP_FATAL);
  184. +#else
  185. + ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_FATAL);
  186. +#endif
  187. #endif
  188. #ifdef MEDIASTREAMER_LESS_2_9
  189. audio_stream_ = audio_stream_new(-1, 0); /* -1 means that function will choose some free port */
  190. -#else
  191. +#elif MEDIASTREAMER_LESS_2_14
  192. audio_stream_ = audio_stream_new(-1, -1, 0); /* -1 means that function will choose some free port */
  193. +#else
  194. + audio_stream_ = audio_stream_new(engine_->factory, -1, -1, 0); /* -1 means that function will choose some free port */
  195. #endif
  196. }
  197. @@ -272,11 +306,22 @@
  198. {
  199. StopRing();
  200. +#ifdef MEDIASTREAMER_LESS_2_14
  201. + MSSndCardManager *snd_manager = ms_snd_card_manager_get();
  202. MSSndCard *playcard = ms_snd_card_manager_get_default_playback_card(ms_snd_card_manager_get());
  203. +#else
  204. + MSSndCardManager *snd_manager = ms_factory_get_snd_card_manager(engine_->factory);
  205. + MSSndCard *playcard = ms_snd_card_manager_get_default_playback_card(snd_manager);
  206. +#endif
  207. +
  208. if (!playcard)
  209. return false;
  210. +#ifdef MEDIASTREAMER_LESS_2_14
  211. MSSndCard *captcard = ms_snd_card_manager_get_default_capture_card(ms_snd_card_manager_get());
  212. +#else
  213. + MSSndCard *captcard = ms_snd_card_manager_get_default_capture_card(snd_manager);
  214. +#endif
  215. if (!captcard)
  216. return false;
  217. @@ -333,8 +378,18 @@
  218. void LinphoneVoiceChannel::StartRing(bool bIncomingCall)
  219. {
  220. +#ifdef MEDIASTREAMER_LESS_2_14
  221. + MSSndCardManager *snd_manager = ms_snd_card_manager_get();
  222. +#else
  223. + MSSndCardManager *snd_manager = ms_factory_get_snd_card_manager(engine_->factory);
  224. +#endif
  225. +
  226. MSSndCard *sndcard = NULL;
  227. +#ifdef MEDIASTREAMER_LESS_2_14
  228. sndcard=ms_snd_card_manager_get_default_card(ms_snd_card_manager_get());
  229. +#else
  230. + sndcard=ms_snd_card_manager_get_default_card(snd_manager);
  231. +#endif
  232. if (sndcard)
  233. {
  234. if (bIncomingCall)
  235. @@ -342,7 +397,11 @@
  236. if (engine_->GetRingWav().size() > 0)
  237. {
  238. LOG(LS_VERBOSE) << "incoming ring. sound file: " << engine_->GetRingWav().c_str() << "\n";
  239. +#ifdef MEDIASTREAMER_LESS_2_14
  240. ring_stream_ = ring_start (engine_->GetRingWav().c_str(), 1, sndcard);
  241. +#else
  242. + ring_stream_ = ring_start (engine_->factory, engine_->GetRingWav().c_str(), 1, sndcard);
  243. +#endif
  244. }
  245. }
  246. else
  247. @@ -350,7 +409,11 @@
  248. if (engine_->GetCallWav().size() > 0)
  249. {
  250. LOG(LS_VERBOSE) << "outgoing ring. sound file: " << engine_->GetCallWav().c_str() << "\n";
  251. +#ifdef MEDIASTREAMER_LESS_2_14
  252. ring_stream_ = ring_start (engine_->GetCallWav().c_str(), 1, sndcard);
  253. +#else
  254. + ring_stream_ = ring_start (engine_->factory, engine_->GetCallWav().c_str(), 1, sndcard);
  255. +#endif
  256. }
  257. }
  258. }