53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
#ifndef C0535B0C_9BD8_4FDC_9429_8FEF7E58BFCE
|
|
#define C0535B0C_9BD8_4FDC_9429_8FEF7E58BFCE
|
|
/*
|
|
*******************************************************************************
|
|
* INCLUDE
|
|
*******************************************************************************
|
|
*/
|
|
#include "../core/AbstractAudioInput.h"
|
|
#include "SoundCard.h"
|
|
#include "PCM.h"
|
|
#include "util/SimpleFactory.h"
|
|
|
|
namespace Video
|
|
{
|
|
namespace ALSA
|
|
{
|
|
/*
|
|
*******************************************************************************
|
|
* CLASS DECLARE
|
|
*******************************************************************************
|
|
*/
|
|
class Input: public Core::AbstractAudioInput, public ::Util::SimpleFactory<Input, const std::string&>
|
|
{
|
|
public:
|
|
using Ptr = Poco::AutoPtr<Input>;
|
|
|
|
public:
|
|
Input(const std::string& name);
|
|
~Input();
|
|
|
|
public:
|
|
CONFIGURABLE_DECLARE_PARAMETER(SoundCard, SoundCard::Ptr);
|
|
|
|
protected:
|
|
void start() override;
|
|
void stop() override;
|
|
void onConfigChanged(ParameterNames& names) override;
|
|
|
|
Core::Frame::Ptr readFrame() override;
|
|
|
|
bool tryEstablishSoundCard();
|
|
|
|
private:
|
|
PCM _pcm;
|
|
std::atomic<bool> _established;
|
|
int _linesize;
|
|
int _channels;
|
|
int _samples;
|
|
snd_pcm_access_t _access;
|
|
};
|
|
}
|
|
}
|
|
#endif
|