xref: /aosp_15_r20/external/openscreen/build/config/external_libraries.md (revision 3f982cf4871df8771c9d4abe6e9a6f8d829b2736)
1*3f982cf4SFabien Sanglard# External Libraries in Open Screen
2*3f982cf4SFabien Sanglard
3*3f982cf4SFabien SanglardCurrently, external libraries are used exclusively by the standalone sender and
4*3f982cf4SFabien Sanglardreceiver applications, for compiling in dependencies used for video decoding and
5*3f982cf4SFabien Sanglardplayback.
6*3f982cf4SFabien Sanglard
7*3f982cf4SFabien SanglardThe decision to link external libraries is made manually by setting the GN args.
8*3f982cf4SFabien SanglardFor example, a developer wanting to link all the libraries for the standalone
9*3f982cf4SFabien Sanglardsender and receiver executables might add the following to `gn args out/Default`:
10*3f982cf4SFabien Sanglard
11*3f982cf4SFabien Sanglard```python
12*3f982cf4SFabien Sanglardis_debug=true
13*3f982cf4SFabien Sanglardhave_ffmpeg=true
14*3f982cf4SFabien Sanglardhave_libsdl2=true
15*3f982cf4SFabien Sanglardhave_libopus=true
16*3f982cf4SFabien Sanglardhave_libvpx=true
17*3f982cf4SFabien Sanglard```
18*3f982cf4SFabien Sanglard
19*3f982cf4SFabien SanglardOn some versions of Debian, the following apt-get command will install all of
20*3f982cf4SFabien Sanglardthe necessary external libraries for Open Screen:
21*3f982cf4SFabien Sanglard
22*3f982cf4SFabien Sanglard```sh
23*3f982cf4SFabien Sanglardsudo apt-get install libsdl2-2.0 libsdl2-dev libavcodec libavcodec-dev
24*3f982cf4SFabien Sanglard                     libavformat libavformat-dev libavutil libavutil-dev
25*3f982cf4SFabien Sanglard                     libswresample libswresample-dev libopus0 libopus-dev
26*3f982cf4SFabien Sanglard                     libvpx5 libvpx-dev
27*3f982cf4SFabien Sanglard```
28*3f982cf4SFabien Sanglard
29*3f982cf4SFabien SanglardSimilarly, on some versions of Raspian, the following command will install the
30*3f982cf4SFabien Sanglardnecessary external libraries, at least for the standalone receiver. Note that
31*3f982cf4SFabien Sanglardthis command is based off of the packages linked in the [sysroot](sysroot.gni):
32*3f982cf4SFabien Sanglard
33*3f982cf4SFabien Sanglard```sh
34*3f982cf4SFabien Sanglardsudo apt-get install libavcodec58=7:4.1.4* libavcodec-dev=7:4.1.4*
35*3f982cf4SFabien Sanglard                     libsdl2-2.0-0=2.0.9* libsdl2-dev=2.0.9*
36*3f982cf4SFabien Sanglard                     libavformat-dev=7:4.1.4*
37*3f982cf4SFabien Sanglard```
38*3f982cf4SFabien Sanglard
39*3f982cf4SFabien SanglardNote: release of these operating systems may require slightly different
40*3f982cf4SFabien Sanglardpackages, so these `sh` commands are merely a potential starting point.
41*3f982cf4SFabien Sanglard
42*3f982cf4SFabien SanglardFinally, note that generally the headers for packages must also be installed.
43*3f982cf4SFabien SanglardIn Debian Linux flavors, this usually means that the `*-dev` version of each
44*3f982cf4SFabien Sanglardpackage must also be installed. In the example above, this looks like having
45*3f982cf4SFabien Sanglardboth `libavcodec` and `libavcodec-dev`.
46*3f982cf4SFabien Sanglard
47*3f982cf4SFabien Sanglard## Standalone Sender
48*3f982cf4SFabien Sanglard
49*3f982cf4SFabien SanglardThe standalone sender uses FFMPEG, LibOpus, and LibVpx for encoding video and
50*3f982cf4SFabien Sanglardaudio for sending. When the build has determined that [have_external_libs](
51*3f982cf4SFabien Sanglard  ../../cast/standalone_sender/BUILD.gn
52*3f982cf4SFabien Sanglard) is set to true, meaning that all of these libraries are installed, then
53*3f982cf4SFabien Sanglardthe VP8 and Opus encoders are enabled and actual video files can be sent
54*3f982cf4SFabien Sanglardto standalone receiver instances. Without these dependencies, the standalone
55*3f982cf4SFabien Sanglardsender cannot properly function (contrasted with the standalone receiver,
56*3f982cf4SFabien Sanglardwhich can use a dummy player).
57*3f982cf4SFabien Sanglard
58*3f982cf4SFabien Sanglard## Standalone Receiver
59*3f982cf4SFabien Sanglard
60*3f982cf4SFabien SanglardThe standalone receiver also uses FFMPEG, for decoding the video stream encoded
61*3f982cf4SFabien Sanglardby the sender, and also uses LibSDL2 to create a surface for decoding video.
62*3f982cf4SFabien SanglardUnlike the sender, the standalone receiver can work without having
63*3f982cf4SFabien Sanglardits [have_external_libs](../.../cast/standalone_receiver/BUILD.gn) set to true,
64*3f982cf4SFabien Sanglardthrough the use of its
65*3f982cf4SFabien Sanglard[Dummy Player](../../cast/standalone_receiver/dummy_player.h).
66