mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Clean & remove old code and dependencies
We don't use QtMultimedia and OpenCV_imgproc anymore Fixes #218
This commit is contained in:
parent
35731e1f53
commit
f97729261a
2
core.cpp
2
core.cpp
|
@ -78,6 +78,8 @@ Core::Core(Camera* cam, QThread *coreThread) :
|
|||
qWarning() << "Core: Cannot create output audio context";
|
||||
alcCloseDevice(alOutDev);
|
||||
}
|
||||
else
|
||||
alGenSources(1, &alMainSource);
|
||||
}
|
||||
alInDev = alcCaptureOpenDevice(NULL,av_DefaultSettings.audio_sample_rate, AL_FORMAT_MONO16,
|
||||
(av_DefaultSettings.audio_frame_duration * av_DefaultSettings.audio_sample_rate * 4) / 1000);
|
||||
|
|
6
core.h
6
core.h
|
@ -31,10 +31,6 @@
|
|||
#include <QFile>
|
||||
#include <QList>
|
||||
#include <QByteArray>
|
||||
#include <QFuture>
|
||||
#include <QBuffer>
|
||||
#include <QAudioOutput>
|
||||
#include <QAudioInput>
|
||||
|
||||
#define TOXAV_MAX_CALLS 16
|
||||
#define GROUPCHAT_MAX_SIZE 32
|
||||
|
@ -304,6 +300,8 @@ private:
|
|||
|
||||
static ALCdevice* alOutDev, *alInDev;
|
||||
static ALCcontext* alContext;
|
||||
public:
|
||||
static ALuint alMainSource;
|
||||
};
|
||||
|
||||
#endif // CORE_HPP
|
||||
|
|
|
@ -8,6 +8,7 @@ int Core::videoBusyness;
|
|||
|
||||
ALCdevice* Core::alOutDev, *Core::alInDev;
|
||||
ALCcontext* Core::alContext;
|
||||
ALuint Core::alMainSource;
|
||||
|
||||
void Core::prepareCall(int friendId, int callId, ToxAv* toxav, bool videoEnabled)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "friend.h"
|
||||
#include "friendlist.h"
|
||||
#include <QMenu>
|
||||
#include <QDebug>
|
||||
|
||||
QList<Friend*> FriendList::friendList;
|
||||
|
||||
|
|
8
qtox.pro
8
qtox.pro
|
@ -20,7 +20,7 @@
|
|||
# See the COPYING file for more details.
|
||||
|
||||
|
||||
QT += core gui network multimedia multimediawidgets xml
|
||||
QT += core gui network xml
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = qtox
|
||||
|
@ -43,9 +43,9 @@ INCLUDEPATH += libs/include
|
|||
win32 {
|
||||
LIBS += $$PWD/libs/lib/libtoxav.a $$PWD/libs/lib/libopus.a $$PWD/libs/lib/libvpx.a $$PWD/libs/lib/libopenal32.a $$PWD/libs/lib/libtoxcore.a -lws2_32 $$PWD/libs/lib/libsodium.a -lpthread -liphlpapi
|
||||
} macx {
|
||||
LIBS += -L$$PWD/libs/lib/ -ltoxcore -ltoxav -lsodium -lvpx -framework OpenAL -lopencv_core -lopencv_highgui -lopencv_imgproc
|
||||
LIBS += -L$$PWD/libs/lib/ -ltoxcore -ltoxav -lsodium -lvpx -framework OpenAL -lopencv_core -lopencv_highgui
|
||||
} else {
|
||||
LIBS += -L$$PWD/libs/lib/ -ltoxcore -ltoxav -lsodium -lvpx -lopenal -lopencv_core -lopencv_highgui -lopencv_imgproc
|
||||
LIBS += -L$$PWD/libs/lib/ -ltoxcore -ltoxav -lsodium -lvpx -lopenal -lopencv_core -lopencv_highgui
|
||||
}
|
||||
|
||||
#### Static linux build
|
||||
|
@ -82,7 +82,6 @@ HEADERS += widget/form/addfriendform.h \
|
|||
cdata.h \
|
||||
cstring.h \
|
||||
widget/selfcamview.h \
|
||||
widget/videosurface.h \
|
||||
widget/camera.h \
|
||||
widget/netcamview.h \
|
||||
widget/tool/clickablelabel.h \
|
||||
|
@ -119,7 +118,6 @@ SOURCES += \
|
|||
cdata.cpp \
|
||||
cstring.cpp \
|
||||
widget/selfcamview.cpp \
|
||||
widget/videosurface.cpp \
|
||||
widget/camera.cpp \
|
||||
widget/netcamview.cpp \
|
||||
widget/tool/clickablelabel.cpp \
|
||||
|
|
|
@ -15,10 +15,7 @@
|
|||
*/
|
||||
|
||||
#include "camera.h"
|
||||
#include <QVideoSurfaceFormat>
|
||||
#include <QMessageBox>
|
||||
#include <QVideoEncoderSettings>
|
||||
#include <QVideoEncoderSettingsControl>
|
||||
|
||||
using namespace cv;
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
See the COPYING file for more details.
|
||||
*/
|
||||
#include "friendlistwidget.h"
|
||||
#include <QDebug>
|
||||
|
||||
FriendListWidget::FriendListWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
|
|
|
@ -15,13 +15,9 @@
|
|||
*/
|
||||
|
||||
#include "selfcamview.h"
|
||||
#include <QActionGroup>
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QShowEvent>
|
||||
#include <QVideoFrame>
|
||||
|
||||
#include "videosurface.h"
|
||||
#include "widget.h"
|
||||
|
||||
using namespace cv;
|
||||
|
|
|
@ -1,103 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2014 by Project Tox <https://tox.im>
|
||||
|
||||
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||
|
||||
This program 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.
|
||||
This program 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 COPYING file for more details.
|
||||
*/
|
||||
|
||||
#include "videosurface.h"
|
||||
#include "core.h"
|
||||
#include <QVideoFrame>
|
||||
#include <QDebug>
|
||||
|
||||
VideoSurface::VideoSurface()
|
||||
: QAbstractVideoSurface()
|
||||
{
|
||||
vpx_img_alloc(&input, VPX_IMG_FMT_YV12, TOXAV_MAX_VIDEO_WIDTH, TOXAV_MAX_VIDEO_HEIGHT, 1);
|
||||
}
|
||||
|
||||
bool VideoSurface::start(const QVideoSurfaceFormat &format)
|
||||
{
|
||||
mVideoFormat = format;
|
||||
//start only if format is UYVY, dont handle other format now
|
||||
if( format.pixelFormat() == QVideoFrame::Format_YV12 ){
|
||||
QAbstractVideoSurface::start(format);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool VideoSurface::present(const QVideoFrame&)
|
||||
{
|
||||
/*
|
||||
mFrame = frame;
|
||||
|
||||
qDebug() << QString("Video: Frame format is %1").arg(mFrame.pixelFormat());
|
||||
|
||||
stop();
|
||||
|
||||
//this is necessary to get valid data from frame
|
||||
mFrame.map(QAbstractVideoBuffer::ReadOnly);
|
||||
|
||||
uchar* data = new uchar[frame.mappedBytes()];
|
||||
memcpy(data, frame.bits(), frame.mappedBytes());
|
||||
|
||||
input.planes[VPX_PLANE_Y] = data;
|
||||
input.planes[VPX_PLANE_U] = data + (frame.bytesPerLine() * frame.height());
|
||||
input.planes[VPX_PLANE_V] = input.planes[VPX_PLANE_U] + (frame.bytesPerLine()/2 * frame.height()/2);
|
||||
input.planes[VPX_PLANE_ALPHA] = nullptr;
|
||||
|
||||
//qDebug() << QString("Got %1 bytes, first plane is %2 bytes long")
|
||||
// .arg(frame.mappedBytes()).arg(frame.bytesPerLine() * frame.height());
|
||||
|
||||
// Slots MUST be called with a direct or blocking connection, or input may die before they return !
|
||||
emit videoFrameReady(input);
|
||||
|
||||
|
||||
QImage lastImage( mFrame.size(), QImage::Format_RGB16);
|
||||
const uchar *src = mFrame.bits();
|
||||
uchar *dst = lastImage.bits();
|
||||
const int srcLineStep = mFrame.bytesPerLine();
|
||||
const int dstLineStep = lastImage.bytesPerLine();
|
||||
const int h = mFrame.height();
|
||||
const int w = mFrame.width();
|
||||
|
||||
for (int y=0; y < h; y++) {
|
||||
//this function you can find in qgraphicsvideoitem_maemo5.cpp,
|
||||
//link is mentioned above
|
||||
uyvy422_to_rgb16_line_neon(dst, src, w);
|
||||
src += srcLineStep;
|
||||
dst += dstLineStep;
|
||||
}
|
||||
|
||||
mLastFrame = QPixmap::fromImage(lastImage);
|
||||
//emit signal, other can handle it and do necessary processing
|
||||
emit frameUpdated(mLastFrame);
|
||||
|
||||
delete[] data;
|
||||
mFrame.unmap();
|
||||
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<QVideoFrame::PixelFormat> VideoSurface::supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const
|
||||
{
|
||||
if (handleType == QAbstractVideoBuffer::NoHandle) {
|
||||
qDebug() << "Video: No handle";
|
||||
return QList<QVideoFrame::PixelFormat>() << QVideoFrame::Format_YV12;
|
||||
} else {
|
||||
qDebug() << "Video: Handle type is not NoHandle";
|
||||
return QList<QVideoFrame::PixelFormat>();
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2014 by Project Tox <https://tox.im>
|
||||
|
||||
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||
|
||||
This program 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.
|
||||
This program 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 COPYING file for more details.
|
||||
*/
|
||||
|
||||
#ifndef VIDEOSURFACE_H
|
||||
#define VIDEOSURFACE_H
|
||||
|
||||
#include <QAbstractVideoSurface>
|
||||
#include <QVideoSurfaceFormat>
|
||||
#include "vpx/vpx_image.h"
|
||||
|
||||
class VideoSurface : public QAbstractVideoSurface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VideoSurface();
|
||||
bool start(const QVideoSurfaceFormat &format);
|
||||
bool present(const QVideoFrame &frame);
|
||||
QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const;
|
||||
|
||||
signals:
|
||||
// Slots MUST be called with a direct or blocking connection, or img may die before they return !
|
||||
void videoFrameReady(vpx_image img);
|
||||
|
||||
private:
|
||||
QVideoSurfaceFormat mVideoFormat;
|
||||
vpx_image_t input;
|
||||
};
|
||||
|
||||
#endif // VIDEOSURFACE_H
|
|
@ -28,7 +28,6 @@
|
|||
#include "style.h"
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
#include <QSound>
|
||||
#include <QTextStream>
|
||||
#include <QFile>
|
||||
#include <QString>
|
||||
|
@ -569,7 +568,21 @@ void Widget::updateFriendStatusLights(int friendId)
|
|||
void Widget::newMessageAlert()
|
||||
{
|
||||
QApplication::alert(this);
|
||||
QSound::play(":audio/notification.wav");
|
||||
|
||||
static QFile sndFile(":audio/notification.wav");
|
||||
static QByteArray sndData;
|
||||
if (sndData.isEmpty())
|
||||
{
|
||||
sndFile.open(QIODevice::ReadOnly);
|
||||
sndData = sndFile.readAll();
|
||||
sndFile.close();
|
||||
}
|
||||
|
||||
ALuint buffer;
|
||||
alGenBuffers(1, &buffer);
|
||||
alBufferData(buffer, AL_FORMAT_STEREO16, sndData.data(), sndData.size(), 44100);
|
||||
alSourcei(core->alMainSource, AL_BUFFER, buffer);
|
||||
alSourcePlay(core->alMainSource);
|
||||
}
|
||||
|
||||
void Widget::onFriendRequestReceived(const QString& userId, const QString& message)
|
||||
|
|
Loading…
Reference in New Issue
Block a user