mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-03 00:06:09 +00:00
Switch to PortAudio for audio playback
This commit is contained in:
parent
2cd4851601
commit
71b625081a
@ -31,6 +31,7 @@ matrix:
|
|||||||
- libavutil-dev
|
- libavutil-dev
|
||||||
- libva-dev
|
- libva-dev
|
||||||
- libvdpau-dev
|
- libvdpau-dev
|
||||||
|
- portaudio19-dev
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- '[ "$TRAVIS_OS_NAME" != osx ] || brew install qt5'
|
- '[ "$TRAVIS_OS_NAME" != osx ] || brew install qt5'
|
||||||
|
@ -24,7 +24,7 @@ You can follow development on our [Discord server](https://discord.gg/6ERtzFY).
|
|||||||
1. Install the latest Qt SDK (and optionally, the Qt Creator IDE) from https://www.qt.io/download
|
1. Install the latest Qt SDK (and optionally, the Qt Creator IDE) from https://www.qt.io/download
|
||||||
- On Windows, install Visual Studio 2017 and select MSVC 2017 toolchain during Qt installation
|
- On Windows, install Visual Studio 2017 and select MSVC 2017 toolchain during Qt installation
|
||||||
- On Mac, install the latest version of XCode
|
- On Mac, install the latest version of XCode
|
||||||
- On Linux, install your distro equivalents of: `openssl-devel qt5-devel SDL2-devel ffmpeg-devel qt5-qtquickcontrols2-devel libva-devel libvdpau-devel`
|
- On Linux, install your distro equivalents of: `openssl-devel qt5-devel SDL2-devel ffmpeg-devel qt5-qtquickcontrols2-devel libva-devel libvdpau-devel opus-devel portaudio-devel`
|
||||||
2. Run `git submodule update --init --recursive` from within `moonlight-qt/`
|
2. Run `git submodule update --init --recursive` from within `moonlight-qt/`
|
||||||
3. Open the project in Qt Creator or build from qmake on the command line
|
3. Open the project in Qt Creator or build from qmake on the command line
|
||||||
|
|
||||||
|
32
app/app.pro
32
app/app.pro
@ -55,6 +55,11 @@ unix:!macx {
|
|||||||
CONFIG += link_pkgconfig
|
CONFIG += link_pkgconfig
|
||||||
PKGCONFIG += openssl sdl2 opus
|
PKGCONFIG += openssl sdl2 opus
|
||||||
|
|
||||||
|
packagesExist(portaudio-2.0) {
|
||||||
|
PKGCONFIG += portaudio-2.0
|
||||||
|
CONFIG += portaudio
|
||||||
|
}
|
||||||
|
|
||||||
packagesExist(libavcodec) {
|
packagesExist(libavcodec) {
|
||||||
PKGCONFIG += libavcodec libavutil
|
PKGCONFIG += libavcodec libavutil
|
||||||
CONFIG += ffmpeg
|
CONFIG += ffmpeg
|
||||||
@ -75,13 +80,13 @@ unix:!macx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
win32 {
|
win32 {
|
||||||
LIBS += -llibssl -llibcrypto -lSDL2 -lavcodec -lavutil -lopus
|
LIBS += -llibssl -llibcrypto -lSDL2 -lavcodec -lavutil -lopus -lportaudio
|
||||||
CONFIG += ffmpeg
|
CONFIG += ffmpeg portaudio
|
||||||
}
|
}
|
||||||
macx {
|
macx {
|
||||||
LIBS += -lssl -lcrypto -lavcodec.58 -lavutil.56 -lopus -framework SDL2
|
LIBS += -lssl -lcrypto -lavcodec.58 -lavutil.56 -lopus -lportaudio -framework SDL2
|
||||||
LIBS += -lobjc -framework VideoToolbox -framework AVFoundation -framework CoreVideo -framework CoreGraphics -framework CoreMedia -framework AppKit
|
LIBS += -lobjc -framework VideoToolbox -framework AVFoundation -framework CoreVideo -framework CoreGraphics -framework CoreMedia -framework AppKit
|
||||||
CONFIG += ffmpeg
|
CONFIG += ffmpeg portaudio
|
||||||
}
|
}
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
@ -95,7 +100,6 @@ SOURCES += \
|
|||||||
streaming/input.cpp \
|
streaming/input.cpp \
|
||||||
streaming/session.cpp \
|
streaming/session.cpp \
|
||||||
streaming/audio/audio.cpp \
|
streaming/audio/audio.cpp \
|
||||||
streaming/audio/renderers/sdlaud.cpp \
|
|
||||||
gui/computermodel.cpp \
|
gui/computermodel.cpp \
|
||||||
gui/appmodel.cpp \
|
gui/appmodel.cpp \
|
||||||
streaming/streamutils.cpp \
|
streaming/streamutils.cpp \
|
||||||
@ -113,7 +117,6 @@ HEADERS += \
|
|||||||
streaming/input.hpp \
|
streaming/input.hpp \
|
||||||
streaming/session.hpp \
|
streaming/session.hpp \
|
||||||
streaming/audio/renderers/renderer.h \
|
streaming/audio/renderers/renderer.h \
|
||||||
streaming/audio/renderers/sdl.h \
|
|
||||||
gui/computermodel.h \
|
gui/computermodel.h \
|
||||||
gui/appmodel.h \
|
gui/appmodel.h \
|
||||||
streaming/video/decoder.h \
|
streaming/video/decoder.h \
|
||||||
@ -171,8 +174,14 @@ config_SLVideo {
|
|||||||
|
|
||||||
DEFINES += HAVE_SLVIDEO
|
DEFINES += HAVE_SLVIDEO
|
||||||
LIBS += -lSLVideo
|
LIBS += -lSLVideo
|
||||||
SOURCES += streaming/video/sl.cpp
|
|
||||||
HEADERS += streaming/video/sl.h
|
SOURCES += \
|
||||||
|
streaming/video/sl.cpp \
|
||||||
|
streaming/audio/renderers/sdlaud.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
streaming/video/sl.h \
|
||||||
|
streaming/audio/renderers/sdl.h
|
||||||
}
|
}
|
||||||
win32 {
|
win32 {
|
||||||
message(DXVA2 renderer selected)
|
message(DXVA2 renderer selected)
|
||||||
@ -196,6 +205,13 @@ macx {
|
|||||||
streaming/video/ffmpeg-renderers/vt.h \
|
streaming/video/ffmpeg-renderers/vt.h \
|
||||||
streaming/video/ffmpeg-renderers/pacer/displaylinkvsyncsource.h
|
streaming/video/ffmpeg-renderers/pacer/displaylinkvsyncsource.h
|
||||||
}
|
}
|
||||||
|
portaudio {
|
||||||
|
message(PortAudio audio renderer selected)
|
||||||
|
|
||||||
|
DEFINES += HAVE_PORTAUDIO
|
||||||
|
SOURCES += streaming/audio/renderers/portaudiorenderer.cpp
|
||||||
|
HEADERS += streaming/audio/renderers/portaudiorenderer.h
|
||||||
|
}
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources.qrc \
|
resources.qrc \
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
#include "../session.hpp"
|
#include "../session.hpp"
|
||||||
#include "renderers/renderer.h"
|
#include "renderers/renderer.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_PORTAUDIO
|
||||||
|
#include "renderers/portaudiorenderer.h"
|
||||||
|
#else
|
||||||
#include "renderers/sdl.h"
|
#include "renderers/sdl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <Limelight.h>
|
#include <Limelight.h>
|
||||||
|
|
||||||
IAudioRenderer* Session::createAudioRenderer()
|
IAudioRenderer* Session::createAudioRenderer()
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_PORTAUDIO
|
||||||
|
return new PortAudioRenderer();
|
||||||
|
#else
|
||||||
return new SdlAudioRenderer();
|
return new SdlAudioRenderer();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::testAudio(int audioConfiguration)
|
bool Session::testAudio(int audioConfiguration)
|
||||||
|
@ -164,7 +164,7 @@ int PortAudioRenderer::detectAudioConfiguration()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int PortAudioRenderer::paStreamCallback(const void*, void* output, unsigned long frameCount, const PaStreamCallbackTimeInfo*, PaStreamCallbackFlags statusFlags, void* userData)
|
int PortAudioRenderer::paStreamCallback(const void*, void* output, unsigned long frameCount, const PaStreamCallbackTimeInfo*, PaStreamCallbackFlags, void* userData)
|
||||||
{
|
{
|
||||||
auto me = reinterpret_cast<PortAudioRenderer*>(userData);
|
auto me = reinterpret_cast<PortAudioRenderer*>(userData);
|
||||||
|
|
||||||
|
@ -3,6 +3,11 @@
|
|||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
|
#ifndef HAVE_SLVIDEO
|
||||||
|
#error SDL audio backend is only available for Steam Link
|
||||||
|
#error Please install PortAudio to build for Linux
|
||||||
|
#endif
|
||||||
|
|
||||||
class SdlAudioRenderer : public IAudioRenderer
|
class SdlAudioRenderer : public IAudioRenderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user