Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ if(WIN32)
enable_language(RC)
set(CMAKE_RC_COMPILER windres)
file(
DOWNLOAD "https://github.com/TheElixZammuto/sunshine-prebuilt/releases/download/1.0.0/pre-compiled.zip" "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled.zip"
DOWNLOAD "https://github.com/LizardByte/ffmpeg-prebuilt/releases/download/v1/pre-compiled-windows.zip" "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled.zip"
TIMEOUT 60
EXPECTED_HASH SHA256=5d59986bd7f619eaaf82b2dd56b5127b747c9cbe8db61e3b898ff6b485298ed6)
EXPECTED_HASH SHA256=8a22fe3ada8a00a8cb931d46e1900fecda2ce627cd5138758156251a0d056155)

file(ARCHIVE_EXTRACT
INPUT "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled.zip"
Expand Down Expand Up @@ -243,7 +243,33 @@ else()
set(WAYLAND_FOUND OFF)
endif()

find_package(FFMPEG REQUIRED)
file(
DOWNLOAD "https://github.com/LizardByte/ffmpeg-prebuilt/releases/download/v1/pre-compiled-debian.zip" "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled.zip"
TIMEOUT 60
EXPECTED_HASH SHA256=baa26844f4bf25bad4e4de6e74026f3f083edb018e950bc09983210bb46a6a7d)

file(ARCHIVE_EXTRACT
INPUT "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled.zip"
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/pre-compiled)

if(NOT DEFINED SUNSHINE_PREPARED_BINARIES)
set(SUNSHINE_PREPARED_BINARIES "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled")
endif()

set(FFMPEG_INCLUDE_DIRS
${SUNSHINE_PREPARED_BINARIES}/include)
set(FFMPEG_LIBRARIES
${SUNSHINE_PREPARED_BINARIES}/lib/libavcodec.a
${SUNSHINE_PREPARED_BINARIES}/lib/libavdevice.a
${SUNSHINE_PREPARED_BINARIES}/lib/libavfilter.a
${SUNSHINE_PREPARED_BINARIES}/lib/libavformat.a
${SUNSHINE_PREPARED_BINARIES}/lib/libavutil.a
${SUNSHINE_PREPARED_BINARIES}/lib/libpostproc.a
${SUNSHINE_PREPARED_BINARIES}/lib/libswresample.a
${SUNSHINE_PREPARED_BINARIES}/lib/libswscale.a
${SUNSHINE_PREPARED_BINARIES}/lib/libx264.a
${SUNSHINE_PREPARED_BINARIES}/lib/libx265.a
z lzma)

if(X11_FOUND)
add_compile_definitions(SUNSHINE_BUILD_X11)
Expand Down Expand Up @@ -414,8 +440,6 @@ include_directories(
${PLATFORM_INCLUDE_DIRS}
)

add_subdirectory(third-party/cbs)

string(TOUPPER "x${CMAKE_BUILD_TYPE}" BUILD_TYPE)
if("${BUILD_TYPE}" STREQUAL "XDEBUG")
list(APPEND SUNSHINE_COMPILE_OPTIONS -O0 -ggdb3)
Expand Down Expand Up @@ -443,13 +467,8 @@ else()
endif()
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_ASSETS_DIR="${SUNSHINE_ASSETS_DIR_DEF}")


list(APPEND CBS_EXTERNAL_LIBRARIES
cbs)

list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
libminiupnpc-static
${CBS_EXTERNAL_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
enet
opus
Expand Down
2 changes: 1 addition & 1 deletion packaging/macos/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ post-fetch {

depends_lib port:avahi \
port:curl \
port:ffmpeg \
port:ffmpeg-upstream \
port:libopus

boost.version 1.80
Expand Down
2 changes: 1 addition & 1 deletion src/cbs.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extern "C" {
#include <cbs/cbs_h264.h>
#include <cbs/cbs_h265.h>
#include <cbs/video_levels.h>
#include <cbs/h264_levels.h>
#include <libavcodec/avcodec.h>
#include <libavutil/pixdesc.h>
}
Expand Down
12 changes: 6 additions & 6 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ enum preset_e : int {
};

enum rc_e : int {
constqp = 0x0, /**< Constant QP mode */
cqp = 0x0, /**< Constant QP mode */
vbr = 0x1, /**< Variable bitrate mode */
cbr = 0x2, /**< Constant bitrate mode */
cbr_ld_hq = 0x8, /**< low-delay CBR, high quality */
Expand Down Expand Up @@ -76,7 +76,7 @@ std::optional<preset_e> preset_from_view(const std::string_view &preset) {
std::optional<rc_e> rc_from_view(const std::string_view &rc) {
#define _CONVERT_(x) \
if(rc == #x##sv) return x
_CONVERT_(constqp);
_CONVERT_(cqp);
_CONVERT_(vbr);
_CONVERT_(cbr);
_CONVERT_(cbr_hq);
Expand All @@ -103,14 +103,14 @@ enum quality_e : int {
};

enum class rc_hevc_e : int {
constqp, /**< Constant QP mode */
cqp, /**< Constant QP mode */
vbr_latency, /**< Latency Constrained Variable Bitrate */
vbr_peak, /**< Peak Constrained Variable Bitrate */
cbr, /**< Constant bitrate mode */
};

enum class rc_h264_e : int {
constqp, /**< Constant QP mode */
cqp, /**< Constant QP mode */
cbr, /**< Constant bitrate mode */
vbr_peak, /**< Peak Constrained Variable Bitrate */
vbr_latency, /**< Latency Constrained Variable Bitrate */
Expand All @@ -135,7 +135,7 @@ std::optional<quality_e> quality_from_view(const std::string_view &quality) {
std::optional<int> rc_h264_from_view(const std::string_view &rc) {
#define _CONVERT_(x) \
if(rc == #x##sv) return (int)rc_h264_e::x
_CONVERT_(constqp);
_CONVERT_(cqp);
_CONVERT_(vbr_latency);
_CONVERT_(vbr_peak);
_CONVERT_(cbr);
Expand All @@ -146,7 +146,7 @@ std::optional<int> rc_h264_from_view(const std::string_view &rc) {
std::optional<int> rc_hevc_from_view(const std::string_view &rc) {
#define _CONVERT_(x) \
if(rc == #x##sv) return (int)rc_hevc_e::x
_CONVERT_(constqp);
_CONVERT_(cqp);
_CONVERT_(vbr_latency);
_CONVERT_(vbr_peak);
_CONVERT_(cbr);
Expand Down
69 changes: 0 additions & 69 deletions third-party/cbs/CMakeLists.txt

This file was deleted.

Loading