1
0
mirror of https://github.com/danog/php-libtgvoip.git synced 2024-12-02 09:17:55 +01:00
php-libtgvoip/audio/AudioInputModule.h
Daniil Gentili 69f4905dc0 This works.
2017-07-13 18:03:33 +02:00

65 lines
1.5 KiB
C++

//
// 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_AUDIOINPUTPHP_H
#define LIBTGVOIP_AUDIOINPUTPHP_H
#include "../libtgvoip/audio/AudioInput.h"
#include "../libtgvoip/threading.h"
#include "../libtgvoip/VoIPController.h"
#include "../main.h"
using namespace tgvoip;
using namespace tgvoip::audio;
namespace tgvoip{ namespace audio{
class AudioInputModule : public AudioInput{
public:
AudioInputModule(std::string deviceID, VoIPController *controller);
virtual ~AudioInputModule();
virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels);
virtual void Start();
virtual void Stop();
bool writeSamples(unsigned char *data);
static void EnumerateDevices(std::vector<AudioInputDevice>& devs);
bool play(const char *file);
bool playOnHold(Php::Parameters &params);
static void* StartSenderThread(void* input);
void RunSenderThread();
int inputBitsPerSample;
int inputSampleRate;
int inputChannels;
int inputSamplePeriod;
int inputWritePeriod;
double inputSamplePeriodSec;
double inputWritePeriodSec;
int inputSampleNumber;
int inputSamplesSize;
size_t inputCSamplesSize;
std::queue<FILE *> inputFiles;
std::queue<FILE *> holdFiles;
tgvoip_mutex_t inputMutex;
bool configuringInput;
private:
tgvoip_thread_t senderThread;
VoIP *wrapper;
};
}}
#endif //LIBTGVOIP_AUDIOINPUTPHP_H