1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
qTox/src/core/coreav.h
tux3 2ab55568f2
Make the video code a singleton, fix multithreading bugs
There can now only be one CameraSource running.

Video frames are decoded in their own thread, and then converted by users in the user's threads.
The CameraSource API is entirely thread-safe and controls the video decoding thread.

The video device only stays open as long as there are users subscribed to the CameraSource.

We use a dangerous combination of spinlocks and memory fences to keep things synchronized.
2015-06-26 18:34:48 +02:00

65 lines
1.5 KiB
C++

/*
Copyright (C) 2013 by Maxim Biro <nurupo.contributions@gmail.com>
Copyright © 2014-2015 by The qTox Project
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COREAV_H
#define COREAV_H
#include <QHash>
#include <tox/toxav.h>
#if defined(__APPLE__) && defined(__MACH__)
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#else
#include <AL/al.h>
#include <AL/alc.h>
#endif
class QTimer;
class CoreVideoSource;
class CameraSource;
struct ToxCall
{
ToxAvCSettings codecSettings;
QTimer *sendAudioTimer;
int32_t callId;
uint32_t friendId;
bool videoEnabled;
bool active;
bool muteMic;
bool muteVol;
ALuint alSource;
CoreVideoSource* videoSource;
};
struct ToxGroupCall
{
ToxAvCSettings codecSettings;
QTimer *sendAudioTimer;
int groupId;
bool active = false;
bool muteMic;
bool muteVol;
QHash<int, ALuint> alSources;
};
#endif // COREAV_H