From 25c19812e1e302f60c7663440c18890b1122c49d Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 4 Sep 2014 23:24:03 +0400 Subject: [PATCH] prepared openal sound and voice messages in linux --- QTCREATOR.md | 14 +++++++++++++- Telegram/FixMake.sh | 5 ++++- Telegram/FixMake32.sh | 5 ++++- Telegram/SourceFiles/audio.cpp | 4 ++-- Telegram/Telegram.pro | 7 +++++-- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/QTCREATOR.md b/QTCREATOR.md index e76a600f0c..9c3dadb8db 100644 --- a/QTCREATOR.md +++ b/QTCREATOR.md @@ -30,7 +30,19 @@ or download in ZIP and extract to **/home/user/TBuild** rename **tdesktop-master Install dev libraries - sudo apt-get install libexif-dev liblzma-dev libz-dev libssl-dev + sudo apt-get install libexif-dev liblzma-dev libz-dev libssl-dev libogg-dev libopus-dev libopusfile-dev + +Install OpenAL Soft + +In Terminal go to **/home/user/TBuild/Libraries** and run + + git clone git://repo.or.cz/openal-soft.git + +then go to **/home/user/TBuild/Libraries/openal-soft/build** and run + + cmake -D LIBTYPE:STRING=STATIC .. + make + sudo make install ####Qt 5.3.1, slightly patched diff --git a/Telegram/FixMake.sh b/Telegram/FixMake.sh index 9605010893..3d177a49f2 100755 --- a/Telegram/FixMake.sh +++ b/Telegram/FixMake.sh @@ -14,4 +14,7 @@ sed -i 's/\-lssl/\/usr\/lib\/x86_64\-linux\-gnu\/libssl\.a/g' Makefile sed -i 's/\-lcrypto/\/usr\/lib\/x86_64\-linux\-gnu\/libcrypto\.a/g' Makefile sed -i 's/\-lexif/\/usr\/lib\/x86_64\-linux\-gnu\/libexif\.a/g' Makefile sed -i 's/\-lglib\-2\.0/\/usr\/lib\/x86_64\-linux\-gnu\/libglib\-2\.0\.a/g' Makefile - +sed -i 's/\-lopusfile/\/usr\/lib\/libopusfile\.a/g' Makefile +sed -i 's/\-lopus/\/usr\/lib\/x86_64\-linux\-gnu\/libopus\.a/g' Makefile +sed -i 's/\-lopenal/\/usr\/local\/lib\/libopenal\.a/g' Makefile +sed -i 's/\-logg/\/usr\/lib\/x86_64\-linux\-gnu\/libogg\.a/g' Makefile diff --git a/Telegram/FixMake32.sh b/Telegram/FixMake32.sh index 4a86928596..ad56ae8b4c 100755 --- a/Telegram/FixMake32.sh +++ b/Telegram/FixMake32.sh @@ -14,4 +14,7 @@ sed -i 's/\-lssl/\/usr\/lib\/i386\-linux\-gnu\/libssl\.a/g' Makefile sed -i 's/\-lcrypto/\/usr\/lib\/i386\-linux\-gnu\/libcrypto\.a/g' Makefile sed -i 's/\-lexif/\/usr\/lib\/i386\-linux\-gnu\/libexif\.a/g' Makefile sed -i 's/\-lglib\-2\.0/\/usr\/lib\/i386\-linux\-gnu\/libglib\-2\.0\.a/g' Makefile - +sed -i 's/\-lopusfile/\/usr\/lib\/libopusfile\.a/g' Makefile +sed -i 's/\-lopus/\/usr\/lib\/i386\-linux\-gnu\/libopus\.a/g' Makefile +sed -i 's/\-lopenal/\/usr\/local\/lib\/libopenal\.a/g' Makefile +sed -i 's/\-logg/\/usr\/lib\/i386\-linux\-gnu\/libogg\.a/g' Makefile diff --git a/Telegram/SourceFiles/audio.cpp b/Telegram/SourceFiles/audio.cpp index 7ed03affcb..cd6f06eda6 100644 --- a/Telegram/SourceFiles/audio.cpp +++ b/Telegram/SourceFiles/audio.cpp @@ -113,7 +113,7 @@ void audioInit() { if (extra) { uint16 extraSize = *((const uint16*)(data + 36)); - if (extraSize + 2 != extra) return audioFinish(); + if (uint32(extraSize + 2) != extra) return audioFinish(); if (uint32(blob.size()) < 44 + extra) return audioFinish(); } @@ -546,7 +546,7 @@ void VoiceMessagesLoader::onLoad(AudioData *audio) { } bool finished = false; - DEBUG_LOG(("Audio Info: reading buffer for file '%1', data size '%2', current pcm_offset %2").arg(l->fname).arg(l->data.size()).arg(l->pcm_offset)); + DEBUG_LOG(("Audio Info: reading buffer for file '%1', data size '%2', current pcm_offset %3").arg(l->fname).arg(l->data.size()).arg(l->pcm_offset)); QByteArray result; int64 samplesAdded = 0; diff --git a/Telegram/Telegram.pro b/Telegram/Telegram.pro index b4eaddde4d..937e275d02 100644 --- a/Telegram/Telegram.pro +++ b/Telegram/Telegram.pro @@ -1,4 +1,4 @@ -QT += core gui network multimedia widgets +QT += core gui network widgets CONFIG += plugin static @@ -81,6 +81,7 @@ SOURCES += \ ./SourceFiles/stdafx.cpp \ ./SourceFiles/app.cpp \ ./SourceFiles/application.cpp \ + ./SourceFiles/audio.cpp \ ./SourceFiles/dialogswidget.cpp \ ./SourceFiles/dropdown.cpp \ ./SourceFiles/fileuploader.cpp \ @@ -149,6 +150,7 @@ HEADERS += \ ./SourceFiles/stdafx.h \ ./SourceFiles/app.h \ ./SourceFiles/application.h \ + ./SourceFiles/audio.h \ ./SourceFiles/config.h \ ./SourceFiles/countries.h \ ./SourceFiles/dialogswidget.h \ @@ -253,9 +255,10 @@ CONFIG(release, debug|release) { INCLUDEPATH += ./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.1/QtGui\ ./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.1/QtCore\ ./../../Libraries/QtStatic/qtbase/include\ + /usr/include/opus\ ./SourceFiles\ ./GeneratedFiles -LIBS += -lcrypto -lssl -lz -ldl -llzma -lexif +LIBS += -lcrypto -lssl -lz -ldl -llzma -lexif -lopus -lopusfile -logg -lopenal LIBS += ./../../../Libraries/QtStatic/qtbase/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.a RESOURCES += \