Add a generic fif_audio_source class

This commit is contained in:
Isaac Connor 2021-03-01 16:42:31 -05:00
parent b4fc782778
commit cc80ae37fb
2 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,38 @@
/* ---------------------------------------------------------------------------
**
** ADTS_FifoSource.cpp
**
** ADTS Live555 source
**
** -------------------------------------------------------------------------*/
#include "zm_logger.h"
#include "zm_rtsp_server_fifo_audio_source.h"
#include <sstream>
#if HAVE_RTSP_SERVER
static unsigned const samplingFrequencyTable[16] = {
96000, 88200, 64000, 48000,
44100, 32000, 24000, 22050,
16000, 12000, 11025, 8000,
7350, 0, 0, 0
};
// ---------------------------------
// ADTS ZoneMinder FramedSource
// ---------------------------------
//
ZoneMinderFifoAudioSource::ZoneMinderFifoAudioSource(
UsageEnvironment& env,
std::string fifo,
unsigned int queueSize
)
:
ZoneMinderFifoSource(env, fifo, queueSize),
samplingFrequencyIndex(-1),
frequency(-1),
channels(1)
{
}
#endif // HAVE_RTSP_SERVER

View File

@ -0,0 +1,56 @@
/* ---------------------------------------------------------------------------
** This software is in the public domain, furnished "as is", without technical
** support, and with no warranty, express or implied, as to its usefulness for
** any purpose.
**
** ADTS_ZoneMinderFifoSource.h
**
** ADTS ZoneMinder live555 source
**
** -------------------------------------------------------------------------*/
#ifndef ZM_RTSP_SERVER_FIFO_AUDIO_SOURCE_H
#define ZM_RTSP_SERVER_FIFO_AUDIO_SOURCE_H
#include "zm_config.h"
#include "zm_rtsp_server_fifo_source.h"
#if HAVE_RTSP_SERVER
// ---------------------------------
// ZoneMinder AUDIO FramedSource
// ---------------------------------
class ZoneMinderFifoAudioSource : public ZoneMinderFifoSource {
public:
static ZoneMinderFifoAudioSource* createNew(
UsageEnvironment& env,
std::string fifo,
unsigned int queueSize
) {
return new ZoneMinderFifoAudioSource(env, fifo, queueSize);
};
protected:
ZoneMinderFifoAudioSource(
UsageEnvironment& env,
std::string fifo,
unsigned int queueSize
);
virtual ~ZoneMinderFifoAudioSource() {}
public:
void setFrequency(int p_frequency) { frequency = p_frequency; };
int getFrequency() { return frequency; };
const char *configStr() const { return config.c_str(); };
void setChannels(int p_channels) { channels = p_channels; };
int getChannels() const { return channels; };
protected:
std::string config;
int samplingFrequencyIndex;
int frequency;
int channels;
};
#endif // HAVE_RTSP_SERVER
#endif // ZM_RTSP_SERVER_FIFO_AUDIO_SOURCE_H