qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
CoreVideoSource Class Reference

A VideoSource that emits frames received by Core. More...

#include <corevideosource.h>

Inheritance diagram for CoreVideoSource:
Inheritance graph
Collaboration diagram for CoreVideoSource:
Collaboration graph

Public Member Functions

void subscribe () override
 If subscribe sucessfully opens the source, it will start emitting frameAvailable signals. More...
 
void unsubscribe () override
 Stop emitting frameAvailable signals, and free associated resources if necessary. More...
 
- Public Member Functions inherited from VideoSource
 VideoSource ()
 
virtual ~VideoSource ()=default
 

Private Member Functions

 CoreVideoSource ()
 CoreVideoSource constructor. More...
 
void pushFrame (const vpx_image_t *frame)
 Makes a copy of the vpx_image_t and emits it as a new VideoFrame. More...
 
void setDeleteOnClose (bool newstate)
 Setup delete on close. More...
 
void stopSource ()
 Stopping the source. More...
 
void restartSource ()
 

Private Attributes

std::atomic_int subscribers
 
std::atomic_bool deleteOnClose
 
QMutex biglock
 
std::atomic_bool stopped
 

Friends

class CoreAV
 
class ToxFriendCall
 

Additional Inherited Members

- Public Types inherited from VideoSource
using IDType = std::uint_fast64_t
 
using AtomicIDType = std::atomic_uint_fast64_t
 
- Signals inherited from VideoSource
void frameAvailable (std::shared_ptr< VideoFrame > frame)
 Emitted when new frame available to use. More...
 
void sourceStopped ()
 Emitted when the source is stopped for an indefinite amount of time, but might restart sending frames again later. More...
 
- Public Attributes inherited from VideoSource
const IDType id
 ID of this VideoSource. More...
 

Detailed Description

A VideoSource that emits frames received by Core.

Definition at line 28 of file corevideosource.h.

Constructor & Destructor Documentation

◆ CoreVideoSource()

CoreVideoSource::CoreVideoSource ( )
private

CoreVideoSource constructor.

Note
Only CoreAV should create a CoreVideoSource since only CoreAV can push images to it.

Definition at line 49 of file corevideosource.cpp.

Member Function Documentation

◆ pushFrame()

void CoreVideoSource::pushFrame ( const vpx_image_t *  vpxframe)
private

Makes a copy of the vpx_image_t and emits it as a new VideoFrame.

Parameters
vpxframeFrame to copy.

Definition at line 60 of file corevideosource.cpp.

Here is the caller graph for this function:

◆ restartSource()

void CoreVideoSource::restartSource ( )
private

Definition at line 151 of file corevideosource.cpp.

◆ setDeleteOnClose()

void CoreVideoSource::setDeleteOnClose ( bool  newstate)
private

Setup delete on close.

Parameters
Iftrue, self-delete after the last suscriber is gone

Definition at line 132 of file corevideosource.cpp.

◆ stopSource()

void CoreVideoSource::stopSource ( )
private

Stopping the source.

See also
The callers in CoreAV for the rationale

Stopping the source will block any pushFrame calls from doing anything

Definition at line 144 of file corevideosource.cpp.

◆ subscribe()

void CoreVideoSource::subscribe ( )
overridevirtual

If subscribe sucessfully opens the source, it will start emitting frameAvailable signals.

Implements VideoSource.

Definition at line 108 of file corevideosource.cpp.

◆ unsubscribe()

void CoreVideoSource::unsubscribe ( )
overridevirtual

Stop emitting frameAvailable signals, and free associated resources if necessary.

Implements VideoSource.

Definition at line 114 of file corevideosource.cpp.

Friends And Related Function Documentation

◆ CoreAV

friend class CoreAV
friend

Definition at line 51 of file corevideosource.h.

◆ ToxFriendCall

friend class ToxFriendCall
friend

Definition at line 52 of file corevideosource.h.

Member Data Documentation

◆ biglock

QMutex CoreVideoSource::biglock
private

Definition at line 48 of file corevideosource.h.

◆ deleteOnClose

std::atomic_bool CoreVideoSource::deleteOnClose
private

Definition at line 47 of file corevideosource.h.

◆ stopped

std::atomic_bool CoreVideoSource::stopped
private

Definition at line 49 of file corevideosource.h.

◆ subscribers

std::atomic_int CoreVideoSource::subscribers
private

Definition at line 46 of file corevideosource.h.


The documentation for this class was generated from the following files: