fill the x-dimension RTSP header

This commit is contained in:
Michel Promonet 2017-06-25 16:58:37 +02:00
parent 10602f3bab
commit 16095342a1
3 changed files with 16 additions and 2 deletions

View File

@ -172,7 +172,10 @@ class ALSACapture
return pfds[0].fd;
}
unsigned long getBufferSize() { return m_bufferSize; };
virtual unsigned long getBufferSize() { return m_bufferSize; };
virtual int getWidth() {return -1;}
virtual int getHeight() {return -1;}
unsigned long getSampleRate() { return m_params.m_sampleRate; };
unsigned long getChannels () { return m_params.m_channels; };

View File

@ -30,6 +30,8 @@ class DeviceCapture
virtual size_t read(char* buffer, size_t bufferSize) = 0;
virtual int getFd() = 0;
virtual unsigned long getBufferSize() = 0;
virtual int getWidth() = 0;
virtual int getHeight() = 0;
virtual ~DeviceCapture() {};
};
@ -43,6 +45,8 @@ class V4L2DeviceCapture : public DeviceCapture
virtual size_t read(char* buffer, size_t bufferSize) { return m_device->read(buffer, bufferSize); }
virtual int getFd() { return m_device->getFd(); }
virtual unsigned long getBufferSize() { return m_device->getBufferSize(); }
virtual int getWidth() { return m_device->getWidth(); }
virtual int getHeight() { return m_device->getHeight(); }
protected:
T* m_device;
@ -87,6 +91,8 @@ class V4L2DeviceSource: public FramedSource
public:
static V4L2DeviceSource* createNew(UsageEnvironment& env, DeviceCapture * device, int outputFd, unsigned int queueSize, bool useThread) ;
std::string getAuxLine() { return m_auxLine; };
int getWidth() { return m_device->getWidth(); };
int getHeight() { return m_device->getHeight(); };
protected:
V4L2DeviceSource(UsageEnvironment& env, DeviceCapture * device, int outputFd, unsigned int queueSize, bool useThread);

View File

@ -92,7 +92,12 @@ char const* BaseServerMediaSubsession::getAuxLine(V4L2DeviceSource* source,unsig
std::ostringstream os;
os << "a=fmtp:" << int(rtpPayloadType) << " ";
os << source->getAuxLine();
os << "\r\n";
os << "\r\n";
int width = source->getWidth();
int height = source->getHeight();
if ( (width > 0) && (height>0) ) {
os << "a=x-dimensions:" << width << "," << height << "\r\n";
}
auxLine = strdup(os.str().c_str());
}
return auxLine;