Add setting up the config string and population of mAuxLine
This commit is contained in:
parent
b2ff9af238
commit
495e2a4827
|
@ -9,6 +9,7 @@
|
|||
#include "zm_logger.h"
|
||||
#include "zm_rtsp_server_adts_fifo_source.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
#if HAVE_RTSP_SERVER
|
||||
|
@ -29,17 +30,27 @@ ADTS_ZoneMinderFifoSource::ADTS_ZoneMinderFifoSource(
|
|||
unsigned int queueSize
|
||||
)
|
||||
:
|
||||
ZoneMinderFifoSource(env, fifo, queueSize),
|
||||
samplingFrequencyIndex(11),
|
||||
channels(1)
|
||||
ZoneMinderFifoAudioSource(env, fifo, queueSize)
|
||||
{
|
||||
#if 1
|
||||
int profile = 0;
|
||||
|
||||
unsigned char audioSpecificConfig[2];
|
||||
u_int8_t const audioObjectType = profile + 1;
|
||||
audioSpecificConfig[0] = (audioObjectType<<3) | (samplingFrequencyIndex>>1);
|
||||
audioSpecificConfig[1] = (samplingFrequencyIndex<<7) | (channels<<3);
|
||||
|
||||
std::ostringstream os;
|
||||
os <<
|
||||
"profile-level-id=1;"
|
||||
"mode=AAC-hbr;sizelength=13;indexlength=3;"
|
||||
"indexdeltalength=3"
|
||||
"indexdeltalength=3;config=" << std::hex << std::setw(2) << std::setfill('0') << audioSpecificConfig[0]
|
||||
<< std::hex << std::setw(2) << std::setfill('0') << audioSpecificConfig[1]
|
||||
<< "\r\n";
|
||||
// Construct the 'AudioSpecificConfig', and from it, the corresponding ASCII string:
|
||||
|
||||
m_auxLine.assign(os.str());
|
||||
Debug(1, "m_auxline is %s", m_auxLine.c_str());
|
||||
#endif
|
||||
}
|
||||
#endif // HAVE_RTSP_SERVER
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
#define ZM_RTSP_SERVER_ADTS_FIFO_SOURCE_H
|
||||
|
||||
#include "zm_config.h"
|
||||
#include "zm_rtsp_server_fifo_source.h"
|
||||
#include "zm_rtsp_server_fifo_audio_source.h"
|
||||
|
||||
#if HAVE_RTSP_SERVER
|
||||
// ---------------------------------
|
||||
// ADTS(AAC) ZoneMinder FramedSource
|
||||
// ---------------------------------
|
||||
|
||||
class ADTS_ZoneMinderFifoSource : public ZoneMinderFifoSource {
|
||||
class ADTS_ZoneMinderFifoSource : public ZoneMinderFifoAudioSource {
|
||||
public:
|
||||
static ADTS_ZoneMinderFifoSource* createNew(
|
||||
UsageEnvironment& env,
|
||||
|
@ -37,29 +37,6 @@ class ADTS_ZoneMinderFifoSource : public ZoneMinderFifoSource {
|
|||
);
|
||||
|
||||
virtual ~ADTS_ZoneMinderFifoSource() {}
|
||||
|
||||
/*
|
||||
virtual unsigned char* extractFrame(unsigned char* frame, size_t& size, size_t& outsize);
|
||||
virtual unsigned char* findMarker(unsigned char *frame, size_t size, size_t &length);
|
||||
*/
|
||||
public:
|
||||
int samplingFrequency() { return 8000; //m_stream->codecpar->sample_rate;
|
||||
};
|
||||
const char *configStr() { return config.c_str(); };
|
||||
int numChannels() {
|
||||
//Debug(1, "this %p m_stream %p channels %d",
|
||||
//this, m_stream, channels);
|
||||
//Debug(1, "m_stream %p codecpar %p channels %d => %d",
|
||||
//m_stream, m_stream->codecpar, m_stream->codecpar->channels, channels);
|
||||
return 1;
|
||||
//return channels;
|
||||
//return m_stream->codecpar->channels;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string config;
|
||||
int samplingFrequencyIndex;
|
||||
int channels;
|
||||
};
|
||||
#endif // HAVE_RTSP_SERVER
|
||||
|
||||
|
|
Loading…
Reference in New Issue