feat: CMake port media/trick_play (#1146)
Issue #1047 (CMake porting) --------- Co-authored-by: Joey Parrish <joeyparrish@google.com>
This commit is contained in:
parent
6c1d4f3885
commit
901013c34e
|
@ -6,14 +6,14 @@
|
||||||
|
|
||||||
# Root-level CMake build file.
|
# Root-level CMake build file.
|
||||||
|
|
||||||
# Project name. May not contain spaces. Versioning is managed elsewhere.
|
|
||||||
cmake_policy(SET CMP0048 NEW)
|
|
||||||
project(shaka-packager VERSION "")
|
|
||||||
|
|
||||||
# Minimum CMake version.
|
# Minimum CMake version.
|
||||||
# We could require as low as 3.10, but glog requires 3.16.
|
# We could require as low as 3.10, but glog requires 3.16.
|
||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
# Project name. May not contain spaces. Versioning is managed elsewhere.
|
||||||
|
cmake_policy(SET CMP0048 NEW)
|
||||||
|
project(shaka-packager VERSION "")
|
||||||
|
|
||||||
# The only build option for Shaka Packager is whether to build a shared
|
# The only build option for Shaka Packager is whether to build a shared
|
||||||
# libpackager library. By default, don't.
|
# libpackager library. By default, don't.
|
||||||
option(LIBPACKAGER_SHARED "Build libpackager as a shared library" OFF)
|
option(LIBPACKAGER_SHARED "Build libpackager as a shared library" OFF)
|
||||||
|
|
|
@ -6,8 +6,9 @@
|
||||||
|
|
||||||
# Subdirectories with their own CMakeLists.txt, all of whose targets are built.
|
# Subdirectories with their own CMakeLists.txt, all of whose targets are built.
|
||||||
add_subdirectory(base)
|
add_subdirectory(base)
|
||||||
|
add_subdirectory(codecs)
|
||||||
|
add_subdirectory(formats)
|
||||||
add_subdirectory(origin)
|
add_subdirectory(origin)
|
||||||
add_subdirectory(replicator)
|
add_subdirectory(replicator)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
add_subdirectory(codecs)
|
add_subdirectory(trick_play)
|
||||||
add_subdirectory(formats)
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2017 Google LLC. All rights reserved.
|
// Copyright 2022 Google LLC. All rights reserved.
|
||||||
//
|
//
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file or at
|
// license that can be found in the LICENSE file or at
|
||||||
|
@ -11,8 +11,10 @@
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "absl/strings/escaping.h"
|
#include "absl/strings/escaping.h"
|
||||||
|
#include "absl/strings/numbers.h"
|
||||||
#include "packager/media/base/media_handler.h"
|
#include "packager/media/base/media_handler.h"
|
||||||
#include "packager/media/base/video_stream_info.h"
|
#include "packager/media/base/video_stream_info.h"
|
||||||
|
#include "packager/utils/bytes_to_string_view.h"
|
||||||
|
|
||||||
namespace shaka {
|
namespace shaka {
|
||||||
namespace media {
|
namespace media {
|
||||||
|
@ -145,8 +147,11 @@ MATCHER_P6(MatchEncryptionConfig,
|
||||||
constant_iv,
|
constant_iv,
|
||||||
key_id,
|
key_id,
|
||||||
"") {
|
"") {
|
||||||
const std::string constant_iv_hex = absl::BytesToHexString(arg.constant_iv);
|
const std::string_view constant_iv_data =
|
||||||
const std::string key_id_hex = absl::BytesToHexString(arg.key_id);
|
byte_vector_to_string_view(constant_iv);
|
||||||
|
const std::string constant_iv_hex = absl::BytesToHexString(constant_iv_data);
|
||||||
|
const std::string key_id_data(arg.key_id.data(), arg.key_id.size());
|
||||||
|
const std::string key_id_hex = absl::BytesToHexString(key_id_data);
|
||||||
const std::string protection_scheme_as_string =
|
const std::string protection_scheme_as_string =
|
||||||
FourCCToString(arg.protection_scheme);
|
FourCCToString(arg.protection_scheme);
|
||||||
// Convert to integers so that they will print as a number and not a uint8_t
|
// Convert to integers so that they will print as a number and not a uint8_t
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Copyright 2022 Google LLC. All rights reserved.
|
||||||
|
#
|
||||||
|
# Use of this source code is governed by a BSD-style
|
||||||
|
# license that can be found in the LICENSE file or at
|
||||||
|
# https://developers.google.com/open-source/licenses/bsd
|
||||||
|
|
||||||
|
add_library(media_trick_play STATIC
|
||||||
|
trick_play_handler.cc)
|
||||||
|
target_link_libraries(media_trick_play
|
||||||
|
media_base
|
||||||
|
absl::base
|
||||||
|
glog)
|
||||||
|
|
||||||
|
add_executable(media_trick_play_unittest
|
||||||
|
trick_play_handler_unittest.cc)
|
||||||
|
target_link_libraries(media_trick_play_unittest
|
||||||
|
media_base
|
||||||
|
media_trick_play
|
||||||
|
media_handler_test_base
|
||||||
|
status
|
||||||
|
gmock
|
||||||
|
gtest
|
||||||
|
gtest_main)
|
||||||
|
|
||||||
|
add_test(NAME media_trick_play_unittest COMMAND media_trick_play_unittest)
|
|
@ -1,38 +0,0 @@
|
||||||
# Copyright 2017 Google LLC. All rights reserved.
|
|
||||||
#
|
|
||||||
# Use of this source code is governed by a BSD-style
|
|
||||||
# license that can be found in the LICENSE file or at
|
|
||||||
# https://developers.google.com/open-source/licenses/bsd
|
|
||||||
|
|
||||||
{
|
|
||||||
'variables': {
|
|
||||||
'shaka_code': 1,
|
|
||||||
},
|
|
||||||
'targets': [
|
|
||||||
{
|
|
||||||
'target_name': 'trick_play',
|
|
||||||
'type': '<(component)',
|
|
||||||
'sources': [
|
|
||||||
'trick_play_handler.cc',
|
|
||||||
'trick_play_handler.h',
|
|
||||||
],
|
|
||||||
'dependencies': [
|
|
||||||
'../base/media_base.gyp:media_base',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'target_name': 'trick_play_unittest',
|
|
||||||
'type': '<(gtest_target_type)',
|
|
||||||
'sources': [
|
|
||||||
'trick_play_handler_unittest.cc',
|
|
||||||
],
|
|
||||||
'dependencies': [
|
|
||||||
'../../testing/gtest.gyp:gtest',
|
|
||||||
'../../testing/gmock.gyp:gmock',
|
|
||||||
'../base/media_base.gyp:media_handler_test_base',
|
|
||||||
'../test/media_test.gyp:media_test_support',
|
|
||||||
'trick_play',
|
|
||||||
]
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
|
@ -6,8 +6,9 @@
|
||||||
|
|
||||||
#include "packager/media/trick_play/trick_play_handler.h"
|
#include "packager/media/trick_play/trick_play_handler.h"
|
||||||
|
|
||||||
#include "packager/base/logging.h"
|
#include "glog/logging.h"
|
||||||
#include "packager/media/base/video_stream_info.h"
|
#include "packager/media/base/video_stream_info.h"
|
||||||
|
#include "packager/status/status.h"
|
||||||
|
|
||||||
namespace shaka {
|
namespace shaka {
|
||||||
namespace media {
|
namespace media {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "packager/media/base/audio_stream_info.h"
|
#include "packager/media/base/audio_stream_info.h"
|
||||||
#include "packager/media/base/media_handler_test_base.h"
|
#include "packager/media/base/media_handler_test_base.h"
|
||||||
#include "packager/media/base/video_stream_info.h"
|
#include "packager/media/base/video_stream_info.h"
|
||||||
#include "packager/status_test_util.h"
|
#include "packager/status/status_test_util.h"
|
||||||
|
|
||||||
using ::testing::_;
|
using ::testing::_;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,9 @@ set(protobuf_DISABLE_RTTI ON)
|
||||||
# The latest version of protobuf requires a path to ABSL.
|
# The latest version of protobuf requires a path to ABSL.
|
||||||
set(ABSL_ROOT_DIR get_filename_component(ABSOLUTE_PATH ../abseil-cpp/source ABSOLUTE))
|
set(ABSL_ROOT_DIR get_filename_component(ABSOLUTE_PATH ../abseil-cpp/source ABSOLUTE))
|
||||||
|
|
||||||
|
# Make sure protoc links against the same MSVC runtime as internal libs.
|
||||||
|
set(protobuf_MSVC_STATIC_RUNTIME OFF)
|
||||||
|
|
||||||
# Disable these errors/warnings:
|
# Disable these errors/warnings:
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
|
|
Loading…
Reference in New Issue