mirror of
https://github.com/danog/php-libtgvoip.git
synced 2024-11-30 04:19:26 +01:00
Fixes
This commit is contained in:
parent
353d52ca65
commit
c8b40b1e62
@ -17,6 +17,7 @@ AudioInputPHP::AudioInputPHP(Php::Value callbacks){
|
||||
startMethod = callbacks["start"];
|
||||
stopMethod = callbacks["stop"];
|
||||
configureMethod = callbacks["configure"];
|
||||
running = false;
|
||||
}
|
||||
|
||||
|
||||
@ -39,11 +40,12 @@ void AudioInputPHP::Stop(){
|
||||
stopMethod();
|
||||
running = false;
|
||||
}
|
||||
void AudioInputPHP::writeFrames(Php::Parameters ¶ms){
|
||||
bool AudioInputPHP::writeFrames(const char* data){
|
||||
if(!running)
|
||||
return;
|
||||
return false;
|
||||
unsigned char * buf;
|
||||
memcpy(buf, params[0], 960*2);
|
||||
memcpy(buf, data, 960*2);
|
||||
InvokeCallback(buf, 960*2);
|
||||
delete buf;
|
||||
return true;
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
#ifndef LIBTGVOIP_AUDIOINPUTPHP_H
|
||||
#define LIBTGVOIP_AUDIOINPUTPHP_H
|
||||
|
||||
#include "phpcpp.h"
|
||||
#include "../libtgvoip/audio/AudioInput.h"
|
||||
#include "../libtgvoip/threading.h"
|
||||
|
||||
@ -21,7 +20,7 @@ public:
|
||||
virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels);
|
||||
virtual void Start();
|
||||
virtual void Stop();
|
||||
void writeFrames(Php::Parameters ¶ms);
|
||||
bool writeFrames(const char* data);
|
||||
private:
|
||||
Php::Value configureMethod;
|
||||
Php::Value startMethod;
|
||||
|
@ -47,7 +47,7 @@ float AudioOutputPHP::GetLevel(){
|
||||
return (double)getLevelMethod();
|
||||
}
|
||||
|
||||
Php::Value AudioOutputPHP::readFrames() {
|
||||
unsigned char* AudioOutputPHP::readFrames() {
|
||||
unsigned char* buf;
|
||||
InvokeCallback(buf, 960*2);
|
||||
return buf;
|
||||
|
@ -8,7 +8,6 @@
|
||||
#define LIBTGVOIP_AUDIOOUTPUTPHP_H
|
||||
|
||||
#include "../libtgvoip/audio/AudioOutput.h"
|
||||
#include "phpcpp.h"
|
||||
|
||||
namespace tgvoip{ namespace audio{
|
||||
class AudioOutputPHP : public AudioOutput{
|
||||
@ -22,7 +21,7 @@ public:
|
||||
virtual void Stop();
|
||||
virtual bool IsPlaying() override;
|
||||
virtual float GetLevel() override;
|
||||
Php::Value readFrames();
|
||||
unsigned char* readFrames();
|
||||
|
||||
private:
|
||||
Php::Value configureMethod;
|
||||
|
Loading…
Reference in New Issue
Block a user