Commit Graph

1542 Commits

Author SHA1 Message Date
Joey Parrish 2038339926
build: Separate shared and static library targets (#1293)
This splits the target so that we always build static libraries, but
optionally also build shared libraries. This also tweaks the
installation so that the static library is never installed, because it
is not usable without the other internal static library deps. The
headers and pkgconfig will only be installed if we have a shared library
to use them with.
2023-10-22 17:46:33 -07:00
Joey Parrish ea311672f1
docs: Add docs on installation (#1294) 2023-10-19 10:54:52 -07:00
Joey Parrish 562473c57e
build: Use the standard BUILD_SHARED_LIBS variable (#1292)
Use the standard BUILD_SHARED_LIBS variable instead of the custom
LIBPACKAGER_SHARED variable
2023-10-19 10:05:35 -07:00
Joey Parrish 168e74c4c9
fix: Fix dependency on system zlib (#1291) 2023-10-19 10:05:23 -07:00
Joey Parrish bcc275454d
fix: Fix clang build (#1288)
Issue #561
2023-10-18 16:47:09 -07:00
Joey Parrish 1e9b251be8
fix: Fix UdpFile build on FreeBSD (#1287)
Issue #561
2023-10-18 16:46:25 -07:00
Joey Parrish 9294dc7c68
fix: Use stable GitHub mirror for libxml2 source (#1286)
The upstream repo at gnome.org sometimes fails in CI
2023-10-18 16:45:36 -07:00
Joey Parrish fac8acf5dd
feat: Build c-ares locally (#1285)
c-ares (used on Linux only) was an exception to the rule of only linking
against internally-built libraries. This fixes that, to support a truly
static build of packager.
2023-10-18 16:44:43 -07:00
Cosmin Stejerean e516608c5e
feat: copy packager_test.py in CMake (#1284)
This is used to run a fairly large number of integrations tests (which are exposing some failures on the CMake branch). Let's copy these over first to enable the integration tests workflow.

Actually running integration tests in CTest is off by default (gated by `SKIP_INTEGRATION_TESTS` while we fix the tests).
2023-10-18 16:06:10 -07:00
Joey Parrish 985abb23d6
fix: Fix internal libraries built as dynamic by default (#1283)
This caused issues with some shared library link tests when I tried to
split the library target into shared and static targets.
2023-10-18 11:31:29 -07:00
Joey Parrish 32723f81bc
build: Fix pssh-box.py targets, installation, and docs (#1279)
pssh-box.py needs Python protos, which we were not building. It also
needs to have those protos installed properly.

This fixes generation of Python proto interfaces and fixes the install
targets to put those protos where they are needed. This also updates the
documentation to match.
2023-10-17 12:52:40 -07:00
Joey Parrish 53eb7b1a38
build: Fix rebuild of link-test targets (#1278)
The link-test targets rebuilt every time you built the project because
that is the behavior of commands attached to add_custom_target. This is
fixed by combining add_custom_command and add_custom_target.

Fixing that led to a situation where the link-test targets built on the
first build, but didn't properly rebuild when their dependencies
changed. This is fixed by using set_source_file_properties to treat
test.cc as dirty when the test-install command runs.
2023-10-17 12:09:04 -07:00
Cosmin Stejerean 4cedb7ca98
docs: update docs for CMake (#1270)
Updated the build docs for Linux, Mac and Windows.

Updated the Linux profiling docs to remove references to things that don't work anymore. 


---------

Co-authored-by: Joey Parrish <joeyparrish@google.com>
2023-10-17 09:39:11 -07:00
Cosmin Stejerean b224fb6e57
feat: add install target for cmake (#1269)
this adds an install target which will install binaries, libraries, pkg-config and headers, along with a simple link-test program to verify the installed library and headers work.

---------

Co-authored-by: Joey Parrish <joeyparrish@google.com>
2023-10-16 13:08:48 -07:00
Joey Parrish 0295ef182b
chore: Refactor public headers and macros (#1275)
This organizes all public headers for the library into
include/  and makes sure then don't rely on any headers from
other folders.

To accomplish this, this change also refactors macros.h,
media/base/macros.h, and status/status_macros.h into macros/classes.h,
macros/compiler.h, macros/crypto.h, macros/logging.h, macros/status.h,
and public/export.h.  Now the export macros from macros.h live in
include/ to keep include/ from requiring anything else.

This refactor enables an install target that includes public headers
only.

---------

Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
2023-10-14 09:36:01 -07:00
Joey Parrish 7653e1e02f
feat: Replace glog with absl::log (#1274)
This deprecates --vmodule (not available in absl, mapping it to --v for
a very minimal sort of compatibility) and adds the absl::log flags
--minloglevel, --stderrthreshold, --log_backtrace_at, and --log_prefix.
2023-10-13 12:42:47 -07:00
Joey Parrish 3b3e267221
style: Sort headers to comply with the style guide (#1273)
Reorder headers to follow the Google C++ Style Guide:

> In dir/foo.cc or dir/foo_test.cc:
>
> 1. dir2/foo2.h.
> 2. A blank line
> 3. C system headers (more precisely: headers in angle brackets with
the .h extension), e.g., <unistd.h>, <stdlib.h>.
> 4. A blank line
> 5. C++ standard library headers (without file extension), e.g.,
<algorithm>, <cstddef>.
> 6. A blank line
> 7. Other libraries' .h files.
> 8. A blank line
> 9. Your project's .h files.


https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes
2023-10-11 16:49:50 +08:00
Joey Parrish 4e310f03bf
style: Use angle-brackets for all internal headers (#1271)
This feeds into efforts to create a working install target.

The order of headers is still funky, and was "fixed" by clang-format,
but in a way that doesn't exactly align with the style guide. Further
cleanup of header order is coming in a follow-up PR.
2023-10-11 07:51:11 +08:00
Cosmin Stejerean 1337e86597
style: cleanup unused includes and use consistent <> for external code (#1267) 2023-10-09 16:21:41 -07:00
Cosmin Stejerean 72117f85ad
feat: add verbose logging flags for CMake branch (#1266)
Co-authored-by: Joey Parrish <joeyparrish@google.com>
2023-10-09 11:08:08 -07:00
Cosmin Stejerean 8b87804c57
fix: apply cmake fixes after merge of #1210 (#1264)
build in CMake branch is broken at least locally on OS X after #1210 was
merged which introduced some new warnings and reintroduced
base::nullopt.
2023-09-19 09:03:32 +01:00
Joey Parrish 5557e76c2b Merge remote-tracking branch 'upstream/main' into cmake 2023-09-13 11:22:35 -07:00
Cosmin Stejerean 6b68c138cc
feat: port demuxer and app to cmake (#1260)
Related to issue #1047

After this it should be possible to build a working `packager` application from the `cmake` branch. Some further logging improvements may be needed to get full parity with the `main` branch in terms of ability to do verbose debug logging, but other than that everything is expected to work.
2023-09-08 17:44:17 -07:00
sr90 8465f5f020
feat(DASH): Add video transfer characteristics. (#1210)
This PR is related to https://github.com/shaka-project/shaka-packager/issues/1035
2023-09-08 14:41:41 -07:00
Cosmin Stejerean 274c885253 Merge branch 'main' into cmake 2023-09-03 10:01:08 -07:00
Shaka Bot b7660590a6
chore: Sync common workflows (#1262)
This is an automated sync of common workflows for this organization.
The upstream source is:

4245160a0b

Co-authored-by: Shaka Bot <shaka-bot@users.noreply.github.com>
2023-09-01 19:26:57 -07:00
Cosmin Stejerean 3afe761637
feat: port media/formats/* to cmake (#1258)
Issue #1047
2023-08-31 16:59:46 -07:00
Caitlin O'Callaghan f264befe86
feat: Write colr atom to muxed mp4 (#1261)
This PR is an extension of the full AV1 codec string feature: [PR
1205](https://github.com/shaka-project/shaka-packager/pull/1205) and
relates to [Issue
1007](https://github.com/shaka-project/shaka-packager/issues/1007) and
[Issue
1202](https://github.com/shaka-project/shaka-packager/issues/1202).

As per the AV1 spec, the codec string may contain optional color values.
These color values are critical for detecting HDR video streams - see
[Issue
1007](https://github.com/shaka-project/shaka-packager/issues/1007).
Color information is extracted from the input mp4's `colr` atom and used
to generate the full AV1 codec string. This PR preserves the color
information by writing the `colr` atom to the muxed mp4.

**References**:
- [AV1 Codec ISO Media File Format
Binding](https://aomediacodec.github.io/av1-isobmff/#codecsparam)
- [AV1 Bitstream & Decoding Process
Specification - Section 6.4.2 Color config semantics (page
117)](https://aomediacodec.github.io/av1-spec/av1-spec.pdf)
- [QuickTime File Format
Specification](https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-125526)
2023-08-29 18:46:19 -07:00
Cosmin Stejerean ab8485c5b7
feat: port HLS module to CMake (#1238)
related to issue #1047
2023-08-21 18:41:18 -07:00
Cosmin Stejerean 682ac3c990 Merge branch 'main' into cmake 2023-08-21 17:22:35 -07:00
Prakash Duggaraju dcf32258ff
fix: Fix handling of non-interleaved multi track FMP4 files (#1214)
Do not assume that each fragment contains all tracks. 
Use track id instead of index to pick the correct timestamp.

Fixes #1213
2023-08-21 16:34:32 -07:00
Cosmin Stejerean c465311525
fix: docs build (#1257)
Sphinx 7.2.0 breaks Breathe, see sphinx-doc/sphinx#11605 for now pin to 7.1.2 until either of them resolve this issue
2023-08-21 10:23:39 -07:00
Cosmin Stejerean 793518c73d Merge branch 'main' into cmake 2023-08-04 22:23:26 -07:00
Cosmin Stejerean 96acd1ecfd
feat: convert mpd module to cmake (#1234)
Related to issue #1047
2023-08-04 20:45:21 -07:00
Caitlin O'Callaghan cc9a691aef
feat: Generate the entire AV1 codec string when the colr atom is present (#1205)
As per the AV1 spec, the codec string may contain optional color values.

This extracts the missing color information from the mp4 `colr` atom, if
present, and generates the full AV1 codec string. 

Closes #1007
2023-08-04 09:00:59 -07:00
Cosmin Stejerean 97cf7c0a5b Merge branch 'main' into cmake 2023-08-02 12:38:01 -07:00
Shaka Bot 6d745460b6
chore: Sync common workflows (#1250)
This is an automated sync of common workflows for this organization.
The upstream source is:
208556c5ea

Co-authored-by: Shaka Bot <shaka-bot@users.noreply.github.com>
2023-07-24 17:17:54 -07:00
Joey Parrish cf8deae0a6 ci: Add PR write permission to update-issues job 2023-07-24 14:58:49 -07:00
Joey Parrish ba51270b0e
feat: Port app/job_manager to cmake and absl (#1249)
Issue #1047 (cmake)
Issue #346 (absl)
2023-07-21 12:41:49 +02:00
sr90 520926c27a
fix(MP4): Add compatible brand dby1 for Dolby content. (#1211)
This PR adds dby1 compatible brand to dolby content as per
https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby_vision_bitstreams_within_the_iso_base_media_file_format_dec2017.pdf
2023-07-18 19:50:33 -07:00
Joey Parrish 4515a9834d Merge branch 'main' into cmake 2023-07-18 16:20:45 -07:00
Joey Parrish 86a183a847
test: Use a random HTTP port for web server tests (#1248)
This will pick a random HTTP port for the test web server, and retry up
to 10 times if the chosen port number is in use.
2023-07-18 16:19:52 -07:00
Joey Parrish 5a2571b9bc
fix: Fix local files with UTF8 names (#1246)
This fixes our use of std::filesystem to interpret all paths names as
UTF8. Before this, UTF8 paths did not work correctly in all cases.

This also adds a new unit test to cover this case.

On Windows, it is critical that a UTF8 locale be set at runtime.
Applications linking with Packager as a library should call setlocale(),
and the Packager frontends now do this automatically after converting
wide character arguments into narrow strings.

Closes #652
2023-07-18 11:59:21 -07:00
Joey Parrish c29c03c6e3
test: Fix bad assertions in formats/mp4 and formats/mp2t tests (#1247)
PR #1242 introduced some bad assertions that went unnoticed because we
are not yet building those modules in the cmake branch. This fixes those
so that ASSERT_ macros are not used in non-void functions, and so that
assumptions about a successful parse are always after an ASSERT_ that
the data was loaded properly.

All ASSERT_ macros from #1242 were audited, and the others were all
fine.
2023-07-18 11:30:05 -07:00
Joey Parrish 137e692406
fix: Fix libpng include directories (#1245) 2023-07-18 10:30:41 +02:00
Joey Parrish 9962075d3b
ci: Fix workflow warnings (#1243)
Fixes the following warnings from GitHub Actions:
- "The following actions uses node12 which is deprecated and will be
forced to run on node16: actions/checkout@v2. For more info:
https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/"
- "The `set-output` command is deprecated and will be disabled soon.
Please upgrade to using Environment Files. For more information see:
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/"
2023-07-17 16:11:52 -07:00
Joey Parrish 868a8c5d8e
ci: Collect and report test results (#1244)
All gtest-based tests should now use add_gtest. Results from these tests
will be surfaced more prominently in GitHub Actions. Before this, it was
hard to find test failures in the log.
2023-07-17 16:11:41 -07:00
Joey Parrish 60fb057f1a
test: Avoid crashing a test executable (#1242)
LOG(FATAL) aborts the executable, which means gtest can't write any
reports it might be configured to write when tests are complete. This
will interfere with reporting.

This converts the only use of LOG(FATAL), which was in
ReadTestDataFile(), to LOG(ERROR). This also updates test cases to avoid
crashing when ReadTestDataFile() returns an empty buffer.
2023-07-17 13:16:22 -07:00
Joey Parrish 052fb64068
ci: Enable parallel builds (#1241)
Our workflows and Dockerfiles now use Ninja on Linux & Mac, which
enables safe parallel builds. This significantly speeds up our
workflows.

GitHub Actions typical compilation times (build step only):
 - Linux 19m => 9m
 - macOS 23m => 8m
 - Windows 12m => 10m
 - Linux arm64 (self-hosted) 72m => 29m
 - Docker build 25m => 14m

Overall workflow time: 84m => 33m

Compilation time on my workstation (12 CPUs @3.3GHz): 15m => 3m

This also adds a new environment variable "PACKAGER_LOW_MEMORY_BUILD".
If defined when CMake is first run, this will configure the build to
disable parallel linking to reduce memory usage. This helps us avoid
failures on our self-hosted arm64 machines, where 6 CPUs share 4GB of
RAM.

NOTE: Parallel builds are **NOT** recommended with Unix Makefiles due to
the use of excessive RAM during parallel linking. Unix Makefiles, unlike
Ninja, cannot be configured to restrict parallel linking during a
parallel build. Anecdotally, parallel builds with Makefiles have
exhausted a system with 32GB RAM. (My workstation.)

In a follow-up, I will update the build documentation to refer to CMake
and recommend all of the flags now used in our workflows.
2023-07-17 13:16:03 -07:00
Joey Parrish 362d98ae62
test: Move CentOS 8 tests to CentOS 9 Stream (#1240)
CentOS 8 is EOL, and the official docker images will not be updated. See
https://www.centos.org/centos-linux-eol/

This switches to the latest release (CentOS 9 Stream). Since CentOS no
longer provides official images, this uses a third-party image provider
(https://hub.docker.com/u/tgagor)

This change also exposed a warning in absl that needed to be silenced in
the default version of GCC in CentOS 9 Stream (GCC 11.4).
2023-07-17 11:10:28 -07:00