From 9a215d954b00b6d07568392a1894341027c1af5a Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 12 Jan 2015 17:15:28 +0000 Subject: [PATCH] Rename camera classes to avoid name clash. Change-Id: I08fe8f7e75bdbf2c4975863642072061741b5bc6 Reviewed-by: Filipe Azevedo Reviewed-by: Sean Harmer Reviewed-by: Yoann Lopes --- ...vicecontrol.h => avfcameradevicecontrol.h} | 10 +++---- ...cecontrol.mm => avfcameradevicecontrol.mm} | 23 ++++++++-------- ...ercontrol.h => avfcamerarenderercontrol.h} | 12 ++++----- ...control.mm => avfcamerarenderercontrol.mm} | 26 +++++++++---------- .../avfoundation/camera/avfcameraservice.h | 10 +++---- .../avfoundation/camera/avfcameraservice.mm | 8 +++--- .../avfoundation/camera/avfcamerasession.h | 6 ++--- .../avfoundation/camera/avfcamerasession.mm | 6 ++--- src/plugins/avfoundation/camera/camera.pro | 14 +++++----- 9 files changed, 59 insertions(+), 56 deletions(-) rename src/plugins/avfoundation/camera/{avfvideodevicecontrol.h => avfcameradevicecontrol.h} (90%) rename src/plugins/avfoundation/camera/{avfvideodevicecontrol.mm => avfcameradevicecontrol.mm} (84%) rename src/plugins/avfoundation/camera/{avfvideorenderercontrol.h => avfcamerarenderercontrol.h} (91%) rename src/plugins/avfoundation/camera/{avfvideorenderercontrol.mm => avfcamerarenderercontrol.mm} (90%) diff --git a/src/plugins/avfoundation/camera/avfvideodevicecontrol.h b/src/plugins/avfoundation/camera/avfcameradevicecontrol.h similarity index 90% rename from src/plugins/avfoundation/camera/avfvideodevicecontrol.h rename to src/plugins/avfoundation/camera/avfcameradevicecontrol.h index c46d1bd6..20e78b77 100644 --- a/src/plugins/avfoundation/camera/avfvideodevicecontrol.h +++ b/src/plugins/avfoundation/camera/avfcameradevicecontrol.h @@ -31,8 +31,8 @@ ** ****************************************************************************/ -#ifndef AVFVIDEODEVICECONTROL_H -#define AVFVIDEODEVICECONTROL_H +#ifndef AVFCAMERADEVICECONTROL_H +#define AVFCAMERADEVICECONTROL_H #include #include @@ -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; diff --git a/src/plugins/avfoundation/camera/avfvideodevicecontrol.mm b/src/plugins/avfoundation/camera/avfcameradevicecontrol.mm similarity index 84% rename from src/plugins/avfoundation/camera/avfvideodevicecontrol.mm rename to src/plugins/avfoundation/camera/avfcameradevicecontrol.mm index 03736c39..15e6b4a5 100644 --- a/src/plugins/avfoundation/camera/avfvideodevicecontrol.mm +++ b/src/plugins/avfoundation/camera/avfcameradevicecontrol.mm @@ -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 &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 &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" diff --git a/src/plugins/avfoundation/camera/avfvideorenderercontrol.h b/src/plugins/avfoundation/camera/avfcamerarenderercontrol.h similarity index 91% rename from src/plugins/avfoundation/camera/avfvideorenderercontrol.h rename to src/plugins/avfoundation/camera/avfcamerarenderercontrol.h index 0f4f6ba7..92c8ba74 100644 --- a/src/plugins/avfoundation/camera/avfvideorenderercontrol.h +++ b/src/plugins/avfoundation/camera/avfcamerarenderercontrol.h @@ -31,8 +31,8 @@ ** ****************************************************************************/ -#ifndef AVFVIDEORENDERERCONTROL_H -#define AVFVIDEORENDERERCONTROL_H +#ifndef AVFCAMERARENDERERCONTROL_H +#define AVFCAMERARENDERERCONTROL_H #include #include @@ -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); diff --git a/src/plugins/avfoundation/camera/avfvideorenderercontrol.mm b/src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm similarity index 90% rename from src/plugins/avfoundation/camera/avfvideorenderercontrol.mm rename to src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm index 369ed473..6f9b6498 100644 --- a/src/plugins/avfoundation/camera/avfvideorenderercontrol.mm +++ b/src/plugins/avfoundation/camera/avfcamerarenderercontrol.mm @@ -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 { @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" diff --git a/src/plugins/avfoundation/camera/avfcameraservice.h b/src/plugins/avfoundation/camera/avfcameraservice.h index 6e546539..5d5d3b94 100644 --- a/src/plugins/avfoundation/camera/avfcameraservice.h +++ b/src/plugins/avfoundation/camera/avfcameraservice.h @@ -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; diff --git a/src/plugins/avfoundation/camera/avfcameraservice.mm b/src/plugins/avfoundation/camera/avfcameraservice.mm index 77a145ba..cdd983a2 100644 --- a/src/plugins/avfoundation/camera/avfcameraservice.mm +++ b/src/plugins/avfoundation/camera/avfcameraservice.mm @@ -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); diff --git a/src/plugins/avfoundation/camera/avfcamerasession.h b/src/plugins/avfoundation/camera/avfcamerasession.h index ec0c746c..97577f41 100644 --- a/src/plugins/avfoundation/camera/avfcamerasession.h +++ b/src/plugins/avfoundation/camera/avfcamerasession.h @@ -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 &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 m_cameraInfo; AVFCameraService *m_service; - AVFVideoRendererControl *m_videoOutput; + AVFCameraRendererControl *m_videoOutput; QCamera::State m_state; bool m_active; diff --git a/src/plugins/avfoundation/camera/avfcamerasession.mm b/src/plugins/avfoundation/camera/avfcamerasession.mm index 3c58c25d..c1b896cf 100644 --- a/src/plugins/avfoundation/camera/avfcamerasession.mm +++ b/src/plugins/avfoundation/camera/avfcamerasession.mm @@ -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) diff --git a/src/plugins/avfoundation/camera/camera.pro b/src/plugins/avfoundation/camera/camera.pro index 2cd3d56a..0ceeb19d 100644 --- a/src/plugins/avfoundation/camera/camera.pro +++ b/src/plugins/avfoundation/camera/camera.pro @@ -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