Skip to content

Commit

Permalink
Steam Link: Add platform, video and audio code
Browse files Browse the repository at this point in the history
Known issues:

* Videos stutter due to increased CPU requirements
  • Loading branch information
garbear authored and eigendude committed Apr 16, 2019
1 parent 77221bf commit 94b3f05
Show file tree
Hide file tree
Showing 63 changed files with 3,174 additions and 8 deletions.
25 changes: 25 additions & 0 deletions cmake/modules/FindSdl2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#.rst:
# FindSdl2
# -------
# Finds the SDL2 library
#
# This will will define the following variables::
#
# SDL2_FOUND - system has SDL2
# SDL2_INCLUDE_DIRS - the SDL2 include directory
# SDL2_LIBRARIES - the SDL2 libraries
# SDL2_DEFINITIONS - the SDL2 compile definitions

find_path(SDL2_INCLUDE_DIR NAMES SDL2/SDL.h)
find_library(SDL2_LIBRARY NAMES SDL2)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Sdl2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)

if(SDL2_FOUND)
set(SDL2_LIBRARIES ${SDL2_LIBRARY})
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
set(SDL2_DEFINITIONS -DHAVE_SDL=1 -DHAVE_SDL_VERSION=2)
endif()

mark_as_advanced(SDL2_LIBRARY SDL2_INCLUDE_DIR)
40 changes: 40 additions & 0 deletions cmake/modules/FindSteamLink.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# FindSteamLink
# ----------
# Finds the FindSteamLink headers and libraries
#
# This will will define the following variables::
#
# STEAMLINK_FOUND - system has Steam Link
# STEAMLINK_INCLUDE_DIRS - the Steam Link include directory
# STEAMLINK_LIBRARIES - the Steam Link libraries
# STEAMLINK_DEFINITIONS - the Steam Link definitions
#
# and the following imported targets::
#
# STEAMLINK::STEAMLINK - The Steam Link library

find_path(STEAMLINK_INCLUDE_DIR NAMES SLVideo.h)

find_library(STEAMLINK_VIDEO_LIBRARY NAMES SLVideo)
find_library(STEAMLINK_AUDIO_LIBRARY NAMES SLAudio)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SteamLink
REQUIRED_VARS STEAMLINK_INCLUDE_DIR
STEAMLINK_VIDEO_LIBRARY
STEAMLINK_AUDIO_LIBRARY)

if(STEAMLINK_FOUND)
set(STEAMLINK_LIBRARIES ${STEAMLINK_VIDEO_LIBRARY}
${STEAMLINK_AUDIO_LIBRARY})
set(STEAMLINK_INCLUDE_DIRS ${STEAMLINK_INCLUDE_DIR})
set(STEAMLINK_DEFINITIONS -DHAS_STEAMLINK)
if(NOT TARGET STEAMLINK::STEAMLINK)
add_library(STEAMLINK::STEAMLINK UNKNOWN IMPORTED)
set_target_properties(STEAMLINK::STEAMLINK PROPERTIES
IMPORTED_LOCATION "${STEAMLINK_VIDEO_LIBRARY}" # TODO
INTERFACE_INCLUDE_DIRECTORIES "${STEAMLINK_INCLUDE_DIR}")
endif()
endif()

mark_as_advanced(STEAMLINK_INCLUDE_DIR STEAMLINK_VIDEO_LIBRARY STEAMLINK_AUDIO_LIBRARY)
2 changes: 2 additions & 0 deletions cmake/platform/linux/steamlink.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set(PLATFORM_REQUIRED_DEPS OpenGLES EGL Sdl2 SteamLink)
set(APP_RENDER_SYSTEM gles)
5 changes: 5 additions & 0 deletions cmake/scripts/linux/ArchSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ if(ENABLE_GBM)
set(ENABLE_VDPAU OFF CACHE BOOL "Disabling VDPAU" FORCE)
endif()

# TODO: Is this needed?
if(ENABLE_STEAMLINK)
set(ENABLE_VDPAU OFF CACHE BOOL "Disabling VDPAU on the Steam Link" FORCE)
endif()

if(ENABLE_VDPAU)
set(ENABLE_GLX ON CACHE BOOL "Enabling GLX" FORCE)
endif()
5 changes: 5 additions & 0 deletions cmake/treedata/optional/common/steamlink.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
xbmc/cores/AudioEngine/Sinks/steamlink cores/AudioEngine/Sinks/steamlink # STEAMLINK
xbmc/cores/RetroPlayer/process/steamlink cores/RetroPlayer/process/steamlink # STEAMLINK
xbmc/cores/VideoPlayer/DVDCodecs/Video/steamlink cores/VideoPlayer/DVDCodecs/Video/steamlink # STEAMLINK
xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/steamlink cores/VideoPlayer/VideoRenderers/HwDecRender/steamlink # STEAMLINK
xbmc/windowing/steamlink windowing/steamlink # STEAMLINK
12 changes: 11 additions & 1 deletion tools/depends/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ case $host in
esac

case $use_platform in
aml|gbm|wayland)
aml|gbm|wayland|steamlink)
if test "$platform_os" != "linux"; then
AC_MSG_ERROR([$use_platform is only supported on the Linux platform])
fi
Expand All @@ -393,6 +393,16 @@ case $use_platform in
AC_MSG_ERROR([$use_platform is only supported for arm and aarch64 architecture])
fi
fi
if test "$use_platform" = "steamlink"; then
platform_cflags="--sysroot=$use_toolchain/../rootfs -marm -mfpu=neon -mfloat-abi=hard"
platform_cxxflags="--sysroot=$use_toolchain/../rootfs -marm -mfpu=neon -mfloat-abi=hard"
platform_ldflags="-static-libgcc -static-libstdc++"

# TODO: Needed for Kodi, not depends
platform_cflags+=" -DEGL_API_FB"
platform_cxxflags+=" -DEGL_API_FB"
platform_ldflags+=" -lstdc++"
fi
target_platform=$use_platform
;;
raspberry-pi)
Expand Down
2 changes: 1 addition & 1 deletion tools/depends/native/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ifeq ($(OS),osx)
endif

ifeq ($(OS),linux)
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),raspberry-pi aml gbm))
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),raspberry-pi aml gbm steamlink))
NATIVE += meson-native ninja-native python3-native
endif
endif
Expand Down
2 changes: 1 addition & 1 deletion tools/depends/target/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ ifeq ($(OS),linux)
DEPENDS += alsa-lib
ALSA_LIB = alsa-lib
CROSSGUID_DEPS = libuuid
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),raspberry-pi aml gbm))
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),raspberry-pi aml gbm steamlink))
DEPENDS += libxkbcommon libinput libudev libevdev mtdev
endif
endif
Expand Down
7 changes: 7 additions & 0 deletions tools/depends/target/Toolchain.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ if(CORE_SYSTEM_NAME STREQUAL android)
string(REPLACE ":" ";" SDK_BUILDTOOLS_PATH "@build_tools_path@")
endif()

# add Steam Link's sdk directory
if(CORE_PLATFORM_NAME STREQUAL steamlink)
list(APPEND CMAKE_FIND_ROOT_PATH @use_toolchain@/../rootfs)
list(APPEND CMAKE_LIBRARY_PATH @use_toolchain@/../rootfs/lib)
list(APPEND CMAKE_INCLUDE_PATH @use_toolchain@/../rootfs/include)
endif()

set(CMAKE_C_FLAGS "@platform_cflags@ @platform_includes@ -isystem @prefix@/@deps_dir@/include")
set(CMAKE_CXX_FLAGS "@platform_cxxflags@ @platform_includes@ -isystem @prefix@/@deps_dir@/include")
set(CMAKE_C_FLAGS_RELEASE "@platform_cflags_release@ @platform_includes@ -isystem @prefix@/@deps_dir@/include")
Expand Down
8 changes: 8 additions & 0 deletions tools/depends/target/Toolchain_binaddons.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ if(CORE_SYSTEM_NAME STREQUAL android)
string(REPLACE ":" ";" SDK_BUILDTOOLS_PATH "@build_tools_path@")
endif()

# add Steam Link's sdk directory
if(CORE_PLATFORM_NAME STREQUAL steamlink)
list(APPEND CMAKE_FIND_ROOT_PATH @use_toolchain@/../rootfs)
list(APPEND CMAKE_LIBRARY_PATH @use_toolchain@/../rootfs/lib)
list(APPEND CMAKE_INCLUDE_PATH @use_toolchain@/../rootfs/include)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()

set(CMAKE_C_FLAGS "@platform_cflags@ @platform_includes@")
set(CMAKE_CXX_FLAGS "@platform_cxxflags@ @platform_includes@")
set(CMAKE_C_FLAGS_RELEASE "@platform_cflags_release@ @platform_includes@")
Expand Down
2 changes: 1 addition & 1 deletion xbmc/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,7 @@ bool CApplication::OnAction(const CAction &action)
m_appPlayer.SetPlaySpeed(1);
return true;
}
if (!m_appPlayer.IsPaused())
if (!m_appPlayer.IsPaused() && m_appPlayer.CanFFRW())
{
if (action.GetID() == ACTION_PLAYER_FORWARD || action.GetID() == ACTION_PLAYER_REWIND)
{
Expand Down
6 changes: 6 additions & 0 deletions xbmc/ApplicationPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,12 @@ bool CApplicationPlayer::CanPause()
return (player && player->CanPause());
}

bool CApplicationPlayer::CanFFRW()
{
std::shared_ptr<IPlayer> player = GetInternal();
return (player && player->CanFFRW());
}

std::shared_ptr<TextCacheStruct_t> CApplicationPlayer::GetTeletextCache()
{
std::shared_ptr<IPlayer> player = GetInternal();
Expand Down
1 change: 1 addition & 0 deletions xbmc/ApplicationPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class CApplicationPlayer
// proxy calls
void AddSubtitle(const std::string& strSubPath);
bool CanPause();
bool CanFFRW();
bool CanSeek();
void DoAudioWork();
void GetAudioCapabilities(std::vector<int> &audioCaps);
Expand Down
Loading

0 comments on commit 94b3f05

Please sign in to comment.