From 2258748d2879f2b5ce7d7b82c54b4e8b75279c6b Mon Sep 17 00:00:00 2001 From: Diadlo Date: Thu, 7 Jul 2016 12:58:28 +0300 Subject: [PATCH] style(audio, video): Style fixes --- src/audio/audio.cpp | 9 --------- src/audio/audio.h | 5 ++++- src/video/cameradevice.cpp | 8 +++++--- src/video/camerasource.cpp | 11 ++++++----- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index 9757fa647..1e684c960 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -582,15 +582,6 @@ void Audio::doCapture() emit frameAvailable(buf, AUDIO_FRAME_SAMPLE_COUNT, AUDIO_CHANNELS, AUDIO_SAMPLE_RATE); } -/** -Returns true if the input device is open and suscribed to -*/ -bool Audio::isInputReady() const -{ - QMutexLocker locker(&audioLock); - return alInDev && inSubscriptions; -} - /** Returns true if the output device is open */ diff --git a/src/audio/audio.h b/src/audio/audio.h index 7693f839b..317ad7998 100644 --- a/src/audio/audio.h +++ b/src/audio/audio.h @@ -63,21 +63,24 @@ public: qreal minInputGain() const; void setMinInputGain(qreal dB); + qreal maxInputGain() const; void setMaxInputGain(qreal dB); + qreal inputGain() const; void setInputGain(qreal dB); void reinitInput(const QString& inDevDesc); bool reinitOutput(const QString& outDevDesc); - bool isInputReady() const; bool isOutputReady() const; static QStringList outDeviceNames(); static QStringList inDeviceNames(); + void subscribeOutput(ALuint& sid); void unsubscribeOutput(ALuint& sid); + void subscribeInput(); void unsubscribeInput(); diff --git a/src/video/cameradevice.cpp b/src/video/cameradevice.cpp index 6a9c2c92c..e0b8e676f 100644 --- a/src/video/cameradevice.cpp +++ b/src/video/cameradevice.cpp @@ -194,13 +194,14 @@ CameraDevice* CameraDevice::open(QString devName, VideoMode mode) #endif else if (mode) { - qWarning() << "Video mode-setting not implemented for input "<name; - (void)mode; + qWarning() << "Video mode-setting not implemented for input " << iformat->name; + Q_UNUSED(mode); } CameraDevice* dev = open(devName, &options); if (options) av_dict_free(&options); + return dev; } @@ -367,6 +368,8 @@ QVector CameraDevice::getScreenModes() QVector CameraDevice::getVideoModes(QString devName) { + Q_UNUSED(devName); + if (!iformat); else if (isScreen(devName)) return getScreenModes(); @@ -385,7 +388,6 @@ QVector CameraDevice::getVideoModes(QString devName) else qWarning() << "Video mode listing not implemented for input "<name; - (void)devName; return {}; } diff --git a/src/video/camerasource.cpp b/src/video/camerasource.cpp index 1bcbcc296..99dcc7c95 100644 --- a/src/video/camerasource.cpp +++ b/src/video/camerasource.cpp @@ -137,8 +137,9 @@ CameraSource::~CameraSource() if (device) { - for(int i = 0; i < subscriptions; i++) + for (int i = 0; i < subscriptions; i++) device->close(); + device = nullptr; } @@ -241,7 +242,7 @@ bool CameraSource::openDevice() // Find the first video stream for (unsigned i = 0; i < device->context->nb_streams; i++) { - if(device->context->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) + if (device->context->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { videoStreamIndex = i; break; @@ -257,7 +258,7 @@ bool CameraSource::openDevice() // Get a pointer to the codec context for the video stream cctxOrig = device->context->streams[videoStreamIndex]->codec; codec = avcodec_find_decoder(cctxOrig->codec_id); - if(!codec) + if (!codec) { qWarning() << "Codec not found"; return false; @@ -265,7 +266,7 @@ bool CameraSource::openDevice() // Copy context, since we apparently aren't allowed to use the original cctx = avcodec_alloc_context3(codec); - if(avcodec_copy_context(cctx, cctxOrig) != 0) + if (avcodec_copy_context(cctx, cctxOrig) != 0) { qWarning() << "Can't copy context"; return false; @@ -274,7 +275,7 @@ bool CameraSource::openDevice() cctx->refcounted_frames = 1; // Open codec - if(avcodec_open2(cctx, codec, nullptr)<0) + if (avcodec_open2(cctx, codec, nullptr)<0) { qWarning() << "Can't open codec"; avcodec_free_context(&cctx);