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:
parent
76f694fe73
commit
2258748d28
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -194,13 +194,14 @@ CameraDevice* CameraDevice::open(QString devName, VideoMode mode)
|
|||
#endif
|
||||
else if (mode)
|
||||
{
|
||||
qWarning() << "Video mode-setting not implemented for input "<<iformat->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<VideoMode> CameraDevice::getScreenModes()
|
|||
|
||||
QVector<VideoMode> CameraDevice::getVideoModes(QString devName)
|
||||
{
|
||||
Q_UNUSED(devName);
|
||||
|
||||
if (!iformat);
|
||||
else if (isScreen(devName))
|
||||
return getScreenModes();
|
||||
|
@ -385,7 +388,6 @@ QVector<VideoMode> CameraDevice::getVideoModes(QString devName)
|
|||
else
|
||||
qWarning() << "Video mode listing not implemented for input "<<iformat->name;
|
||||
|
||||
(void)devName;
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user