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