mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-24 09:08:53 +02:00
Telegram: bump version
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
954
net-im/telegram-desktop/patches/libtgvoip-2.6.1.patchset
Normal file
954
net-im/telegram-desktop/patches/libtgvoip-2.6.1.patchset
Normal file
@@ -0,0 +1,954 @@
|
||||
From fa203d769199d21dd4b007d2f9d60479972e58de Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Thu, 25 Feb 2021 17:18:39 +1000
|
||||
Subject: Add Haiku support
|
||||
|
||||
|
||||
diff --git a/Telegram/ThirdParty/libtgvoip/VoIPController.cpp b/Telegram/ThirdParty/libtgvoip/VoIPController.cpp
|
||||
index d0b0038..c2c258b 100644
|
||||
--- a/Telegram/ThirdParty/libtgvoip/VoIPController.cpp
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/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>
|
||||
@@ -3009,6 +3012,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/Telegram/ThirdParty/libtgvoip/audio/AudioIO.cpp b/Telegram/ThirdParty/libtgvoip/audio/AudioIO.cpp
|
||||
index 2c16ca7..e00c731 100644
|
||||
--- a/Telegram/ThirdParty/libtgvoip/audio/AudioIO.cpp
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/audio/AudioIO.cpp
|
||||
@@ -39,6 +39,9 @@
|
||||
#ifndef WITHOUT_PULSE
|
||||
#include "../os/linux/AudioPulse.h"
|
||||
#endif
|
||||
+#elif defined(__HAIKU__)
|
||||
+#include "../os/haiku/AudioInputHaiku.h"
|
||||
+#include "../os/haiku/AudioOutputHaiku.h"
|
||||
#else
|
||||
#error "Unsupported operating system"
|
||||
#endif
|
||||
@@ -65,6 +68,8 @@ AudioIO* AudioIO::Create(std::string inputDevice, std::string outputDevice){
|
||||
return new ContextlessAudioIO<AudioInputWave, AudioOutputWave>(inputDevice, outputDevice);
|
||||
#endif
|
||||
return new ContextlessAudioIO<AudioInputWASAPI, AudioOutputWASAPI>(inputDevice, outputDevice);
|
||||
+#elif defined(__HAIKU__)
|
||||
+ return new ContextlessAudioIO<AudioInputHaiku, AudioOutputHaiku>();
|
||||
#elif defined(__linux__)
|
||||
#ifndef WITHOUT_ALSA
|
||||
#ifndef WITHOUT_PULSE
|
||||
diff --git a/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp b/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp
|
||||
index 674cd34..83a6dbb 100644
|
||||
--- a/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp
|
||||
@@ -33,6 +33,8 @@
|
||||
#ifndef WITHOUT_PULSE
|
||||
#include "../os/linux/AudioPulse.h"
|
||||
#endif
|
||||
+#elif defined(__HAIKU__)
|
||||
+#include "../os/haiku/AudioInputHaiku.h"
|
||||
#else
|
||||
#error "Unsupported operating system"
|
||||
#endif
|
||||
diff --git a/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp b/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp
|
||||
index 14ab0be..44c615e 100644
|
||||
--- a/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "../os/linux/AudioOutputPulse.h"
|
||||
#include "../os/linux/AudioPulse.h"
|
||||
#endif
|
||||
+#elif defined(__HAIKU__)
|
||||
+#include "../os/haiku/AudioOutputHaiku.h"
|
||||
#else
|
||||
#error "Unsupported operating system"
|
||||
#endif
|
||||
diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.cpp b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.cpp
|
||||
new file mode 100644
|
||||
index 0000000..7cce3e3
|
||||
--- /dev/null
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.cpp
|
||||
@@ -0,0 +1,276 @@
|
||||
+//
|
||||
+// 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 "../../audio/Resampler.h"
|
||||
+#include "../../VoIPController.h"
|
||||
+
|
||||
+#include "RingBuffer.h"
|
||||
+
|
||||
+using namespace tgvoip::audio;
|
||||
+
|
||||
+void RecordData(void* cookie, bigtime_t timestamp, void* data, size_t size, const media_format &format)
|
||||
+{
|
||||
+ AudioInputHaiku *audioInput = (AudioInputHaiku*)cookie;
|
||||
+ if (!audioInput->IsRecording())
|
||||
+ return;
|
||||
+
|
||||
+ if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_SHORT &&
|
||||
+ format.u.raw_audio.channel_count == 1) {
|
||||
+ audioInput->fRingBuffer->Write((unsigned char*)data, size);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ uint32 bytesPerSample = 2;
|
||||
+ switch (format.u.raw_audio.format) {
|
||||
+ case media_raw_audio_format::B_AUDIO_CHAR:
|
||||
+ bytesPerSample = 1;
|
||||
+ break;
|
||||
+ case media_raw_audio_format::B_AUDIO_SHORT:
|
||||
+ bytesPerSample = 2;
|
||||
+ break;
|
||||
+ case media_raw_audio_format::B_AUDIO_INT:
|
||||
+ bytesPerSample = 4;
|
||||
+ break;
|
||||
+ case media_raw_audio_format::B_AUDIO_FLOAT:
|
||||
+ bytesPerSample = 4;
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ int frames = size / (format.u.raw_audio.channel_count * bytesPerSample);
|
||||
+ int16_t *dst = audioInput->workBuffer;
|
||||
+
|
||||
+ if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_CHAR) {
|
||||
+ unsigned char* src=reinterpret_cast<unsigned char*>(data);
|
||||
+ for (int n=0; n < frames; n++) {
|
||||
+ int32_t value = 0;
|
||||
+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) {
|
||||
+ value += ((int32_t)(*src) - INT8_MAX) * UINT8_MAX;
|
||||
+ }
|
||||
+ value /= format.u.raw_audio.channel_count;
|
||||
+ dst[n] = (int16_t)value;
|
||||
+ }
|
||||
+ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_SHORT) {
|
||||
+ int16_t* src=reinterpret_cast<int16_t*>(data);
|
||||
+ for (int n=0; n < frames; n++) {
|
||||
+ int32_t value = 0;
|
||||
+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) {
|
||||
+ value += *src;
|
||||
+ }
|
||||
+ value /= format.u.raw_audio.channel_count;
|
||||
+ dst[n] = (int16_t)value;
|
||||
+ }
|
||||
+ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_INT) {
|
||||
+ int32_t* src=reinterpret_cast<int32_t*>(data);
|
||||
+ for (int n=0; n < frames; n++) {
|
||||
+ int64_t value = 0;
|
||||
+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) {
|
||||
+ value += (int64_t)(*src);
|
||||
+ }
|
||||
+ value /= format.u.raw_audio.channel_count;
|
||||
+ dst[n] = (int16_t)(value / (UINT16_MAX + 1));
|
||||
+ }
|
||||
+ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_FLOAT) {
|
||||
+ float* src=reinterpret_cast<float*>(data);
|
||||
+ for (int n=0; n < frames; n++) {
|
||||
+ float value = 0;
|
||||
+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) {
|
||||
+ value += *src;
|
||||
+ }
|
||||
+ value /= format.u.raw_audio.channel_count;
|
||||
+ dst[n] = (int16_t)(value*INT16_MAX);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if(format.u.raw_audio.frame_rate != audioInput->tgFrameRate) {
|
||||
+ size_t len = tgvoip::audio::Resampler::Convert(dst, audioInput->convertBuffer,
|
||||
+ frames, frames, audioInput->tgFrameRate, format.u.raw_audio.frame_rate) * audioInput->tgBytesPerSample;
|
||||
+ audioInput->fRingBuffer->Write((unsigned char*)audioInput->convertBuffer, len);
|
||||
+ } else {
|
||||
+ audioInput->fRingBuffer->Write((unsigned char*)dst, frames * audioInput->tgBytesPerSample);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void NotifyRecordData(void * cookie, BMediaRecorder::notification code, ...)
|
||||
+{
|
||||
+ AudioInputHaiku *audioInput = (AudioInputHaiku*)cookie;
|
||||
+ if (code == BMediaRecorder::B_WILL_STOP) {
|
||||
+ if (audioInput->IsRecording()) {
|
||||
+ audioInput->Stop();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+AudioInputHaiku::AudioInputHaiku()
|
||||
+{
|
||||
+ fRecorder = NULL;
|
||||
+ fRingBuffer = NULL;
|
||||
+ isRecording = false;
|
||||
+
|
||||
+ tgFrameRate = 48000;
|
||||
+ tgChannelsCount = 1;
|
||||
+ tgBytesPerSample = 2;
|
||||
+
|
||||
+ 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(RecordData, NotifyRecordData, 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){
|
||||
+ tgFrameRate = sampleRate;
|
||||
+ tgChannelsCount = channels;
|
||||
+ tgBytesPerSample = bitsPerSample / 8;
|
||||
+}
|
||||
+
|
||||
+bool AudioInputHaiku::IsRecording(){
|
||||
+ return isRecording;
|
||||
+}
|
||||
+
|
||||
+void AudioInputHaiku::Start(){
|
||||
+ if(failed || isRecording)
|
||||
+ return;
|
||||
+
|
||||
+ isRecording=true;
|
||||
+
|
||||
+ thread = new Thread(std::bind(&AudioInputHaiku::RunThread, this));
|
||||
+ 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(){
|
||||
+ 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/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.h b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.h
|
||||
new file mode 100644
|
||||
index 0000000..1c63afe
|
||||
--- /dev/null
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.h
|
||||
@@ -0,0 +1,66 @@
|
||||
+//
|
||||
+// 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"
|
||||
+
|
||||
+#define BUFFER_SIZE 960
|
||||
+
|
||||
+namespace tgvoip{
|
||||
+namespace audio{
|
||||
+
|
||||
+class AudioInputHaiku : public AudioInput{
|
||||
+
|
||||
+public:
|
||||
+ AudioInputHaiku();
|
||||
+ 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;
|
||||
+ int16_t workBuffer[BUFFER_SIZE * 64];
|
||||
+ int16_t convertBuffer[BUFFER_SIZE * 64];
|
||||
+
|
||||
+ uint32 tgFrameRate;
|
||||
+ uint32 tgChannelsCount;
|
||||
+ uint32 tgBytesPerSample;
|
||||
+
|
||||
+private:
|
||||
+ void RunThread();
|
||||
+
|
||||
+ bool isConfigured;
|
||||
+ bool isRecording;
|
||||
+
|
||||
+ BMediaRoster * fRoster;
|
||||
+ BMediaRecorder * fRecorder;
|
||||
+ media_format fRecordFormat;
|
||||
+ media_node fAudioInputNode;
|
||||
+ media_node fAudioMixerNode;
|
||||
+
|
||||
+ Thread* thread;
|
||||
+};
|
||||
+
|
||||
+}
|
||||
+}
|
||||
+
|
||||
+#endif //LIBTGVOIP_AUDIOINPUTHAIKU_H
|
||||
diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.cpp b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.cpp
|
||||
new file mode 100644
|
||||
index 0000000..2fca8a1
|
||||
--- /dev/null
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.cpp
|
||||
@@ -0,0 +1,99 @@
|
||||
+//
|
||||
+// 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(){
|
||||
+ soundPlayer = NULL;
|
||||
+ isPlaying = false;
|
||||
+ isConfigured = false;
|
||||
+ Configure(48000, 16, 1);
|
||||
+ 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 * (bitsPerSample / 8) * 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;
|
||||
+ failed = true;
|
||||
+ 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;
|
||||
+}
|
||||
diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.h b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.h
|
||||
new file mode 100644
|
||||
index 0000000..91f2521
|
||||
--- /dev/null
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/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"
|
||||
+
|
||||
+#include <SoundPlayer.h>
|
||||
+
|
||||
+namespace tgvoip{
|
||||
+namespace audio{
|
||||
+
|
||||
+class AudioOutputHaiku : public AudioOutput{
|
||||
+public:
|
||||
+ AudioOutputHaiku();
|
||||
+ virtual ~AudioOutputHaiku();
|
||||
+ virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels);
|
||||
+ virtual void Start();
|
||||
+ virtual void Stop();
|
||||
+ virtual bool IsPlaying() override;
|
||||
+private:
|
||||
+ bool isPlaying;
|
||||
+ bool isConfigured;
|
||||
+ BSoundPlayer *soundPlayer;
|
||||
+};
|
||||
+
|
||||
+}
|
||||
+}
|
||||
+
|
||||
+#endif //LIBTGVOIP_AUDIOOUTPUTHAIKU_H
|
||||
diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.cpp b/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.cpp
|
||||
new file mode 100644
|
||||
index 0000000..6c94933
|
||||
--- /dev/null
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.cpp
|
||||
@@ -0,0 +1,136 @@
|
||||
+//
|
||||
+// 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 <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/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.h b/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.h
|
||||
new file mode 100644
|
||||
index 0000000..01f6096
|
||||
--- /dev/null
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.h
|
||||
@@ -0,0 +1,37 @@
|
||||
+//
|
||||
+// 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 __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/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp b/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp
|
||||
index 78e0583..81bf9fc 100644
|
||||
--- a/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp
|
||||
@@ -248,12 +248,13 @@ void NetworkSocketPosix::Open(){
|
||||
}
|
||||
int flag=0;
|
||||
int res=setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &flag, sizeof(flag));
|
||||
+#ifndef __HAIKU__
|
||||
if(res<0){
|
||||
LOGE("error enabling dual stack socket: %d / %s", errno, strerror(errno));
|
||||
failed=true;
|
||||
return;
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
SetMaxPriority();
|
||||
fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||
|
||||
@@ -403,6 +404,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/Telegram/ThirdParty/libtgvoip/threading.h b/Telegram/ThirdParty/libtgvoip/threading.h
|
||||
old mode 100755
|
||||
new mode 100644
|
||||
index 81c577c..1ccf029
|
||||
--- a/Telegram/ThirdParty/libtgvoip/threading.h
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/threading.h
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
-#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>
|
||||
@@ -92,6 +92,7 @@ namespace tgvoip{
|
||||
static void* ActualEntryPoint(void* arg){
|
||||
Thread* self=reinterpret_cast<Thread*>(arg);
|
||||
if(self->name){
|
||||
+#ifndef __HAIKU__
|
||||
#if !defined(__APPLE__) && !defined(__gnu_hurd__)
|
||||
pthread_setname_np(self->thread, self->name);
|
||||
#elif !defined(__gnu_hurd__)
|
||||
@@ -100,6 +101,7 @@ namespace tgvoip{
|
||||
DarwinSpecific::SetCurrentThreadPriority(DarwinSpecific::THREAD_PRIO_USER_INTERACTIVE);
|
||||
}
|
||||
#endif
|
||||
+#endif //__HAIKU__
|
||||
}
|
||||
self->entry();
|
||||
return NULL;
|
||||
diff --git a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/logging_webrtc.cc b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/logging_webrtc.cc
|
||||
old mode 100755
|
||||
new mode 100644
|
||||
index a8d1522..991241b
|
||||
--- a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/logging_webrtc.cc
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/logging_webrtc.cc
|
||||
@@ -28,6 +28,10 @@
|
||||
static const int kMaxLogLineSize = 1024 - 60;
|
||||
#endif // WEBRTC_MAC && !defined(WEBRTC_IOS) || WEBRTC_ANDROID
|
||||
|
||||
+#if defined(WEBRTC_HAIKU)
|
||||
+#include <OS.h>
|
||||
+#endif
|
||||
+
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
@@ -120,7 +124,12 @@ LogMessage::LogMessage(const char* file,
|
||||
|
||||
if (thread_) {
|
||||
PlatformThreadId id = CurrentThreadId();
|
||||
+#if defined(WEBRTC_HAIKU)
|
||||
+ thread_id tid = get_pthread_thread_id(id);
|
||||
+ print_stream_ << "[" << tid << "] ";
|
||||
+#else
|
||||
print_stream_ << "[" << id << "] ";
|
||||
+#endif
|
||||
}
|
||||
|
||||
if (file != nullptr) {
|
||||
diff --git a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_file.h b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_file.h
|
||||
old mode 100755
|
||||
new mode 100644
|
||||
diff --git a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc
|
||||
index cf7d478..f27b9a1 100644
|
||||
--- a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc
|
||||
@@ -20,6 +20,8 @@ namespace rtc {
|
||||
PlatformThreadId CurrentThreadId() {
|
||||
#if defined(WEBRTC_WIN)
|
||||
return GetCurrentThreadId();
|
||||
+#elif defined(WEBRTC_HAIKU)
|
||||
+ return pthread_self();
|
||||
#elif defined(WEBRTC_POSIX)
|
||||
#if defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
|
||||
return pthread_mach_thread_np(pthread_self());
|
||||
diff --git a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.h b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.h
|
||||
index 0bc42eb..c87cde9 100644
|
||||
--- a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.h
|
||||
+++ b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.h
|
||||
@@ -35,6 +35,9 @@ typedef DWORD PlatformThreadRef;
|
||||
#elif defined(WEBRTC_FUCHSIA)
|
||||
typedef zx_handle_t PlatformThreadId;
|
||||
typedef zx_handle_t PlatformThreadRef;
|
||||
+#elif defined(WEBRTC_HAIKU)
|
||||
+typedef pthread_t PlatformThreadId;
|
||||
+typedef pthread_t PlatformThreadRef;
|
||||
#elif defined(WEBRTC_POSIX)
|
||||
typedef pid_t PlatformThreadId;
|
||||
typedef pthread_t PlatformThreadRef;
|
||||
diff --git a/Telegram/cmake/lib_tgvoip.cmake b/Telegram/cmake/lib_tgvoip.cmake
|
||||
index 74d4f26..79f5023 100644
|
||||
--- a/Telegram/cmake/lib_tgvoip.cmake
|
||||
+++ b/Telegram/cmake/lib_tgvoip.cmake
|
||||
@@ -120,6 +120,14 @@ if (NOT TGVOIP_FOUND)
|
||||
os/linux/AudioPulse.cpp
|
||||
os/linux/AudioPulse.h
|
||||
|
||||
+ # Haiku
|
||||
+ os/haiku/AudioInputHaiku.cpp
|
||||
+ os/haiku/AudioInputHaiku.h
|
||||
+ os/haiku/AudioOutputHaiku.cpp
|
||||
+ os/haiku/AudioOutputHaiku.h
|
||||
+ os/haiku/RingBuffer.cpp
|
||||
+ os/haiku/RingBuffer.h
|
||||
+
|
||||
# POSIX
|
||||
os/posix/NetworkSocketPosix.cpp
|
||||
os/posix/NetworkSocketPosix.h
|
||||
@@ -157,6 +165,38 @@ if (NOT TGVOIP_FOUND)
|
||||
TGVOIP_NO_OSX_PRIVATE_API
|
||||
)
|
||||
endif()
|
||||
+ elseif (HAIKU)
|
||||
+ target_compile_definitions(lib_tgvoip_bundled
|
||||
+ PUBLIC
|
||||
+ WEBRTC_POSIX
|
||||
+ WEBRTC_HAIKU
|
||||
+ )
|
||||
+ target_compile_options(lib_tgvoip_bundled
|
||||
+ PRIVATE
|
||||
+ -Wno-unknown-pragmas
|
||||
+ -Wno-error=sequence-point
|
||||
+ -Wno-error=unused-result
|
||||
+ -mmmx
|
||||
+ -msse2
|
||||
+ )
|
||||
+ target_link_libraries(lib_tgvoip_bundled
|
||||
+ PRIVATE
|
||||
+ be
|
||||
+ network
|
||||
+ media
|
||||
+ )
|
||||
+ remove_target_sources(lib_tgvoip_bundled ${tgvoip_loc}
|
||||
+ os/linux/AudioInputALSA.cpp
|
||||
+ os/linux/AudioInputALSA.h
|
||||
+ os/linux/AudioOutputALSA.cpp
|
||||
+ os/linux/AudioOutputALSA.h
|
||||
+ os/linux/AudioOutputPulse.cpp
|
||||
+ os/linux/AudioOutputPulse.h
|
||||
+ os/linux/AudioInputPulse.cpp
|
||||
+ os/linux/AudioInputPulse.h
|
||||
+ os/linux/AudioPulse.cpp
|
||||
+ os/linux/AudioPulse.h
|
||||
+ )
|
||||
else()
|
||||
target_compile_options(lib_tgvoip_bundled
|
||||
PRIVATE
|
||||
@@ -179,7 +219,7 @@ if (NOT TGVOIP_FOUND)
|
||||
desktop-app::external_opus
|
||||
)
|
||||
|
||||
- if (LINUX)
|
||||
+ if (LINUX AND NOT HAIKU)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(ALSA REQUIRED)
|
||||
pkg_check_modules(PULSE REQUIRED libpulse)
|
||||
--
|
||||
2.30.0
|
||||
|
||||
@@ -1,822 +0,0 @@
|
||||
From c7cf52d0deb5c65488d287ba89fe58026011a000 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Sat, 30 Jan 2021 21:16:28 +1000
|
||||
Subject: Add Haiku support
|
||||
|
||||
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/CMakeLists.txt b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/CMakeLists.txt
|
||||
index 7a5bb2c..24db2ef 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/CMakeLists.txt
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/CMakeLists.txt
|
||||
@@ -58,7 +58,7 @@ include(cmake/libusrsctp.cmake)
|
||||
include(cmake/libvpx.cmake)
|
||||
include(cmake/libwebrtcbuild.cmake)
|
||||
include(cmake/libyuv.cmake)
|
||||
-if (NOT WIN32 AND NOT APPLE)
|
||||
+if (NOT WIN32 AND NOT APPLE AND NOT HAIKU)
|
||||
include(cmake/libevent.cmake)
|
||||
endif()
|
||||
if (APPLE)
|
||||
@@ -127,7 +127,7 @@ PRIVATE
|
||||
${libopenh264_yasm_objects}
|
||||
)
|
||||
|
||||
-if (NOT WIN32 AND NOT APPLE)
|
||||
+if (NOT WIN32 AND NOT APPLE AND NOT HAIKU)
|
||||
target_link_libraries(tg_owt PRIVATE tg_owt::libevent)
|
||||
endif()
|
||||
if (APPLE)
|
||||
@@ -410,6 +410,8 @@ PRIVATE
|
||||
rtc_base/task_queue.cc
|
||||
rtc_base/task_queue_gcd.cc
|
||||
rtc_base/task_queue_gcd.h
|
||||
+ rtc_base/task_queue_stdlib.cc
|
||||
+ rtc_base/task_queue_stdlib.h
|
||||
rtc_base/task_queue_libevent.cc
|
||||
rtc_base/task_queue_libevent.h
|
||||
rtc_base/task_queue_win.cc
|
||||
@@ -489,6 +491,7 @@ PRIVATE
|
||||
api/stats_types.cc
|
||||
api/task_queue/default_task_queue_factory.h
|
||||
api/task_queue/default_task_queue_factory_gcd.cc
|
||||
+ api/task_queue/default_task_queue_factory_stdlib.cc
|
||||
api/task_queue/default_task_queue_factory_libevent.cc
|
||||
api/task_queue/default_task_queue_factory_win.cc
|
||||
api/task_queue/task_queue_base.cc
|
||||
@@ -1410,6 +1413,8 @@ PRIVATE
|
||||
modules/video_capture/device_info_impl.cc
|
||||
modules/video_capture/linux/device_info_linux.cc
|
||||
modules/video_capture/linux/video_capture_linux.cc
|
||||
+ modules/video_capture/haiku/device_info_haiku.cc
|
||||
+ modules/video_capture/haiku/video_capture_haiku.cc
|
||||
modules/video_capture/windows/device_info_ds.cc
|
||||
modules/video_capture/windows/device_info_ds.h
|
||||
modules/video_capture/windows/help_functions_ds.cc
|
||||
@@ -2105,7 +2110,7 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
-if (WIN32 OR APPLE)
|
||||
+if (WIN32 OR APPLE OR HAIKU)
|
||||
remove_target_sources(tg_owt ${webrtc_loc}
|
||||
rtc_base/task_queue_libevent.cc
|
||||
rtc_base/task_queue_libevent.h
|
||||
@@ -2121,7 +2126,7 @@ else()
|
||||
endif()
|
||||
|
||||
set(platform_export)
|
||||
-if (NOT WIN32 AND NOT APPLE)
|
||||
+if (NOT WIN32 AND NOT APPLE AND NOT HAIKU)
|
||||
set(platform_export
|
||||
libevent
|
||||
)
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libusrsctp.cmake b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libusrsctp.cmake
|
||||
index f652679..0c00f10 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libusrsctp.cmake
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libusrsctp.cmake
|
||||
@@ -25,6 +25,11 @@ elseif (APPLE)
|
||||
PRIVATE
|
||||
-U__APPLE__
|
||||
)
|
||||
+elseif (HAIKU)
|
||||
+ target_compile_definitions(libusrsctp
|
||||
+ PRIVATE
|
||||
+ __Userspace_os_Haiku
|
||||
+ )
|
||||
else()
|
||||
target_compile_definitions(libusrsctp
|
||||
PRIVATE
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libwebrtcbuild.cmake b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libwebrtcbuild.cmake
|
||||
index d79049e..bad89f0 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libwebrtcbuild.cmake
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libwebrtcbuild.cmake
|
||||
@@ -17,8 +17,8 @@ INTERFACE
|
||||
WEBRTC_USE_H264
|
||||
WEBRTC_LIBRARY_IMPL
|
||||
WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1
|
||||
- WEBRTC_ENABLE_LINUX_ALSA
|
||||
- WEBRTC_ENABLE_LINUX_PULSE
|
||||
+# WEBRTC_ENABLE_LINUX_ALSA
|
||||
+# WEBRTC_ENABLE_LINUX_PULSE
|
||||
HAVE_WEBRTC_VIDEO
|
||||
RTC_ENABLE_VP9
|
||||
)
|
||||
@@ -34,6 +34,12 @@ elseif (APPLE)
|
||||
WEBRTC_POSIX
|
||||
WEBRTC_MAC
|
||||
)
|
||||
+elseif (HAIKU)
|
||||
+ target_compile_definitions(libwebrtcbuild
|
||||
+ INTERFACE
|
||||
+ WEBRTC_POSIX
|
||||
+ WEBRTC_HAIKU
|
||||
+ )
|
||||
else()
|
||||
target_compile_definitions(libwebrtcbuild
|
||||
INTERFACE
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/nice_target_sources.cmake b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/nice_target_sources.cmake
|
||||
index cfc6aeb..699d0e6 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/nice_target_sources.cmake
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/nice_target_sources.cmake
|
||||
@@ -15,6 +15,7 @@ function(nice_target_sources target_name src_loc)
|
||||
set(not_win_sources "")
|
||||
set(not_mac_sources "")
|
||||
set(not_linux_sources "")
|
||||
+ set(not_haiku_sources "")
|
||||
foreach (entry ${list})
|
||||
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
|
||||
set(writing_now ${entry})
|
||||
@@ -23,12 +24,19 @@ function(nice_target_sources target_name src_loc)
|
||||
if (${entry} MATCHES "(^|/)win/" OR ${entry} MATCHES "(^|/)winrc/" OR ${entry} MATCHES "(^|/)windows/" OR ${entry} MATCHES "[_\\/]win\\.")
|
||||
list(APPEND not_mac_sources ${full_name})
|
||||
list(APPEND not_linux_sources ${full_name})
|
||||
+ list(APPEND not_haiku_sources ${full_name})
|
||||
elseif (${entry} MATCHES "(^|/)mac/" OR ${entry} MATCHES "(^|/)darwin/" OR ${entry} MATCHES "(^|/)osx/" OR ${entry} MATCHES "[_\\/]mac\\." OR ${entry} MATCHES "[_\\/]darwin\\." OR ${entry} MATCHES "[_\\/]osx\\.")
|
||||
list(APPEND not_win_sources ${full_name})
|
||||
list(APPEND not_linux_sources ${full_name})
|
||||
+ list(APPEND not_haiku_sources ${full_name})
|
||||
elseif (${entry} MATCHES "(^|/)linux/" OR ${entry} MATCHES "[_\\/]linux\\.")
|
||||
list(APPEND not_win_sources ${full_name})
|
||||
list(APPEND not_mac_sources ${full_name})
|
||||
+ list(APPEND not_haiku_sources ${full_name})
|
||||
+ elseif (${entry} MATCHES "(^|/)haiku/" OR ${entry} MATCHES "[_\\/]haiku\\.")
|
||||
+ list(APPEND not_win_sources ${full_name})
|
||||
+ list(APPEND not_mac_sources ${full_name})
|
||||
+ list(APPEND not_linux_sources ${full_name})
|
||||
elseif (${entry} MATCHES "(^|/)posix/" OR ${entry} MATCHES "[_\\/]posix\\.")
|
||||
list(APPEND not_win_sources ${full_name})
|
||||
endif()
|
||||
@@ -64,6 +72,9 @@ function(nice_target_sources target_name src_loc)
|
||||
elseif (APPLE)
|
||||
set_source_files_properties(${not_mac_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
set_source_files_properties(${not_mac_sources} PROPERTIES SKIP_AUTOGEN TRUE)
|
||||
+ elseif (HAIKU)
|
||||
+ set_source_files_properties(${not_haiku_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
+ set_source_files_properties(${not_haiku_sources} PROPERTIES SKIP_AUTOGEN TRUE)
|
||||
else()
|
||||
set_source_files_properties(${not_linux_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
set_source_files_properties(${not_linux_sources} PROPERTIES SKIP_AUTOGEN TRUE)
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/api/task_queue/BUILD.gn b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/api/task_queue/BUILD.gn
|
||||
index 1072057..745f5b7 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/api/task_queue/BUILD.gn
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/api/task_queue/BUILD.gn
|
||||
@@ -82,7 +82,7 @@ rtc_library("default_task_queue_factory") {
|
||||
sources = [ "default_task_queue_factory.h" ]
|
||||
deps = [ ":task_queue" ]
|
||||
|
||||
- if (rtc_enable_libevent) {
|
||||
+ if (rtc_enable_libevent && !is_haiku) {
|
||||
sources += [ "default_task_queue_factory_libevent.cc" ]
|
||||
deps += [ "../../rtc_base:rtc_task_queue_libevent" ]
|
||||
} else if (is_mac || is_ios) {
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/device_info_haiku.cc b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/device_info_haiku.cc
|
||||
new file mode 100644
|
||||
index 0000000..6f1c551
|
||||
--- /dev/null
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/device_info_haiku.cc
|
||||
@@ -0,0 +1,69 @@
|
||||
+#include "modules/video_capture/haiku/device_info_haiku.h"
|
||||
+
|
||||
+#include <errno.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <sys/ioctl.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+#include <vector>
|
||||
+
|
||||
+#include "modules/video_capture/video_capture.h"
|
||||
+#include "modules/video_capture/video_capture_defines.h"
|
||||
+#include "modules/video_capture/video_capture_impl.h"
|
||||
+#include "rtc_base/logging.h"
|
||||
+
|
||||
+namespace webrtc {
|
||||
+namespace videocapturemodule {
|
||||
+VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo() {
|
||||
+ return new videocapturemodule::DeviceInfoHaiku();
|
||||
+}
|
||||
+
|
||||
+DeviceInfoHaiku::DeviceInfoHaiku() : DeviceInfoImpl() {}
|
||||
+
|
||||
+int32_t DeviceInfoHaiku::Init() {
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+DeviceInfoHaiku::~DeviceInfoHaiku() {}
|
||||
+
|
||||
+uint32_t DeviceInfoHaiku::NumberOfDevices() {
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int32_t DeviceInfoHaiku::GetDeviceName(uint32_t deviceNumber,
|
||||
+ char* deviceNameUTF8,
|
||||
+ uint32_t deviceNameLength,
|
||||
+ char* deviceUniqueIdUTF8,
|
||||
+ uint32_t deviceUniqueIdUTF8Length,
|
||||
+ char* /*productUniqueIdUTF8*/,
|
||||
+ uint32_t /*productUniqueIdUTF8Length*/) {
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+int32_t DeviceInfoHaiku::CreateCapabilityMap(const char* deviceUniqueIdUTF8) {
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+int32_t DeviceInfoHaiku::DisplayCaptureSettingsDialogBox(
|
||||
+ const char* /*deviceUniqueIdUTF8*/,
|
||||
+ const char* /*dialogTitleUTF8*/,
|
||||
+ void* /*parentWindow*/,
|
||||
+ uint32_t /*positionX*/,
|
||||
+ uint32_t /*positionY*/) {
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+bool DeviceInfoHaiku::IsDeviceNameMatches(const char* name,
|
||||
+ const char* deviceUniqueIdUTF8) {
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+int32_t DeviceInfoHaiku::FillCapabilities(int fd) {
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+} // namespace videocapturemodule
|
||||
+} // namespace webrtc
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/device_info_haiku.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/device_info_haiku.h
|
||||
new file mode 100644
|
||||
index 0000000..96352fa
|
||||
--- /dev/null
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/device_info_haiku.h
|
||||
@@ -0,0 +1,36 @@
|
||||
+#ifndef MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_DEVICE_INFO_HAIKU_H_
|
||||
+#define MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_DEVICE_INFO_HAIKU_H_
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+
|
||||
+#include "modules/video_capture/device_info_impl.h"
|
||||
+
|
||||
+namespace webrtc {
|
||||
+namespace videocapturemodule {
|
||||
+class DeviceInfoHaiku : public DeviceInfoImpl {
|
||||
+ public:
|
||||
+ DeviceInfoHaiku();
|
||||
+ ~DeviceInfoHaiku() override;
|
||||
+ uint32_t NumberOfDevices() override;
|
||||
+ int32_t GetDeviceName(uint32_t deviceNumber,
|
||||
+ char* deviceNameUTF8,
|
||||
+ uint32_t deviceNameLength,
|
||||
+ char* deviceUniqueIdUTF8,
|
||||
+ uint32_t deviceUniqueIdUTF8Length,
|
||||
+ char* productUniqueIdUTF8 = 0,
|
||||
+ uint32_t productUniqueIdUTF8Length = 0) override;
|
||||
+ int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8) override;
|
||||
+ int32_t DisplayCaptureSettingsDialogBox(const char*,
|
||||
+ const char*,
|
||||
+ void*,
|
||||
+ uint32_t,
|
||||
+ uint32_t) override;
|
||||
+ int32_t FillCapabilities(int fd);
|
||||
+ int32_t Init() override;
|
||||
+
|
||||
+ private:
|
||||
+ bool IsDeviceNameMatches(const char* name, const char* deviceUniqueIdUTF8);
|
||||
+};
|
||||
+} // namespace videocapturemodule
|
||||
+} // namespace webrtc
|
||||
+#endif // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_DEVICE_INFO_HAIKU_H_
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.cc b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.cc
|
||||
new file mode 100644
|
||||
index 0000000..94a79df
|
||||
--- /dev/null
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.cc
|
||||
@@ -0,0 +1,29 @@
|
||||
+#include "modules/video_capture/haiku/video_capture_haiku.h"
|
||||
+
|
||||
+#include <errno.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <stdio.h>
|
||||
+#include <string.h>
|
||||
+#include <sys/ioctl.h>
|
||||
+#include <sys/mman.h>
|
||||
+#include <sys/select.h>
|
||||
+#include <time.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+#include <new>
|
||||
+#include <string>
|
||||
+
|
||||
+#include "api/scoped_refptr.h"
|
||||
+#include "media/base/video_common.h"
|
||||
+#include "modules/video_capture/video_capture.h"
|
||||
+#include "rtc_base/logging.h"
|
||||
+#include "rtc_base/ref_counted_object.h"
|
||||
+
|
||||
+namespace webrtc {
|
||||
+namespace videocapturemodule {
|
||||
+rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
|
||||
+ const char* deviceUniqueId) {
|
||||
+ return nullptr;
|
||||
+}
|
||||
+} // namespace videocapturemodule
|
||||
+} // namespace webrtc
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.h
|
||||
new file mode 100644
|
||||
index 0000000..55a27fc
|
||||
--- /dev/null
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.h
|
||||
@@ -0,0 +1,20 @@
|
||||
+#ifndef MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_VIDEO_CAPTURE_HAIKU_H_
|
||||
+#define MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_VIDEO_CAPTURE_HAIKU_H_
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+#include <stdint.h>
|
||||
+
|
||||
+#include <memory>
|
||||
+
|
||||
+#include "modules/video_capture/video_capture_defines.h"
|
||||
+#include "modules/video_capture/video_capture_impl.h"
|
||||
+#include "rtc_base/critical_section.h"
|
||||
+#include "rtc_base/platform_thread.h"
|
||||
+
|
||||
+namespace webrtc {
|
||||
+namespace videocapturemodule {
|
||||
+
|
||||
+} // namespace videocapturemodule
|
||||
+} // namespace webrtc
|
||||
+
|
||||
+#endif // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_VIDEO_CAPTURE_HAIKU_H_
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/BUILD.gn b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/BUILD.gn
|
||||
index c4f4d32..d5d82d1 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/BUILD.gn
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/BUILD.gn
|
||||
@@ -489,7 +489,7 @@ rtc_source_set("rtc_operations_chain") {
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
}
|
||||
|
||||
-if (rtc_enable_libevent) {
|
||||
+if (rtc_enable_libevent && !is_haiku) {
|
||||
rtc_library("rtc_task_queue_libevent") {
|
||||
visibility = [ "../api/task_queue:default_task_queue_factory" ]
|
||||
sources = [
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/ip_address.cc b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/ip_address.cc
|
||||
index 9dd534c..aadf0fd 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/ip_address.cc
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/ip_address.cc
|
||||
@@ -11,6 +11,9 @@
|
||||
#if defined(WEBRTC_POSIX)
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
+#if defined(WEBRTC_HAIKU)
|
||||
+#include <netinet6/in6.h>
|
||||
+#endif
|
||||
#ifdef OPENBSD
|
||||
#include <netinet/in_systm.h>
|
||||
#endif
|
||||
@@ -32,6 +35,15 @@
|
||||
namespace rtc {
|
||||
|
||||
// Prefixes used for categorizing IPv6 addresses.
|
||||
+#if defined(WEBRTC_HAIKU)
|
||||
+static const in6_addr kV4MappedPrefix = {
|
||||
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0}};
|
||||
+static const in6_addr k6To4Prefix = {{0x20, 0x02, 0}};
|
||||
+static const in6_addr kTeredoPrefix = {{0x20, 0x01, 0x00, 0x00}};
|
||||
+static const in6_addr kV4CompatibilityPrefix = {{0}};
|
||||
+static const in6_addr k6BonePrefix = {{0x3f, 0xfe, 0}};
|
||||
+static const in6_addr kPrivateNetworkPrefix = {{0xFD}};
|
||||
+#else
|
||||
static const in6_addr kV4MappedPrefix = {
|
||||
{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0}}};
|
||||
static const in6_addr k6To4Prefix = {{{0x20, 0x02, 0}}};
|
||||
@@ -39,6 +51,7 @@ static const in6_addr kTeredoPrefix = {{{0x20, 0x01, 0x00, 0x00}}};
|
||||
static const in6_addr kV4CompatibilityPrefix = {{{0}}};
|
||||
static const in6_addr k6BonePrefix = {{{0x3f, 0xfe, 0}}};
|
||||
static const in6_addr kPrivateNetworkPrefix = {{{0xFD}}};
|
||||
+#endif
|
||||
|
||||
static bool IPIsHelper(const IPAddress& ip,
|
||||
const in6_addr& tomatch,
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/logging.cc b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/logging.cc
|
||||
index 13a5f02..8362c3e 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/logging.cc
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/logging.cc
|
||||
@@ -122,7 +122,11 @@ LogMessage::LogMessage(const char* file,
|
||||
|
||||
if (thread_) {
|
||||
PlatformThreadId id = CurrentThreadId();
|
||||
+#ifdef WEBRTC_HAIKU
|
||||
+ print_stream_ << "[" << (uint64_t)id << "] ";
|
||||
+#else
|
||||
print_stream_ << "[" << id << "] ";
|
||||
+#endif
|
||||
}
|
||||
|
||||
if (file != nullptr) {
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/network.cc b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/network.cc
|
||||
index 07c39ae..a2c077a 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/network.cc
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/network.cc
|
||||
@@ -524,7 +524,7 @@ void BasicNetworkManager::ConvertIfAddrs(struct ifaddrs* interfaces,
|
||||
continue;
|
||||
}
|
||||
// Skip ones which are down.
|
||||
- if (!(cursor->ifa_flags & IFF_RUNNING)) {
|
||||
+ if (!(cursor->ifa_flags & IFF_LINK)) {
|
||||
continue;
|
||||
}
|
||||
// Skip unknown family.
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/physical_socket_server.cc b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/physical_socket_server.cc
|
||||
index 3cb7c20..ee1b674 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/physical_socket_server.cc
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/physical_socket_server.cc
|
||||
@@ -69,7 +69,7 @@ typedef void* SockOptArg;
|
||||
|
||||
#endif // WEBRTC_POSIX
|
||||
|
||||
-#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(__native_client__)
|
||||
+#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(WEBRTC_HAIKU) && !defined(__native_client__)
|
||||
|
||||
int64_t GetSocketRecvTimestamp(int socket) {
|
||||
struct timeval tv_ioctl;
|
||||
@@ -332,7 +332,7 @@ int PhysicalSocket::SetOption(Option opt, int value) {
|
||||
value <<= 2;
|
||||
#endif
|
||||
}
|
||||
-#if defined(WEBRTC_POSIX)
|
||||
+#if defined(WEBRTC_POSIX) && !defined(WEBRTC_HAIKU)
|
||||
if (sopt == IPV6_TCLASS) {
|
||||
// Set the IPv4 option in all cases to support dual-stack sockets.
|
||||
// Don't bother checking the return code, as this is expected to fail if
|
||||
@@ -574,7 +574,7 @@ int PhysicalSocket::TranslateOption(Option opt, int* slevel, int* sopt) {
|
||||
#elif defined(WEBRTC_MAC) || defined(BSD) || defined(__native_client__)
|
||||
RTC_LOG(LS_WARNING) << "Socket::OPT_DONTFRAGMENT not supported.";
|
||||
return -1;
|
||||
-#elif defined(WEBRTC_POSIX)
|
||||
+#elif defined(WEBRTC_POSIX) && !defined(WEBRTC_HAIKU)
|
||||
*slevel = IPPROTO_IP;
|
||||
*sopt = IP_MTU_DISCOVER;
|
||||
break;
|
||||
@@ -592,7 +592,7 @@ int PhysicalSocket::TranslateOption(Option opt, int* slevel, int* sopt) {
|
||||
*sopt = TCP_NODELAY;
|
||||
break;
|
||||
case OPT_DSCP:
|
||||
-#if defined(WEBRTC_POSIX)
|
||||
+#if defined(WEBRTC_POSIX) && !defined(WEBRTC_HAIKU)
|
||||
if (family_ == AF_INET6) {
|
||||
*slevel = IPPROTO_IPV6;
|
||||
*sopt = IPV6_TCLASS;
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/platform_thread_types.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/platform_thread_types.h
|
||||
index 6b9101e..0ae52e5 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/platform_thread_types.h
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/platform_thread_types.h
|
||||
@@ -38,6 +38,9 @@ typedef DWORD PlatformThreadRef;
|
||||
#elif defined(WEBRTC_FUCHSIA)
|
||||
typedef zx_handle_t PlatformThreadId;
|
||||
typedef zx_handle_t PlatformThreadRef;
|
||||
+#elif defined(WEBRTC_HAIKU)
|
||||
+typedef pthread_t PlatformThreadId;
|
||||
+typedef pthread_t PlatformThreadRef;
|
||||
#elif defined(WEBRTC_POSIX)
|
||||
typedef pid_t PlatformThreadId;
|
||||
typedef pthread_t PlatformThreadRef;
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export.h
|
||||
index d1eb60a..9dc761d 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export.h
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export.h
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#else // WEBRTC_WIN
|
||||
|
||||
-#if __has_attribute(visibility) && defined(WEBRTC_LIBRARY_IMPL)
|
||||
+#if defined(WEBRTC_LIBRARY_IMPL)
|
||||
#define RTC_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export_template.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export_template.h
|
||||
index 4ac7043..5fe950f 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export_template.h
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export_template.h
|
||||
@@ -185,7 +185,7 @@
|
||||
|
||||
RTC_EXPORT_TEMPLATE_TEST(DEFAULT, ); // NOLINT
|
||||
RTC_EXPORT_TEMPLATE_TEST(DEFAULT, __attribute__((visibility("default"))));
|
||||
-RTC_EXPORT_TEMPLATE_TEST(MSVC_HACK, __declspec(dllexport));
|
||||
+//RTC_EXPORT_TEMPLATE_TEST(MSVC_HACK, __declspec(dllexport));
|
||||
RTC_EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllimport));
|
||||
|
||||
#undef RTC_EXPORT_TEMPLATE_TEST
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/base/options.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/base/options.h
|
||||
index 230bf1e..6e1b9e5 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/base/options.h
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/base/options.h
|
||||
@@ -100,7 +100,7 @@
|
||||
// User code should not inspect this macro. To check in the preprocessor if
|
||||
// absl::any is a typedef of std::any, use the feature macro ABSL_USES_STD_ANY.
|
||||
|
||||
-#define ABSL_OPTION_USE_STD_ANY 2
|
||||
+#define ABSL_OPTION_USE_STD_ANY 0
|
||||
|
||||
|
||||
// ABSL_OPTION_USE_STD_OPTIONAL
|
||||
@@ -127,7 +127,7 @@
|
||||
// absl::optional is a typedef of std::optional, use the feature macro
|
||||
// ABSL_USES_STD_OPTIONAL.
|
||||
|
||||
-#define ABSL_OPTION_USE_STD_OPTIONAL 2
|
||||
+#define ABSL_OPTION_USE_STD_OPTIONAL 0
|
||||
|
||||
|
||||
// ABSL_OPTION_USE_STD_STRING_VIEW
|
||||
@@ -154,7 +154,7 @@
|
||||
// absl::string_view is a typedef of std::string_view, use the feature macro
|
||||
// ABSL_USES_STD_STRING_VIEW.
|
||||
|
||||
-#define ABSL_OPTION_USE_STD_STRING_VIEW 2
|
||||
+#define ABSL_OPTION_USE_STD_STRING_VIEW 0
|
||||
|
||||
// ABSL_OPTION_USE_STD_VARIANT
|
||||
//
|
||||
@@ -180,7 +180,7 @@
|
||||
// absl::variant is a typedef of std::variant, use the feature macro
|
||||
// ABSL_USES_STD_VARIANT.
|
||||
|
||||
-#define ABSL_OPTION_USE_STD_VARIANT 2
|
||||
+#define ABSL_OPTION_USE_STD_VARIANT 0
|
||||
|
||||
|
||||
// ABSL_OPTION_USE_INLINE_NAMESPACE
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.cc b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.cc
|
||||
index 8127cb0..40a23b6 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.cc
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.cc
|
||||
@@ -19,22 +19,5 @@
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
-bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2) {
|
||||
- return (piece1.size() == piece2.size() &&
|
||||
- 0 == absl::strings_internal::memcasecmp(piece1.data(), piece2.data(),
|
||||
- piece1.size()));
|
||||
- // memcasecmp uses absl::ascii_tolower().
|
||||
-}
|
||||
-
|
||||
-bool StartsWithIgnoreCase(absl::string_view text, absl::string_view prefix) {
|
||||
- return (text.size() >= prefix.size()) &&
|
||||
- EqualsIgnoreCase(text.substr(0, prefix.size()), prefix);
|
||||
-}
|
||||
-
|
||||
-bool EndsWithIgnoreCase(absl::string_view text, absl::string_view suffix) {
|
||||
- return (text.size() >= suffix.size()) &&
|
||||
- EqualsIgnoreCase(text.substr(text.size() - suffix.size()), suffix);
|
||||
-}
|
||||
-
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.h
|
||||
index 90fca98..53ada13 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.h
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.h
|
||||
@@ -35,7 +35,9 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
+#include "absl/strings/match.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
+#include "absl/strings/internal/memutil.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
@@ -70,19 +72,30 @@ inline bool EndsWith(absl::string_view text, absl::string_view suffix) {
|
||||
//
|
||||
// Returns whether given ASCII strings `piece1` and `piece2` are equal, ignoring
|
||||
// case in the comparison.
|
||||
-bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2);
|
||||
+inline bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2) {
|
||||
+ return (piece1.size() == piece2.size() &&
|
||||
+ 0 == absl::strings_internal::memcasecmp(piece1.data(), piece2.data(),
|
||||
+ piece1.size()));
|
||||
+ // memcasecmp uses absl::ascii_tolower().
|
||||
+}
|
||||
|
||||
// StartsWithIgnoreCase()
|
||||
//
|
||||
// Returns whether a given ASCII string `text` starts with `prefix`,
|
||||
// ignoring case in the comparison.
|
||||
-bool StartsWithIgnoreCase(absl::string_view text, absl::string_view prefix);
|
||||
+inline bool StartsWithIgnoreCase(absl::string_view text, absl::string_view prefix) {
|
||||
+ return (text.size() >= prefix.size()) &&
|
||||
+ EqualsIgnoreCase(text.substr(0, prefix.size()), prefix);
|
||||
+}
|
||||
|
||||
// EndsWithIgnoreCase()
|
||||
//
|
||||
// Returns whether a given ASCII string `text` ends with `suffix`, ignoring
|
||||
// case in the comparison.
|
||||
-bool EndsWithIgnoreCase(absl::string_view text, absl::string_view suffix);
|
||||
+inline bool EndsWithIgnoreCase(absl::string_view text, absl::string_view suffix) {
|
||||
+ return (text.size() >= suffix.size()) &&
|
||||
+ EqualsIgnoreCase(text.substr(text.size() - suffix.size()), suffix);
|
||||
+}
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp
|
||||
index 8aa67f1..5c2b6e1 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp
|
||||
@@ -48,7 +48,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <unistd.h>
|
||||
-#ifndef __Fuchsia__
|
||||
+#if !defined(__Fuchsia__) && !defined(__HAIKU__)
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
@@ -244,7 +244,7 @@ WELS_THREAD_ERROR_CODE WelsThreadCreate (WELS_THREAD_HANDLE* thread, LPWELS_
|
||||
err = pthread_attr_init (&at);
|
||||
if (err)
|
||||
return err;
|
||||
-#if !defined(__ANDROID__) && !defined(__Fuchsia__)
|
||||
+#if !defined(__ANDROID__) && !defined(__Fuchsia__) && !defined(__HAIKU__)
|
||||
err = pthread_attr_setscope (&at, PTHREAD_SCOPE_SYSTEM);
|
||||
if (err)
|
||||
return err;
|
||||
@@ -517,6 +517,10 @@ WELS_THREAD_ERROR_CODE WelsQueryLogicalProcessInfo (WelsLogicalProcessInfo* p
|
||||
|
||||
return WELS_THREAD_ERROR_OK;
|
||||
|
||||
+#elif defined(__HAIKU__)
|
||||
+ pInfo->ProcessorCount = 1;
|
||||
+ return WELS_THREAD_ERROR_OK;
|
||||
+
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
|
||||
// There is not yet a way to determine CPU count in emscripten JS environment.
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h
|
||||
index 9847624..82409dd 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h
|
||||
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD: head/sys/netinet/sctp.h 356357 2020-01-04 20:33:12Z tuexen $
|
||||
#ifndef _NETINET_SCTP_H_
|
||||
#define _NETINET_SCTP_H_
|
||||
|
||||
-#if (defined(__APPLE__) || defined(__Userspace_os_Linux) || defined(__Userspace_os_Darwin))
|
||||
+#if (defined(__APPLE__) || defined(__Userspace_os_Linux) || defined(__Userspace_os_Darwin) || defined(__Userspace_os_Haiku))
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c
|
||||
index 5afe781..e1d99a7 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c
|
||||
@@ -6304,7 +6304,7 @@ sctp_input(i_pak, va_alist)
|
||||
#if defined(__Windows__)
|
||||
NTOHS(ip->ip_len);
|
||||
#endif
|
||||
-#if defined(__Userspace_os_Linux) || defined(__Userspace_os_Windows)
|
||||
+#if defined(__Userspace_os_Linux) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Haiku)
|
||||
ip->ip_len = ntohs(ip->ip_len);
|
||||
#endif
|
||||
#if defined(__FreeBSD__)
|
||||
@@ -6316,7 +6316,7 @@ sctp_input(i_pak, va_alist)
|
||||
#elif defined(__APPLE__)
|
||||
length = ip->ip_len + iphlen;
|
||||
#elif defined(__Userspace__)
|
||||
-#if defined(__Userspace_os_Linux) || defined(__Userspace_os_Windows)
|
||||
+#if defined(__Userspace_os_Linux) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Haiku)
|
||||
length = ip->ip_len;
|
||||
#else
|
||||
length = ip->ip_len + iphlen;
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h
|
||||
index f09cb8d..c26fad1 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h
|
||||
@@ -277,7 +277,7 @@ typedef char* caddr_t;
|
||||
|
||||
#else /* !defined(Userspace_os_Windows) */
|
||||
#include <sys/socket.h>
|
||||
-#if defined(__Userspace_os_DragonFly) || defined(__Userspace_os_FreeBSD) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_OpenBSD) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_Fuchsia)
|
||||
+#if defined(__Userspace_os_DragonFly) || defined(__Userspace_os_FreeBSD) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_OpenBSD) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_Fuchsia) || defined(__Userspace_os_Haiku)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
typedef pthread_mutex_t userland_mutex_t;
|
||||
@@ -1155,7 +1155,7 @@ sctp_get_mbuf_for_msg(unsigned int space_needed, int want_header, int how, int a
|
||||
|
||||
#define SCTP_IS_LISTENING(inp) ((inp->sctp_flags & SCTP_PCB_FLAGS_ACCEPTING) != 0)
|
||||
|
||||
-#if defined(__Userspace_os_Darwin) || defined(__Userspace_os_DragonFly) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Fuchsia)
|
||||
+#if defined(__Userspace_os_Darwin) || defined(__Userspace_os_DragonFly) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Fuchsia) || defined(__Userspace_os_Haiku)
|
||||
int
|
||||
timingsafe_bcmp(const void *, const void *, size_t);
|
||||
#endif
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c
|
||||
index 28922b6..dba15fd 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c
|
||||
@@ -94,7 +94,7 @@ sctp_userspace_set_threadname(const char *name)
|
||||
#endif
|
||||
}
|
||||
|
||||
-#if !defined(_WIN32) && !defined(__Userspace_os_NaCl)
|
||||
+#if !defined(_WIN32) && !defined(__Userspace_os_NaCl) && !defined(__Userspace_os_Haiku)
|
||||
int
|
||||
sctp_userspace_get_mtu_from_ifn(uint32_t if_index, int af)
|
||||
{
|
||||
@@ -118,7 +118,7 @@ sctp_userspace_get_mtu_from_ifn(uint32_t if_index, int af)
|
||||
}
|
||||
#endif
|
||||
|
||||
-#if defined(__Userspace_os_NaCl)
|
||||
+#if defined(__Userspace_os_NaCl) || defined(__Userspace_os_Haiku)
|
||||
int
|
||||
sctp_userspace_get_mtu_from_ifn(uint32_t if_index, int af)
|
||||
{
|
||||
@@ -126,7 +126,7 @@ sctp_userspace_get_mtu_from_ifn(uint32_t if_index, int af)
|
||||
}
|
||||
#endif
|
||||
|
||||
-#if defined(__Userspace_os_Darwin) || defined(__Userspace_os_DragonFly) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Fuchsia)
|
||||
+#if defined(__Userspace_os_Darwin) || defined(__Userspace_os_DragonFly) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Fuchsia) || defined(__Userspace_os_Haiku)
|
||||
int
|
||||
timingsafe_bcmp(const void *b1, const void *b2, size_t n)
|
||||
{
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c
|
||||
index 146a6d9..63a6240 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c
|
||||
@@ -50,6 +50,9 @@
|
||||
#if defined(__Userspace_os_Linux)
|
||||
#define __FAVOR_BSD /* (on Ubuntu at least) enables UDP header field names like BSD in RFC 768 */
|
||||
#endif
|
||||
+#if defined(__Userspace_os_Haiku)
|
||||
+#define UIO_MAXIOV _SC_IOV_MAX
|
||||
+#endif
|
||||
#if !defined (__Userspace_os_Windows)
|
||||
#if defined INET || defined INET6
|
||||
#include <netinet/udp.h>
|
||||
@@ -1068,7 +1071,7 @@ userspace_sctp_recvmsg(struct socket *so,
|
||||
if (error) {
|
||||
if ((auio.uio_resid != ulen) &&
|
||||
(error == EINTR ||
|
||||
-#if !defined(__Userspace_os_NetBSD)
|
||||
+#if !defined(__Userspace_os_NetBSD) && !defined(__Userspace_os_Haiku)
|
||||
error == ERESTART ||
|
||||
#endif
|
||||
error == EWOULDBLOCK)) {
|
||||
@@ -1161,7 +1164,7 @@ usrsctp_recvv(struct socket *so,
|
||||
if (errno) {
|
||||
if ((auio.uio_resid != ulen) &&
|
||||
(errno == EINTR ||
|
||||
-#if !defined(__Userspace_os_NetBSD)
|
||||
+#if !defined(__Userspace_os_NetBSD) && !defined(__Userspace_os_Haiku)
|
||||
errno == ERESTART ||
|
||||
#endif
|
||||
errno == EWOULDBLOCK)) {
|
||||
@@ -2117,7 +2120,7 @@ int user_connect(struct socket *so, struct sockaddr *sa)
|
||||
error = pthread_cond_wait(SOCK_COND(so), SOCK_MTX(so));
|
||||
#endif
|
||||
if (error) {
|
||||
-#if defined(__Userspace_os_NetBSD)
|
||||
+#if defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Haiku)
|
||||
if (error == EINTR) {
|
||||
#else
|
||||
if (error == EINTR || error == ERESTART) {
|
||||
@@ -2137,7 +2140,7 @@ bad:
|
||||
if (!interrupted) {
|
||||
so->so_state &= ~SS_ISCONNECTING;
|
||||
}
|
||||
-#if !defined(__Userspace_os_NetBSD)
|
||||
+#if !defined(__Userspace_os_NetBSD) && !defined(__Userspace_os_Haiku)
|
||||
if (error == ERESTART) {
|
||||
error = EINTR;
|
||||
}
|
||||
--
|
||||
2.30.0
|
||||
|
||||
|
||||
From 489b7fbcdf3eb5f9ea7e80bc3aab944be19c3001 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Sat, 30 Jan 2021 22:18:47 +1000
|
||||
Subject: Fix build
|
||||
|
||||
|
||||
diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.h
|
||||
index 55a27fc..ac60bb0 100644
|
||||
--- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.h
|
||||
+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.h
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
#include "modules/video_capture/video_capture_defines.h"
|
||||
#include "modules/video_capture/video_capture_impl.h"
|
||||
-#include "rtc_base/critical_section.h"
|
||||
#include "rtc_base/platform_thread.h"
|
||||
+#include "rtc_base/synchronization/mutex.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace videocapturemodule {
|
||||
--
|
||||
2.30.0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
742
net-im/telegram-desktop/patches/telegram_desktop-2.6.1.patchset
Normal file
742
net-im/telegram-desktop/patches/telegram_desktop-2.6.1.patchset
Normal file
@@ -0,0 +1,742 @@
|
||||
From 5fff21fdc96b36c3eb24ca31b8ce3c81b3817029 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Thu, 25 Feb 2021 17:20:48 +1000
|
||||
Subject: Add haiku support
|
||||
|
||||
|
||||
diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt
|
||||
index c5ba8fd..19037d3 100644
|
||||
--- a/Telegram/CMakeLists.txt
|
||||
+++ b/Telegram/CMakeLists.txt
|
||||
@@ -1137,6 +1137,18 @@ if (DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
|
||||
)
|
||||
endif()
|
||||
|
||||
+if (HAIKU)
|
||||
+ remove_target_sources(Telegram ${src_loc}
|
||||
+ platform/linux/notifications_manager_linux.h
|
||||
+ platform/linux/notifications_manager_linux_dummy.cpp
|
||||
+ )
|
||||
+ nice_target_sources(Telegram ${src_loc}
|
||||
+ PRIVATE
|
||||
+ platform/linux/notifications_manager_haiku.h
|
||||
+ platform/linux/notifications_manager_haiku.cpp
|
||||
+ )
|
||||
+endif()
|
||||
+
|
||||
if (DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
|
||||
remove_target_sources(Telegram ${src_loc} platform/linux/linux_wayland_integration.cpp)
|
||||
nice_target_sources(Telegram ${src_loc} PRIVATE platform/linux/linux_wayland_integration_dummy.cpp)
|
||||
@@ -1263,7 +1275,7 @@ elseif (build_osx)
|
||||
else()
|
||||
set(bundle_identifier "com.tdesktop.Telegram$<$<CONFIG:Debug>:Debug>")
|
||||
set(bundle_entitlements "Telegram.entitlements")
|
||||
- if (LINUX AND DESKTOP_APP_USE_PACKAGED)
|
||||
+ if (LINUX AND NOT HAIKU AND DESKTOP_APP_USE_PACKAGED)
|
||||
set(output_name "telegram-desktop")
|
||||
else()
|
||||
set(output_name "Telegram")
|
||||
diff --git a/Telegram/SourceFiles/core/core_settings.h b/Telegram/SourceFiles/core/core_settings.h
|
||||
index 732f75b..138608f 100644
|
||||
--- a/Telegram/SourceFiles/core/core_settings.h
|
||||
+++ b/Telegram/SourceFiles/core/core_settings.h
|
||||
@@ -586,7 +586,7 @@ private:
|
||||
rpl::variable<float64> _dialogsWidthRatio; // per-window
|
||||
rpl::variable<int> _thirdColumnWidth = kDefaultThirdColumnWidth; // p-w
|
||||
bool _notifyFromAll = true;
|
||||
- rpl::variable<bool> _nativeWindowFrame = false;
|
||||
+ rpl::variable<bool> _nativeWindowFrame = true;
|
||||
rpl::variable<std::optional<bool>> _systemDarkMode = std::nullopt;
|
||||
rpl::variable<bool> _systemDarkModeEnabled = false;
|
||||
WindowPosition _windowPosition; // per-window
|
||||
diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp
|
||||
index 9796164..947f7fc 100644
|
||||
--- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp
|
||||
+++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp
|
||||
@@ -620,14 +620,26 @@ bool MainWindow::hasTrayIcon() const {
|
||||
|
||||
bool MainWindow::isActiveForTrayMenu() {
|
||||
updateIsActive();
|
||||
+#ifdef Q_OS_HAIKU
|
||||
+ return isVisible();
|
||||
+#else
|
||||
return Platform::IsWayland() ? isVisible() : isActive();
|
||||
+#endif
|
||||
}
|
||||
|
||||
void MainWindow::psShowTrayMenu() {
|
||||
+#ifndef Q_OS_HAIKU
|
||||
_trayIconMenuXEmbed->popup(QCursor::pos());
|
||||
+#endif
|
||||
}
|
||||
|
||||
void MainWindow::psTrayMenuUpdated() {
|
||||
+#ifdef Q_OS_HAIKU
|
||||
+ if (trayIcon && trayIconMenu
|
||||
+ && trayIcon->contextMenu() != trayIconMenu) {
|
||||
+ trayIcon->setContextMenu(trayIconMenu);
|
||||
+ }
|
||||
+#endif
|
||||
}
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
@@ -893,8 +905,10 @@ void MainWindow::updateIconCounters() {
|
||||
}
|
||||
|
||||
void MainWindow::initTrayMenuHook() {
|
||||
+#ifndef Q_OS_HAIKU
|
||||
_trayIconMenuXEmbed.emplace(nullptr, trayIconMenu);
|
||||
_trayIconMenuXEmbed->deleteOnHide(false);
|
||||
+#endif
|
||||
}
|
||||
|
||||
#ifdef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
diff --git a/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.cpp b/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.cpp
|
||||
new file mode 100644
|
||||
index 0000000..d567f10
|
||||
--- /dev/null
|
||||
+++ b/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.cpp
|
||||
@@ -0,0 +1,64 @@
|
||||
+/*
|
||||
+This file is part of Telegram Desktop for Haiku,
|
||||
+
|
||||
+For license and copyright information please follow this link:
|
||||
+https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
+
|
||||
+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com
|
||||
+*/
|
||||
+
|
||||
+#include <Application.h>
|
||||
+#include <OS.h>
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+#define APPSIGNATURE "application/x-vnd.tg-notify-gate"
|
||||
+#define NOTIFY_PORT_NAME "tg_notify"
|
||||
+#define NOTIFY_MESSAGE 'TGNF'
|
||||
+
|
||||
+typedef struct notify_msg
|
||||
+{
|
||||
+ uint64 sessionId;
|
||||
+ uint64 peerId;
|
||||
+ int32 msgId;
|
||||
+} notify_msg;
|
||||
+
|
||||
+class SimpleLauncherApp : public BApplication {
|
||||
+ public:
|
||||
+ SimpleLauncherApp(int argc, char **argv);
|
||||
+ void ArgvReceived(int32 argc, char **argv);
|
||||
+ virtual void ReadyToRun();
|
||||
+};
|
||||
+
|
||||
+SimpleLauncherApp::SimpleLauncherApp(int argc, char **argv) : BApplication(APPSIGNATURE)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+SimpleLauncherApp::ArgvReceived(int32 argc, char **argv)
|
||||
+{
|
||||
+ if (argc == 2) {
|
||||
+ notify_msg message;
|
||||
+ sscanf(argv[1], "%lld %lld %d", &message.sessionId, &message.peerId, &message.msgId);
|
||||
+ if (message.peerId != 0 && message.msgId != 0) {
|
||||
+ port_id portId = find_port(NOTIFY_PORT_NAME);
|
||||
+ if (portId > 0) {
|
||||
+ write_port(portId, NOTIFY_MESSAGE, &message, sizeof(message));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+SimpleLauncherApp::ReadyToRun()
|
||||
+{
|
||||
+ Quit();
|
||||
+}
|
||||
+
|
||||
+int main(int argc, char **argv)
|
||||
+{
|
||||
+ SimpleLauncherApp application(argc, argv);
|
||||
+ application.Run();
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.rdef b/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.rdef
|
||||
new file mode 100644
|
||||
index 0000000..b6f3490
|
||||
--- /dev/null
|
||||
+++ b/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.rdef
|
||||
@@ -0,0 +1,13 @@
|
||||
+resource app_flags B_MULTIPLE_LAUNCH | B_BACKGROUND_APP;
|
||||
+
|
||||
+resource app_version {
|
||||
+ major = 0,
|
||||
+ middle = 0,
|
||||
+ minor = 1,
|
||||
+ variety = B_APPV_FINAL,
|
||||
+ internal = 0,
|
||||
+ short_info = "tg-notify-gate",
|
||||
+ long_info = "Telegram native notifications gate"
|
||||
+};
|
||||
+
|
||||
+resource app_signature "application/x-vnd.tg-notify-gate";
|
||||
diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.cpp
|
||||
new file mode 100644
|
||||
index 0000000..e36b747
|
||||
--- /dev/null
|
||||
+++ b/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.cpp
|
||||
@@ -0,0 +1,202 @@
|
||||
+/*
|
||||
+This file is part of Telegram Desktop for Haiku,
|
||||
+
|
||||
+For license and copyright information please follow this link:
|
||||
+https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
+
|
||||
+Copyright (c) 2018-2021 Gerasim Troeglazov, 3dEyes@gmail.com
|
||||
+*/
|
||||
+
|
||||
+#ifdef __x86_64__
|
||||
+#define int64 __haiku_int64
|
||||
+#define uint64 __haiku_uint64
|
||||
+#else
|
||||
+#define int32 __haiku_int32
|
||||
+#define uint32 __haiku_uint32
|
||||
+#endif
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <fcntl.h>
|
||||
+
|
||||
+#include <SupportDefs.h>
|
||||
+#include <Notification.h>
|
||||
+#include <Bitmap.h>
|
||||
+#include <TranslationUtils.h>
|
||||
+#include <Entry.h>
|
||||
+#include <OS.h>
|
||||
+
|
||||
+#include "platform/linux/notifications_manager_haiku.h"
|
||||
+
|
||||
+#include "window/notifications_utilities.h"
|
||||
+#include "history/history.h"
|
||||
+#include "lang/lang_keys.h"
|
||||
+#include "core/application.h"
|
||||
+#include "core/core_settings.h"
|
||||
+#include "main/main_session.h"
|
||||
+
|
||||
+#define DeclareReadOnlyVar(Type, Name) const Type &Name();
|
||||
+#define DeclareRefVar(Type, Name) DeclareReadOnlyVar(Type, Name) \
|
||||
+ Type &Ref##Name();
|
||||
+#define DeclareVar(Type, Name) DeclareRefVar(Type, Name) \
|
||||
+ void Set##Name(const Type &Name);
|
||||
+
|
||||
+#include <QProcess>
|
||||
+#include <QThread>
|
||||
+#include <QObject>
|
||||
+#include <QString>
|
||||
+#include <QStringList>
|
||||
+
|
||||
+namespace Platform {
|
||||
+namespace Notifications {
|
||||
+namespace {
|
||||
+
|
||||
+} // namespace
|
||||
+
|
||||
+bool Supported() {
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+void Create(Window::Notifications::System *system) {
|
||||
+ if (Core::App().settings().nativeNotifications() && Supported()) {
|
||||
+ auto result = std::make_unique<Manager>(system);
|
||||
+ system->setManager(std::move(result));
|
||||
+ return;
|
||||
+ }
|
||||
+ system->setManager(nullptr);
|
||||
+}
|
||||
+
|
||||
+void Finish() {
|
||||
+}
|
||||
+
|
||||
+NotifyReader::NotifyReader()
|
||||
+{
|
||||
+ portId = create_port(NOTIFY_MESSAGE_DEEP, NOTIFY_PORT_NAME);
|
||||
+}
|
||||
+
|
||||
+NotifyReader::~NotifyReader()
|
||||
+{
|
||||
+ if (portId >= B_OK)
|
||||
+ delete_port(portId);
|
||||
+}
|
||||
+
|
||||
+void NotifyReader::run()
|
||||
+{
|
||||
+ notify_msg message;
|
||||
+ int32 code;
|
||||
+
|
||||
+ while (true) {
|
||||
+ ssize_t bytesRead = read_port(portId, &code, &message, sizeof(message));
|
||||
+ if (bytesRead == B_BAD_PORT_ID)
|
||||
+ break;
|
||||
+ if (bytesRead < (ssize_t)sizeof(message) || code != NOTIFY_MESSAGE)
|
||||
+ continue;
|
||||
+ if (message.peerId != 0 && message.msgId != 0)
|
||||
+ notificationActivated(message.sessionId, message.peerId, message.msgId);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+Manager::Private::Private(not_null<Manager*> manager, Type type)
|
||||
+: _cachedUserpics(type)
|
||||
+, _manager(manager) {
|
||||
+ portReaderThread = new QThread;
|
||||
+ portReader = new NotifyReader();
|
||||
+ portReader->moveToThread(portReaderThread);
|
||||
+ connect(portReaderThread, SIGNAL(started()), portReader, SLOT(run()));
|
||||
+ qRegisterMetaType<PeerId>("PeerId");
|
||||
+ qRegisterMetaType<MsgId>("MsgId");
|
||||
+ connect(
|
||||
+ portReader,
|
||||
+ SIGNAL(notificationActivated(PeerId, PeerId, MsgId)),
|
||||
+ this,
|
||||
+ SLOT(notificationActivatedSlot(PeerId, PeerId, MsgId)));
|
||||
+ portReaderThread->start();
|
||||
+}
|
||||
+
|
||||
+void Manager::Private::showNotification(
|
||||
+ not_null<PeerData*> peer,
|
||||
+ std::shared_ptr<Data::CloudImageView> &userpicView,
|
||||
+ MsgId msgId,
|
||||
+ const QString &title,
|
||||
+ const QString &subtitle,
|
||||
+ const QString &msg,
|
||||
+ bool hideNameAndPhoto,
|
||||
+ bool hideReplyButton) {
|
||||
+ auto titleText = title;
|
||||
+ auto subtitleText = subtitle;
|
||||
+ auto msgText = msg;
|
||||
+
|
||||
+ const auto key = hideNameAndPhoto
|
||||
+ ? InMemoryKey()
|
||||
+ : peer->userpicUniqueKey(userpicView);
|
||||
+
|
||||
+ auto userpicPath = _cachedUserpics.get(key, peer, userpicView);
|
||||
+ BBitmap *icon = BTranslationUtils::GetBitmapFile(userpicPath.toUtf8().data());
|
||||
+ QString args = QString("%1 %2 %3").arg(peer->session().uniqueId()).arg(peer->id).arg(msgId);
|
||||
+ BNotification notify(B_INFORMATION_NOTIFICATION);
|
||||
+ if (icon)
|
||||
+ notify.SetIcon(icon);
|
||||
+ notify.SetGroup("Telegram");
|
||||
+ notify.SetTitle(titleText.toUtf8().data());
|
||||
+ notify.SetContent(msgText.toUtf8().data());
|
||||
+ entry_ref ref;
|
||||
+ BEntry entry(NOTIFY_GATE_NAME);
|
||||
+ entry.GetRef(&ref);
|
||||
+ notify.SetOnClickFile(&ref);
|
||||
+ notify.AddOnClickArg(BString(args.toUtf8().data()));
|
||||
+ notify.Send();
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+Manager::Private::notificationActivatedSlot(PeerId _sessionId, PeerId _peerId, MsgId _msgId) {
|
||||
+ const auto manager = _manager;
|
||||
+ const auto my = Window::Notifications::Manager::NotificationId{
|
||||
+ .full = Manager::FullPeer{
|
||||
+ .sessionId = _sessionId,
|
||||
+ .peerId = _peerId
|
||||
+ },
|
||||
+ .msgId = _msgId
|
||||
+ };
|
||||
+ crl::on_main(manager, [=] {
|
||||
+ manager->notificationActivated(my);
|
||||
+ });
|
||||
+}
|
||||
+
|
||||
+Manager::Manager(Window::Notifications::System *system) : NativeManager(system)
|
||||
+, _private(std::make_unique<Private>(this, Private::Type::Rounded)) {
|
||||
+}
|
||||
+
|
||||
+Manager::~Manager() = default;
|
||||
+
|
||||
+void Manager::doShowNativeNotification(
|
||||
+ not_null<PeerData*> peer,
|
||||
+ std::shared_ptr<Data::CloudImageView> &userpicView,
|
||||
+ MsgId msgId,
|
||||
+ const QString &title,
|
||||
+ const QString &subtitle,
|
||||
+ const QString &msg,
|
||||
+ bool hideNameAndPhoto,
|
||||
+ bool hideReplyButton) {
|
||||
+ _private->showNotification(
|
||||
+ peer,
|
||||
+ userpicView,
|
||||
+ msgId,
|
||||
+ title,
|
||||
+ subtitle,
|
||||
+ msg,
|
||||
+ hideNameAndPhoto,
|
||||
+ hideReplyButton);
|
||||
+}
|
||||
+
|
||||
+void Manager::doClearAllFast() {
|
||||
+}
|
||||
+
|
||||
+void Manager::doClearFromHistory(not_null<History*> history) {
|
||||
+}
|
||||
+
|
||||
+void Manager::doClearFromSession(not_null<Main::Session*> session) {
|
||||
+}
|
||||
+
|
||||
+} // namespace Notifications
|
||||
+} // namespace Platform
|
||||
diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.h b/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.h
|
||||
new file mode 100644
|
||||
index 0000000..1f80b62
|
||||
--- /dev/null
|
||||
+++ b/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.h
|
||||
@@ -0,0 +1,123 @@
|
||||
+/*
|
||||
+This file is part of Telegram Desktop for Haiku,
|
||||
+
|
||||
+For license and copyright information please follow this link:
|
||||
+https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
+
|
||||
+Copyright (c) 2018-2021 Gerasim Troeglazov, 3dEyes@gmail.com
|
||||
+*/
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#include "platform/platform_notifications_manager.h"
|
||||
+#include "window/notifications_utilities.h"
|
||||
+
|
||||
+#include <QProcess>
|
||||
+#include <QThread>
|
||||
+#include <QObject>
|
||||
+
|
||||
+#define NOTIFY_MESSAGE_DEEP 16
|
||||
+#define NOTIFY_PORT_NAME "tg_notify"
|
||||
+#define NOTIFY_GATE_NAME "/bin/tg-notify-gate"
|
||||
+#define NOTIFY_MESSAGE 'TGNF'
|
||||
+
|
||||
+typedef struct notify_msg
|
||||
+{
|
||||
+ uint64 sessionId;
|
||||
+ uint64 peerId;
|
||||
+ int32 msgId;
|
||||
+} notify_msg;
|
||||
+
|
||||
+namespace Platform {
|
||||
+namespace Notifications {
|
||||
+
|
||||
+inline bool SkipAudio() {
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+inline bool SkipToast() {
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+inline bool SkipFlashBounce() {
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+inline bool Enforced() {
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+inline bool ByDefault() {
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+void Finish();
|
||||
+
|
||||
+class NotifyReader:public QObject {
|
||||
+ Q_OBJECT
|
||||
+public:
|
||||
+ NotifyReader();
|
||||
+ ~NotifyReader();
|
||||
+public slots:
|
||||
+ void run();
|
||||
+signals:
|
||||
+ void notificationActivated(PeerId sessionId, PeerId peerId, MsgId msgId);
|
||||
+private:
|
||||
+ int32 portId;
|
||||
+};
|
||||
+
|
||||
+
|
||||
+class Manager : public Window::Notifications::NativeManager, public base::has_weak_ptr {
|
||||
+public:
|
||||
+ Manager(Window::Notifications::System *system);
|
||||
+ ~Manager();
|
||||
+
|
||||
+protected:
|
||||
+ void doShowNativeNotification(
|
||||
+ not_null<PeerData*> peer,
|
||||
+ std::shared_ptr<Data::CloudImageView> &userpicView,
|
||||
+ MsgId msgId,
|
||||
+ const QString &title,
|
||||
+ const QString &subtitle,
|
||||
+ const QString &msg,
|
||||
+ bool hideNameAndPhoto,
|
||||
+ bool hideReplyButton) override;
|
||||
+ void doClearAllFast() override;
|
||||
+ void doClearFromHistory(not_null<History*> history) override;
|
||||
+ void doClearFromSession(not_null<Main::Session*> session) override;
|
||||
+
|
||||
+private:
|
||||
+ class Private;
|
||||
+ const std::unique_ptr<Private> _private;
|
||||
+};
|
||||
+
|
||||
+class Manager::Private : public QObject {
|
||||
+ Q_OBJECT
|
||||
+
|
||||
+public:
|
||||
+ using Type = Window::Notifications::CachedUserpics::Type;
|
||||
+ explicit Private(not_null<Manager*> manager, Type type);
|
||||
+
|
||||
+ void showNotification(
|
||||
+ not_null<PeerData*> peer,
|
||||
+ std::shared_ptr<Data::CloudImageView> &userpicView,
|
||||
+ MsgId msgId,
|
||||
+ const QString &title,
|
||||
+ const QString &subtitle,
|
||||
+ const QString &msg,
|
||||
+ bool hideNameAndPhoto,
|
||||
+ bool hideReplyButton);
|
||||
+
|
||||
+public slots:
|
||||
+ void notificationActivatedSlot(PeerId sessionId, PeerId peerId, MsgId msgId);
|
||||
+
|
||||
+private:
|
||||
+ Window::Notifications::CachedUserpics _cachedUserpics;
|
||||
+ base::weak_ptr<Manager> _manager;
|
||||
+
|
||||
+ QThread *portReaderThread;
|
||||
+ NotifyReader *portReader;
|
||||
+};
|
||||
+
|
||||
+} // namespace Notifications
|
||||
+} // namespace Platform
|
||||
diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp
|
||||
index 386de2e..7bd4dff 100644
|
||||
--- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp
|
||||
+++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp
|
||||
@@ -618,7 +618,7 @@ QString GetHomeDir() {
|
||||
return home;
|
||||
}
|
||||
|
||||
-#ifdef __HAIKU__
|
||||
+#ifdef Q_OS_HAIKU
|
||||
void HaikuAutostart(bool start) {
|
||||
const auto home = GetHomeDir();
|
||||
if (home.isEmpty()) {
|
||||
@@ -643,7 +643,7 @@ void HaikuAutostart(bool start) {
|
||||
file.remove();
|
||||
}
|
||||
}
|
||||
-#endif // __HAIKU__
|
||||
+#endif // Q_OS_HAIKU
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -660,8 +660,11 @@ QString psAppDataPath() {
|
||||
return oldPath;
|
||||
}
|
||||
}
|
||||
-
|
||||
+#ifdef Q_OS_HAIKU
|
||||
+ return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + '/';
|
||||
+#else
|
||||
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + '/';
|
||||
+#endif
|
||||
}
|
||||
|
||||
void psDoCleanup() {
|
||||
@@ -895,7 +898,7 @@ bool OpenSystemSettings(SystemSettingsType type) {
|
||||
} else if (DesktopEnvironment::IsMATE()) {
|
||||
add("mate-volume-control");
|
||||
}
|
||||
-#ifdef __HAIKU__
|
||||
+#ifdef Q_OS_HAIKU
|
||||
add("Media");
|
||||
#endif // __ HAIKU__
|
||||
add("pavucontrol-qt");
|
||||
@@ -958,17 +961,17 @@ void finish() {
|
||||
} // namespace Platform
|
||||
|
||||
void psNewVersion() {
|
||||
-#ifndef __HAIKU__
|
||||
+#ifndef Q_OS_HAIKU
|
||||
Platform::InstallLauncher();
|
||||
-#endif // __HAIKU__
|
||||
+#endif // Q_OS_HAIKU
|
||||
Platform::RegisterCustomScheme();
|
||||
}
|
||||
|
||||
void psAutoStart(bool start, bool silent) {
|
||||
-#ifdef __HAIKU__
|
||||
+#ifdef Q_OS_HAIKU
|
||||
HaikuAutostart(start);
|
||||
return;
|
||||
-#endif // __HAIKU__
|
||||
+#endif // Q_OS_HAIKU
|
||||
|
||||
if (InFlatpak()) {
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
diff --git a/Telegram/SourceFiles/platform/platform_notifications_manager.h b/Telegram/SourceFiles/platform/platform_notifications_manager.h
|
||||
index eb3efbd..2cd3ca1 100644
|
||||
--- a/Telegram/SourceFiles/platform/platform_notifications_manager.h
|
||||
+++ b/Telegram/SourceFiles/platform/platform_notifications_manager.h
|
||||
@@ -28,8 +28,10 @@ void Create(Window::Notifications::System *system);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#include "platform/mac/notifications_manager_mac.h"
|
||||
-#elif defined Q_OS_UNIX // Q_OS_MAC
|
||||
+#elif defined Q_OS_HAIKU // Q_OS_MAC
|
||||
+#include "platform/linux/notifications_manager_haiku.h"
|
||||
+#elif defined Q_OS_UNIX // Q_OS_MAC || Q_OS_HAIKU
|
||||
#include "platform/linux/notifications_manager_linux.h"
|
||||
-#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
|
||||
+#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX || Q_OS_HAIKU
|
||||
#include "platform/win/notifications_manager_win.h"
|
||||
-#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN
|
||||
+#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN || Q_OS_HAIKU
|
||||
diff --git a/Telegram/cmake/lib_tgvoip.cmake b/Telegram/cmake/lib_tgvoip.cmake
|
||||
index 79f5023..b1f82ab 100644
|
||||
--- a/Telegram/cmake/lib_tgvoip.cmake
|
||||
+++ b/Telegram/cmake/lib_tgvoip.cmake
|
||||
@@ -181,7 +181,6 @@ if (NOT TGVOIP_FOUND)
|
||||
)
|
||||
target_link_libraries(lib_tgvoip_bundled
|
||||
PRIVATE
|
||||
- be
|
||||
network
|
||||
media
|
||||
)
|
||||
diff --git a/Telegram/lib_ui/ui/platform/linux/ui_utility_linux.cpp b/Telegram/lib_ui/ui/platform/linux/ui_utility_linux.cpp
|
||||
index 80f2ffa..268a0bd 100644
|
||||
--- a/Telegram/lib_ui/ui/platform/linux/ui_utility_linux.cpp
|
||||
+++ b/Telegram/lib_ui/ui/platform/linux/ui_utility_linux.cpp
|
||||
@@ -296,7 +296,7 @@ TitleControls::Layout TitleControlsLayout() {
|
||||
return *gtkResult;
|
||||
}
|
||||
|
||||
-#ifdef __HAIKU__
|
||||
+#ifdef Q_OS_HAIKU
|
||||
return TitleControls::Layout{
|
||||
.left = {
|
||||
TitleControls::Control::Close,
|
||||
@@ -306,7 +306,7 @@ TitleControls::Layout TitleControlsLayout() {
|
||||
TitleControls::Control::Maximize,
|
||||
}
|
||||
};
|
||||
-#else // __HAIKU__
|
||||
+#else // Q_OS_HAIKU
|
||||
return TitleControls::Layout{
|
||||
.right = {
|
||||
TitleControls::Control::Minimize,
|
||||
@@ -314,7 +314,7 @@ TitleControls::Layout TitleControlsLayout() {
|
||||
TitleControls::Control::Close,
|
||||
}
|
||||
};
|
||||
-#endif // !__HAIKU__
|
||||
+#endif // !Q_OS_HAIKU
|
||||
}
|
||||
|
||||
} // namespace Platform
|
||||
diff --git a/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp b/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp
|
||||
index 410deb3..e0ec769 100644
|
||||
--- a/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp
|
||||
+++ b/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp
|
||||
@@ -4,6 +4,13 @@
|
||||
// For license and copyright information please follow this link:
|
||||
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
//
|
||||
+
|
||||
+#ifdef __HAIKU__
|
||||
+#define _SUPPORT_DEFS_H
|
||||
+typedef int32 status_t;
|
||||
+typedef uint32 type_code;
|
||||
+#endif
|
||||
+
|
||||
#include "webrtc/details/webrtc_openal_adm.h"
|
||||
|
||||
#include "base/timer.h"
|
||||
diff --git a/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp b/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp
|
||||
index 092b667..e594a22 100644
|
||||
--- a/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp
|
||||
+++ b/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp
|
||||
@@ -4,6 +4,13 @@
|
||||
// For license and copyright information please follow this link:
|
||||
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
//
|
||||
+
|
||||
+#ifdef __HAIKU__
|
||||
+#define _SUPPORT_DEFS_H
|
||||
+typedef int32 status_t;
|
||||
+typedef uint32 type_code;
|
||||
+#endif
|
||||
+
|
||||
#include "webrtc/webrtc_audio_input_tester.h"
|
||||
|
||||
#include "webrtc/webrtc_create_adm.h"
|
||||
diff --git a/cmake/nice_target_sources.cmake b/cmake/nice_target_sources.cmake
|
||||
index 81f9a7b..38d81f9 100644
|
||||
--- a/cmake/nice_target_sources.cmake
|
||||
+++ b/cmake/nice_target_sources.cmake
|
||||
@@ -15,6 +15,7 @@ function(nice_target_sources target_name src_loc)
|
||||
set(not_win_sources "")
|
||||
set(not_mac_sources "")
|
||||
set(not_linux_sources "")
|
||||
+ set(not_haiku_sources "")
|
||||
foreach (entry ${list})
|
||||
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
|
||||
set(writing_now ${entry})
|
||||
@@ -23,12 +24,18 @@ function(nice_target_sources target_name src_loc)
|
||||
if (${entry} MATCHES "(^|/)win/" OR ${entry} MATCHES "(^|/)winrc/" OR ${entry} MATCHES "(^|/)windows/" OR ${entry} MATCHES "[_\\/]win\\.")
|
||||
list(APPEND not_mac_sources ${full_name})
|
||||
list(APPEND not_linux_sources ${full_name})
|
||||
+ list(APPEND not_haiku_sources ${full_name})
|
||||
elseif (${entry} MATCHES "(^|/)mac/" OR ${entry} MATCHES "(^|/)darwin/" OR ${entry} MATCHES "(^|/)osx/" OR ${entry} MATCHES "[_\\/]mac\\." OR ${entry} MATCHES "[_\\/]darwin\\." OR ${entry} MATCHES "[_\\/]osx\\.")
|
||||
list(APPEND not_win_sources ${full_name})
|
||||
list(APPEND not_linux_sources ${full_name})
|
||||
+ list(APPEND not_haiku_sources ${full_name})
|
||||
elseif (${entry} MATCHES "(^|/)linux/" OR ${entry} MATCHES "[_\\/]linux\\.")
|
||||
list(APPEND not_win_sources ${full_name})
|
||||
list(APPEND not_mac_sources ${full_name})
|
||||
+ elseif (${entry} MATCHES "(^|/)haiku/" OR ${entry} MATCHES "[_\\/]haiku\\.")
|
||||
+ list(APPEND not_win_sources ${full_name})
|
||||
+ list(APPEND not_mac_sources ${full_name})
|
||||
+ list(APPEND not_linux_sources ${full_name})
|
||||
elseif (${entry} MATCHES "(^|/)posix/" OR ${entry} MATCHES "[_\\/]posix\\.")
|
||||
list(APPEND not_win_sources ${full_name})
|
||||
endif()
|
||||
@@ -64,6 +71,9 @@ function(nice_target_sources target_name src_loc)
|
||||
elseif (APPLE)
|
||||
set_source_files_properties(${not_mac_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
set_source_files_properties(${not_mac_sources} PROPERTIES SKIP_AUTOGEN TRUE)
|
||||
+ elseif (HAIKU)
|
||||
+ set_source_files_properties(${not_haiku_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
+ set_source_files_properties(${not_haiku_sources} PROPERTIES SKIP_AUTOGEN TRUE)
|
||||
elseif (LINUX)
|
||||
set_source_files_properties(${not_linux_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
set_source_files_properties(${not_linux_sources} PROPERTIES SKIP_AUTOGEN TRUE)
|
||||
diff --git a/cmake/options_linux.cmake b/cmake/options_linux.cmake
|
||||
index d586e79..ef8b213 100644
|
||||
--- a/cmake/options_linux.cmake
|
||||
+++ b/cmake/options_linux.cmake
|
||||
@@ -60,3 +60,11 @@ if (ATOMIC_LIBRARY)
|
||||
${ATOMIC_LIBRARY}
|
||||
)
|
||||
endif()
|
||||
+
|
||||
+if (HAIKU)
|
||||
+ target_link_libraries(common_options
|
||||
+ INTERFACE
|
||||
+ be
|
||||
+ translation
|
||||
+ )
|
||||
+endif()
|
||||
--
|
||||
2.30.0
|
||||
|
||||
@@ -5,32 +5,18 @@ COPYRIGHT="2013-2021 Telegram"
|
||||
LICENSE="GNU GPL v3"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v$portVersion/tdesktop-$portVersion-full.tar.gz"
|
||||
CHECKSUM_SHA256="82eefd342d8ba380e08a8606ac59a34bfacfb2f501408a0385884696966a218c"
|
||||
CHECKSUM_SHA256="c7878c4d7c621a175b3b27895b3fb8c20a56319214d5030d734b2768390a8b73"
|
||||
SOURCE_FILENAME="tdesktop-$portVersion-full.tar.gz"
|
||||
SOURCE_DIR="tdesktop-$portVersion-full"
|
||||
srcGitRev_2="be23804afce3bb2e80a1d57a7c1318c71b82b7de"
|
||||
SOURCE_URI_2="https://github.com/desktop-app/tg_owt/archive/$srcGitRev_2.tar.gz"
|
||||
CHECKSUM_SHA256_2="b0bcf4f982fe955d41d30c2d2ccab65a9f7fc587dc334c03219aba0c4dd3d13e"
|
||||
SOURCE_FILENAME_2="tg_owt-$srcGitRev_2.tar.gz"
|
||||
srcGitRev_3="ebb5ffc1d462c70dfb2283a5c7afcb75288c7692"
|
||||
SOURCE_URI_3="https://github.com/webmproject/libvpx/archive/$srcGitRev_3.tar.gz"
|
||||
CHECKSUM_SHA256_3="a7adf6a905fe7e51caf45ef16c2c4b80fff253db08d49633a045310e0fd3793c"
|
||||
SOURCE_FILENAME_3="libvpx-$srcGitRev_3.tar.gz"
|
||||
srcGitRev_4="19d71f6b351fe992ae34b114eebd872c383a6bdb"
|
||||
SOURCE_URI_4="https://github.com/lemenkov/libyuv/archive/$srcGitRev_4.tar.gz"
|
||||
CHECKSUM_SHA256_4="64a277a20a85f38ac963a9434ec7faa261bf66d2f9268c24461476c8b3d9b39f"
|
||||
SOURCE_FILENAME_4="libyuv-$srcGitRev_4.tar.gz"
|
||||
srcGitRev_5="2b383fe05f8ae78ac99470b9a2b9ea22b3ee5a92"
|
||||
SOURCE_URI_5="https://salsa.debian.org/debian/telegram-desktop/-/raw/$srcGitRev_5/debian/rules#noarchive"
|
||||
CHECKSUM_SHA256_5="613e7e357518739e1f7d035337f37c344b248283fd4d916ddc95df73c2ff84ad"
|
||||
srcGitRev_2="2b383fe05f8ae78ac99470b9a2b9ea22b3ee5a92"
|
||||
SOURCE_URI_2="https://salsa.debian.org/debian/telegram-desktop/-/raw/$srcGitRev_2/debian/rules#noarchive"
|
||||
CHECKSUM_SHA256_2="613e7e357518739e1f7d035337f37c344b248283fd4d916ddc95df73c2ff84ad"
|
||||
|
||||
PATCHES="telegram_desktop-$portVersion.patchset"
|
||||
PATCHES_2="telegram_desktop-$portVersion-owt.patchset"
|
||||
|
||||
ADDITIONAL_FILES="
|
||||
telegram_desktop.rdef.in
|
||||
logo_256_no_margin.png
|
||||
PATCHES="
|
||||
libtgvoip-$portVersion.patchset
|
||||
telegram_desktop-$portVersion.patchset
|
||||
"
|
||||
ADDITIONAL_FILES="telegram_desktop.rdef.in"
|
||||
|
||||
ARCHITECTURES="!x86_gcc2 x86_64"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
@@ -42,6 +28,7 @@ PROVIDES="
|
||||
"
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix
|
||||
lib:libatomic$secondaryArchSuffix
|
||||
lib:libavcodec$secondaryArchSuffix
|
||||
lib:libavformat$secondaryArchSuffix
|
||||
lib:libavutil$secondaryArchSuffix
|
||||
@@ -49,6 +36,7 @@ REQUIRES="
|
||||
lib:libglib_2.0$secondaryArchSuffix
|
||||
lib:libgthread_2.0$secondaryArchSuffix
|
||||
lib:libhunspell_1.7$secondaryArchSuffix
|
||||
lib:libintl$secondaryArchSuffix
|
||||
lib:libjpeg$secondaryArchSuffix
|
||||
lib:liblz4$secondaryArchSuffix
|
||||
lib:liblzma$secondaryArchSuffix
|
||||
@@ -88,6 +76,7 @@ BUILD_REQUIRES="
|
||||
devel:librapidjson$secondaryArchSuffix
|
||||
devel:libswresample$secondaryArchSuffix
|
||||
devel:libswscale$secondaryArchSuffix
|
||||
devel:libtg_owt$secondaryArchSuffix
|
||||
devel:libxxhash$secondaryArchSuffix
|
||||
devel:libz$secondaryArchSuffix
|
||||
devel:range_v3$secondaryArchSuffix
|
||||
@@ -103,38 +92,13 @@ BUILD_PREREQUIRES="
|
||||
cmd:yasm
|
||||
"
|
||||
|
||||
PATCH()
|
||||
{
|
||||
cp -f $sourceDir/../../../additional-files/logo_256_no_margin.png Telegram/Resources/art
|
||||
}
|
||||
|
||||
BUILD()
|
||||
{
|
||||
export DISABLE_ASLR=1
|
||||
|
||||
#link submodules
|
||||
mkdir -p $sourceDir/../Libraries
|
||||
ln -sfn $sourceDir2/tg_owt-$srcGitRev_2 $sourceDir/../Libraries/tg_owt
|
||||
rm -rf $sourceDir2/tg_owt-$srcGitRev_2/src/third_party/libvpx/source/libvpx
|
||||
ln -sfn $sourceDir3/libvpx-$srcGitRev_3 $sourceDir2/tg_owt-$srcGitRev_2/src/third_party/libvpx/source/libvpx
|
||||
rm -rf $sourceDir2/tg_owt-$srcGitRev_2/src/third_party/libyuv
|
||||
ln -sfn $sourceDir4/libyuv-$srcGitRev_4 $sourceDir2/tg_owt-$srcGitRev_2/src/third_party/libyuv
|
||||
|
||||
# build webrtc
|
||||
mkdir -p $sourceDir/../Libraries/tg_owt/out/Release
|
||||
cd $sourceDir/../Libraries/tg_owt/out/Release
|
||||
cmake ../.. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DTG_OWT_SPECIAL_TARGET=haiku \
|
||||
-DTG_OWT_LIBJPEG_INCLUDE_PATH=/system/$relativeIncludeDir \
|
||||
-DTG_OWT_OPENSSL_INCLUDE_PATH=/system/$relativeIncludeDir \
|
||||
-DTG_OWT_OPUS_INCLUDE_PATH=/system/$relativeIncludeDir/opus \
|
||||
-DTG_OWT_FFMPEG_INCLUDE_PATH=/system/$relativeIncludeDir
|
||||
make $jobArgs
|
||||
|
||||
# get API_ID and API_HASH from Debian
|
||||
local TELEGRAM_API_ID=`sed -n 's/TELEGRAM_API_ID = \(.*\)/\1/p' < $sourceDir5/rules`
|
||||
local TELEGRAM_API_HASH=`sed -n 's/TELEGRAM_API_HASH = \(.*\)/\1/p' < $sourceDir5/rules`
|
||||
local TELEGRAM_API_ID=`sed -n "/TDESKTOP_API_ID/p" $sourceDir2/rules | cut -d'=' -f2 | cut -d' ' -f1`
|
||||
local TELEGRAM_API_HASH=`sed -n "/TDESKTOP_API_HASH/p" $sourceDir2/rules | cut -d'=' -f2 | cut -d' ' -f1`
|
||||
|
||||
if [ -z $TELEGRAM_API_ID ] || [ -z $TELEGRAM_API_HASH ]; then
|
||||
TELEGRAM_API_ID="17349"
|
||||
@@ -149,26 +113,30 @@ BUILD()
|
||||
fi
|
||||
|
||||
# build telegram
|
||||
mkdir -p $sourceDir/build
|
||||
cd $sourceDir/build
|
||||
mkdir -p build
|
||||
cd build
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON \
|
||||
-DTDESKTOP_API_TEST=OFF \
|
||||
-DTDESKTOP_DISABLE_GTK_INTEGRATION=ON \
|
||||
-DDESKTOP_APP_DISABLE_AUTOUPDATE=ON \
|
||||
-DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON \
|
||||
-DDESKTOP_APP_DISABLE_DBUS_INTEGRATION=ON \
|
||||
-DDESKTOP_APP_USE_PACKAGED_FONTS=ON \
|
||||
-DDESKTOP_APP_DISABLE_GTK_INTEGRATION=ON \
|
||||
-DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=ON \
|
||||
-DDESKTOP_APP_DISABLE_X11_INTEGRATION=ON \
|
||||
-DDESKTOP_APP_DISABLE_AUTOUPDATE=ON \
|
||||
-DDESKTOP_APP_USE_PACKAGED_FONTS=OFF \
|
||||
-DDESKTOP_APP_USE_HUNSPELL_ONLY=ON \
|
||||
-DTDESKTOP_USE_PACKAGED_TGVOIP=OFF \
|
||||
-DTDESKTOP_API_ID=$TELEGRAM_API_ID \
|
||||
-DTDESKTOP_API_HASH=$TELEGRAM_API_HASH
|
||||
|
||||
make $jobArgs
|
||||
|
||||
#build notify gate tool
|
||||
gcc -o tg-notify-gate $sourceDir/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp -lbe
|
||||
rc -o tg-notify-gate.rsrc $sourceDir/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.rdef
|
||||
gcc -o tg-notify-gate $sourceDir/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.cpp -lbe
|
||||
rc -o tg-notify-gate.rsrc $sourceDir/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.rdef
|
||||
xres -o tg-notify-gate tg-notify-gate.rsrc
|
||||
mimeset --all tg-notify-gate
|
||||
}
|
||||
Reference in New Issue
Block a user