rename classes

This commit is contained in:
MPR 2014-11-02 15:42:30 +00:00
parent 61c52f8c3a
commit 87fbcff400
9 changed files with 57 additions and 57 deletions

View File

@ -3,15 +3,15 @@
** support, and with no warranty, express or implied, as to its usefulness for
** any purpose.
**
** v4l2Device.h
** V4l2Capture.h
**
** V4L2 wrapper
**
** -------------------------------------------------------------------------*/
#ifndef V4L2_DEVICE
#define V4L2_DEVICE
#ifndef V4L2_CAPTURE
#define V4L2_CAPTURE
#include <string>
#include <list>
@ -36,13 +36,13 @@ struct V4L2DeviceParameters
// ---------------------------------
// V4L2 Capture
// ---------------------------------
class V4L2Device
class V4l2Capture
{
protected:
V4L2Device(V4L2DeviceParameters params);
V4l2Capture(V4L2DeviceParameters params);
public:
virtual ~V4L2Device();
virtual ~V4l2Capture();
public:
int getBufferSize() { return m_bufferSize; };

View File

@ -3,9 +3,9 @@
** support, and with no warranty, express or implied, as to its usefulness for
** any purpose.
**
** v4l2DeviceSource.h
** V4l2DeviceSource.h
**
** V4L2 source
** V4L2 live555 source
**
** -------------------------------------------------------------------------*/
@ -21,7 +21,7 @@
#include <liveMedia.hh>
// project
#include "V4l2Device.h"
#include "V4l2Capture.h"
// ---------------------------------
// V4L2 FramedSource
@ -64,11 +64,11 @@ class V4L2DeviceSource: public FramedSource
};
public:
static V4L2DeviceSource* createNew(UsageEnvironment& env, V4L2DeviceParameters params, V4L2Device * device, const std::string &outputFIle, unsigned int queueSize, int verbose) ;
static V4L2DeviceSource* createNew(UsageEnvironment& env, V4L2DeviceParameters params, V4l2Capture * device, const std::string &outputFIle, unsigned int queueSize, int verbose) ;
std::string getAuxLine() { return m_auxLine; };
protected:
V4L2DeviceSource(UsageEnvironment& env, V4L2DeviceParameters params, V4L2Device * device, const std::string &outputFIle, unsigned int queueSize, int verbose);
V4L2DeviceSource(UsageEnvironment& env, V4L2DeviceParameters params, V4l2Capture * device, const std::string &outputFIle, unsigned int queueSize, int verbose);
virtual ~V4L2DeviceSource();
protected:
@ -92,7 +92,7 @@ class V4L2DeviceSource: public FramedSource
EventTriggerId m_eventTriggerId;
FILE* m_outfile;
std::string m_auxLine;
V4L2Device * m_device;
V4l2Capture * m_device;
std::string m_outputFIle;
unsigned int m_queueSize;
int m_verbose;

View File

@ -3,27 +3,27 @@
** support, and with no warranty, express or implied, as to its usefulness for
** any purpose.
**
** V4L2MMAPDeviceSource.h
** V4l2MmapCapture.h
**
** V4L2 source using mmap API
**
** -------------------------------------------------------------------------*/
#ifndef V4L2_MMAP_DEVICE_SOURCE
#define V4L2_MMAP_DEVICE_SOURCE
#ifndef V4L2_MMAP_CAPTURE
#define V4L2_MMAP_CAPTURE
// project
#include "V4l2Device.h"
#include "V4l2Capture.h"
#define V4L2MMAP_NBBUFFER 10
class V4L2MMAPDeviceSource : public V4L2Device
class V4l2MmapCapture : public V4l2Capture
{
public:
static V4L2MMAPDeviceSource* createNew(V4L2DeviceParameters params);
static V4l2MmapCapture* createNew(V4L2DeviceParameters params);
protected:
V4L2MMAPDeviceSource(V4L2DeviceParameters params) : V4L2Device(params), n_buffers(0) {};
V4l2MmapCapture(V4L2DeviceParameters params) : V4l2Capture(params), n_buffers(0) {};
public:
virtual bool captureStart();

View File

@ -3,26 +3,26 @@
** support, and with no warranty, express or implied, as to its usefulness for
** any purpose.
**
** V4l2READDeviceSource.h
** V4l2ReadCapture.h
**
** V4L2 source using read API
**
** -------------------------------------------------------------------------*/
#ifndef V4L2_READ_DEVICE_SOURCE
#define V4L2_READ_DEVICE_SOURCE
#ifndef V4L2_READ_CAPTURE
#define V4L2_READ_CAPTURE
// project
#include "V4l2Device.h"
#include "V4l2Capture.h"
class V4L2READDeviceSource : public V4L2Device
class V4l2ReadCapture : public V4l2Capture
{
public:
static V4L2READDeviceSource* createNew(V4L2DeviceParameters params);
static V4l2ReadCapture* createNew(V4L2DeviceParameters params);
protected:
V4L2READDeviceSource(V4L2DeviceParameters params) : V4L2Device(params) {};
V4l2ReadCapture(V4L2DeviceParameters params) : V4l2Capture(params) {};
public:
virtual bool captureStart() { return true; };

View File

@ -3,7 +3,7 @@
** support, and with no warranty, express or implied, as to its usefulness for
** any purpose.
**
** v4l2Device.cpp
** V4l2Capture.cpp
**
** V4L2 wrapper
**
@ -20,21 +20,21 @@
#include <libv4l2.h>
// project
#include "V4l2Device.h"
#include "V4l2Capture.h"
// Constructor
V4L2Device::V4L2Device(V4L2DeviceParameters params) : m_params(params), m_fd(-1), m_bufferSize(0)
V4l2Capture::V4l2Capture(V4L2DeviceParameters params) : m_params(params), m_fd(-1), m_bufferSize(0)
{
}
// Destructor
V4L2Device::~V4L2Device()
V4l2Capture::~V4l2Capture()
{
if (m_fd !=-1) v4l2_close(m_fd);
}
// intialize the source
bool V4L2Device::init(unsigned int mandatoryCapabilities)
bool V4l2Capture::init(unsigned int mandatoryCapabilities)
{
if (initdevice(m_params.m_devName.c_str(), mandatoryCapabilities) == -1)
{
@ -44,14 +44,14 @@ bool V4L2Device::init(unsigned int mandatoryCapabilities)
return (m_fd!=-1);
}
void V4L2Device::close()
void V4l2Capture::close()
{
if (m_fd !=-1) v4l2_close(m_fd);
m_fd = -1;
}
// intialize the V4L2 device
int V4L2Device::initdevice(const char *dev_name, unsigned int mandatoryCapabilities)
int V4l2Capture::initdevice(const char *dev_name, unsigned int mandatoryCapabilities)
{
m_fd = v4l2_open(dev_name, O_RDWR | O_NONBLOCK, 0);
if (m_fd < 0)
@ -80,7 +80,7 @@ int V4L2Device::initdevice(const char *dev_name, unsigned int mandatoryCapabilit
}
// check needed V4L2 capabilities
int V4L2Device::checkCapabilities(int fd, unsigned int mandatoryCapabilities)
int V4l2Capture::checkCapabilities(int fd, unsigned int mandatoryCapabilities)
{
struct v4l2_capability cap;
memset(&(cap), 0, sizeof(cap));
@ -111,7 +111,7 @@ int V4L2Device::checkCapabilities(int fd, unsigned int mandatoryCapabilities)
}
// configure capture format
int V4L2Device::configureFormat(int fd)
int V4l2Capture::configureFormat(int fd)
{
struct v4l2_format fmt;
memset(&(fmt), 0, sizeof(fmt));
@ -141,7 +141,7 @@ int V4L2Device::configureFormat(int fd)
}
// configure capture FPS
int V4L2Device::configureParam(int fd)
int V4l2Capture::configureParam(int fd)
{
struct v4l2_streamparm param;
memset(&(param), 0, sizeof(param));
@ -161,7 +161,7 @@ int V4L2Device::configureParam(int fd)
}
// ioctl encapsulation
int V4L2Device::xioctl(int fd, int request, void *arg)
int V4l2Capture::xioctl(int fd, int request, void *arg)
{
int ret = -1;
do

View File

@ -5,7 +5,7 @@
**
** v4l2DeviceSource.cpp
**
** V4L2 source
** V4L2 Live555 source
**
** -------------------------------------------------------------------------*/
@ -48,7 +48,7 @@ int V4L2DeviceSource::Stats::notify(int tv_sec, int framesize, int verbose)
// ---------------------------------
// V4L2 FramedSource
// ---------------------------------
V4L2DeviceSource* V4L2DeviceSource::createNew(UsageEnvironment& env, V4L2DeviceParameters params, V4L2Device * device, const std::string &outputFIle, unsigned int queueSize, int verbose)
V4L2DeviceSource* V4L2DeviceSource::createNew(UsageEnvironment& env, V4L2DeviceParameters params, V4l2Capture * device, const std::string &outputFIle, unsigned int queueSize, int verbose)
{
V4L2DeviceSource* source = NULL;
if (device)
@ -59,7 +59,7 @@ V4L2DeviceSource* V4L2DeviceSource::createNew(UsageEnvironment& env, V4L2DeviceP
}
// Constructor
V4L2DeviceSource::V4L2DeviceSource(UsageEnvironment& env, V4L2DeviceParameters params, V4L2Device * device, const std::string &outputFIle, unsigned int queueSize, int verbose)
V4L2DeviceSource::V4L2DeviceSource(UsageEnvironment& env, V4L2DeviceParameters params, V4l2Capture * device, const std::string &outputFIle, unsigned int queueSize, int verbose)
: FramedSource(env),
m_params(params),
m_in("in"),

View File

@ -3,7 +3,7 @@
** support, and with no warranty, express or implied, as to its usefulness for
** any purpose.
**
** V4l2MMAPDeviceSource.cpp
** V4l2MmapCapture.cpp
**
** V4L2 source using mmap API
**
@ -19,11 +19,11 @@
#include <libv4l2.h>
// project
#include "V4l2MMAPDeviceSource.h"
#include "V4l2MmapCapture.h"
V4L2MMAPDeviceSource* V4L2MMAPDeviceSource::createNew(V4L2DeviceParameters params)
V4l2MmapCapture* V4l2MmapCapture::createNew(V4L2DeviceParameters params)
{
V4L2MMAPDeviceSource* device = new V4L2MMAPDeviceSource(params);
V4l2MmapCapture* device = new V4l2MmapCapture(params);
if (device && !device->init(V4L2_CAP_STREAMING))
{
delete device;
@ -32,7 +32,7 @@ V4L2MMAPDeviceSource* V4L2MMAPDeviceSource::createNew(V4L2DeviceParameters param
return device;
}
bool V4L2MMAPDeviceSource::captureStart()
bool V4l2MmapCapture::captureStart()
{
bool success = true;
struct v4l2_requestbuffers req;
@ -119,7 +119,7 @@ bool V4L2MMAPDeviceSource::captureStart()
return success;
}
size_t V4L2MMAPDeviceSource::read(char* buffer, size_t bufferSize)
size_t V4l2MmapCapture::read(char* buffer, size_t bufferSize)
{
size_t size = 0;
if (n_buffers > 0)
@ -154,7 +154,7 @@ size_t V4L2MMAPDeviceSource::read(char* buffer, size_t bufferSize)
return size;
}
bool V4L2MMAPDeviceSource::captureStop()
bool V4l2MmapCapture::captureStop()
{
bool success = true;
int type = V4L2_BUF_TYPE_VIDEO_CAPTURE;

View File

@ -3,7 +3,7 @@
** support, and with no warranty, express or implied, as to its usefulness for
** any purpose.
**
** V4l2READDeviceSource.cpp
** V4l2ReadCapture.cpp
**
** V4L2 source using read API
**
@ -15,12 +15,12 @@
#include <libv4l2.h>
// project
#include "V4l2READDeviceSource.h"
#include "V4l2ReadCapture.h"
// Creator
V4L2READDeviceSource* V4L2READDeviceSource::createNew(V4L2DeviceParameters params)
V4l2ReadCapture* V4l2ReadCapture::createNew(V4L2DeviceParameters params)
{
V4L2READDeviceSource* device = new V4L2READDeviceSource(params);
V4l2ReadCapture* device = new V4l2ReadCapture(params);
if (device && !device->init(V4L2_CAP_READWRITE))
{
delete device;
@ -29,7 +29,7 @@ V4L2READDeviceSource* V4L2READDeviceSource::createNew(V4L2DeviceParameters param
return device;
}
size_t V4L2READDeviceSource::read(char* buffer, size_t bufferSize)
size_t V4l2ReadCapture::read(char* buffer, size_t bufferSize)
{
return v4l2_read(m_fd, buffer, bufferSize);
}

View File

@ -31,8 +31,8 @@
#include <Base64.hh>
// project
#include "V4l2READDeviceSource.h"
#include "V4l2MMAPDeviceSource.h"
#include "V4l2ReadCapture.h"
#include "V4l2MmapCapture.h"
#include "V4l2DeviceSource.h"
#include "ServerMediaSubsession.h"
@ -148,14 +148,14 @@ int main(int argc, char** argv)
// Init capture
*env << "Create V4L2 Source..." << dev_name << "\n";
V4L2DeviceParameters param(dev_name,format,width,height,fps,verbose);
V4L2Device* videoCapture = NULL;
V4l2Capture* videoCapture = NULL;
if (useMmap)
{
videoCapture = V4L2MMAPDeviceSource::createNew(param);
videoCapture = V4l2MmapCapture::createNew(param);
}
else
{
videoCapture = V4L2READDeviceSource::createNew(param);
videoCapture = V4l2ReadCapture::createNew(param);
}
if (videoCapture)
{