diff options
-rw-r--r-- | build/config/external_libraries.gni | 33 | ||||
-rw-r--r-- | cast/standalone_receiver/BUILD.gn | 27 | ||||
-rw-r--r-- | cast/standalone_receiver/main.cc | 9 |
3 files changed, 45 insertions, 24 deletions
diff --git a/build/config/external_libraries.gni b/build/config/external_libraries.gni new file mode 100644 index 00000000..fe283535 --- /dev/null +++ b/build/config/external_libraries.gni @@ -0,0 +1,33 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +declare_args() { + # FFMPEG: If installed on the system, set have_ffmpeg to true. This also + # requires the FFMPEG headers be installed. For example, on Debian-like + # systems, the following should install everything needed: + # + # sudo apt-get install libavcodec libavcodec-dev \ + # libavformat libavformat-dev \ + # libavutil libavutil-dev \ + # libswresample libswresample-dev + have_ffmpeg = false + ffmpeg_libs = [ + "avcodec", + "avformat", + "avutil", + "swresample", + ] + ffmpeg_include_dirs = [] # Add only if headers are at non-standard locations. + ffmpeg_lib_dirs = [] # Add only if libraries are at non-standard locations. + + # libsdl2: If installed on the system, set have_libsdl2 to true. This also + # requires the libSDL2 headers be installed. For example, on Debian-like + # systems, the following should install everything needed: + # + # sudo apt-get install libsdl2-2.0 libsdl2-dev + have_libsdl2 = false + libsdl2_libs = [ "SDL2" ] + libsdl2_include_dirs = [] # Add only if headers are at non-standard locations. + libsdl2_lib_dirs = [] # Add only if libraries are at non-standard locations. +} diff --git a/cast/standalone_receiver/BUILD.gn b/cast/standalone_receiver/BUILD.gn index 0de68ee4..27755fe8 100644 --- a/cast/standalone_receiver/BUILD.gn +++ b/cast/standalone_receiver/BUILD.gn @@ -2,20 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/external_libraries.gni") import("//build_overrides/build.gni") -declare_args() { - # These are only relevant for building the demo apps, which require external - # headers/libraries be installed. Set them to true if your local system has - # SDL2/FFMPEG installed. On Debian-like systems, the following should install - # all the required headers and libraries: - # - # sudo apt-get install libsdl2-2.0 libsdl2-dev libavcodec libavcodec-dev \ - # libavformat libavformat-dev libavutil libavutil-dev - have_sdl_for_demo_apps = false - have_ffmpeg_for_demo_apps = false -} - # Define the executable target only when the build is configured to use the # standalone platform implementation; since this is itself a standalone # application. @@ -23,7 +12,6 @@ if (!build_with_chromium) { executable("cast_receiver") { sources = [ "main.cc", - "memory_util.h", ] deps = [ "../../platform", @@ -32,9 +20,10 @@ if (!build_with_chromium) { defines = [] include_dirs = [] + lib_dirs = [] libs = [] - if (have_sdl_for_demo_apps && have_ffmpeg_for_demo_apps) { - defines += [ "CAST_STREAMING_HAVE_EXTERNAL_LIBS_FOR_DEMO_APPS" ] + if (have_ffmpeg && have_libsdl2) { + defines += [ "CAST_STANDALONE_RECEIVER_HAVE_EXTERNAL_LIBS" ] sources += [ "avcodec_glue.h", "decoder.cc", @@ -48,11 +37,9 @@ if (!build_with_chromium) { "sdl_video_player.cc", "sdl_video_player.h", ] - libs += [ - "SDL2", - "avcodec", - "avutil", - ] + include_dirs += ffmpeg_include_dirs + libsdl2_include_dirs + lib_dirs += ffmpeg_lib_dirs + libsdl2_lib_dirs + libs += ffmpeg_libs + libsdl2_libs } else { sources += [ "dummy_player.cc", diff --git a/cast/standalone_receiver/main.cc b/cast/standalone_receiver/main.cc index 8ded25d1..62f22980 100644 --- a/cast/standalone_receiver/main.cc +++ b/cast/standalone_receiver/main.cc @@ -10,6 +10,7 @@ #include "cast/streaming/environment.h" #include "cast/streaming/receiver.h" #include "cast/streaming/receiver_packet_router.h" +#include "cast/streaming/session_config.h" #include "cast/streaming/ssrc.h" #include "platform/api/time.h" #include "platform/api/udp_socket.h" @@ -19,13 +20,13 @@ #include "platform/impl/platform_client_posix.h" #include "platform/impl/task_runner.h" -#if defined(CAST_STREAMING_HAVE_EXTERNAL_LIBS_FOR_DEMO_APPS) +#if defined(CAST_STANDALONE_RECEIVER_HAVE_EXTERNAL_LIBS) #include "cast/standalone_receiver/sdl_audio_player.h" #include "cast/standalone_receiver/sdl_glue.h" #include "cast/standalone_receiver/sdl_video_player.h" #else #include "cast/standalone_receiver/dummy_player.h" -#endif // defined(CAST_STREAMING_HAVE_EXTERNAL_LIBS_FOR_DEMO_APPS) +#endif // defined(CAST_STANDALONE_RECEIVER_HAVE_EXTERNAL_LIBS) namespace openscreen { namespace cast { @@ -100,7 +101,7 @@ void RunStandaloneReceiver(TaskRunnerImpl* task_runner) { OSP_LOG_INFO << "Awaiting first Cast Streaming packet at " << env.GetBoundLocalEndpoint() << "..."; -#if defined(CAST_STREAMING_HAVE_EXTERNAL_LIBS_FOR_DEMO_APPS) +#if defined(CAST_STANDALONE_RECEIVER_HAVE_EXTERNAL_LIBS) // Start the SDL event loop, using the task runner to poll/process events. const ScopedSDLSubSystem<SDL_INIT_AUDIO> sdl_audio_sub_system; @@ -138,7 +139,7 @@ void RunStandaloneReceiver(TaskRunnerImpl* task_runner) { const DummyPlayer audio_player(&audio_receiver); const DummyPlayer video_player(&video_receiver); -#endif // defined(CAST_STREAMING_HAVE_EXTERNAL_LIBS_FOR_DEMO_APPS) +#endif // defined(CAST_STANDALONE_RECEIVER_HAVE_EXTERNAL_LIBS) // Run the event loop until an exit is requested (e.g., the video player GUI // window is closed, a SIGTERM is intercepted, or whatever other appropriate |