1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

style(audio, video): Style fixes

This commit is contained in:
Diadlo 2016-07-07 12:58:28 +03:00
parent 76f694fe73
commit 2258748d28
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
4 changed files with 15 additions and 18 deletions

View File

@ -582,15 +582,6 @@ void Audio::doCapture()
emit frameAvailable(buf, AUDIO_FRAME_SAMPLE_COUNT, AUDIO_CHANNELS, AUDIO_SAMPLE_RATE); 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 Returns true if the output device is open
*/ */

View File

@ -63,21 +63,24 @@ public:
qreal minInputGain() const; qreal minInputGain() const;
void setMinInputGain(qreal dB); void setMinInputGain(qreal dB);
qreal maxInputGain() const; qreal maxInputGain() const;
void setMaxInputGain(qreal dB); void setMaxInputGain(qreal dB);
qreal inputGain() const; qreal inputGain() const;
void setInputGain(qreal dB); void setInputGain(qreal dB);
void reinitInput(const QString& inDevDesc); void reinitInput(const QString& inDevDesc);
bool reinitOutput(const QString& outDevDesc); bool reinitOutput(const QString& outDevDesc);
bool isInputReady() const;
bool isOutputReady() const; bool isOutputReady() const;
static QStringList outDeviceNames(); static QStringList outDeviceNames();
static QStringList inDeviceNames(); static QStringList inDeviceNames();
void subscribeOutput(ALuint& sid); void subscribeOutput(ALuint& sid);
void unsubscribeOutput(ALuint& sid); void unsubscribeOutput(ALuint& sid);
void subscribeInput(); void subscribeInput();
void unsubscribeInput(); void unsubscribeInput();

View File

@ -194,13 +194,14 @@ CameraDevice* CameraDevice::open(QString devName, VideoMode mode)
#endif #endif
else if (mode) else if (mode)
{ {
qWarning() << "Video mode-setting not implemented for input "<<iformat->name; qWarning() << "Video mode-setting not implemented for input " << iformat->name;
(void)mode; Q_UNUSED(mode);
} }
CameraDevice* dev = open(devName, &options); CameraDevice* dev = open(devName, &options);
if (options) if (options)
av_dict_free(&options); av_dict_free(&options);
return dev; return dev;
} }
@ -367,6 +368,8 @@ QVector<VideoMode> CameraDevice::getScreenModes()
QVector<VideoMode> CameraDevice::getVideoModes(QString devName) QVector<VideoMode> CameraDevice::getVideoModes(QString devName)
{ {
Q_UNUSED(devName);
if (!iformat); if (!iformat);
else if (isScreen(devName)) else if (isScreen(devName))
return getScreenModes(); return getScreenModes();
@ -385,7 +388,6 @@ QVector<VideoMode> CameraDevice::getVideoModes(QString devName)
else else
qWarning() << "Video mode listing not implemented for input "<<iformat->name; qWarning() << "Video mode listing not implemented for input "<<iformat->name;
(void)devName;
return {}; return {};
} }

View File

@ -137,8 +137,9 @@ CameraSource::~CameraSource()
if (device) if (device)
{ {
for(int i = 0; i < subscriptions; i++) for (int i = 0; i < subscriptions; i++)
device->close(); device->close();
device = nullptr; device = nullptr;
} }
@ -241,7 +242,7 @@ bool CameraSource::openDevice()
// Find the first video stream // Find the first video stream
for (unsigned i = 0; i < device->context->nb_streams; i++) 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; videoStreamIndex = i;
break; break;
@ -257,7 +258,7 @@ bool CameraSource::openDevice()
// Get a pointer to the codec context for the video stream // Get a pointer to the codec context for the video stream
cctxOrig = device->context->streams[videoStreamIndex]->codec; cctxOrig = device->context->streams[videoStreamIndex]->codec;
codec = avcodec_find_decoder(cctxOrig->codec_id); codec = avcodec_find_decoder(cctxOrig->codec_id);
if(!codec) if (!codec)
{ {
qWarning() << "Codec not found"; qWarning() << "Codec not found";
return false; return false;
@ -265,7 +266,7 @@ bool CameraSource::openDevice()
// Copy context, since we apparently aren't allowed to use the original // Copy context, since we apparently aren't allowed to use the original
cctx = avcodec_alloc_context3(codec); cctx = avcodec_alloc_context3(codec);
if(avcodec_copy_context(cctx, cctxOrig) != 0) if (avcodec_copy_context(cctx, cctxOrig) != 0)
{ {
qWarning() << "Can't copy context"; qWarning() << "Can't copy context";
return false; return false;
@ -274,7 +275,7 @@ bool CameraSource::openDevice()
cctx->refcounted_frames = 1; cctx->refcounted_frames = 1;
// Open codec // Open codec
if(avcodec_open2(cctx, codec, nullptr)<0) if (avcodec_open2(cctx, codec, nullptr)<0)
{ {
qWarning() << "Can't open codec"; qWarning() << "Can't open codec";
avcodec_free_context(&cctx); avcodec_free_context(&cctx);