Browse Source

docs(audio, video): Added leading stars

reviewable/pr3577/r8
Diadlo 9 years ago
parent
commit
672744de96
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
  1. 170
      src/audio/audio.cpp
  2. 140
      src/video/cameradevice.cpp
  3. 133
      src/video/camerasource.cpp
  4. 48
      src/video/corevideosource.cpp
  5. 28
      src/video/videomode.cpp
  6. 3
      src/video/videosource.h
  7. 18
      src/video/videosurface.cpp

170
src/audio/audio.cpp

@ -33,10 +33,10 @@ @@ -33,10 +33,10 @@
#include <cassert>
/**
@class Audio::Private
@brief Encapsulates private audio framework from public qTox Audio API.
*/
* @class Audio::Private
*
* @brief Encapsulates private audio framework from public qTox Audio API.
*/
class Audio::Private
{
public:
@ -86,29 +86,29 @@ private: @@ -86,29 +86,29 @@ private:
};
/**
@class Audio
@fn void Audio::frameAvailable(const int16_t *pcm, size_t sample_count, uint8_t channels, uint32_t sampling_rate);
When there are input subscribers, we regularly emit captured audio frames with this signal
Always connect with a blocking queued connection lambda, else the behaviour is undefined
@var Audio::AUDIO_SAMPLE_RATE
@brief The next best Opus would take is 24k
@var Audio::AUDIO_FRAME_DURATION
@brief In milliseconds
@var Audio::AUDIO_FRAME_SAMPLE_COUNT
@brief Frame sample count
@var Audio::AUDIO_CHANNELS
@brief Ideally, we'd auto-detect, but that's a sane default
*/
* @class Audio
*
* @fn void Audio::frameAvailable(const int16_t *pcm, size_t sample_count, uint8_t channels, uint32_t sampling_rate);
*
* When there are input subscribers, we regularly emit captured audio frames with this signal
* Always connect with a blocking queued connection lambda, else the behaviour is undefined
*
* @var Audio::AUDIO_SAMPLE_RATE
* @brief The next best Opus would take is 24k
*
* @var Audio::AUDIO_FRAME_DURATION
* @brief In milliseconds
*
* @var Audio::AUDIO_FRAME_SAMPLE_COUNT
* @brief Frame sample count
*
* @var Audio::AUDIO_CHANNELS
* @brief Ideally, we'd auto-detect, but that's a sane default
*/
/**
@brief Returns the singleton instance.
*/
* @brief Returns the singleton instance.
*/
Audio& Audio::getInstance()
{
static Audio instance;
@ -169,8 +169,8 @@ void Audio::checkAlcError(ALCdevice *device) noexcept @@ -169,8 +169,8 @@ void Audio::checkAlcError(ALCdevice *device) noexcept
}
/**
@brief Returns the current output volume (between 0 and 1)
*/
* @brief Returns the current output volume (between 0 and 1)
*/
qreal Audio::outputVolume() const
{
QMutexLocker locker(&audioLock);
@ -187,10 +187,10 @@ qreal Audio::outputVolume() const @@ -187,10 +187,10 @@ qreal Audio::outputVolume() const
}
/**
@brief Set the master output volume.
@param[in] volume the master volume (between 0 and 1)
*/
* @brief Set the master output volume.
*
* @param[in] volume the master volume (between 0 and 1)
*/
void Audio::setOutputVolume(qreal volume)
{
QMutexLocker locker(&audioLock);
@ -202,10 +202,10 @@ void Audio::setOutputVolume(qreal volume) @@ -202,10 +202,10 @@ void Audio::setOutputVolume(qreal volume)
}
/**
@brief The minimum gain value for an input device.
@return minimum gain value in dB
*/
* @brief The minimum gain value for an input device.
*
* @return minimum gain value in dB
*/
qreal Audio::minInputGain() const
{
QMutexLocker locker(&audioLock);
@ -213,10 +213,10 @@ qreal Audio::minInputGain() const @@ -213,10 +213,10 @@ qreal Audio::minInputGain() const
}
/**
@brief Set the minimum allowed gain value in dB.
@note Default is -30dB; usually you don't need to alter this value;
*/
* @brief Set the minimum allowed gain value in dB.
*
* @note Default is -30dB; usually you don't need to alter this value;
*/
void Audio::setMinInputGain(qreal dB)
{
QMutexLocker locker(&audioLock);
@ -224,10 +224,10 @@ void Audio::setMinInputGain(qreal dB) @@ -224,10 +224,10 @@ void Audio::setMinInputGain(qreal dB)
}
/**
@brief The maximum gain value for an input device.
@return maximum gain value in dB
*/
* @brief The maximum gain value for an input device.
*
* @return maximum gain value in dB
*/
qreal Audio::maxInputGain() const
{
QMutexLocker locker(&audioLock);
@ -235,10 +235,10 @@ qreal Audio::maxInputGain() const @@ -235,10 +235,10 @@ qreal Audio::maxInputGain() const
}
/**
@brief Set the maximum allowed gain value in dB.
@note Default is 30dB; usually you don't need to alter this value.
*/
* @brief Set the maximum allowed gain value in dB.
*
* @note Default is 30dB; usually you don't need to alter this value.
*/
void Audio::setMaxInputGain(qreal dB)
{
QMutexLocker locker(&audioLock);
@ -246,10 +246,10 @@ void Audio::setMaxInputGain(qreal dB) @@ -246,10 +246,10 @@ void Audio::setMaxInputGain(qreal dB)
}
/**
@brief The dB gain value.
@return the gain value in dB
*/
* @brief The dB gain value.
*
* @return the gain value in dB
*/
qreal Audio::inputGain() const
{
QMutexLocker locker(&audioLock);
@ -257,8 +257,8 @@ qreal Audio::inputGain() const @@ -257,8 +257,8 @@ qreal Audio::inputGain() const
}
/**
@brief Set the input gain dB level.
*/
* @brief Set the input gain dB level.
*/
void Audio::setInputGain(qreal dB)
{
QMutexLocker locker(&audioLock);
@ -280,10 +280,10 @@ bool Audio::reinitOutput(const QString& outDevDesc) @@ -280,10 +280,10 @@ bool Audio::reinitOutput(const QString& outDevDesc)
}
/**
@brief Subscribe to capture sound from the opened input device.
If the input device is not open, it will be opened before capturing.
*/
* @brief Subscribe to capture sound from the opened input device.
*
* If the input device is not open, it will be opened before capturing.
*/
void Audio::subscribeInput()
{
QMutexLocker locker(&audioLock);
@ -299,10 +299,10 @@ void Audio::subscribeInput() @@ -299,10 +299,10 @@ void Audio::subscribeInput()
}
/**
@brief Unsubscribe from capturing from an opened input device.
If the input device has no more subscriptions, it will be closed.
*/
* @brief Unsubscribe from capturing from an opened input device.
*
* If the input device has no more subscriptions, it will be closed.
*/
void Audio::unsubscribeInput()
{
QMutexLocker locker(&audioLock);
@ -318,20 +318,20 @@ void Audio::unsubscribeInput() @@ -318,20 +318,20 @@ void Audio::unsubscribeInput()
}
/**
@brief Initialize audio input device, if not initialized.
@return true, if device was initialized; false otherwise
*/
* @brief Initialize audio input device, if not initialized.
*
* @return true, if device was initialized; false otherwise
*/
bool Audio::autoInitInput()
{
return alInDev ? true : initInput(Settings::getInstance().getInDev());
}
/**
@brief Initialize audio output device, if not initialized.
@return true, if device was initialized; false otherwise
*/
* @brief Initialize audio output device, if not initialized.
*
* @return true, if device was initialized; false otherwise
*/
bool Audio::autoInitOutput()
{
return alOutDev ? true : initOutput(Settings::getInstance().getOutDev());
@ -373,8 +373,8 @@ bool Audio::initInput(const QString& deviceName) @@ -373,8 +373,8 @@ bool Audio::initInput(const QString& deviceName)
}
/**
@brief Open an audio output device
*/
* @brief Open an audio output device
*/
bool Audio::initOutput(const QString& deviceName)
{
outSources.clear();
@ -426,8 +426,8 @@ bool Audio::initOutput(const QString& deviceName) @@ -426,8 +426,8 @@ bool Audio::initOutput(const QString& deviceName)
}
/**
@brief Play a 44100Hz mono 16bit PCM sound from a file
*/
* @brief Play a 44100Hz mono 16bit PCM sound from a file
*/
void Audio::playMono16Sound(const QString& path)
{
QFile sndFile(path);
@ -436,8 +436,8 @@ void Audio::playMono16Sound(const QString& path) @@ -436,8 +436,8 @@ void Audio::playMono16Sound(const QString& path)
}
/**
@brief Play a 44100Hz mono 16bit PCM sound
*/
* @brief Play a 44100Hz mono 16bit PCM sound
*/
void Audio::playMono16Sound(const QByteArray& data)
{
QMutexLocker locker(&audioLock);
@ -505,8 +505,8 @@ void Audio::playAudioBuffer(ALuint alSource, const int16_t *data, int samples, u @@ -505,8 +505,8 @@ void Audio::playAudioBuffer(ALuint alSource, const int16_t *data, int samples, u
}
/**
@brief Close active audio input device.
*/
* @brief Close active audio input device.
*/
void Audio::cleanupInput()
{
if (!alInDev)
@ -521,8 +521,8 @@ void Audio::cleanupInput() @@ -521,8 +521,8 @@ void Audio::cleanupInput()
}
/**
@brief Close active audio output device
*/
* @brief Close active audio output device
*/
void Audio::cleanupOutput()
{
outputInitialized = false;
@ -554,8 +554,8 @@ void Audio::cleanupOutput() @@ -554,8 +554,8 @@ void Audio::cleanupOutput()
}
/**
@brief Called after a mono16 sound stopped playing
*/
* @brief Called after a mono16 sound stopped playing
*/
void Audio::playMono16SoundCleanup()
{
QMutexLocker locker(&audioLock);
@ -571,8 +571,8 @@ void Audio::playMono16SoundCleanup() @@ -571,8 +571,8 @@ void Audio::playMono16SoundCleanup()
}
/**
@brief Called on the captureTimer events to capture audio
*/
* @brief Called on the captureTimer events to capture audio
*/
void Audio::doCapture()
{
QMutexLocker lock(&audioLock);
@ -602,8 +602,8 @@ void Audio::doCapture() @@ -602,8 +602,8 @@ void Audio::doCapture()
}
/**
@brief Returns true if the output device is open
*/
* @brief Returns true if the output device is open
*/
bool Audio::isOutputReady() const
{
QMutexLocker locker(&audioLock);

140
src/video/cameradevice.cpp

@ -39,25 +39,25 @@ extern "C" { @@ -39,25 +39,25 @@ extern "C" {
#endif
/**
@class CameraDevice
Maintains an FFmpeg context for open camera devices,
takes care of sharing the context accross users and closing
the camera device when not in use. The device can be opened
recursively, and must then be closed recursively
*/
* @class CameraDevice
*
* Maintains an FFmpeg context for open camera devices,
* takes care of sharing the context accross users and closing
* the camera device when not in use. The device can be opened
* recursively, and must then be closed recursively
*/
/**
@var const QString CameraDevice::devName
@brief Short name of the device
@var AVFormatContext* CameraDevice::context
@brief Context of the open device, must always be valid
@var std::atomic_int CameraDevice::refcount;
@brief Number of times the device was opened
*/
* @var const QString CameraDevice::devName
* @brief Short name of the device
*
* @var AVFormatContext* CameraDevice::context
* @brief Context of the open device, must always be valid
*
* @var std::atomic_int CameraDevice::refcount;
* @brief Number of times the device was opened
*/
QHash<QString, CameraDevice*> CameraDevice::openDevices;
@ -126,17 +126,17 @@ out: @@ -126,17 +126,17 @@ out:
}
/**
@brief Opens a device.
Opens a device, creating a new one if needed
If the device is alreay open in another mode, the mode
will be ignored and the existing device is used
If the mode does not exist, a new device can't be opened.
@param devName Device name to open.
@param mode Mode of device to open.
@return CameraDevice if the device could be opened, nullptr otherwise.
*/
* @brief Opens a device.
*
* Opens a device, creating a new one if needed
* If the device is alreay open in another mode, the mode
* will be ignored and the existing device is used
* If the mode does not exist, a new device can't be opened.
*
* @param devName Device name to open.
* @param mode Mode of device to open.
* @return CameraDevice if the device could be opened, nullptr otherwise.
*/
CameraDevice* CameraDevice::open(QString devName, VideoMode mode)
{
if (!getDefaultInputFormat())
@ -240,19 +240,19 @@ CameraDevice* CameraDevice::open(QString devName, VideoMode mode) @@ -240,19 +240,19 @@ CameraDevice* CameraDevice::open(QString devName, VideoMode mode)
}
/**
@brief Opens the device again. Never fails
*/
* @brief Opens the device again. Never fails
*/
void CameraDevice::open()
{
++refcount;
}
/**
@brief Closes the device. Never fails.
@note If returns true, "this" becomes invalid.
@return True, if device finally deleted (closed last reference),
false otherwise (if other references exist).
*/
* @brief Closes the device. Never fails.
* @note If returns true, "this" becomes invalid.
* @return True, if device finally deleted (closed last reference),
* false otherwise (if other references exist).
*/
bool CameraDevice::close()
{
if (--refcount > 0)
@ -267,10 +267,10 @@ bool CameraDevice::close() @@ -267,10 +267,10 @@ bool CameraDevice::close()
}
/**
@brief Get raw device list
@note Uses avdevice_list_devices
@return Raw device list
*/
* @brief Get raw device list
* @note Uses avdevice_list_devices
* @return Raw device list
*/
QVector<QPair<QString, QString>> CameraDevice::getRawDeviceListGeneric()
{
QVector<QPair<QString, QString>> devices;
@ -341,10 +341,10 @@ QVector<QPair<QString, QString>> CameraDevice::getRawDeviceListGeneric() @@ -341,10 +341,10 @@ QVector<QPair<QString, QString>> CameraDevice::getRawDeviceListGeneric()
}
/**
@brief Get device list with desciption
@return A list of device names and descriptions.
The names are the first part of the pair and can be passed to open(QString).
*/
* @brief Get device list with desciption
* @return A list of device names and descriptions.
* The names are the first part of the pair and can be passed to open(QString).
*/
QVector<QPair<QString, QString>> CameraDevice::getDeviceList()
{
QVector<QPair<QString, QString>> devices;
@ -392,10 +392,10 @@ QVector<QPair<QString, QString>> CameraDevice::getDeviceList() @@ -392,10 +392,10 @@ QVector<QPair<QString, QString>> CameraDevice::getDeviceList()
}
/**
@brief Get the default device name.
@return The short name of the default device
This is either the device in the settings or the system default.
*/
* @brief Get the default device name.
* @return The short name of the default device
* This is either the device in the settings or the system default.
*/
QString CameraDevice::getDefaultDeviceName()
{
QString defaultdev = Settings::getInstance().getVideoDev();
@ -415,19 +415,19 @@ QString CameraDevice::getDefaultDeviceName() @@ -415,19 +415,19 @@ QString CameraDevice::getDefaultDeviceName()
}
/**
@brief Checks if a device name specifies a display.
@param devName Device name to check.
@return True, if device is screen, false otherwise.
*/
* @brief Checks if a device name specifies a display.
* @param devName Device name to check.
* @return True, if device is screen, false otherwise.
*/
bool CameraDevice::isScreen(const QString &devName)
{
return devName.startsWith("x11grab") || devName.startsWith("gdigrab");
}
/**
@brief Get list of resolutions and position of screens
@return Vector of avaliable screen modes with offset
*/
* @brief Get list of resolutions and position of screens
* @return Vector of avaliable screen modes with offset
*/
QVector<VideoMode> CameraDevice::getScreenModes()
{
QList<QScreen*> screens = QApplication::screens();
@ -452,10 +452,10 @@ QVector<VideoMode> CameraDevice::getScreenModes() @@ -452,10 +452,10 @@ QVector<VideoMode> CameraDevice::getScreenModes()
}
/**
@brief Get the list of video modes for a device.
@param devName Device name to get nodes from.
@return Vector of available modes for the device.
*/
* @brief Get the list of video modes for a device.
* @param devName Device name to get nodes from.
* @return Vector of available modes for the device.
*/
QVector<VideoMode> CameraDevice::getVideoModes(QString devName)
{
Q_UNUSED(devName);
@ -482,10 +482,10 @@ QVector<VideoMode> CameraDevice::getVideoModes(QString devName) @@ -482,10 +482,10 @@ QVector<VideoMode> CameraDevice::getVideoModes(QString devName)
}
/**
@brief Get the name of the pixel format of a video mode.
@param pixel_format Pixel format to get the name from.
@return Name of the pixel format.
*/
* @brief Get the name of the pixel format of a video mode.
* @param pixel_format Pixel format to get the name from.
* @return Name of the pixel format.
*/
QString CameraDevice::getPixelFormatString(uint32_t pixel_format)
{
#ifdef Q_OS_LINUX
@ -496,12 +496,12 @@ QString CameraDevice::getPixelFormatString(uint32_t pixel_format) @@ -496,12 +496,12 @@ QString CameraDevice::getPixelFormatString(uint32_t pixel_format)
}
/**
@brief Compare two pixel formats.
@param a First pixel format to compare.
@param b Second pixel format to compare.
@return True if we prefer format a to b,
false otherwise (such as if there's no preference).
*/
* @brief Compare two pixel formats.
* @param a First pixel format to compare.
* @param b Second pixel format to compare.
* @return True if we prefer format a to b,
* false otherwise (such as if there's no preference).
*/
bool CameraDevice::betterPixelFormat(uint32_t a, uint32_t b)
{
#ifdef Q_OS_LINUX
@ -512,9 +512,9 @@ bool CameraDevice::betterPixelFormat(uint32_t a, uint32_t b) @@ -512,9 +512,9 @@ bool CameraDevice::betterPixelFormat(uint32_t a, uint32_t b)
}
/**
@brief Sets CameraDevice::iformat to default.
@return True if success, false if failure.
*/
* @brief Sets CameraDevice::iformat to default.
* @return True if success, false if failure.
*/
bool CameraDevice::getDefaultInputFormat()
{
QMutexLocker locker(&iformatLock);

133
src/video/camerasource.cpp

@ -35,52 +35,55 @@ extern "C" { @@ -35,52 +35,55 @@ extern "C" {
#include "videoframe.h"
/**
@class CameraSource
@brief This class is a wrapper to share a camera's captured video frames
It allows objects to suscribe and unsuscribe to the stream, starting
the camera and streaming new video frames only when needed.
This is a singleton, since we can only capture from one
camera at the same time without thread-safety issues.
The source is lazy in the sense that it will only keep the video
device open as long as there are subscribers, the source can be
open but the device closed if there are zero subscribers.
*/
* @class CameraSource
* @brief This class is a wrapper to share a camera's captured video frames
*
* It allows objects to suscribe and unsuscribe to the stream, starting
* the camera and streaming new video frames only when needed.
* This is a singleton, since we can only capture from one
* camera at the same time without thread-safety issues.
* The source is lazy in the sense that it will only keep the video
* device open as long as there are subscribers, the source can be
* open but the device closed if there are zero subscribers.
*/
/**
@var QVector<std::weak_ptr<VideoFrame>> CameraSource::freelist
@brief Frames that need freeing before we can safely close the device
@var QFuture<void> CameraSource::streamFuture
@brief Future of the streaming thread
@var QString CameraSource::deviceName
@brief Short name of the device for CameraDevice's open(QString)
@var CameraDevice* CameraSource::device
@brief Non-owning pointer to an open CameraDevice, or nullptr. Not atomic, synced with memfences when becomes null.
@var VideoMode CameraSource::mode
@brief What mode we tried to open the device in, all zeros means default mode
@var AVCodecContext* CameraSource::cctx
@brief Codec context of the camera's selected video stream
@var AVCodecContext* CameraSource::cctxOrig
@brief Codec context of the camera's selected video stream
@var int CameraSource::videoStreamIndex
@brief A camera can have multiple streams, this is the one we're decoding
@var QMutex CameraSource::biglock
@brief True when locked. Faster than mutexes for video decoding.
@var std::atomic_bool CameraSource::streamBlocker
@brief Holds the streaming thread still when true
@var std::atomic_int CameraSource::subscriptions
@brief Remember how many times we subscribed for RAII
*/
* @var QVector<std::weak_ptr<VideoFrame>> CameraSource::freelist
* @brief Frames that need freeing before we can safely close the device
*
* @var QFuture<void> CameraSource::streamFuture
* @brief Future of the streaming thread
*
* @var QString CameraSource::deviceName
* @brief Short name of the device for CameraDevice's open(QString)
*
* @var CameraDevice* CameraSource::device
* @brief Non-owning pointer to an open CameraDevice, or nullptr. Not atomic, synced with memfences when becomes null.
*
* @var VideoMode CameraSource::mode
* @brief What mode we tried to open the device in, all zeros means default mode
*
* @var AVCodecContext* CameraSource::cctx
* @brief Codec context of the camera's selected video stream
*
* @var AVCodecContext* CameraSource::cctxOrig
* @brief Codec context of the camera's selected video stream
*
* @var int CameraSource::videoStreamIndex
* @brief A camera can have multiple streams, this is the one we're decoding
*
* @var QMutex CameraSource::biglock
* @brief True when locked. Faster than mutexes for video decoding.
*
* @var QMutex CameraSource::freelistLock
* @brief True when locked. Faster than mutexes for video decoding.
*
* @var std::atomic_bool CameraSource::streamBlocker
* @brief Holds the streaming thread still when true
*
* @var std::atomic_int CameraSource::subscriptions
* @brief Remember how many times we subscribed for RAII
*/
CameraSource* CameraSource::instance{nullptr};
@ -95,8 +98,8 @@ CameraSource::CameraSource() @@ -95,8 +98,8 @@ CameraSource::CameraSource()
}
/**
@brief Returns the singleton instance.
*/
* @brief Returns the singleton instance.
*/
CameraSource& CameraSource::getInstance()
{
if (!instance)
@ -114,11 +117,11 @@ void CameraSource::destroyInstance() @@ -114,11 +117,11 @@ void CameraSource::destroyInstance()
}
/**
@brief Opens the source for the camera device.
@note If a device is already open, the source will seamlessly switch to the new device.
Opens the source for the camera device in argument, in the settings, or the system default.
*/
* @brief Opens the source for the camera device.
* @note If a device is already open, the source will seamlessly switch to the new device.
*
* Opens the source for the camera device in argument, in the settings, or the system default.
*/
void CameraSource::open()
{
open(CameraDevice::getDefaultDeviceName());
@ -158,10 +161,10 @@ void CameraSource::open(const QString& DeviceName, VideoMode Mode) @@ -158,10 +161,10 @@ void CameraSource::open(const QString& DeviceName, VideoMode Mode)
}
/**
@brief Stops streaming.
Equivalent to opening the source with the video device "none".
*/
* @brief Stops streaming.
*
* Equivalent to opening the source with the video device "none".
*/
void CameraSource::close()
{
open("none");
@ -257,10 +260,10 @@ void CameraSource::unsubscribe() @@ -257,10 +260,10 @@ void CameraSource::unsubscribe()
}
/**
@brief Opens the video device and starts streaming.
@note Callers must own the biglock.
@return True if success, false otherwise.
*/
* @brief Opens the video device and starts streaming.
* @note Callers must own the biglock.
* @return True if success, false otherwise.
*/
bool CameraSource::openDevice()
{
qDebug() << "Opening device " << deviceName;
@ -344,9 +347,9 @@ bool CameraSource::openDevice() @@ -344,9 +347,9 @@ bool CameraSource::openDevice()
}
/**
@brief Closes the video device and stops streaming.
@note Callers must own the biglock.
*/
* @brief Closes the video device and stops streaming.
* @note Callers must own the biglock.
*/
void CameraSource::closeDevice()
{
qDebug() << "Closing device " << deviceName;
@ -364,9 +367,9 @@ void CameraSource::closeDevice() @@ -364,9 +367,9 @@ void CameraSource::closeDevice()
}
/**
@brief Blocking. Decodes video stream and emits new frames.
@note Designed to run in its own thread.
*/
* @brief Blocking. Decodes video stream and emits new frames.
* @note Designed to run in its own thread.
*/
void CameraSource::stream()
{
auto streamLoop = [=]()

48
src/video/corevideosource.cpp

@ -26,23 +26,23 @@ extern "C" { @@ -26,23 +26,23 @@ extern "C" {
#include "videoframe.h"
/**
@class CoreVideoSource
@brief A VideoSource that emits frames received by Core.
*/
* @class CoreVideoSource
* @brief A VideoSource that emits frames received by Core.
*/
/**
@var std::atomic_int subscribers
@brief Number of suscribers
@var std::atomic_bool deleteOnClose
@brief If true, self-delete after the last suscriber is gone
*/
* @var std::atomic_int subscribers
* @brief Number of suscribers
*
* @var std::atomic_bool deleteOnClose
* @brief If true, self-delete after the last suscriber is gone
*/
/**
@brief CoreVideoSource constructor.
@note Only CoreAV should create a CoreVideoSource since
only CoreAV can push images to it.
*/
* @brief CoreVideoSource constructor.
* @note Only CoreAV should create a CoreVideoSource since
* only CoreAV can push images to it.
*/
CoreVideoSource::CoreVideoSource()
: subscribers{0}, deleteOnClose{false},
stopped{false}
@ -50,9 +50,9 @@ CoreVideoSource::CoreVideoSource() @@ -50,9 +50,9 @@ CoreVideoSource::CoreVideoSource()
}
/**
@brief Makes a copy of the vpx_image_t and emits it as a new VideoFrame.
@param vpxframe Frame to copy.
*/
* @brief Makes a copy of the vpx_image_t and emits it as a new VideoFrame.
* @param vpxframe Frame to copy.
*/
void CoreVideoSource::pushFrame(const vpx_image_t* vpxframe)
{
if (stopped)
@ -127,9 +127,9 @@ void CoreVideoSource::unsubscribe() @@ -127,9 +127,9 @@ void CoreVideoSource::unsubscribe()
}
/**
@brief Setup delete on close
@param If true, self-delete after the last suscriber is gone
*/
* @brief Setup delete on close
* @param If true, self-delete after the last suscriber is gone
*/
void CoreVideoSource::setDeleteOnClose(bool newstate)
{
QMutexLocker locker(&biglock);
@ -137,11 +137,11 @@ void CoreVideoSource::setDeleteOnClose(bool newstate) @@ -137,11 +137,11 @@ void CoreVideoSource::setDeleteOnClose(bool newstate)
}
/**
@brief Stopping the source.
@see The callers in CoreAV for the rationale
Stopping the source will block any pushFrame calls from doing anything
*/
* @brief Stopping the source.
* @see The callers in CoreAV for the rationale
*
* Stopping the source will block any pushFrame calls from doing anything
*/
void CoreVideoSource::stopSource()
{
QMutexLocker locker(&biglock);

28
src/video/videomode.cpp

@ -20,18 +20,18 @@ @@ -20,18 +20,18 @@
#include "videomode.h"
/**
@struct VideoMode
@brief Describes a video mode supported by a device.
@var unsigned short VideoMode::width, VideoMode::height
@brief Displayed video resolution (NOT frame resolution).
@var unsigned short VideoMode::x, VideoMode::y
@brief Coordinates of upper-left corner.
@var float VideoMode::FPS
@brief Frames per second supported by the device at this resolution
*/
* @struct VideoMode
* @brief Describes a video mode supported by a device.
*
* @var unsigned short VideoMode::width, VideoMode::height
* @brief Displayed video resolution (NOT frame resolution).
*
* @var unsigned short VideoMode::x, VideoMode::y
* @brief Coordinates of upper-left corner.
*
* @var float VideoMode::FPS
* @brief Frames per second supported by the device at this resolution
*/
VideoMode::VideoMode(int width, int height, int x, int y, int FPS, int format) :
width(width), height(height), x(x), y(y),
@ -67,8 +67,8 @@ uint32_t VideoMode::norm(const VideoMode &other) const @@ -67,8 +67,8 @@ uint32_t VideoMode::norm(const VideoMode &other) const
}
/**
@brief All zeros means a default/unspecified mode
*/
* @brief All zeros means a default/unspecified mode
*/
VideoMode::operator bool() const
{
return width || height || FPS;

3
src/video/videosource.h

@ -27,7 +27,6 @@ @@ -27,7 +27,6 @@
class VideoFrame;
class VideoSource : public QObject
{
Q_OBJECT
@ -64,7 +63,7 @@ signals: @@ -64,7 +63,7 @@ signals:
*/
void sourceStopped();
private:
/// Used to manage a global ID for all VideoSources
// Used to manage a global ID for all VideoSources
static AtomicIDType sourceIDs;
};

18
src/video/videosurface.cpp

@ -31,9 +31,9 @@ @@ -31,9 +31,9 @@
#include <QDebug>
/**
@var std::atomic_bool VideoSurface::frameLock
@brief Fast lock for lastFrame.
*/
* @var std::atomic_bool VideoSurface::frameLock
* @brief Fast lock for lastFrame.
*/
float getSizeRatio(const QSize size)
{
@ -69,12 +69,12 @@ bool VideoSurface::isExpanding() const @@ -69,12 +69,12 @@ bool VideoSurface::isExpanding() const
}
/**
@brief Update source.
@note nullptr is a valid option.
@param src source to set.
Unsubscribe from old source and subscribe to new.
*/
* @brief Update source.
* @note nullptr is a valid option.
* @param src source to set.
*
* Unsubscribe from old source and subscribe to new.
*/
void VideoSurface::setSource(VideoSource *src)
{
if (source == src)

Loading…
Cancel
Save