Rename camera classes to avoid name clash.

Change-Id: I08fe8f7e75bdbf2c4975863642072061741b5bc6
Reviewed-by: Filipe Azevedo <filipe.azevedo@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
This commit is contained in:
James Turner
2015-01-12 17:15:28 +00:00
committed by Sean Harmer
parent fe21ee675e
commit 9a215d954b
9 changed files with 59 additions and 56 deletions

View File

@@ -31,8 +31,8 @@
**
****************************************************************************/
#ifndef AVFVIDEODEVICECONTROL_H
#define AVFVIDEODEVICECONTROL_H
#ifndef AVFCAMERADEVICECONTROL_H
#define AVFCAMERADEVICECONTROL_H
#include <QtMultimedia/qvideodeviceselectorcontrol.h>
#include <QtCore/qstringlist.h>
@@ -44,12 +44,12 @@ QT_BEGIN_NAMESPACE
class AVFCameraSession;
class AVFCameraService;
class AVFVideoDeviceControl : public QVideoDeviceSelectorControl
class AVFCameraDeviceControl : public QVideoDeviceSelectorControl
{
Q_OBJECT
public:
AVFVideoDeviceControl(AVFCameraService *service, QObject *parent = 0);
~AVFVideoDeviceControl();
AVFCameraDeviceControl(AVFCameraService *service, QObject *parent = 0);
~AVFCameraDeviceControl();
int deviceCount() const;

View File

@@ -40,30 +40,31 @@
****************************************************************************/
#include "avfcameradebug.h"
#include "avfvideodevicecontrol.h"
#include "avfcameradevicecontrol.h"
#include "avfcameraservice.h"
#include "avfcamerasession.h"
QT_USE_NAMESPACE
AVFVideoDeviceControl::AVFVideoDeviceControl(AVFCameraService *service, QObject *parent)
AVFCameraDeviceControl::AVFCameraDeviceControl(AVFCameraService *service, QObject *parent)
: QVideoDeviceSelectorControl(parent)
, m_service(service)
, m_selectedDevice(0)
, m_dirty(true)
{
Q_UNUSED(m_service);
}
AVFVideoDeviceControl::~AVFVideoDeviceControl()
AVFCameraDeviceControl::~AVFCameraDeviceControl()
{
}
int AVFVideoDeviceControl::deviceCount() const
int AVFCameraDeviceControl::deviceCount() const
{
return AVFCameraSession::availableCameraDevices().count();
}
QString AVFVideoDeviceControl::deviceName(int index) const
QString AVFCameraDeviceControl::deviceName(int index) const
{
const QList<QByteArray> &devices = AVFCameraSession::availableCameraDevices();
if (index < 0 || index >= devices.count())
@@ -72,7 +73,7 @@ QString AVFVideoDeviceControl::deviceName(int index) const
return QString::fromUtf8(devices.at(index));
}
QString AVFVideoDeviceControl::deviceDescription(int index) const
QString AVFCameraDeviceControl::deviceDescription(int index) const
{
const QList<QByteArray> &devices = AVFCameraSession::availableCameraDevices();
if (index < 0 || index >= devices.count())
@@ -81,17 +82,17 @@ QString AVFVideoDeviceControl::deviceDescription(int index) const
return AVFCameraSession::cameraDeviceInfo(devices.at(index)).description;
}
int AVFVideoDeviceControl::defaultDevice() const
int AVFCameraDeviceControl::defaultDevice() const
{
return AVFCameraSession::availableCameraDevices().indexOf(AVFCameraSession::defaultCameraDevice());
}
int AVFVideoDeviceControl::selectedDevice() const
int AVFCameraDeviceControl::selectedDevice() const
{
return m_selectedDevice;
}
void AVFVideoDeviceControl::setSelectedDevice(int index)
void AVFCameraDeviceControl::setSelectedDevice(int index)
{
if (index >= 0 &&
index < deviceCount() &&
@@ -103,7 +104,7 @@ void AVFVideoDeviceControl::setSelectedDevice(int index)
}
}
AVCaptureDevice *AVFVideoDeviceControl::createCaptureDevice()
AVCaptureDevice *AVFCameraDeviceControl::createCaptureDevice()
{
m_dirty = false;
AVCaptureDevice *device = 0;
@@ -121,4 +122,4 @@ AVCaptureDevice *AVFVideoDeviceControl::createCaptureDevice()
return device;
}
#include "moc_avfvideodevicecontrol.cpp"
#include "moc_avfcameradevicecontrol.cpp"

View File

@@ -31,8 +31,8 @@
**
****************************************************************************/
#ifndef AVFVIDEORENDERERCONTROL_H
#define AVFVIDEORENDERERCONTROL_H
#ifndef AVFCAMERARENDERERCONTROL_H
#define AVFCAMERARENDERERCONTROL_H
#include <QtMultimedia/qvideorenderercontrol.h>
#include <QtMultimedia/qvideoframe.h>
@@ -46,14 +46,14 @@ QT_BEGIN_NAMESPACE
class AVFCameraSession;
class AVFCameraService;
class AVFVideoRendererControl;
class AVFCameraRendererControl;
class AVFVideoRendererControl : public QVideoRendererControl
class AVFCameraRendererControl : public QVideoRendererControl
{
Q_OBJECT
public:
AVFVideoRendererControl(QObject *parent = 0);
~AVFVideoRendererControl();
AVFCameraRendererControl(QObject *parent = 0);
~AVFCameraRendererControl();
QAbstractVideoSurface *surface() const;
void setSurface(QAbstractVideoSurface *surface);

View File

@@ -39,7 +39,7 @@
**
****************************************************************************/
#include "avfvideorenderercontrol.h"
#include "avfcamerarenderercontrol.h"
#include "avfcamerasession.h"
#include "avfcameraservice.h"
#include "avfcameradebug.h"
@@ -103,10 +103,10 @@ private:
@interface AVFCaptureFramesDelegate : NSObject <AVCaptureVideoDataOutputSampleBufferDelegate>
{
@private
AVFVideoRendererControl *m_renderer;
AVFCameraRendererControl *m_renderer;
}
- (AVFCaptureFramesDelegate *) initWithRenderer:(AVFVideoRendererControl*)renderer;
- (AVFCaptureFramesDelegate *) initWithRenderer:(AVFCameraRendererControl*)renderer;
- (void) captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
@@ -115,7 +115,7 @@ private:
@implementation AVFCaptureFramesDelegate
- (AVFCaptureFramesDelegate *) initWithRenderer:(AVFVideoRendererControl*)renderer
- (AVFCaptureFramesDelegate *) initWithRenderer:(AVFCameraRendererControl*)renderer
{
if (!(self = [super init]))
return nil;
@@ -143,7 +143,7 @@ private:
@end
AVFVideoRendererControl::AVFVideoRendererControl(QObject *parent)
AVFCameraRendererControl::AVFCameraRendererControl(QObject *parent)
: QVideoRendererControl(parent)
, m_surface(0)
, m_needsHorizontalMirroring(false)
@@ -151,18 +151,18 @@ AVFVideoRendererControl::AVFVideoRendererControl(QObject *parent)
m_viewfinderFramesDelegate = [[AVFCaptureFramesDelegate alloc] initWithRenderer:this];
}
AVFVideoRendererControl::~AVFVideoRendererControl()
AVFCameraRendererControl::~AVFCameraRendererControl()
{
[m_cameraSession->captureSession() removeOutput:m_videoDataOutput];
[m_viewfinderFramesDelegate release];
}
QAbstractVideoSurface *AVFVideoRendererControl::surface() const
QAbstractVideoSurface *AVFCameraRendererControl::surface() const
{
return m_surface;
}
void AVFVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
void AVFCameraRendererControl::setSurface(QAbstractVideoSurface *surface)
{
if (m_surface != surface) {
m_surface = surface;
@@ -170,7 +170,7 @@ void AVFVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
}
}
void AVFVideoRendererControl::configureAVCaptureSession(AVFCameraSession *cameraSession)
void AVFCameraRendererControl::configureAVCaptureSession(AVFCameraSession *cameraSession)
{
m_cameraSession = cameraSession;
connect(m_cameraSession, SIGNAL(readyToConfigureConnections()),
@@ -196,7 +196,7 @@ void AVFVideoRendererControl::configureAVCaptureSession(AVFCameraSession *camera
[m_cameraSession->captureSession() addOutput:m_videoDataOutput];
}
void AVFVideoRendererControl::updateCaptureConnection()
void AVFCameraRendererControl::updateCaptureConnection()
{
AVCaptureConnection *connection = [m_videoDataOutput connectionWithMediaType:AVMediaTypeVideo];
if (connection == nil || !m_cameraSession->videoCaptureDevice())
@@ -213,7 +213,7 @@ void AVFVideoRendererControl::updateCaptureConnection()
}
//can be called from non main thread
void AVFVideoRendererControl::syncHandleViewfinderFrame(const QVideoFrame &frame)
void AVFCameraRendererControl::syncHandleViewfinderFrame(const QVideoFrame &frame)
{
QMutexLocker lock(&m_vfMutex);
if (!m_lastViewfinderFrame.isValid()) {
@@ -244,7 +244,7 @@ void AVFVideoRendererControl::syncHandleViewfinderFrame(const QVideoFrame &frame
m_cameraSession->onCameraFrameFetched(m_lastViewfinderFrame);
}
void AVFVideoRendererControl::handleViewfinderFrame()
void AVFCameraRendererControl::handleViewfinderFrame()
{
QVideoFrame frame;
{
@@ -273,4 +273,4 @@ void AVFVideoRendererControl::handleViewfinderFrame()
}
#include "moc_avfvideorenderercontrol.cpp"
#include "moc_avfcamerarenderercontrol.cpp"

View File

@@ -46,11 +46,11 @@ class AVFCameraInfoControl;
class AVFCameraMetaDataControl;
class AVFVideoWindowControl;
class AVFVideoWidgetControl;
class AVFVideoRendererControl;
class AVFCameraRendererControl;
class AVFMediaRecorderControl;
class AVFImageCaptureControl;
class AVFCameraSession;
class AVFVideoDeviceControl;
class AVFCameraDeviceControl;
class AVFAudioInputSelectorControl;
class AVFCameraService : public QMediaService
@@ -65,7 +65,7 @@ public:
AVFCameraSession *session() const { return m_session; }
AVFCameraControl *cameraControl() const { return m_cameraControl; }
AVFVideoDeviceControl *videoDeviceControl() const { return m_videoDeviceControl; }
AVFCameraDeviceControl *videoDeviceControl() const { return m_videoDeviceControl; }
AVFAudioInputSelectorControl *audioInputSelectorControl() const { return m_audioInputSelectorControl; }
AVFCameraMetaDataControl *metaDataControl() const { return m_metaDataControl; }
AVFMediaRecorderControl *recorderControl() const { return m_recorderControl; }
@@ -76,9 +76,9 @@ private:
AVFCameraSession *m_session;
AVFCameraControl *m_cameraControl;
AVFCameraInfoControl *m_cameraInfoControl;
AVFVideoDeviceControl *m_videoDeviceControl;
AVFCameraDeviceControl *m_videoDeviceControl;
AVFAudioInputSelectorControl *m_audioInputSelectorControl;
AVFVideoRendererControl *m_videoOutput;
AVFCameraRendererControl *m_videoOutput;
AVFCameraMetaDataControl *m_metaDataControl;
AVFMediaRecorderControl *m_recorderControl;
AVFImageCaptureControl *m_imageCaptureControl;

View File

@@ -46,12 +46,12 @@
#include "avfcameracontrol.h"
#include "avfcamerainfocontrol.h"
#include "avfcamerasession.h"
#include "avfvideodevicecontrol.h"
#include "avfcameradevicecontrol.h"
#include "avfaudioinputselectorcontrol.h"
#include "avfcamerametadatacontrol.h"
#include "avfmediarecordercontrol.h"
#include "avfimagecapturecontrol.h"
#include "avfvideorenderercontrol.h"
#include "avfcamerarenderercontrol.h"
#include "avfmediarecordercontrol.h"
#include "avfimagecapturecontrol.h"
#include "avfmediavideoprobecontrol.h"
@@ -68,7 +68,7 @@ AVFCameraService::AVFCameraService(QObject *parent):
m_session = new AVFCameraSession(this);
m_cameraControl = new AVFCameraControl(this);
m_cameraInfoControl = new AVFCameraInfoControl(this);
m_videoDeviceControl = new AVFVideoDeviceControl(this);
m_videoDeviceControl = new AVFCameraDeviceControl(this);
m_audioInputSelectorControl = new AVFAudioInputSelectorControl(this);
m_metaDataControl = new AVFCameraMetaDataControl(this);
@@ -128,7 +128,7 @@ QMediaControl *AVFCameraService::requestControl(const char *name)
}
if (!m_videoOutput) {
if (qstrcmp(name, QVideoRendererControl_iid) == 0)
m_videoOutput = new AVFVideoRendererControl(this);
m_videoOutput = new AVFCameraRendererControl(this);
if (m_videoOutput) {
m_session->setVideoOutput(m_videoOutput);

View File

@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
class AVFCameraControl;
class AVFCameraService;
class AVFVideoRendererControl;
class AVFCameraRendererControl;
class AVFMediaVideoProbeControl;
struct AVFCameraInfo
@@ -70,7 +70,7 @@ public:
static const QList<QByteArray> &availableCameraDevices();
static AVFCameraInfo cameraDeviceInfo(const QByteArray &device);
void setVideoOutput(AVFVideoRendererControl *output);
void setVideoOutput(AVFCameraRendererControl *output);
AVCaptureSession *captureSession() const { return m_captureSession; }
AVCaptureDevice *videoCaptureDevice() const;
@@ -104,7 +104,7 @@ private:
static QMap<QByteArray, AVFCameraInfo> m_cameraInfo;
AVFCameraService *m_service;
AVFVideoRendererControl *m_videoOutput;
AVFCameraRendererControl *m_videoOutput;
QCamera::State m_state;
bool m_active;

View File

@@ -43,8 +43,8 @@
#include "avfcamerasession.h"
#include "avfcameraservice.h"
#include "avfcameracontrol.h"
#include "avfvideorenderercontrol.h"
#include "avfvideodevicecontrol.h"
#include "avfcamerarenderercontrol.h"
#include "avfcameradevicecontrol.h"
#include "avfaudioinputselectorcontrol.h"
#include "avfmediavideoprobecontrol.h"
@@ -241,7 +241,7 @@ void AVFCameraSession::updateCameraDevices()
}
}
void AVFCameraSession::setVideoOutput(AVFVideoRendererControl *output)
void AVFCameraSession::setVideoOutput(AVFCameraRendererControl *output)
{
m_videoOutput = output;
if (output)

View File

@@ -25,30 +25,32 @@ HEADERS += \
avfcameradebug.h \
avfcameraserviceplugin.h \
avfcameracontrol.h \
avfvideorenderercontrol.h \
avfcamerametadatacontrol.h \
avfimagecapturecontrol.h \
avfmediarecordercontrol.h \
avfcameraservice.h \
avfcamerasession.h \
avfstoragelocation.h \
avfvideodevicecontrol.h \
avfaudioinputselectorcontrol.h \
avfcamerainfocontrol.h \
avfmediavideoprobecontrol.h
avfmediavideoprobecontrol.h \
avfcamerainfocontrol.h \
avfcamerarenderercontrol.h \
avfcameradevicecontrol.h
OBJECTIVE_SOURCES += \
avfcameraserviceplugin.mm \
avfcameracontrol.mm \
avfvideorenderercontrol.mm \
avfcamerametadatacontrol.mm \
avfimagecapturecontrol.mm \
avfmediarecordercontrol.mm \
avfcameraservice.mm \
avfcamerasession.mm \
avfstoragelocation.mm \
avfvideodevicecontrol.mm \
avfaudioinputselectorcontrol.mm \
avfcamerainfocontrol.mm \
avfmediavideoprobecontrol.mm
avfmediavideoprobecontrol.mm \
avfcamerainfocontrol.mm \
avfcameradevicecontrol.mm \
avfcamerarenderercontrol.mm