2015-03-07 19:25:52 +00:00
|
|
|
/* ---------------------------------------------------------------------------
|
|
|
|
** 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.
|
|
|
|
**
|
|
|
|
** H264_V4l2DeviceSource.h
|
|
|
|
**
|
|
|
|
** H264 V4L2 live555 source
|
|
|
|
**
|
|
|
|
** -------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
2021-11-07 10:21:53 +00:00
|
|
|
#pragma once
|
2015-03-07 19:25:52 +00:00
|
|
|
|
|
|
|
// project
|
2021-11-07 10:21:53 +00:00
|
|
|
#include "V4L2DeviceSource.h"
|
2015-03-07 19:25:52 +00:00
|
|
|
|
|
|
|
// ---------------------------------
|
|
|
|
// H264 V4L2 FramedSource
|
|
|
|
// ---------------------------------
|
|
|
|
const char H264marker[] = {0,0,0,1};
|
2015-09-05 15:58:59 +00:00
|
|
|
const char H264shortmarker[] = {0,0,1};
|
2015-03-07 19:25:52 +00:00
|
|
|
|
2017-08-15 15:49:30 +00:00
|
|
|
class H26X_V4L2DeviceSource : public V4L2DeviceSource
|
|
|
|
{
|
2015-03-07 19:25:52 +00:00
|
|
|
protected:
|
2017-08-15 15:49:30 +00:00
|
|
|
H26X_V4L2DeviceSource(UsageEnvironment& env, DeviceInterface * device, int outputFd, unsigned int queueSize, bool useThread, bool repeatConfig, bool keepMarker)
|
2019-07-01 21:18:47 +00:00
|
|
|
: V4L2DeviceSource(env, device, outputFd, queueSize, useThread), m_repeatConfig(repeatConfig), m_keepMarker(keepMarker) {}
|
2017-08-15 15:49:30 +00:00
|
|
|
|
|
|
|
virtual ~H26X_V4L2DeviceSource() {}
|
2015-03-07 19:25:52 +00:00
|
|
|
|
2019-07-01 21:18:47 +00:00
|
|
|
unsigned char* extractFrame(unsigned char* frame, size_t& size, size_t& outsize, int& frameType);
|
2017-08-15 15:49:30 +00:00
|
|
|
|
|
|
|
protected:
|
2015-03-07 19:25:52 +00:00
|
|
|
std::string m_sps;
|
|
|
|
std::string m_pps;
|
2015-04-25 16:46:23 +00:00
|
|
|
bool m_repeatConfig;
|
2016-01-16 20:15:14 +00:00
|
|
|
bool m_keepMarker;
|
2015-03-07 19:25:52 +00:00
|
|
|
};
|
|
|
|
|
2017-08-15 15:49:30 +00:00
|
|
|
class H264_V4L2DeviceSource : public H26X_V4L2DeviceSource
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static H264_V4L2DeviceSource* createNew(UsageEnvironment& env, DeviceInterface * device, int outputFd, unsigned int queueSize, bool useThread, bool repeatConfig, bool keepMarker) {
|
|
|
|
return new H264_V4L2DeviceSource(env, device, outputFd, queueSize, useThread, repeatConfig, keepMarker);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
H264_V4L2DeviceSource(UsageEnvironment& env, DeviceInterface * device, int outputFd, unsigned int queueSize, bool useThread, bool repeatConfig, bool keepMarker)
|
|
|
|
: H26X_V4L2DeviceSource(env, device, outputFd, queueSize, useThread, repeatConfig, keepMarker) {}
|
|
|
|
|
|
|
|
// overide V4L2DeviceSource
|
|
|
|
virtual std::list< std::pair<unsigned char*,size_t> > splitFrames(unsigned char* frame, unsigned frameSize);
|
|
|
|
};
|
|
|
|
|
|
|
|
class H265_V4L2DeviceSource : public H26X_V4L2DeviceSource
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static H265_V4L2DeviceSource* createNew(UsageEnvironment& env, DeviceInterface * device, int outputFd, unsigned int queueSize, bool useThread, bool repeatConfig, bool keepMarker) {
|
|
|
|
return new H265_V4L2DeviceSource(env, device, outputFd, queueSize, useThread, repeatConfig, keepMarker);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
H265_V4L2DeviceSource(UsageEnvironment& env, DeviceInterface * device, int outputFd, unsigned int queueSize, bool useThread, bool repeatConfig, bool keepMarker)
|
|
|
|
: H26X_V4L2DeviceSource(env, device, outputFd, queueSize, useThread, repeatConfig, keepMarker) {}
|
|
|
|
|
|
|
|
// overide V4L2DeviceSource
|
|
|
|
virtual std::list< std::pair<unsigned char*,size_t> > splitFrames(unsigned char* frame, unsigned frameSize);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
std::string m_vps;
|
|
|
|
};
|
|
|
|
|