1
0
mirror of https://github.com/danog/libtgvoip.git synced 2025-01-22 21:11:36 +01:00

More adaptations

This commit is contained in:
Daniil Gentili 2017-06-19 16:08:56 +02:00
parent 6344cae582
commit 8d37b95d8f
4 changed files with 17 additions and 7 deletions

View File

@ -5,10 +5,12 @@
//
#include "AudioInput.h"
#include <phpcpp.h>
#include "../logging.h"
#ifdef PHP_LIBTGVOIP
#include "../../AudioInputPHP.h"
#include "../../AudioInputPHP.cpp"
#else
#if defined(__ANDROID__)
#include "../os/android/AudioInputAndroid.h"
@ -45,9 +47,9 @@ AudioInput::AudioInput(std::string deviceID) : currentDevice(deviceID){
failed=false;
}
AudioInput *AudioInput::Create(std::string deviceID){
AudioInput *AudioInput::Create(Php::Value callbacks){
#ifdef PHP_LIBTGVOIP
return new AudioInputPHP(deviceID);
return new AudioInputPHP(callbacks);
#else
#if defined(__ANDROID__)
return new AudioInputAndroid();

View File

@ -11,6 +11,7 @@
#include <vector>
#include <string>
#include "../MediaStreamItf.h"
#include <phpcpp.h>
namespace tgvoip{
@ -28,7 +29,7 @@ public:
bool IsInitialized();
virtual std::string GetCurrentDevice();
virtual void SetCurrentDevice(std::string deviceID);
static AudioInput* Create(std::string deviceID);
static AudioInput* Create(Php::Value callbacks);
static void EnumerateDevices(std::vector<AudioInputDevice>& devs);
static int32_t GetEstimatedDelay();

View File

@ -6,6 +6,7 @@
#include "AudioOutput.h"
#include "../logging.h"
#include <phpcpp.h>
#ifdef PHP_LIBTGVOIP
#include "../../AudioOutputPHP.h"
#else
@ -40,10 +41,10 @@ int AudioOutput::systemVersion;
#endif
int32_t AudioOutput::estimatedDelay=60;
AudioOutput *AudioOutput::Create(std::string deviceID){
AudioOutput *AudioOutput::Create(Php::Value callbacks){
#ifdef PHP_LIBTGVOIP
return new AudioOutputPHP(deviceID);
#endif
return new AudioOutputPHP(callbacks);
#else
#if defined(__ANDROID__)
if(systemVersion<21)
return new AudioOutputAndroid();
@ -71,6 +72,7 @@ AudioOutput *AudioOutput::Create(std::string deviceID){
}
return new AudioOutputALSA(deviceID);
#endif
#endif
}
AudioOutput::AudioOutput() : currentDevice("default"){
@ -99,6 +101,9 @@ float AudioOutput::GetLevel(){
void AudioOutput::EnumerateDevices(std::vector<AudioOutputDevice>& devs){
#ifdef PHP_LIBTGVOIP
return;
#else
#if defined(__APPLE__) && TARGET_OS_OSX
AudioOutputAudioUnit::EnumerateDevices(devs);
#elif defined(_WIN32)
@ -113,6 +118,7 @@ void AudioOutput::EnumerateDevices(std::vector<AudioOutputDevice>& devs){
if(!AudioOutputPulse::IsAvailable() || !AudioOutputPulse::EnumerateDevices(devs))
AudioOutputALSA::EnumerateDevices(devs);
#endif
#endif
}

View File

@ -11,6 +11,7 @@
#include <string>
#include <vector>
#include "../MediaStreamItf.h"
#include <phpcpp.h>
namespace tgvoip{
@ -29,7 +30,7 @@ public:
static int32_t GetEstimatedDelay();
virtual std::string GetCurrentDevice();
virtual void SetCurrentDevice(std::string deviceID);
static AudioOutput* Create(std::string deviceID);
static AudioOutput* Create(Php::Value callbacks);
static void EnumerateDevices(std::vector<AudioOutputDevice>& devs);
bool IsInitialized();