mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-21 19:20:08 +02:00
Telegram: bump version
* added audio call support (experemental)
This commit is contained in:
@@ -1,425 +0,0 @@
|
||||
From 03e063f72e9495ce1974aa41b4e708abf3695796 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Fri, 25 May 2018 22:46:39 +1000
|
||||
Subject: Fix opus header path
|
||||
|
||||
|
||||
diff --git a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/OpusDecoder.h b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/OpusDecoder.h
|
||||
index 69346ee..5cd00dc 100644
|
||||
--- a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/OpusDecoder.h
|
||||
+++ b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/OpusDecoder.h
|
||||
@@ -9,7 +9,11 @@
|
||||
|
||||
|
||||
#include "MediaStreamItf.h"
|
||||
+#ifdef __HAIKU__
|
||||
+#include <opus/opus.h>
|
||||
+#else
|
||||
#include "opus.h"
|
||||
+#endif
|
||||
#include "threading.h"
|
||||
#include "BlockingQueue.h"
|
||||
#include "BufferPool.h"
|
||||
diff --git a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/OpusEncoder.h b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/OpusEncoder.h
|
||||
index aaf3da1..b86d6f6 100644
|
||||
--- a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/OpusEncoder.h
|
||||
+++ b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/OpusEncoder.h
|
||||
@@ -9,7 +9,11 @@
|
||||
|
||||
|
||||
#include "MediaStreamItf.h"
|
||||
+#ifdef __HAIKU__
|
||||
+#include <opus/opus.h>
|
||||
+#else
|
||||
#include "opus.h"
|
||||
+#endif
|
||||
#include "threading.h"
|
||||
#include "BlockingQueue.h"
|
||||
#include "BufferPool.h"
|
||||
--
|
||||
2.16.2
|
||||
|
||||
|
||||
From d135d442d303ba2cf2ed93256c2833205c31e7de Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Fri, 25 May 2018 22:49:20 +1000
|
||||
Subject: Add haiku support
|
||||
|
||||
|
||||
diff --git a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/audio/AudioInput.cpp b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/audio/AudioInput.cpp
|
||||
index 062ca06..348d13c 100644
|
||||
--- a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/audio/AudioInput.cpp
|
||||
+++ b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/audio/AudioInput.cpp
|
||||
@@ -22,6 +22,8 @@
|
||||
#elif defined(__linux__)
|
||||
#include "../os/linux/AudioInputALSA.h"
|
||||
#include "../os/linux/AudioInputPulse.h"
|
||||
+#elif defined(__HAIKU__)
|
||||
+#include "../os/haiku/AudioInputHaiku.h"
|
||||
#else
|
||||
#error "Unsupported operating system"
|
||||
#endif
|
||||
diff --git a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/audio/AudioOutput.cpp b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/audio/AudioOutput.cpp
|
||||
index da964ec..b19c5ce 100644
|
||||
--- a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/audio/AudioOutput.cpp
|
||||
+++ b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/audio/AudioOutput.cpp
|
||||
@@ -25,6 +25,8 @@
|
||||
#elif defined(__linux__)
|
||||
#include "../os/linux/AudioOutputALSA.h"
|
||||
#include "../os/linux/AudioOutputPulse.h"
|
||||
+#elif defined(__HAIKU__)
|
||||
+#include "../os/haiku/AudioOutputHaiku.h"
|
||||
#else
|
||||
#error "Unsupported operating system"
|
||||
#endif
|
||||
diff --git a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/libtgvoip.gyp b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/libtgvoip.gyp
|
||||
index 5ff19f6..9523ea3 100644
|
||||
--- a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/libtgvoip.gyp
|
||||
+++ b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/libtgvoip.gyp
|
||||
@@ -87,18 +87,12 @@
|
||||
'<(tgvoip_src_loc)/os/darwin/AudioUnitIO.h',
|
||||
'<(tgvoip_src_loc)/os/darwin/DarwinSpecific.mm',
|
||||
'<(tgvoip_src_loc)/os/darwin/DarwinSpecific.h',
|
||||
-
|
||||
- # Linux
|
||||
- '<(tgvoip_src_loc)/os/linux/AudioInputALSA.cpp',
|
||||
- '<(tgvoip_src_loc)/os/linux/AudioInputALSA.h',
|
||||
- '<(tgvoip_src_loc)/os/linux/AudioOutputALSA.cpp',
|
||||
- '<(tgvoip_src_loc)/os/linux/AudioOutputALSA.h',
|
||||
- '<(tgvoip_src_loc)/os/linux/AudioOutputPulse.cpp',
|
||||
- '<(tgvoip_src_loc)/os/linux/AudioOutputPulse.h',
|
||||
- '<(tgvoip_src_loc)/os/linux/AudioInputPulse.cpp',
|
||||
- '<(tgvoip_src_loc)/os/linux/AudioInputPulse.h',
|
||||
- '<(tgvoip_src_loc)/os/linux/PulseAudioLoader.cpp',
|
||||
- '<(tgvoip_src_loc)/os/linux/PulseAudioLoader.h',
|
||||
+
|
||||
+ # Haiku
|
||||
+ '<(tgvoip_src_loc)/os/haiku/AudioInputHaiku.cpp',
|
||||
+ '<(tgvoip_src_loc)/os/haiku/AudioInputHaiku.h',
|
||||
+ '<(tgvoip_src_loc)/os/haiku/AudioOutputHaiku.cpp',
|
||||
+ '<(tgvoip_src_loc)/os/haiku/AudioOutputHaiku.h',
|
||||
|
||||
# POSIX
|
||||
'<(tgvoip_src_loc)/os/posix/NetworkSocketPosix.cpp',
|
||||
@@ -258,6 +252,11 @@
|
||||
'sources/': [['exclude', '<(tgvoip_src_loc)/os/darwin/']],
|
||||
},
|
||||
],
|
||||
+ [
|
||||
+ '"<(OS)" != "haiku"', {
|
||||
+ 'sources/': [['exclude', '<(tgvoip_src_loc)/os/haiku/']],
|
||||
+ },
|
||||
+ ],
|
||||
[
|
||||
'"<(OS)" != "linux"', {
|
||||
'sources/': [['exclude', '<(tgvoip_src_loc)/os/linux/']],
|
||||
@@ -377,6 +376,22 @@
|
||||
},
|
||||
},
|
||||
],
|
||||
+ [
|
||||
+ '"<(OS)" == "haiku"', {
|
||||
+ 'defines': [
|
||||
+ 'WEBRTC_POSIX',
|
||||
+ ],
|
||||
+ 'cflags_cc': [
|
||||
+ '-msse2',
|
||||
+ '-std=gnu++14',
|
||||
+ ],
|
||||
+ 'direct_dependent_settings': {
|
||||
+ 'libraries': [
|
||||
+
|
||||
+ ],
|
||||
+ },
|
||||
+ },
|
||||
+ ],
|
||||
[
|
||||
'"<(OS)" == "linux"', {
|
||||
'defines': [
|
||||
diff --git a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/haiku/AudioInputHaiku.cpp b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/haiku/AudioInputHaiku.cpp
|
||||
new file mode 100644
|
||||
index 0000000..7651b3d
|
||||
--- /dev/null
|
||||
+++ b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/haiku/AudioInputHaiku.cpp
|
||||
@@ -0,0 +1,52 @@
|
||||
+//
|
||||
+// libtgvoip is free and unencumbered public domain software.
|
||||
+// For more information, see http://unlicense.org or the UNLICENSE file
|
||||
+// you should have received with this source code distribution.
|
||||
+//
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+#include <assert.h>
|
||||
+#include <dlfcn.h>
|
||||
+#include "AudioInputHaiku.h"
|
||||
+#include "../../logging.h"
|
||||
+#include "../../VoIPController.h"
|
||||
+
|
||||
+using namespace tgvoip::audio;
|
||||
+
|
||||
+
|
||||
+AudioInputHaiku::AudioInputHaiku(std::string devID){
|
||||
+ isRecording=false;
|
||||
+ failed=true;
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+AudioInputHaiku::~AudioInputHaiku(){
|
||||
+}
|
||||
+
|
||||
+void AudioInputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){
|
||||
+
|
||||
+}
|
||||
+
|
||||
+void AudioInputHaiku::Start(){
|
||||
+ if(failed || isRecording)
|
||||
+ return;
|
||||
+
|
||||
+ isRecording=true;
|
||||
+}
|
||||
+
|
||||
+void AudioInputHaiku::Stop(){
|
||||
+ if(!isRecording)
|
||||
+ return;
|
||||
+
|
||||
+ isRecording=false;
|
||||
+}
|
||||
+
|
||||
+void AudioInputHaiku::RunThread(void* arg){
|
||||
+}
|
||||
+
|
||||
+void AudioInputHaiku::SetCurrentDevice(std::string devID){
|
||||
+}
|
||||
+
|
||||
+void AudioInputHaiku::EnumerateDevices(std::vector<AudioInputDevice>& devs){
|
||||
+}
|
||||
diff --git a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/haiku/AudioInputHaiku.h b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/haiku/AudioInputHaiku.h
|
||||
new file mode 100644
|
||||
index 0000000..2980e71
|
||||
--- /dev/null
|
||||
+++ b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/haiku/AudioInputHaiku.h
|
||||
@@ -0,0 +1,35 @@
|
||||
+//
|
||||
+// libtgvoip is free and unencumbered public domain software.
|
||||
+// For more information, see http://unlicense.org or the UNLICENSE file
|
||||
+// you should have received with this source code distribution.
|
||||
+//
|
||||
+
|
||||
+#ifndef LIBTGVOIP_AUDIOINPUTHAIKU_H
|
||||
+#define LIBTGVOIP_AUDIOINPUTHAIKU_H
|
||||
+
|
||||
+#include "../../audio/AudioInput.h"
|
||||
+#include "../../threading.h"
|
||||
+
|
||||
+namespace tgvoip{
|
||||
+namespace audio{
|
||||
+
|
||||
+class AudioInputHaiku : public AudioInput{
|
||||
+
|
||||
+public:
|
||||
+ AudioInputHaiku(std::string devID);
|
||||
+ virtual ~AudioInputHaiku();
|
||||
+ virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels);
|
||||
+ virtual void Start();
|
||||
+ virtual void Stop();
|
||||
+ virtual void SetCurrentDevice(std::string devID);
|
||||
+ static void EnumerateDevices(std::vector<AudioInputDevice>& devs);
|
||||
+
|
||||
+private:
|
||||
+ void RunThread(void* arg);
|
||||
+ bool isRecording;
|
||||
+};
|
||||
+
|
||||
+}
|
||||
+}
|
||||
+
|
||||
+#endif //LIBTGVOIP_AUDIOINPUTALSA_H
|
||||
diff --git a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/haiku/AudioOutputHaiku.cpp b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/haiku/AudioOutputHaiku.cpp
|
||||
new file mode 100644
|
||||
index 0000000..2233257
|
||||
--- /dev/null
|
||||
+++ b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/haiku/AudioOutputHaiku.cpp
|
||||
@@ -0,0 +1,54 @@
|
||||
+//
|
||||
+// libtgvoip is free and unencumbered public domain software.
|
||||
+// For more information, see http://unlicense.org or the UNLICENSE file
|
||||
+// you should have received with this source code distribution.
|
||||
+//
|
||||
+
|
||||
+
|
||||
+#include <assert.h>
|
||||
+#include <dlfcn.h>
|
||||
+#include "AudioOutputHaiku.h"
|
||||
+#include "../../logging.h"
|
||||
+#include "../../VoIPController.h"
|
||||
+
|
||||
+using namespace tgvoip::audio;
|
||||
+
|
||||
+AudioOutputHaiku::AudioOutputHaiku(std::string devID){
|
||||
+ isPlaying=false;
|
||||
+ failed=true;
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+AudioOutputHaiku::~AudioOutputHaiku(){
|
||||
+}
|
||||
+
|
||||
+void AudioOutputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){
|
||||
+
|
||||
+}
|
||||
+
|
||||
+void AudioOutputHaiku::Start(){
|
||||
+ if(failed || isPlaying)
|
||||
+ return;
|
||||
+
|
||||
+ isPlaying=true;
|
||||
+}
|
||||
+
|
||||
+void AudioOutputHaiku::Stop(){
|
||||
+ if(!isPlaying)
|
||||
+ return;
|
||||
+
|
||||
+ isPlaying=false;
|
||||
+}
|
||||
+
|
||||
+bool AudioOutputHaiku::IsPlaying(){
|
||||
+ return isPlaying;
|
||||
+}
|
||||
+
|
||||
+void AudioOutputHaiku::RunThread(void* arg){
|
||||
+}
|
||||
+
|
||||
+void AudioOutputHaiku::SetCurrentDevice(std::string devID){
|
||||
+}
|
||||
+
|
||||
+void AudioOutputHaiku::EnumerateDevices(std::vector<AudioOutputDevice>& devs){
|
||||
+}
|
||||
diff --git a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/haiku/AudioOutputHaiku.h b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/haiku/AudioOutputHaiku.h
|
||||
new file mode 100644
|
||||
index 0000000..e368b05
|
||||
--- /dev/null
|
||||
+++ b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/haiku/AudioOutputHaiku.h
|
||||
@@ -0,0 +1,35 @@
|
||||
+//
|
||||
+// libtgvoip is free and unencumbered public domain software.
|
||||
+// For more information, see http://unlicense.org or the UNLICENSE file
|
||||
+// you should have received with this source code distribution.
|
||||
+//
|
||||
+
|
||||
+#ifndef LIBTGVOIP_AUDIOOUTPUTHAIKU_H
|
||||
+#define LIBTGVOIP_AUDIOOUTPUTHAIKU_H
|
||||
+
|
||||
+#include "../../audio/AudioOutput.h"
|
||||
+#include "../../threading.h"
|
||||
+
|
||||
+namespace tgvoip{
|
||||
+namespace audio{
|
||||
+
|
||||
+class AudioOutputHaiku : public AudioOutput{
|
||||
+public:
|
||||
+ AudioOutputHaiku(std::string devID);
|
||||
+ virtual ~AudioOutputHaiku();
|
||||
+ virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels);
|
||||
+ virtual void Start();
|
||||
+ virtual void Stop();
|
||||
+ virtual bool IsPlaying();
|
||||
+ virtual void SetCurrentDevice(std::string devID);
|
||||
+ static void EnumerateDevices(std::vector<AudioOutputDevice>& devs);
|
||||
+
|
||||
+private:
|
||||
+ void RunThread(void* arg);
|
||||
+ bool isPlaying;
|
||||
+};
|
||||
+
|
||||
+}
|
||||
+}
|
||||
+
|
||||
+#endif //LIBTGVOIP_AudioOutputHaiku_H
|
||||
diff --git a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/posix/NetworkSocketPosix.cpp b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/posix/NetworkSocketPosix.cpp
|
||||
index 2bacfa4..a2e160f 100644
|
||||
--- a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/posix/NetworkSocketPosix.cpp
|
||||
+++ b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/os/posix/NetworkSocketPosix.cpp
|
||||
@@ -47,6 +47,7 @@ NetworkSocketPosix::~NetworkSocketPosix(){
|
||||
}
|
||||
|
||||
void NetworkSocketPosix::SetMaxPriority(){
|
||||
+#ifndef __HAIKU__
|
||||
#ifdef __APPLE__
|
||||
int prio=NET_SERVICE_TYPE_VO;
|
||||
int res=setsockopt(fd, SOL_SOCKET, SO_NET_SERVICE_TYPE, &prio, sizeof(prio));
|
||||
@@ -65,6 +66,7 @@ void NetworkSocketPosix::SetMaxPriority(){
|
||||
LOGE("error setting ip tos: %d / %s", errno, strerror(errno));
|
||||
}
|
||||
#endif
|
||||
+#endif //__HAIKU__
|
||||
}
|
||||
|
||||
void NetworkSocketPosix::Send(NetworkPacket *packet){
|
||||
@@ -306,6 +308,10 @@ void NetworkSocketPosix::OnActiveInterfaceChanged(){
|
||||
}
|
||||
|
||||
std::string NetworkSocketPosix::GetLocalInterfaceInfo(IPv4Address *v4addr, IPv6Address *v6addr){
|
||||
+#ifdef __HAIKU__
|
||||
+ std::string name="";
|
||||
+ return name;
|
||||
+#else
|
||||
#ifdef __ANDROID__
|
||||
char sdkNum[PROP_VALUE_MAX];
|
||||
__system_property_get("ro.build.version.sdk", sdkNum);
|
||||
@@ -397,6 +403,7 @@ std::string NetworkSocketPosix::GetLocalInterfaceInfo(IPv4Address *v4addr, IPv6A
|
||||
close(sd);
|
||||
}
|
||||
return name;
|
||||
+#endif
|
||||
}
|
||||
|
||||
uint16_t NetworkSocketPosix::GetLocalPort(){
|
||||
diff --git a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/threading.h b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/threading.h
|
||||
index 0b4933c..adc69b5 100644
|
||||
--- a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/threading.h
|
||||
+++ b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/threading.h
|
||||
@@ -33,7 +33,7 @@ namespace tgvoip{
|
||||
};
|
||||
}
|
||||
|
||||
-#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))
|
||||
+#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
|
||||
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
@@ -94,11 +94,13 @@ namespace tgvoip{
|
||||
static void* ActualEntryPoint(void* arg){
|
||||
Thread* self=reinterpret_cast<Thread*>(arg);
|
||||
if(self->name){
|
||||
+#ifndef __HAIKU__
|
||||
#ifndef __APPLE__
|
||||
pthread_setname_np(self->thread, self->name);
|
||||
#else
|
||||
pthread_setname_np(self->name);
|
||||
#endif
|
||||
+#endif //__HAIKU__
|
||||
}
|
||||
self->entry->Invoke(self->arg);
|
||||
return NULL;
|
||||
diff --git a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/webrtc_dsp/webrtc/common_audio/signal_processing/spl_init.c b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/webrtc_dsp/webrtc/common_audio/signal_processing/spl_init.c
|
||||
index c9c4e65..9d93596 100644
|
||||
--- a/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/webrtc_dsp/webrtc/common_audio/signal_processing/spl_init.c
|
||||
+++ b/libtgvoip-00851dc6346d9c1e02d09885029e5ba32a4094e8/webrtc_dsp/webrtc/common_audio/signal_processing/spl_init.c
|
||||
@@ -99,7 +99,12 @@ static void once(void (*func)(void)) {
|
||||
static pthread_once_t lock = PTHREAD_ONCE_INIT;
|
||||
pthread_once(&lock, func);
|
||||
}
|
||||
-
|
||||
+#elif defined(__HAIKU__)
|
||||
+#include <pthread.h>
|
||||
+static void once(void (*func)(void)) {
|
||||
+ static pthread_once_t lock = PTHREAD_ONCE_INIT;
|
||||
+ pthread_once(&lock, func);
|
||||
+}
|
||||
#elif defined(_WIN32)
|
||||
#include <windows.h>
|
||||
|
||||
--
|
||||
2.16.2
|
||||
|
||||
@@ -0,0 +1,824 @@
|
||||
From 1a5c29603f7145f440c46190e69e1c5b0bbc7e3e Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Sun, 10 Jun 2018 11:08:42 +1000
|
||||
Subject: Fix for using external opus lib
|
||||
|
||||
|
||||
diff --git a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/OpusDecoder.h b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/OpusDecoder.h
|
||||
index 6425c97..848b930 100644
|
||||
--- a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/OpusDecoder.h
|
||||
+++ b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/OpusDecoder.h
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
|
||||
#include "MediaStreamItf.h"
|
||||
-#include "opus.h"
|
||||
+#include <opus/opus.h>
|
||||
#include "threading.h"
|
||||
#include "BlockingQueue.h"
|
||||
#include "Buffers.h"
|
||||
diff --git a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/OpusEncoder.h b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/OpusEncoder.h
|
||||
index 4726f6b..92d8c33 100644
|
||||
--- a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/OpusEncoder.h
|
||||
+++ b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/OpusEncoder.h
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
|
||||
#include "MediaStreamItf.h"
|
||||
-#include "opus.h"
|
||||
+#include <opus/opus.h>
|
||||
#include "threading.h"
|
||||
#include "BlockingQueue.h"
|
||||
#include "Buffers.h"
|
||||
--
|
||||
2.16.4
|
||||
|
||||
|
||||
From bfee792f8cd75f2096e20551c5b5230e85489c91 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Sun, 10 Jun 2018 11:10:12 +1000
|
||||
Subject: Add haiku modules
|
||||
|
||||
|
||||
diff --git a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/VoIPController.cpp b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/VoIPController.cpp
|
||||
index 4a1f63d..1264b01 100644
|
||||
--- a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/VoIPController.cpp
|
||||
+++ b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/VoIPController.cpp
|
||||
@@ -8,6 +8,9 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
+#ifdef __HAIKU__
|
||||
+#include <OS.h>
|
||||
+#endif
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
@@ -2403,6 +2406,10 @@ double VoIPController::GetCurrentTime(){
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return ts.tv_sec+(double)ts.tv_nsec/1000000000.0;
|
||||
+#elif defined(__HAIKU__)
|
||||
+ struct timeval tm;
|
||||
+ gettimeofday(&tm, NULL);
|
||||
+ return tm.tv_sec+(double)tm.tv_usec/1000000.0;
|
||||
#elif defined(__APPLE__)
|
||||
static pthread_once_t token = PTHREAD_ONCE_INIT;
|
||||
pthread_once(&token, &initMachTimestart);
|
||||
diff --git a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/audio/AudioInput.cpp b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/audio/AudioInput.cpp
|
||||
index 062ca06..887889e 100644
|
||||
--- a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/audio/AudioInput.cpp
|
||||
+++ b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/audio/AudioInput.cpp
|
||||
@@ -22,6 +22,8 @@
|
||||
#elif defined(__linux__)
|
||||
#include "../os/linux/AudioInputALSA.h"
|
||||
#include "../os/linux/AudioInputPulse.h"
|
||||
+#elif defined(__HAIKU__)
|
||||
+#include "../os/haiku/AudioInputHaiku.h"
|
||||
#else
|
||||
#error "Unsupported operating system"
|
||||
#endif
|
||||
@@ -64,6 +66,8 @@ AudioInput *AudioInput::Create(std::string deviceID, void* platformSpecific){
|
||||
LOGW("in: PulseAudio available but not working; trying ALSA");
|
||||
}
|
||||
return new AudioInputALSA(deviceID);
|
||||
+#elif defined(__HAIKU__)
|
||||
+ return new AudioInputHaiku(deviceID);
|
||||
#endif
|
||||
}
|
||||
|
||||
diff --git a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/audio/AudioOutput.cpp b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/audio/AudioOutput.cpp
|
||||
index 109d24d..c3cc014 100644
|
||||
--- a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/audio/AudioOutput.cpp
|
||||
+++ b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/audio/AudioOutput.cpp
|
||||
@@ -25,6 +25,8 @@
|
||||
#elif defined(__linux__)
|
||||
#include "../os/linux/AudioOutputALSA.h"
|
||||
#include "../os/linux/AudioOutputPulse.h"
|
||||
+#elif defined(__HAIKU__)
|
||||
+#include "../os/haiku/AudioOutputHaiku.h"
|
||||
#else
|
||||
#error "Unsupported operating system"
|
||||
#endif
|
||||
@@ -59,6 +61,9 @@ std::unique_ptr<AudioOutput> AudioOutput::Create(std::string deviceID, void* pla
|
||||
LOGW("out: PulseAudio available but not working; trying ALSA");
|
||||
}
|
||||
return std::unique_ptr<AudioOutput>(new AudioOutputALSA(deviceID));
|
||||
+#elif defined(__HAIKU__)
|
||||
+ LOGW("out: MediaKitAudio enabled");
|
||||
+ return std::unique_ptr<AudioOutput>(new AudioOutputHaiku(deviceID));
|
||||
#endif
|
||||
}
|
||||
|
||||
diff --git a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/libtgvoip.gyp b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/libtgvoip.gyp
|
||||
index f236987..24f017b 100644
|
||||
--- a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/libtgvoip.gyp
|
||||
+++ b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/libtgvoip.gyp
|
||||
@@ -100,6 +100,14 @@
|
||||
'<(tgvoip_src_loc)/os/linux/PulseAudioLoader.cpp',
|
||||
'<(tgvoip_src_loc)/os/linux/PulseAudioLoader.h',
|
||||
|
||||
+ # Haiku
|
||||
+ '<(tgvoip_src_loc)/os/haiku/AudioInputHaiku.cpp',
|
||||
+ '<(tgvoip_src_loc)/os/haiku/AudioInputHaiku.h',
|
||||
+ '<(tgvoip_src_loc)/os/haiku/AudioOutputHaiku.cpp',
|
||||
+ '<(tgvoip_src_loc)/os/haiku/AudioOutputHaiku.h',
|
||||
+ '<(tgvoip_src_loc)/os/haiku/RingBuffer.cpp',
|
||||
+ '<(tgvoip_src_loc)/os/haiku/RingBuffer.h',
|
||||
+
|
||||
# POSIX
|
||||
'<(tgvoip_src_loc)/os/posix/NetworkSocketPosix.cpp',
|
||||
'<(tgvoip_src_loc)/os/posix/NetworkSocketPosix.h',
|
||||
@@ -253,6 +261,11 @@
|
||||
'sources/': [['exclude', '<(tgvoip_src_loc)/os/posix/']],
|
||||
},
|
||||
],
|
||||
+ [
|
||||
+ '"<(OS)" != "haiku"', {
|
||||
+ 'sources/': [['exclude', '<(tgvoip_src_loc)/os/haiku/']],
|
||||
+ },
|
||||
+ ],
|
||||
[
|
||||
'"<(OS)" != "mac"', {
|
||||
'sources/': [['exclude', '<(tgvoip_src_loc)/os/darwin/']],
|
||||
@@ -378,6 +391,21 @@
|
||||
},
|
||||
],
|
||||
[
|
||||
+ '"<(OS)" == "haiku"', {
|
||||
+ 'defines': [
|
||||
+ 'WEBRTC_POSIX',
|
||||
+ ],
|
||||
+ 'cflags_cc': [
|
||||
+ '-msse2',
|
||||
+ '-std=gnu++14',
|
||||
+ ],
|
||||
+ 'direct_dependent_settings': {
|
||||
+ 'libraries': [
|
||||
+
|
||||
+ ],
|
||||
+ },
|
||||
+ },
|
||||
+ ], [
|
||||
'"<(OS)" == "linux"', {
|
||||
'defines': [
|
||||
'WEBRTC_POSIX',
|
||||
diff --git a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/AudioInputHaiku.cpp b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/AudioInputHaiku.cpp
|
||||
new file mode 100644
|
||||
index 0000000..ce54b6e
|
||||
--- /dev/null
|
||||
+++ b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/AudioInputHaiku.cpp
|
||||
@@ -0,0 +1,198 @@
|
||||
+//
|
||||
+// libtgvoip is free and unencumbered public domain software.
|
||||
+// For more information, see http://unlicense.org or the UNLICENSE file
|
||||
+// you should have received with this source code distribution.
|
||||
+//
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+#include <assert.h>
|
||||
+#include <dlfcn.h>
|
||||
+#include "AudioInputHaiku.h"
|
||||
+#include "../../logging.h"
|
||||
+#include "../../VoIPController.h"
|
||||
+
|
||||
+#include "RingBuffer.h"
|
||||
+
|
||||
+#define BUFFER_SIZE 960
|
||||
+
|
||||
+using namespace tgvoip::audio;
|
||||
+
|
||||
+void RecordFile(void* cookie, bigtime_t timestamp, void* data, size_t size, const media_format &format)
|
||||
+{
|
||||
+ AudioInputHaiku *obj = (AudioInputHaiku*)cookie;
|
||||
+ if (!obj->IsRecording())
|
||||
+ return;
|
||||
+ if (format.u.raw_audio.channel_count == 1) {
|
||||
+ obj->fRingBuffer->Write((unsigned char*)data, size);
|
||||
+ } else if (format.u.raw_audio.channel_count == 2) {
|
||||
+ unsigned char *s = (unsigned char*)data;
|
||||
+ for (int i=0; i<size/4; i++, s+=4)
|
||||
+ obj->fRingBuffer->Write(s, 2);
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+void NotifyRecordFile(void * cookie, BMediaRecorder::notification code, ...)
|
||||
+{
|
||||
+ if (code == BMediaRecorder::B_WILL_STOP) {
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+AudioInputHaiku::AudioInputHaiku(std::string devID)
|
||||
+{
|
||||
+ fRecorder = NULL;
|
||||
+ fRingBuffer = NULL;
|
||||
+ isRecording = false;
|
||||
+
|
||||
+ status_t error;
|
||||
+
|
||||
+ fRoster = BMediaRoster::Roster(&error);
|
||||
+ if (!fRoster) {
|
||||
+ failed=true;
|
||||
+ return;
|
||||
+ }
|
||||
+ error = fRoster->GetAudioInput(&fAudioInputNode);
|
||||
+ if (error < B_OK) {
|
||||
+ failed=true;
|
||||
+ return;
|
||||
+ }
|
||||
+ error = fRoster->GetAudioMixer(&fAudioMixerNode);
|
||||
+ if (error < B_OK) {
|
||||
+ failed=true;
|
||||
+ return;
|
||||
+ }
|
||||
+ fRecorder = new BMediaRecorder("Telegram", B_MEDIA_RAW_AUDIO);
|
||||
+ if (fRecorder->InitCheck() < B_OK) {
|
||||
+ failed=true;
|
||||
+ return;
|
||||
+ }
|
||||
+ media_format output_format;
|
||||
+ output_format.type = B_MEDIA_RAW_AUDIO;
|
||||
+ output_format.u.raw_audio = media_raw_audio_format::wildcard;
|
||||
+ output_format.u.raw_audio.channel_count = 1;
|
||||
+ fRecorder->SetAcceptedFormat(output_format);
|
||||
+
|
||||
+ const int maxInputCount = 64;
|
||||
+ dormant_node_info dni[maxInputCount];
|
||||
+
|
||||
+ int32 real_count = maxInputCount;
|
||||
+
|
||||
+ error = fRoster->GetDormantNodes(dni, &real_count, 0, &output_format, 0, B_BUFFER_PRODUCER | B_PHYSICAL_INPUT);
|
||||
+ if (real_count > maxInputCount)
|
||||
+ real_count = maxInputCount;
|
||||
+ char selected_name[B_MEDIA_NAME_LENGTH] = "Default input";
|
||||
+
|
||||
+ for (int i = 0; i < real_count; i++) {
|
||||
+ media_node_id ni[12];
|
||||
+ int32 ni_count = 12;
|
||||
+ error = fRoster->GetInstancesFor(dni[i].addon, dni[i].flavor_id, ni, &ni_count);
|
||||
+ if (error == B_OK) {
|
||||
+ for (int j = 0; j < ni_count; j++) {
|
||||
+ if (ni[j] == fAudioInputNode.node) {
|
||||
+ strcpy(selected_name, dni[i].name);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ media_output audioOutput;
|
||||
+ if (!fRecorder->IsConnected()) {
|
||||
+ int32 count = 0;
|
||||
+ error = fRoster->GetFreeOutputsFor(fAudioInputNode, &audioOutput, 1, &count, B_MEDIA_RAW_AUDIO);
|
||||
+ if (error < B_OK) {
|
||||
+ failed=true;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (count < 1) {
|
||||
+ failed=true;
|
||||
+ return;
|
||||
+ }
|
||||
+ fRecordFormat.u.raw_audio = audioOutput.format.u.raw_audio;
|
||||
+ } else {
|
||||
+ fRecordFormat.u.raw_audio = fRecorder->AcceptedFormat().u.raw_audio;
|
||||
+ }
|
||||
+ fRecordFormat.type = B_MEDIA_RAW_AUDIO;
|
||||
+
|
||||
+ error = fRecorder->SetHooks(RecordFile, NotifyRecordFile, this);
|
||||
+ if (error < B_OK) {
|
||||
+ failed=true;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (!fRecorder->IsConnected()) {
|
||||
+ error = fRecorder->Connect(fAudioInputNode, &audioOutput, &fRecordFormat);
|
||||
+ if (error < B_OK) {
|
||||
+ fRecorder->SetHooks(NULL, NULL, NULL);
|
||||
+ failed=true;
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ fRingBuffer = new RingBuffer(BUFFER_SIZE * 2 * 3);
|
||||
+ if (fRingBuffer->InitCheck() != B_OK) {
|
||||
+ failed=true;
|
||||
+ return;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+AudioInputHaiku::~AudioInputHaiku(){
|
||||
+ if (fRecorder != NULL) {
|
||||
+ if (fRecorder->InitCheck() == B_OK) {
|
||||
+ if (fRecorder->IsConnected())
|
||||
+ fRecorder->Disconnect();
|
||||
+ }
|
||||
+ delete fRecorder;
|
||||
+ }
|
||||
+ if (fRingBuffer != NULL)
|
||||
+ delete fRingBuffer;
|
||||
+}
|
||||
+
|
||||
+void AudioInputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){
|
||||
+
|
||||
+}
|
||||
+
|
||||
+bool AudioInputHaiku::IsRecording(){
|
||||
+ return isRecording;
|
||||
+}
|
||||
+
|
||||
+void AudioInputHaiku::Start(){
|
||||
+ if(failed || isRecording)
|
||||
+ return;
|
||||
+
|
||||
+ isRecording=true;
|
||||
+
|
||||
+ thread = new Thread(new MethodPointer<AudioInputHaiku>(&AudioInputHaiku::RunThread, this), NULL);
|
||||
+ thread->SetName("AudioInputHaiku");
|
||||
+ thread->Start();
|
||||
+
|
||||
+ fRecorder->Start();
|
||||
+}
|
||||
+
|
||||
+void AudioInputHaiku::Stop(){
|
||||
+ if(!isRecording)
|
||||
+ return;
|
||||
+
|
||||
+ isRecording=false;
|
||||
+
|
||||
+ fRecorder->Stop();
|
||||
+
|
||||
+ thread->Join();
|
||||
+ delete thread;
|
||||
+ thread=NULL;
|
||||
+}
|
||||
+
|
||||
+void AudioInputHaiku::RunThread(void* arg){
|
||||
+ unsigned char buffer[BUFFER_SIZE*2];
|
||||
+ while (isRecording){
|
||||
+ if (fRingBuffer->GetReadAvailable() >= sizeof(buffer)) {
|
||||
+ int readed = fRingBuffer->Read(buffer, sizeof(buffer));
|
||||
+ if (readed < sizeof(buffer))
|
||||
+ memset(buffer + readed, 0, sizeof(buffer) - readed);
|
||||
+ InvokeCallback(buffer, sizeof(buffer));
|
||||
+ } else
|
||||
+ snooze(100);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/AudioInputHaiku.h b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/AudioInputHaiku.h
|
||||
new file mode 100644
|
||||
index 0000000..80573df
|
||||
--- /dev/null
|
||||
+++ b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/AudioInputHaiku.h
|
||||
@@ -0,0 +1,57 @@
|
||||
+//
|
||||
+// libtgvoip is free and unencumbered public domain software.
|
||||
+// For more information, see http://unlicense.org or the UNLICENSE file
|
||||
+// you should have received with this source code distribution.
|
||||
+//
|
||||
+
|
||||
+#ifndef LIBTGVOIP_AUDIOINPUTHAIKU_H
|
||||
+#define LIBTGVOIP_AUDIOINPUTHAIKU_H
|
||||
+
|
||||
+#include "../../audio/AudioInput.h"
|
||||
+#include "../../threading.h"
|
||||
+
|
||||
+#include <OS.h>
|
||||
+#include <MediaFile.h>
|
||||
+#include <MediaNode.h>
|
||||
+#include <MediaRecorder.h>
|
||||
+#include <MediaTrack.h>
|
||||
+#include <MediaRoster.h>
|
||||
+#include <TimeSource.h>
|
||||
+#include <NodeInfo.h>
|
||||
+#include <MediaAddOn.h>
|
||||
+
|
||||
+#include "RingBuffer.h"
|
||||
+
|
||||
+namespace tgvoip{
|
||||
+namespace audio{
|
||||
+
|
||||
+class AudioInputHaiku : public AudioInput{
|
||||
+
|
||||
+public:
|
||||
+ AudioInputHaiku(std::string devID);
|
||||
+ virtual ~AudioInputHaiku();
|
||||
+ virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels);
|
||||
+ virtual void Start();
|
||||
+ virtual void Stop();
|
||||
+ virtual bool IsRecording();
|
||||
+
|
||||
+ RingBuffer *fRingBuffer;
|
||||
+private:
|
||||
+ void RunThread(void* arg);
|
||||
+
|
||||
+ bool isConfigured;
|
||||
+ bool isRecording;
|
||||
+
|
||||
+ BMediaRoster * fRoster;
|
||||
+ BMediaRecorder * fRecorder;
|
||||
+ media_format fRecordFormat;
|
||||
+ media_node fAudioInputNode;
|
||||
+ media_node fAudioMixerNode;
|
||||
+
|
||||
+ Thread* thread;
|
||||
+};
|
||||
+
|
||||
+}
|
||||
+}
|
||||
+
|
||||
+#endif //LIBTGVOIP_AUDIOINPUTALSA_H
|
||||
diff --git a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/AudioOutputHaiku.cpp b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/AudioOutputHaiku.cpp
|
||||
new file mode 100644
|
||||
index 0000000..4454323
|
||||
--- /dev/null
|
||||
+++ b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/AudioOutputHaiku.cpp
|
||||
@@ -0,0 +1,101 @@
|
||||
+//
|
||||
+// libtgvoip is free and unencumbered public domain software.
|
||||
+// For more information, see http://unlicense.org or the UNLICENSE file
|
||||
+// you should have received with this source code distribution.
|
||||
+//
|
||||
+
|
||||
+
|
||||
+#include <assert.h>
|
||||
+#include <dlfcn.h>
|
||||
+#include "AudioOutputHaiku.h"
|
||||
+#include "../../logging.h"
|
||||
+#include "../../VoIPController.h"
|
||||
+
|
||||
+#define BUFFER_SIZE 960
|
||||
+
|
||||
+using namespace tgvoip::audio;
|
||||
+
|
||||
+static void playerProc(void *cookie, void *buffer, size_t len, const media_raw_audio_format &format)
|
||||
+{
|
||||
+ AudioOutputHaiku *obj = (AudioOutputHaiku*)cookie;
|
||||
+ obj->InvokeCallback((unsigned char*)buffer, len);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+AudioOutputHaiku::AudioOutputHaiku(std::string devID){
|
||||
+ soundPlayer = NULL;
|
||||
+ isPlaying = false;
|
||||
+ isConfigured = false;
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+AudioOutputHaiku::~AudioOutputHaiku(){
|
||||
+ if (isConfigured) {
|
||||
+ if (soundPlayer != NULL) {
|
||||
+ soundPlayer->Stop();
|
||||
+ delete soundPlayer;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void AudioOutputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){
|
||||
+ media_raw_audio_format mediaKitFormat = {
|
||||
+ (float)sampleRate,
|
||||
+ (uint32)channels,
|
||||
+ media_raw_audio_format::B_AUDIO_SHORT,
|
||||
+ B_MEDIA_LITTLE_ENDIAN,
|
||||
+ (uint32)BUFFER_SIZE * 2 * channels
|
||||
+ };
|
||||
+
|
||||
+ switch (bitsPerSample) {
|
||||
+ case 8:
|
||||
+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_CHAR;
|
||||
+ break;
|
||||
+ case 16:
|
||||
+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_SHORT;
|
||||
+ break;
|
||||
+ case 32:
|
||||
+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_INT;
|
||||
+ break;
|
||||
+ default:
|
||||
+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_SHORT;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ soundPlayer = new BSoundPlayer(&mediaKitFormat, "Telegram", playerProc, NULL, (void*)this);
|
||||
+
|
||||
+ if(soundPlayer->InitCheck() != B_OK) {
|
||||
+ delete soundPlayer;
|
||||
+ soundPlayer = NULL;
|
||||
+ isPlaying = false;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ isConfigured = true;
|
||||
+}
|
||||
+
|
||||
+void AudioOutputHaiku::Start(){
|
||||
+ if(soundPlayer == NULL || isPlaying)
|
||||
+ return;
|
||||
+
|
||||
+ soundPlayer->Start();
|
||||
+ soundPlayer->SetHasData(true);
|
||||
+
|
||||
+ isPlaying=true;
|
||||
+}
|
||||
+
|
||||
+void AudioOutputHaiku::Stop(){
|
||||
+ if(!isPlaying)
|
||||
+ return;
|
||||
+
|
||||
+ soundPlayer->Stop();
|
||||
+ isPlaying=false;
|
||||
+}
|
||||
+
|
||||
+bool AudioOutputHaiku::IsPlaying(){
|
||||
+ return isPlaying;
|
||||
+}
|
||||
+
|
||||
+float AudioOutputHaiku::GetLevel(){
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/AudioOutputHaiku.h b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/AudioOutputHaiku.h
|
||||
new file mode 100644
|
||||
index 0000000..6880709
|
||||
--- /dev/null
|
||||
+++ b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/AudioOutputHaiku.h
|
||||
@@ -0,0 +1,36 @@
|
||||
+//
|
||||
+// libtgvoip is free and unencumbered public domain software.
|
||||
+// For more information, see http://unlicense.org or the UNLICENSE file
|
||||
+// you should have received with this source code distribution.
|
||||
+//
|
||||
+
|
||||
+#ifndef LIBTGVOIP_AUDIOOUTPUTHAIKU_H
|
||||
+#define LIBTGVOIP_AUDIOOUTPUTHAIKU_H
|
||||
+
|
||||
+#include "../../audio/AudioOutput.h"
|
||||
+#include "../../threading.h"
|
||||
+
|
||||
+#include <SoundPlayer.h>
|
||||
+
|
||||
+namespace tgvoip{
|
||||
+namespace audio{
|
||||
+
|
||||
+class AudioOutputHaiku : public AudioOutput{
|
||||
+public:
|
||||
+ AudioOutputHaiku(std::string devID);
|
||||
+ virtual ~AudioOutputHaiku();
|
||||
+ virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels);
|
||||
+ virtual void Start();
|
||||
+ virtual void Stop();
|
||||
+ virtual bool IsPlaying() override;
|
||||
+ virtual float GetLevel() override;
|
||||
+private:
|
||||
+ bool isPlaying;
|
||||
+ bool isConfigured;
|
||||
+ BSoundPlayer *soundPlayer;
|
||||
+};
|
||||
+
|
||||
+}
|
||||
+}
|
||||
+
|
||||
+#endif //LIBTGVOIP_AudioOutputHaiku_H
|
||||
diff --git a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/RingBuffer.cpp b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/RingBuffer.cpp
|
||||
new file mode 100644
|
||||
index 0000000..43236d3
|
||||
--- /dev/null
|
||||
+++ b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/RingBuffer.cpp
|
||||
@@ -0,0 +1,130 @@
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <OS.h>
|
||||
+
|
||||
+#include "RingBuffer.h"
|
||||
+
|
||||
+RingBuffer::RingBuffer( int size )
|
||||
+{
|
||||
+ initialized = false;
|
||||
+ Buffer = new unsigned char[size];
|
||||
+ if(Buffer!=NULL) {
|
||||
+ memset( Buffer, 0, size );
|
||||
+ BufferSize = size;
|
||||
+ } else {
|
||||
+ BufferSize = 0;
|
||||
+ }
|
||||
+ reader = 0;
|
||||
+ writer = 0;
|
||||
+ writeBytesAvailable = size;
|
||||
+ if((locker=create_sem(1,"locker")) >= B_OK) {
|
||||
+ initialized = true;
|
||||
+ } else {
|
||||
+ if(Buffer!=NULL) {
|
||||
+ delete[] Buffer;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+RingBuffer::~RingBuffer( )
|
||||
+{
|
||||
+ if(initialized) {
|
||||
+ delete[] Buffer;
|
||||
+ delete_sem(locker);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+bool
|
||||
+RingBuffer::Empty( void )
|
||||
+{
|
||||
+ memset( Buffer, 0, BufferSize );
|
||||
+ reader = 0;
|
||||
+ writer = 0;
|
||||
+ writeBytesAvailable = BufferSize;
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+RingBuffer::Read( unsigned char *data, int size )
|
||||
+{
|
||||
+ acquire_sem(locker);
|
||||
+
|
||||
+ if( data == 0 || size <= 0 || writeBytesAvailable == BufferSize ) {
|
||||
+ release_sem(locker);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ int readBytesAvailable = BufferSize - writeBytesAvailable;
|
||||
+
|
||||
+ if( size > readBytesAvailable ) {
|
||||
+ size = readBytesAvailable;
|
||||
+ }
|
||||
+
|
||||
+ if(size > BufferSize - reader) {
|
||||
+ int len = BufferSize - reader;
|
||||
+ memcpy(data, Buffer + reader, len);
|
||||
+ memcpy(data + len, Buffer, size-len);
|
||||
+ } else {
|
||||
+ memcpy(data, Buffer + reader, size);
|
||||
+ }
|
||||
+
|
||||
+ reader = (reader + size) % BufferSize;
|
||||
+ writeBytesAvailable += size;
|
||||
+
|
||||
+ release_sem(locker);
|
||||
+ return size;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+RingBuffer::Write( unsigned char *data, int size )
|
||||
+{
|
||||
+ acquire_sem(locker);
|
||||
+
|
||||
+ if( data == 0 || size <= 0 || writeBytesAvailable == 0 ) {
|
||||
+ release_sem(locker);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if( size > writeBytesAvailable ) {
|
||||
+ size = writeBytesAvailable;
|
||||
+ }
|
||||
+
|
||||
+ if(size > BufferSize - writer) {
|
||||
+ int len = BufferSize - writer;
|
||||
+ memcpy(Buffer + writer, data, len);
|
||||
+ memcpy(Buffer, data+len, size-len);
|
||||
+ } else {
|
||||
+ memcpy(Buffer + writer, data, size);
|
||||
+ }
|
||||
+
|
||||
+ writer = (writer + size) % BufferSize;
|
||||
+ writeBytesAvailable -= size;
|
||||
+
|
||||
+ release_sem(locker);
|
||||
+ return size;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+RingBuffer::GetSize( void )
|
||||
+{
|
||||
+ return BufferSize;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+RingBuffer::GetWriteAvailable( void )
|
||||
+{
|
||||
+ return writeBytesAvailable;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+RingBuffer::GetReadAvailable( void )
|
||||
+{
|
||||
+ return BufferSize - writeBytesAvailable;
|
||||
+}
|
||||
+
|
||||
+status_t
|
||||
+RingBuffer::InitCheck( void )
|
||||
+{
|
||||
+ return initialized?B_OK:B_ERROR;
|
||||
+}
|
||||
diff --git a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/RingBuffer.h b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/RingBuffer.h
|
||||
new file mode 100644
|
||||
index 0000000..4715632
|
||||
--- /dev/null
|
||||
+++ b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/haiku/RingBuffer.h
|
||||
@@ -0,0 +1,31 @@
|
||||
+#ifndef __RING_BUFFER_H__
|
||||
+#define __RING_BUFFER_H__
|
||||
+
|
||||
+#include <OS.h>
|
||||
+
|
||||
+class RingBuffer {
|
||||
+
|
||||
+public:
|
||||
+ RingBuffer(int size);
|
||||
+ ~RingBuffer();
|
||||
+ int Read( unsigned char* dataPtr, int numBytes );
|
||||
+ int Write( unsigned char *dataPtr, int numBytes );
|
||||
+
|
||||
+ bool Empty( void );
|
||||
+ int GetSize( );
|
||||
+ int GetWriteAvailable( );
|
||||
+ int GetReadAvailable( );
|
||||
+ status_t InitCheck( );
|
||||
+private:
|
||||
+ unsigned char *Buffer;
|
||||
+ int BufferSize;
|
||||
+ int reader;
|
||||
+ int writer;
|
||||
+ int writeBytesAvailable;
|
||||
+
|
||||
+ sem_id locker;
|
||||
+
|
||||
+ bool initialized;
|
||||
+};
|
||||
+
|
||||
+#endif
|
||||
diff --git a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/posix/NetworkSocketPosix.cpp b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/posix/NetworkSocketPosix.cpp
|
||||
index 05ddbb9..fcf7580 100644
|
||||
--- a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/posix/NetworkSocketPosix.cpp
|
||||
+++ b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/os/posix/NetworkSocketPosix.cpp
|
||||
@@ -47,6 +47,7 @@ NetworkSocketPosix::~NetworkSocketPosix(){
|
||||
}
|
||||
|
||||
void NetworkSocketPosix::SetMaxPriority(){
|
||||
+#ifndef __HAIKU__
|
||||
#ifdef __APPLE__
|
||||
int prio=NET_SERVICE_TYPE_VO;
|
||||
int res=setsockopt(fd, SOL_SOCKET, SO_NET_SERVICE_TYPE, &prio, sizeof(prio));
|
||||
@@ -65,6 +66,7 @@ void NetworkSocketPosix::SetMaxPriority(){
|
||||
LOGE("error setting ip tos: %d / %s", errno, strerror(errno));
|
||||
}
|
||||
#endif
|
||||
+#endif //__HAIKU__
|
||||
}
|
||||
|
||||
void NetworkSocketPosix::Send(NetworkPacket *packet){
|
||||
@@ -196,8 +198,10 @@ void NetworkSocketPosix::Open(){
|
||||
int res=setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &flag, sizeof(flag));
|
||||
if(res<0){
|
||||
LOGE("error enabling dual stack socket: %d / %s", errno, strerror(errno));
|
||||
+#ifndef __HAIKU__
|
||||
failed=true;
|
||||
return;
|
||||
+#endif
|
||||
}
|
||||
|
||||
SetMaxPriority();
|
||||
@@ -345,6 +349,8 @@ std::string NetworkSocketPosix::GetLocalInterfaceInfo(IPv4Address *v4addr, IPv6A
|
||||
if(didAttach){
|
||||
sharedJVM->DetachCurrentThread();
|
||||
}
|
||||
+#elif defined(__HAIKU__)
|
||||
+ return name;
|
||||
#else
|
||||
struct ifaddrs* interfaces;
|
||||
if(!getifaddrs(&interfaces)){
|
||||
diff --git a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/threading.h b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/threading.h
|
||||
index 0b4933c..87ea3b7 100644
|
||||
--- a/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/threading.h
|
||||
+++ b/libtgvoip-6ba1241cfef6c3ddf4e50e82f67afde0abc02285/threading.h
|
||||
@@ -33,7 +33,7 @@ namespace tgvoip{
|
||||
};
|
||||
}
|
||||
|
||||
-#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))
|
||||
+#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || defined(__HAIKU__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
@@ -94,11 +94,13 @@ namespace tgvoip{
|
||||
static void* ActualEntryPoint(void* arg){
|
||||
Thread* self=reinterpret_cast<Thread*>(arg);
|
||||
if(self->name){
|
||||
+#ifndef __HAIKU__
|
||||
#ifndef __APPLE__
|
||||
pthread_setname_np(self->thread, self->name);
|
||||
#else
|
||||
pthread_setname_np(self->name);
|
||||
#endif
|
||||
+#endif //__HAKIU__
|
||||
}
|
||||
self->entry->Invoke(self->arg);
|
||||
return NULL;
|
||||
--
|
||||
2.16.4
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 23f7a2917ad776a989f4ef9d019171db5057d3cf Mon Sep 17 00:00:00 2001
|
||||
From f2b8da872bbe986e8024770dc7754c5fd3462fa0 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Tue, 22 May 2018 23:50:00 +1000
|
||||
Date: Sun, 10 Jun 2018 10:41:50 +1000
|
||||
Subject: Add haiku support
|
||||
|
||||
|
||||
@@ -156,33 +156,11 @@ index dfc7fa0..38c6308 100644
|
||||
#include <QFile>
|
||||
|
||||
namespace base {
|
||||
diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h
|
||||
index 386801a..9d856c8 100644
|
||||
--- a/Telegram/SourceFiles/config.h
|
||||
+++ b/Telegram/SourceFiles/config.h
|
||||
@@ -229,6 +229,8 @@ inline const char *cApiDeviceModel() {
|
||||
return "Mac";
|
||||
#elif defined Q_OS_LINUX
|
||||
return "PC";
|
||||
+#elif defined Q_OS_HAIKU
|
||||
+ return "PC";
|
||||
#endif
|
||||
}
|
||||
inline const char *cApiSystemVersion() {
|
||||
@@ -238,6 +240,8 @@ inline const char *cApiSystemVersion() {
|
||||
return "OS X";
|
||||
#elif defined Q_OS_LINUX
|
||||
return "Linux";
|
||||
+#elif defined Q_OS_HAIKU
|
||||
+ return "Haiku";
|
||||
#endif
|
||||
}
|
||||
|
||||
diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp
|
||||
index a773f37..f3264ea 100644
|
||||
index c21bd67..f366c99 100644
|
||||
--- a/Telegram/SourceFiles/core/launcher.cpp
|
||||
+++ b/Telegram/SourceFiles/core/launcher.cpp
|
||||
@@ -54,6 +54,10 @@ int Launcher::exec() {
|
||||
@@ -60,6 +60,10 @@ int Launcher::exec() {
|
||||
|
||||
// I don't know why path is not in QT_PLUGIN_PATH by default
|
||||
QCoreApplication::addLibraryPath("/usr/lib/qt/plugins");
|
||||
@@ -193,7 +171,7 @@ index a773f37..f3264ea 100644
|
||||
// without this Telegram doesn't start on Ubuntu 17.04 due GTK errors
|
||||
setenv("QT_STYLE_OVERRIDE", "qwerty", false);
|
||||
// Telegram doesn't start when extraordinary theme is set, see launchpad.net/bugs/1680943
|
||||
@@ -133,6 +137,9 @@ void Launcher::prepareSettings() {
|
||||
@@ -143,6 +147,9 @@ void Launcher::prepareSettings() {
|
||||
case dbipMacOld:
|
||||
gPlatformString = qsl("MacOSold");
|
||||
break;
|
||||
@@ -204,10 +182,10 @@ index a773f37..f3264ea 100644
|
||||
gPlatformString = qsl("Linux64bit");
|
||||
break;
|
||||
diff --git a/Telegram/SourceFiles/core/update_checker.cpp b/Telegram/SourceFiles/core/update_checker.cpp
|
||||
index 722e02e..4d876ce 100644
|
||||
index e60635c..d52aad2 100644
|
||||
--- a/Telegram/SourceFiles/core/update_checker.cpp
|
||||
+++ b/Telegram/SourceFiles/core/update_checker.cpp
|
||||
@@ -311,6 +311,7 @@ bool Updater::checkResponse(const QByteArray &response) {
|
||||
@@ -630,6 +630,7 @@ bool ParseCommonMap(
|
||||
case dbipWindows: return "win";
|
||||
case dbipMac: return "mac";
|
||||
case dbipMacOld: return "mac32";
|
||||
@@ -216,10 +194,10 @@ index 722e02e..4d876ce 100644
|
||||
case dbipLinux32: return "linux32";
|
||||
}
|
||||
diff --git a/Telegram/SourceFiles/core/utils.h b/Telegram/SourceFiles/core/utils.h
|
||||
index 08f6f65..3a730de 100644
|
||||
index b4acd52..b435482 100644
|
||||
--- a/Telegram/SourceFiles/core/utils.h
|
||||
+++ b/Telegram/SourceFiles/core/utils.h
|
||||
@@ -468,6 +468,7 @@ enum DBIPlatform {
|
||||
@@ -443,6 +443,7 @@ enum DBIPlatform {
|
||||
dbipLinux64 = 2,
|
||||
dbipLinux32 = 3,
|
||||
dbipMacOld = 4,
|
||||
@@ -228,12 +206,12 @@ index 08f6f65..3a730de 100644
|
||||
|
||||
enum DBIPeerReportSpamStatus {
|
||||
diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp
|
||||
index 5ecf2b7..218b91b 100644
|
||||
index 24ec0cf..1e4992c 100644
|
||||
--- a/Telegram/SourceFiles/logs.cpp
|
||||
+++ b/Telegram/SourceFiles/logs.cpp
|
||||
@@ -321,7 +321,7 @@ void start(not_null<Core::Launcher*> launcher) {
|
||||
@@ -335,7 +335,7 @@ void start(not_null<Core::Launcher*> launcher) {
|
||||
if (cBetaVersion()) {
|
||||
cSetDebug(true);
|
||||
SetDebugEnabled(true);
|
||||
workingDirChosen = true;
|
||||
-#if defined Q_OS_MAC || defined Q_OS_LINUX
|
||||
+#if defined Q_OS_MAC || defined Q_OS_LINUX || defined Q_OS_HAIKU
|
||||
@@ -241,7 +219,7 @@ index 5ecf2b7..218b91b 100644
|
||||
#ifdef _DEBUG
|
||||
cForceWorkingDir(cExeDir());
|
||||
diff --git a/Telegram/SourceFiles/media/media_audio.cpp b/Telegram/SourceFiles/media/media_audio.cpp
|
||||
index 38aa7b1..9d11a1c 100644
|
||||
index d7b2e48..746af58 100644
|
||||
--- a/Telegram/SourceFiles/media/media_audio.cpp
|
||||
+++ b/Telegram/SourceFiles/media/media_audio.cpp
|
||||
@@ -86,6 +86,7 @@ void EnumeratePlaybackDevices() {
|
||||
@@ -603,10 +581,10 @@ index 0000000..e76c8fe
|
||||
+} // namespace Platform
|
||||
diff --git a/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp b/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp
|
||||
new file mode 100644
|
||||
index 0000000..6a38373
|
||||
index 0000000..b861841
|
||||
--- /dev/null
|
||||
+++ b/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp
|
||||
@@ -0,0 +1,47 @@
|
||||
@@ -0,0 +1,59 @@
|
||||
+/*
|
||||
+This file is part of Telegram Desktop,
|
||||
+the official desktop application for the Telegram messaging service.
|
||||
@@ -647,8 +625,20 @@ index 0000000..6a38373
|
||||
+
|
||||
+};
|
||||
+
|
||||
+QString DeviceModel() {
|
||||
+ return "PC";
|
||||
+}
|
||||
+
|
||||
+QString SystemVersion() {
|
||||
+ return "Haiku"
|
||||
+}
|
||||
+
|
||||
+} // namespace
|
||||
+
|
||||
+Launcher::Launcher(int argc, char *argv[])
|
||||
+: Core::Launcher(argc, argv, DeviceModel(), SystemVersion()) {
|
||||
+}
|
||||
+
|
||||
+bool Launcher::launchUpdater(UpdaterLaunch action) {
|
||||
+ return false;
|
||||
+}
|
||||
@@ -656,7 +646,7 @@ index 0000000..6a38373
|
||||
+} // namespace
|
||||
diff --git a/Telegram/SourceFiles/platform/haiku/launcher_haiku.h b/Telegram/SourceFiles/platform/haiku/launcher_haiku.h
|
||||
new file mode 100644
|
||||
index 0000000..db1de28
|
||||
index 0000000..0b7dea1
|
||||
--- /dev/null
|
||||
+++ b/Telegram/SourceFiles/platform/haiku/launcher_haiku.h
|
||||
@@ -0,0 +1,23 @@
|
||||
@@ -675,7 +665,7 @@ index 0000000..db1de28
|
||||
+
|
||||
+class Launcher : public Core::Launcher {
|
||||
+public:
|
||||
+ using Core::Launcher::Launcher;
|
||||
+ Launcher(int argc, char *argv[]);
|
||||
+
|
||||
+private:
|
||||
+ bool launchUpdater(UpdaterLaunch action) override;
|
||||
@@ -1610,10 +1600,10 @@ index 7705b2e..cfc1fc9 100644
|
||||
namespace Audio {
|
||||
|
||||
diff --git a/Telegram/SourceFiles/platform/platform_file_utilities.h b/Telegram/SourceFiles/platform/platform_file_utilities.h
|
||||
index b595362..f109c91 100644
|
||||
index 68b1058..2839790 100644
|
||||
--- a/Telegram/SourceFiles/platform/platform_file_utilities.h
|
||||
+++ b/Telegram/SourceFiles/platform/platform_file_utilities.h
|
||||
@@ -40,6 +40,8 @@ bool Get(QStringList &files, QByteArray &remoteContent, const QString &caption,
|
||||
@@ -47,6 +47,8 @@ bool Get(
|
||||
#include "platform/mac/file_utilities_mac.h"
|
||||
#elif defined Q_OS_LINUX // Q_OS_MAC
|
||||
#include "platform/linux/file_utilities_linux.h"
|
||||
@@ -1623,7 +1613,7 @@ index b595362..f109c91 100644
|
||||
#include "platform/win/file_utilities_win.h"
|
||||
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN
|
||||
diff --git a/Telegram/SourceFiles/platform/platform_launcher.h b/Telegram/SourceFiles/platform/platform_launcher.h
|
||||
index 08ef909..e26f07e 100644
|
||||
index 27180d0..953b47f 100644
|
||||
--- a/Telegram/SourceFiles/platform/platform_launcher.h
|
||||
+++ b/Telegram/SourceFiles/platform/platform_launcher.h
|
||||
@@ -25,6 +25,8 @@ namespace Platform {
|
||||
@@ -1663,10 +1653,10 @@ index 692f4b4..a40f830 100644
|
||||
#include "platform/win/notifications_manager_win.h"
|
||||
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN
|
||||
diff --git a/Telegram/SourceFiles/platform/platform_specific.h b/Telegram/SourceFiles/platform/platform_specific.h
|
||||
index c2b1664..3a1cace 100644
|
||||
index bd3b2f9..7c14335 100644
|
||||
--- a/Telegram/SourceFiles/platform/platform_specific.h
|
||||
+++ b/Telegram/SourceFiles/platform/platform_specific.h
|
||||
@@ -34,6 +34,8 @@ void finish();
|
||||
@@ -35,6 +35,8 @@ void finish();
|
||||
#include "platform/mac/specific_mac.h"
|
||||
#elif defined Q_OS_LINUX // Q_OS_MAC
|
||||
#include "platform/linux/specific_linux.h"
|
||||
@@ -1690,7 +1680,7 @@ index 7aed20b..dc0212c 100644
|
||||
namespace Platform {
|
||||
|
||||
diff --git a/Telegram/SourceFiles/rpl/operators_tests.cpp b/Telegram/SourceFiles/rpl/operators_tests.cpp
|
||||
index f7d141a..cef212b 100644
|
||||
index bd3b739..5735e12 100644
|
||||
--- a/Telegram/SourceFiles/rpl/operators_tests.cpp
|
||||
+++ b/Telegram/SourceFiles/rpl/operators_tests.cpp
|
||||
@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service.
|
||||
@@ -1706,7 +1696,7 @@ index f7d141a..cef212b 100644
|
||||
#include <rpl/rpl.h>
|
||||
#include <string>
|
||||
diff --git a/Telegram/SourceFiles/rpl/producer_tests.cpp b/Telegram/SourceFiles/rpl/producer_tests.cpp
|
||||
index 42fc603..96acb8d 100644
|
||||
index 0267f92..0e783b0 100644
|
||||
--- a/Telegram/SourceFiles/rpl/producer_tests.cpp
|
||||
+++ b/Telegram/SourceFiles/rpl/producer_tests.cpp
|
||||
@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service.
|
||||
@@ -1738,10 +1728,10 @@ index 9c697fc..36ddf56 100644
|
||||
#include <rpl/rpl.h>
|
||||
#include <string>
|
||||
diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp
|
||||
index 1623698..89452b4 100644
|
||||
index 680f347..cb0d5a3 100644
|
||||
--- a/Telegram/SourceFiles/settings.cpp
|
||||
+++ b/Telegram/SourceFiles/settings.cpp
|
||||
@@ -78,6 +78,8 @@ DBIPlatform gPlatform = dbipWindows;
|
||||
@@ -77,6 +77,8 @@ DBIPlatform gPlatform = dbipWindows;
|
||||
DBIPlatform gPlatform = dbipMacOld;
|
||||
#elif defined Q_OS_MAC
|
||||
DBIPlatform gPlatform = dbipMac;
|
||||
@@ -1764,10 +1754,10 @@ index 7f5c191..649255c 100644
|
||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||
#define FTELLO_FUNC(stream) ftello(stream)
|
||||
diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp
|
||||
index aef8683..f44dc40 100644
|
||||
index 73ed391..57b4dc8 100644
|
||||
--- a/Telegram/gyp/Telegram.gyp
|
||||
+++ b/Telegram/gyp/Telegram.gyp
|
||||
@@ -57,6 +57,7 @@
|
||||
@@ -58,6 +58,7 @@
|
||||
'telegram_win.gypi',
|
||||
'telegram_mac.gypi',
|
||||
'telegram_linux.gypi',
|
||||
@@ -1775,7 +1765,7 @@ index aef8683..f44dc40 100644
|
||||
'qt.gypi',
|
||||
'qt_moc.gypi',
|
||||
'qt_rcc.gypi',
|
||||
@@ -82,11 +83,12 @@
|
||||
@@ -83,11 +84,12 @@
|
||||
'include_dirs': [
|
||||
'<(src_loc)',
|
||||
'<(SHARED_INTERMEDIATE_DIR)',
|
||||
@@ -1849,7 +1839,7 @@ index 9efee62..d978ed6 100644
|
||||
for replace in replaces:
|
||||
replace_parts = replace.split('=', 1)
|
||||
diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi
|
||||
index 3f91776..a9f6881 100644
|
||||
index 3f91776..8f3e531 100644
|
||||
--- a/Telegram/gyp/qt.gypi
|
||||
+++ b/Telegram/gyp/qt.gypi
|
||||
@@ -14,7 +14,7 @@
|
||||
@@ -1889,13 +1879,13 @@ index 3f91776..a9f6881 100644
|
||||
- '/usr/include/qt/QtGui/<(qt_version)',
|
||||
- '/usr/include/qt/QtCore/<(qt_version)/QtCore',
|
||||
- '/usr/include/qt/QtGui/<(qt_version)/QtGui',
|
||||
+ '/system/develop/headers',
|
||||
+ '/system/develop/headers/QtCore',
|
||||
+ '/system/develop/headers/QtGui',
|
||||
+ '/system/develop/headers/QtCore/<(qt_version)',
|
||||
+ '/system/develop/headers/QtGui/<(qt_version)',
|
||||
+ '/system/develop/headers/QtCore/<(qt_version)/QtCore',
|
||||
+ '/system/develop/headers/QtGui/<(qt_version)/QtGui',
|
||||
+ '@HAIKU_HEADERS@',
|
||||
+ '@HAIKU_HEADERS@/QtCore',
|
||||
+ '@HAIKU_HEADERS@/QtGui',
|
||||
+ '@HAIKU_HEADERS@/QtCore/<(qt_version)',
|
||||
+ '@HAIKU_HEADERS@/QtGui/<(qt_version)',
|
||||
+ '@HAIKU_HEADERS@/QtCore/<(qt_version)/QtCore',
|
||||
+ '@HAIKU_HEADERS@/QtGui/<(qt_version)/QtGui',
|
||||
],
|
||||
'library_dirs': [
|
||||
'<(qt_loc)/lib',
|
||||
@@ -1951,7 +1941,7 @@ index 1129a95..fd1e3bd 100644
|
||||
'-no-compress',
|
||||
'<(RULE_INPUT_PATH)',
|
||||
diff --git a/Telegram/gyp/refresh.sh b/Telegram/gyp/refresh.sh
|
||||
index 348eda4..46d8fc2 100755
|
||||
index b14a916..0d1e0cc 100755
|
||||
--- a/Telegram/gyp/refresh.sh
|
||||
+++ b/Telegram/gyp/refresh.sh
|
||||
@@ -23,6 +23,14 @@ if [ "$MySystem" == "Linux" ]; then
|
||||
@@ -2064,10 +2054,10 @@ index 0000000..a1fe2c9
|
||||
+}
|
||||
diff --git a/Telegram/gyp/telegram_haiku.gypi b/Telegram/gyp/telegram_haiku.gypi
|
||||
new file mode 100644
|
||||
index 0000000..5a95d31
|
||||
index 0000000..96b6190
|
||||
--- /dev/null
|
||||
+++ b/Telegram/gyp/telegram_haiku.gypi
|
||||
@@ -0,0 +1,68 @@
|
||||
@@ -0,0 +1,69 @@
|
||||
+# This file is part of Telegram Desktop,
|
||||
+# the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
+#
|
||||
@@ -2090,8 +2080,8 @@ index 0000000..5a95d31
|
||||
+{
|
||||
+ 'conditions': [[ 'build_haiku', {
|
||||
+ 'variables': {
|
||||
+ 'haiku_path_include%': '/system/develop/headers',
|
||||
+ 'haiku_path_lib%': '/system/develop/lib',
|
||||
+ 'haiku_path_include%': '@HAIKU_HEADERS@',
|
||||
+ 'haiku_path_lib%': '@HAIKU_LIBS@',
|
||||
+ },
|
||||
+ 'include_dirs': [
|
||||
+ '<(haiku_path_include)',
|
||||
@@ -2111,6 +2101,7 @@ index 0000000..5a95d31
|
||||
+ 'swresample',
|
||||
+ 'swscale',
|
||||
+ 'avutil',
|
||||
+ 'media',
|
||||
+ 'minizip',
|
||||
+ 'opus',
|
||||
+ 'network',
|
||||
@@ -2163,13 +2154,13 @@ index 77b126d..6c27563 100644
|
||||
'variables': {
|
||||
'qrc_files': [
|
||||
diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt
|
||||
index 08ee606..ecebed3 100644
|
||||
index 2202031..76dd1d8 100644
|
||||
--- a/Telegram/gyp/telegram_sources.txt
|
||||
+++ b/Telegram/gyp/telegram_sources.txt
|
||||
@@ -454,6 +454,18 @@
|
||||
<(src_loc)/mtproto/type_utils.h
|
||||
<(src_loc)/overview/overview_layout.cpp
|
||||
<(src_loc)/overview/overview_layout.h
|
||||
@@ -492,6 +492,18 @@
|
||||
<(src_loc)/platform/linux/notifications_manager_linux.h
|
||||
<(src_loc)/platform/linux/specific_linux.cpp
|
||||
<(src_loc)/platform/linux/specific_linux.h
|
||||
+<(src_loc)/platform/haiku/file_utilities_haiku.cpp
|
||||
+<(src_loc)/platform/haiku/file_utilities_haiku.h
|
||||
+<(src_loc)/platform/haiku/haiku_desktop_environment.cpp
|
||||
@@ -2182,9 +2173,9 @@ index 08ee606..ecebed3 100644
|
||||
+<(src_loc)/platform/haiku/main_window_haiku.h
|
||||
+<(src_loc)/platform/haiku/specific_haiku.cpp
|
||||
+<(src_loc)/platform/haiku/specific_haiku.h
|
||||
<(src_loc)/platform/linux/linux_desktop_environment.cpp
|
||||
<(src_loc)/platform/linux/linux_desktop_environment.h
|
||||
<(src_loc)/platform/linux/linux_gdk_helper.cpp
|
||||
<(src_loc)/platform/mac/file_utilities_mac.mm
|
||||
<(src_loc)/platform/mac/file_utilities_mac.h
|
||||
<(src_loc)/platform/mac/launcher_mac.mm
|
||||
diff --git a/Telegram/gyp/utils.gyp b/Telegram/gyp/utils.gyp
|
||||
index 622462e..e3ba800 100644
|
||||
--- a/Telegram/gyp/utils.gyp
|
||||
@@ -2204,55 +2195,67 @@ index 622462e..e3ba800 100644
|
||||
'include_dirs': [
|
||||
'<(libs_loc)/openssl/include'
|
||||
--
|
||||
2.16.2
|
||||
2.16.4
|
||||
|
||||
|
||||
From bf76d5367894f06fc58f2feb94e6eb02fbd3c225 Mon Sep 17 00:00:00 2001
|
||||
From 795c07344ae1a7583e9d960d43ac1b5ee66abb41 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Thu, 24 May 2018 08:30:00 +1000
|
||||
Subject: gypi files templating
|
||||
Date: Sun, 10 Jun 2018 14:50:46 +1000
|
||||
Subject: Adapt code to new API
|
||||
|
||||
|
||||
diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi
|
||||
index a9f6881..8f3e531 100644
|
||||
--- a/Telegram/gyp/qt.gypi
|
||||
+++ b/Telegram/gyp/qt.gypi
|
||||
@@ -161,13 +161,13 @@
|
||||
},
|
||||
diff --git a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp
|
||||
index 5777c2c..58bc1c3 100644
|
||||
--- a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp
|
||||
+++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp
|
||||
@@ -103,8 +103,9 @@ bool PreviewSupported() {
|
||||
|
||||
'include_dirs': [
|
||||
- '/system/develop/headers',
|
||||
- '/system/develop/headers/QtCore',
|
||||
- '/system/develop/headers/QtGui',
|
||||
- '/system/develop/headers/QtCore/<(qt_version)',
|
||||
- '/system/develop/headers/QtGui/<(qt_version)',
|
||||
- '/system/develop/headers/QtCore/<(qt_version)/QtCore',
|
||||
- '/system/develop/headers/QtGui/<(qt_version)/QtGui',
|
||||
+ '@HAIKU_HEADERS@',
|
||||
+ '@HAIKU_HEADERS@/QtCore',
|
||||
+ '@HAIKU_HEADERS@/QtGui',
|
||||
+ '@HAIKU_HEADERS@/QtCore/<(qt_version)',
|
||||
+ '@HAIKU_HEADERS@/QtGui/<(qt_version)',
|
||||
+ '@HAIKU_HEADERS@/QtCore/<(qt_version)/QtCore',
|
||||
+ '@HAIKU_HEADERS@/QtGui/<(qt_version)/QtGui',
|
||||
],
|
||||
'library_dirs': [
|
||||
'<(qt_loc)/lib',
|
||||
diff --git a/Telegram/gyp/telegram_haiku.gypi b/Telegram/gyp/telegram_haiku.gypi
|
||||
index 5a95d31..3be76fc 100644
|
||||
--- a/Telegram/gyp/telegram_haiku.gypi
|
||||
+++ b/Telegram/gyp/telegram_haiku.gypi
|
||||
@@ -20,8 +20,8 @@
|
||||
{
|
||||
'conditions': [[ 'build_haiku', {
|
||||
'variables': {
|
||||
- 'haiku_path_include%': '/system/develop/headers',
|
||||
- 'haiku_path_lib%': '/system/develop/lib',
|
||||
+ 'haiku_path_include%': '@HAIKU_HEADERS@',
|
||||
+ 'haiku_path_lib%': '@HAIKU_LIBS@',
|
||||
},
|
||||
'include_dirs': [
|
||||
'<(haiku_path_include)',
|
||||
} // namespace
|
||||
|
||||
-bool Get(QStringList &files, QByteArray &remoteContent, const QString &caption, const QString &filter, Type type, QString startFile) {
|
||||
- return ::FileDialog::internal::GetDefault(files, remoteContent, caption, filter, type, startFile);
|
||||
+bool Get(QPointer<QWidget> parent, QStringList &files, QByteArray &remoteContent, const QString &caption, \
|
||||
+ const QString &filter, Type type, QString startFile) {
|
||||
+ return ::FileDialog::internal::GetDefault(parent, files, remoteContent, caption, filter, type, startFile);
|
||||
}
|
||||
|
||||
namespace internal {
|
||||
diff --git a/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp b/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp
|
||||
index b861841..a7bea21 100644
|
||||
--- a/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp
|
||||
+++ b/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp
|
||||
@@ -43,7 +43,7 @@ QString DeviceModel() {
|
||||
}
|
||||
|
||||
QString SystemVersion() {
|
||||
- return "Haiku"
|
||||
+ return "Haiku";
|
||||
}
|
||||
|
||||
} // namespace
|
||||
diff --git a/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp
|
||||
index b303e1d..1928257 100644
|
||||
--- a/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp
|
||||
+++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp
|
||||
@@ -335,6 +335,9 @@ QString SystemLanguage() {
|
||||
return QString();
|
||||
}
|
||||
|
||||
+void RegisterCustomScheme() {
|
||||
+}
|
||||
+
|
||||
namespace ThirdParty {
|
||||
|
||||
void start() {
|
||||
@@ -365,7 +368,7 @@ void psRegisterCustomScheme() {
|
||||
}
|
||||
|
||||
void psNewVersion() {
|
||||
- psRegisterCustomScheme();
|
||||
+ Platform::RegisterCustomScheme();
|
||||
}
|
||||
|
||||
bool _execUpdater(bool update = true, const QString &crashreport = QString()) {
|
||||
--
|
||||
2.16.2
|
||||
2.16.4
|
||||
|
||||
@@ -3,15 +3,15 @@ DESCRIPTION="Official desktop version of Telegram messaging app."
|
||||
HOMEPAGE="https://www.telegram.org/"
|
||||
COPYRIGHT="2013-2018 Telegram"
|
||||
LICENSE="GNU GPL v3"
|
||||
REVISION="3"
|
||||
REVISION="1"
|
||||
|
||||
SOURCE_URI="https://github.com/telegramdesktop/tdesktop/archive/v$portVersion.tar.gz"
|
||||
SOURCE_DIR="tdesktop-$portVersion"
|
||||
CHECKSUM_SHA256="d64bf3faea8a43c162b13bf89291f580493d1c08b1b536461e2634928196597d"
|
||||
CHECKSUM_SHA256="f0cc960c0b0cbb9f288375603635688db772211e375a88cd9d836b2d6f020931"
|
||||
|
||||
COMMIT_2="00851dc6346d9c1e02d09885029e5ba32a4094e8"
|
||||
COMMIT_2="6ba1241cfef6c3ddf4e50e82f67afde0abc02285"
|
||||
SOURCE_URI_2="https://github.com/telegramdesktop/libtgvoip/archive/$COMMIT_2.zip"
|
||||
CHECKSUM_SHA256_2="ac0846131af3fb61649d1a1c74e75e89681427ddefc508debb143010475f769e"
|
||||
CHECKSUM_SHA256_2="24d75490fcd405a90a56074d396189f75dd0c859bee74de1c01478685ba634c0"
|
||||
|
||||
COMMIT_3="550ac2f159ca883d360c196149b466955c77a573"
|
||||
SOURCE_URI_3="https://github.com/mapbox/variant/archive/$COMMIT_3.zip"
|
||||
@@ -25,18 +25,19 @@ COMMIT_5="5ca44b68721833ae3731802ed99af67c6f38a53a"
|
||||
SOURCE_URI_5="https://github.com/philsquared/Catch/archive/$COMMIT_5.zip"
|
||||
CHECKSUM_SHA256_5="bec93e64dea2dd0c6662a75a81cdd1747a753ccd86025ef436b7d2fac3b408d2"
|
||||
|
||||
COMMIT_6="344cbde9ae8d89a6530408d3176d2754ae0ff0e2"
|
||||
COMMIT_6="f893c36427993e22181c8b3ec382dedb5563dc08"
|
||||
SOURCE_URI_6="https://github.com/telegramdesktop/crl/archive/$COMMIT_6.zip"
|
||||
CHECKSUM_SHA256_6="3709a6707cfbe2654c2c5ea3edc5c338391d678b0bd44221997b32f19f848140"
|
||||
CHECKSUM_SHA256_6="275d26711f8eadc3ee8fbdb97ce750a6c8a08adf35f99726c267c6e12256fa26"
|
||||
|
||||
COMMIT_7="b10e6803c6fb3ebb1fa5bdc48e6724e0f7476ac9"
|
||||
COMMIT_7="4b10be9cbadd7d0880437f48f875185589fd86d3"
|
||||
SOURCE_URI_7="https://github.com/ericniebler/range-v3/archive/$COMMIT_7.zip"
|
||||
CHECKSUM_SHA256_7="3b5faa6833eb501a98c8dc9d87f7cc41cf00f116b7faf28e7ce6bbbbc9375a46"
|
||||
CHECKSUM_SHA256_7="67095606bd533dcffefb6a9ae6be0dc5176d77912928b60ad4e60cc66fc611c7"
|
||||
|
||||
PATCHES="
|
||||
telegram_desktop-$portVersion-systemqt.patch
|
||||
telegram_desktop-$portVersion.patchset
|
||||
"
|
||||
|
||||
PATCHES_2="
|
||||
telegram_desktop-$portVersion-libtgvoip.patchset
|
||||
"
|
||||
@@ -99,7 +100,7 @@ BUILD_PREREQUIRES="
|
||||
"
|
||||
|
||||
PATCH()
|
||||
{
|
||||
{
|
||||
sed -i "s|@HAIKU_HEADERS@|/system/$relativeIncludeDir|" Telegram/gyp/telegram_haiku.gypi
|
||||
sed -i "s|@HAIKU_HEADERS@|/system/$relativeIncludeDir|" Telegram/gyp/qt.gypi
|
||||
sed -i "s|@HAIKU_LIBS@|/system/$relativeLibDir|" Telegram/gyp/telegram_haiku.gypi
|
||||
Reference in New Issue
Block a user