Move status.h under packager/
Change-Id: I4a7f34c575c1c8b9a9a275f3889cf8641cfdd471
This commit is contained in:
parent
e56d1faaf0
commit
3bad4ca700
|
@ -320,7 +320,7 @@ int PackagerMain(int argc, char** argv) {
|
|||
stream_descriptors.push_back(stream_descriptor.value());
|
||||
}
|
||||
Packager packager;
|
||||
media::Status status =
|
||||
Status status =
|
||||
packager.Initialize(packaging_params.value(), stream_descriptors);
|
||||
if (!status.ok()) {
|
||||
LOG(ERROR) << "Failed to initialize packager: " << status.ToString();
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
#include "packager/media/base/muxer_options.h"
|
||||
#include "packager/media/base/playready_key_source.h"
|
||||
#include "packager/media/base/request_signer.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/media/base/widevine_key_source.h"
|
||||
#include "packager/media/chunking/chunking_handler.h"
|
||||
#include "packager/media/crypto/encryption_handler.h"
|
||||
#include "packager/media/file/file.h"
|
||||
#include "packager/mpd/base/mpd_options.h"
|
||||
#include "packager/packager.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -29,7 +29,6 @@ namespace media {
|
|||
|
||||
class MediaHandler;
|
||||
class KeySource;
|
||||
class Status;
|
||||
struct ChunkingOptions;
|
||||
struct EncryptionOptions;
|
||||
struct MuxerOptions;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "packager/base/macros.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
#include "packager/base/files/file_util.h"
|
||||
#include "packager/media/base/buffer_reader.h"
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/media/file/file.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
namespace {
|
||||
const int kReservedBufferCapacity = 1000;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "packager/base/strings/string_number_conversions.h"
|
||||
#include "packager/media/base/fixed_key_source.h"
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
#define EXPECT_HEX_EQ(expected, actual) \
|
||||
do { \
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "packager/base/compiler_specific.h"
|
||||
#include "packager/media/base/key_fetcher.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "packager/base/logging.h"
|
||||
#include "packager/base/strings/string_number_conversions.h"
|
||||
#include "packager/base/strings/string_util.h"
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
namespace {
|
||||
const char kTestUrl[] = "http://packager-test.appspot.com/http_test";
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define MEDIA_BASE_KEY_FETCHER_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "packager/media/base/protection_system_specific_info.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -80,8 +80,6 @@
|
|||
'request_signer.h',
|
||||
'rsa_key.cc',
|
||||
'rsa_key.h',
|
||||
'status.cc',
|
||||
'status.h',
|
||||
'stream_info.cc',
|
||||
'stream_info.h',
|
||||
'text_sample.cc',
|
||||
|
@ -100,6 +98,7 @@
|
|||
'dependencies': [
|
||||
'widevine_pssh_data_proto',
|
||||
'../../base/base.gyp:base',
|
||||
'../../packager.gyp:status',
|
||||
'../../third_party/boringssl/boringssl.gyp:boringssl',
|
||||
'../../third_party/curl/curl.gyp:libcurl',
|
||||
'../../third_party/libxml/libxml.gyp:libxml',
|
||||
|
@ -150,17 +149,15 @@
|
|||
'protection_system_specific_info_unittest.cc',
|
||||
'rsa_key_unittest.cc',
|
||||
'status_test_util_unittest.cc',
|
||||
'status_unittest.cc',
|
||||
'test/fake_prng.cc', # For rsa_key_unittest
|
||||
'test/fake_prng.h', # For rsa_key_unittest
|
||||
'test/rsa_test_data.cc', # For rsa_key_unittest
|
||||
'test/rsa_test_data.h', # For rsa_key_unittest
|
||||
'test/status_test_util.h',
|
||||
'widevine_key_source_unittest.cc',
|
||||
],
|
||||
'dependencies': [
|
||||
'../../testing/gtest.gyp:gtest',
|
||||
'../../testing/gmock.gyp:gmock',
|
||||
'../../testing/gtest.gyp:gtest',
|
||||
'../../third_party/boringssl/boringssl.gyp:boringssl',
|
||||
'../file/file.gyp:file',
|
||||
'../test/media_test.gyp:media_test_support',
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
#include <utility>
|
||||
|
||||
#include "packager/media/base/media_sample.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/media/base/stream_info.h"
|
||||
#include "packager/media/base/text_sample.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#include "packager/media/base/media_handler_test_base.h"
|
||||
|
||||
#include "packager/media/base/audio_stream_info.h"
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/media/base/video_stream_info.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
#include "packager/base/time/clock.h"
|
||||
#include "packager/media/base/media_handler.h"
|
||||
#include "packager/media/base/muxer_options.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/media/event/muxer_listener.h"
|
||||
#include "packager/media/event/progress_listener.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -89,7 +89,7 @@ std::vector<uint8_t> ConvertGuidEndianness(const std::vector<uint8_t>& input) {
|
|||
// PlayReady PSSH Data is a PlayReady Header Object.
|
||||
// Format is outlined in the following document.
|
||||
// http://download.microsoft.com/download/2/3/8/238F67D9-1B8B-48D3-AB83-9C00112268B2/PlayReady%20Header%20Object%202015-08-13-FINAL-CL.PDF
|
||||
shaka::media::Status GeneratePlayReadyPsshData(const std::vector<uint8_t>& key_id,
|
||||
Status GeneratePlayReadyPsshData(const std::vector<uint8_t>& key_id,
|
||||
const std::vector<uint8_t>& key,
|
||||
std::vector<uint8_t>* output) {
|
||||
CHECK(output);
|
||||
|
@ -118,7 +118,7 @@ shaka::media::Status GeneratePlayReadyPsshData(const std::vector<uint8_t>& key_i
|
|||
// 'PlayReady Header Object' document. Note data is in little endian format.
|
||||
std::vector<uint16_t> record_value =
|
||||
std::vector<uint16_t>(playready_header.begin(), playready_header.end());
|
||||
shaka::media::BufferWriter writer_pr_record;
|
||||
BufferWriter writer_pr_record;
|
||||
uint16_t record_type = 1; // Indicates that the record contains a rights management header.
|
||||
uint16_t record_length = record_value.size() * 2;
|
||||
writer_pr_record.AppendInt(static_cast<uint8_t>(record_type & 0xff));
|
||||
|
@ -133,7 +133,7 @@ shaka::media::Status GeneratePlayReadyPsshData(const std::vector<uint8_t>& key_i
|
|||
// Create the PlayReady Header object.
|
||||
// Outline in section '1.PlayReady Header Objects' of
|
||||
// 'PlayReady Header Object' document. Note data is in little endian format.
|
||||
shaka::media::BufferWriter writer_pr_header_object;
|
||||
BufferWriter writer_pr_header_object;
|
||||
uint32_t playready_header_length = writer_pr_record.Size() + 4 + 2;
|
||||
uint16_t record_count = 1;
|
||||
writer_pr_header_object.AppendInt(
|
||||
|
@ -152,7 +152,7 @@ shaka::media::Status GeneratePlayReadyPsshData(const std::vector<uint8_t>& key_i
|
|||
*output = std::vector<uint8_t>(writer_pr_header_object.Buffer(),
|
||||
writer_pr_header_object.Buffer() +
|
||||
writer_pr_header_object.Size());
|
||||
return shaka::media::Status::OK;
|
||||
return Status::OK;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "packager/base/synchronization/condition_variable.h"
|
||||
#include "packager/base/synchronization/lock.h"
|
||||
#include "packager/base/timer/elapsed_timer.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "packager/base/synchronization/waitable_event.h"
|
||||
#include "packager/media/base/closure_thread.h"
|
||||
#include "packager/media/base/producer_consumer_queue.h"
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <gtest/gtest-spi.h>
|
||||
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
// Copyright 2014 Google Inc. 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
|
||||
|
||||
#ifndef MEDIA_BASE_STATUS_TEST_UTIL_H_
|
||||
#define MEDIA_BASE_STATUS_TEST_UTIL_H_
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "packager/media/base/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
||||
#define EXPECT_OK(val) EXPECT_EQ(Status::OK, (val))
|
||||
#define ASSERT_OK(val) ASSERT_EQ(Status::OK, (val))
|
||||
|
||||
} // namespace media
|
||||
} // namespace shaka
|
||||
|
||||
#endif // MEDIA_BASE_STATUS_TEST_UTIL_H_
|
|
@ -15,8 +15,8 @@
|
|||
#include "packager/media/base/fixed_key_source.h"
|
||||
#include "packager/media/base/key_fetcher.h"
|
||||
#include "packager/media/base/request_signer.h"
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/media/base/widevine_key_source.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::Bool;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "packager/media/base/media_handler_test_base.h"
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
using ::testing::ElementsAre;
|
||||
using ::testing::IsEmpty;
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
#include "packager/media/base/aes_pattern_cryptor.h"
|
||||
#include "packager/media/base/fixed_key_source.h"
|
||||
#include "packager/media/base/media_handler_test_base.h"
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/media/codecs/video_slice_header_parser.h"
|
||||
#include "packager/media/codecs/vpx_parser.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "packager/base/compiler_specific.h"
|
||||
#include "packager/media/base/container_names.h"
|
||||
#include "packager/media/base/media_handler.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
#include "packager/media/base/fixed_key_source.h"
|
||||
#include "packager/media/base/media_handler_test_base.h"
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/media/test/test_data_util.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#include <memory>
|
||||
|
||||
#include "packager/media/base/muxer_util.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/media/event/muxer_listener.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
#include <memory>
|
||||
#include "packager/media/base/muxer_options.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/media/file/file.h"
|
||||
#include "packager/media/formats/mp2t/pes_packet_generator.h"
|
||||
#include "packager/media/formats/mp2t/ts_writer.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "packager/media/base/audio_stream_info.h"
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/media/base/video_stream_info.h"
|
||||
#include "packager/media/event/mock_muxer_listener.h"
|
||||
#include "packager/media/formats/mp2t/ts_segmenter.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "packager/base/logging.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include <vector>
|
||||
|
||||
#include "packager/media/base/fourccs.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/media/formats/mp4/box_definitions.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/status.h"
|
||||
#include "packager/third_party/libwebm/src/mkvmuxer.hpp"
|
||||
|
||||
namespace shaka {
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <memory>
|
||||
#include "packager/media/base/media_sample.h"
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/media/formats/webm/webm_constants.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/media/file/file_closer.h"
|
||||
#include "packager/status.h"
|
||||
#include "packager/third_party/libwebm/src/mkvmuxer.hpp"
|
||||
|
||||
namespace shaka {
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#define MEDIA_FORMATS_WEBM_MULTI_SEGMENT_SEGMENTER_H_
|
||||
|
||||
#include <memory>
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/media/formats/webm/mkv_writer.h"
|
||||
#include "packager/media/formats/webm/segmenter.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#define MEDIA_FORMATS_WEBM_SEGMENTER_H_
|
||||
|
||||
#include <memory>
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/media/formats/webm/mkv_writer.h"
|
||||
#include "packager/media/formats/webm/seek_head.h"
|
||||
#include "packager/status.h"
|
||||
#include "packager/third_party/libwebm/src/mkvmuxer.hpp"
|
||||
|
||||
namespace shaka {
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
|
||||
#include "packager/media/base/media_sample.h"
|
||||
#include "packager/media/base/muxer_options.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/media/base/stream_info.h"
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/media/base/video_stream_info.h"
|
||||
#include "packager/media/file/file_closer.h"
|
||||
#include "packager/media/file/file_test_util.h"
|
||||
|
@ -21,6 +19,8 @@
|
|||
#include "packager/media/formats/webm/mkv_writer.h"
|
||||
#include "packager/media/formats/webm/segmenter.h"
|
||||
#include "packager/media/formats/webm/webm_parser.h"
|
||||
#include "packager/status.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include "packager/media/formats/webm/segmenter.h"
|
||||
|
||||
#include <memory>
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/media/formats/webm/mkv_writer.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/media/formats/webm/mkv_writer.h"
|
||||
#include "packager/media/formats/webm/single_segment_segmenter.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
#include <stdint.h>
|
||||
#include <list>
|
||||
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/media/formats/mp4/box.h"
|
||||
#include "packager/media/formats/mp4/box_definitions.h"
|
||||
#include "packager/media/formats/webvtt/cue.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "packager/base/strings/string_number_conversions.h"
|
||||
#include "packager/media/base/media_sample.h"
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
#include "packager/media/base/audio_stream_info.h"
|
||||
#include "packager/media/base/key_source.h"
|
||||
#include "packager/media/base/media_sample.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/media/base/video_stream_info.h"
|
||||
#include "packager/media/codecs/aac_audio_specific_config.h"
|
||||
#include "packager/media/codecs/avc_decoder_configuration_record.h"
|
||||
#include "packager/media/codecs/es_descriptor.h"
|
||||
#include "packager/media/formats/mp2t/adts_header.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
#define HAS_HEADER_EXTENSION(x) ((x != 0xBC) && (x != 0xBE) && (x != 0xBF) \
|
||||
&& (x != 0xF0) && (x != 0xF2) && (x != 0xF8) \
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "packager/media/base/media_handler_test_base.h"
|
||||
#include "packager/media/base/test/status_test_util.h"
|
||||
#include "packager/media/base/video_stream_info.h"
|
||||
#include "packager/status_test_util.h"
|
||||
|
||||
using ::testing::ElementsAre;
|
||||
using ::testing::IsEmpty;
|
||||
|
|
|
@ -48,8 +48,6 @@ using media::Demuxer;
|
|||
using media::EncryptionOptions;
|
||||
using media::KeySource;
|
||||
using media::MuxerOptions;
|
||||
using media::Status;
|
||||
namespace error = media::error;
|
||||
|
||||
namespace media {
|
||||
namespace {
|
||||
|
|
|
@ -136,6 +136,38 @@
|
|||
}],
|
||||
'dependencies': ['packager'],
|
||||
},
|
||||
{
|
||||
'target_name': 'status',
|
||||
'type': '<(component)',
|
||||
'sources': [
|
||||
'status.cc',
|
||||
'status.h',
|
||||
],
|
||||
'dependencies': [
|
||||
'base/base.gyp:base',
|
||||
],
|
||||
'conditions': [
|
||||
['libpackager_type == "shared_library"', {
|
||||
'defines': [
|
||||
'SHARED_LIBRARY_BUILD',
|
||||
'SHAKA_IMPLEMENTATION',
|
||||
],
|
||||
}],
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'status_unittest',
|
||||
'type': '<(gtest_target_type)',
|
||||
'sources': [
|
||||
'status_unittest.cc',
|
||||
],
|
||||
'dependencies': [
|
||||
'status',
|
||||
'testing/gmock.gyp:gmock',
|
||||
'testing/gtest.gyp:gtest',
|
||||
'testing/gtest.gyp:gtest_main',
|
||||
]
|
||||
},
|
||||
{
|
||||
'target_name': 'packager_builder_tests',
|
||||
'type': 'none',
|
||||
|
@ -156,6 +188,7 @@
|
|||
'media/trick_play/trick_play.gyp:trick_play_unittest',
|
||||
'mpd/mpd.gyp:mpd_unittest',
|
||||
'packager_test',
|
||||
'status_unittest',
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
@ -14,31 +14,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// TODO(kqyang): Refactor status.h and move it under packager/.
|
||||
#include "packager/media/base/status.h"
|
||||
|
||||
#if defined(SHARED_LIBRARY_BUILD)
|
||||
#if defined(OS_WIN)
|
||||
|
||||
#if defined(SHAKA_IMPLEMENTATION)
|
||||
#define SHAKA_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define SHAKA_EXPORT __declspec(dllimport)
|
||||
#endif // defined(SHAKA_IMPLEMENTATION)
|
||||
|
||||
#else // defined(OS_WIN)
|
||||
|
||||
#if defined(SHAKA_IMPLEMENTATION)
|
||||
#define SHAKA_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
#define SHAKA_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
#else // defined(SHARED_LIBRARY_BUILD)
|
||||
#define SHAKA_EXPORT
|
||||
#endif // defined(SHARED_LIBRARY_BUILD)
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
|
||||
|
@ -454,14 +430,14 @@ class SHAKA_EXPORT Packager {
|
|||
/// @param packaging_params contains the packaging parameters.
|
||||
/// @param stream_descriptors a list of stream descriptors.
|
||||
/// @return OK on success, an appropriate error code on failure.
|
||||
media::Status Initialize(
|
||||
Status Initialize(
|
||||
const PackagingParams& packaging_params,
|
||||
const std::vector<StreamDescriptor>& stream_descriptors);
|
||||
|
||||
/// Run the pipeline to completion (or failed / been cancelled). Note
|
||||
/// that it blocks until completion.
|
||||
/// @return OK on success, an appropriate error code on failure.
|
||||
media::Status Run();
|
||||
Status Run();
|
||||
|
||||
/// Cancel packaging. Note that it has to be called from another thread.
|
||||
void Cancel();
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
namespace shaka {
|
||||
namespace {
|
||||
|
||||
using media::Status;
|
||||
const char kTestFile[] = "bear-640x360.mp4";
|
||||
const char kOutputVideo[] = "output_video.mp4";
|
||||
const char kOutputVideoTemplate[] = "output_video_$Number$.m4s";
|
||||
|
@ -103,17 +102,16 @@ TEST_F(PackagerTest, Version) {
|
|||
|
||||
TEST_F(PackagerTest, Success) {
|
||||
Packager packager;
|
||||
ASSERT_TRUE(
|
||||
packager.Initialize(SetupPackagingParams(), SetupStreamDescriptors())
|
||||
.ok());
|
||||
ASSERT_TRUE(packager.Run().ok());
|
||||
ASSERT_EQ(Status::OK, packager.Initialize(SetupPackagingParams(),
|
||||
SetupStreamDescriptors()));
|
||||
ASSERT_EQ(Status::OK, packager.Run());
|
||||
}
|
||||
|
||||
TEST_F(PackagerTest, MissingStreamDescriptors) {
|
||||
std::vector<StreamDescriptor> stream_descriptors;
|
||||
Packager packager;
|
||||
auto status = packager.Initialize(SetupPackagingParams(), stream_descriptors);
|
||||
ASSERT_EQ(media::error::INVALID_ARGUMENT, status.error_code());
|
||||
ASSERT_EQ(error::INVALID_ARGUMENT, status.error_code());
|
||||
}
|
||||
|
||||
TEST_F(PackagerTest, MixingSegmentTemplateAndSingleSegment) {
|
||||
|
@ -134,7 +132,7 @@ TEST_F(PackagerTest, MixingSegmentTemplateAndSingleSegment) {
|
|||
|
||||
Packager packager;
|
||||
auto status = packager.Initialize(SetupPackagingParams(), stream_descriptors);
|
||||
ASSERT_EQ(media::error::INVALID_ARGUMENT, status.error_code());
|
||||
ASSERT_EQ(error::INVALID_ARGUMENT, status.error_code());
|
||||
}
|
||||
|
||||
TEST_F(PackagerTest, SegmentAlignedAndSubsegmentNotAligned) {
|
||||
|
@ -142,9 +140,9 @@ TEST_F(PackagerTest, SegmentAlignedAndSubsegmentNotAligned) {
|
|||
packaging_params.chunking_params.segment_sap_aligned = true;
|
||||
packaging_params.chunking_params.subsegment_sap_aligned = false;
|
||||
Packager packager;
|
||||
ASSERT_TRUE(
|
||||
packager.Initialize(packaging_params, SetupStreamDescriptors()).ok());
|
||||
ASSERT_TRUE(packager.Run().ok());
|
||||
ASSERT_EQ(Status::OK,
|
||||
packager.Initialize(packaging_params, SetupStreamDescriptors()));
|
||||
ASSERT_EQ(Status::OK, packager.Run());
|
||||
}
|
||||
|
||||
TEST_F(PackagerTest, SegmentNotAlignedButSubsegmentAligned) {
|
||||
|
@ -153,7 +151,7 @@ TEST_F(PackagerTest, SegmentNotAlignedButSubsegmentAligned) {
|
|||
packaging_params.chunking_params.subsegment_sap_aligned = true;
|
||||
Packager packager;
|
||||
auto status = packager.Initialize(packaging_params, SetupStreamDescriptors());
|
||||
ASSERT_EQ(media::error::INVALID_ARGUMENT, status.error_code());
|
||||
ASSERT_EQ(error::INVALID_ARGUMENT, status.error_code());
|
||||
}
|
||||
|
||||
// TODO(kqyang): Add more tests.
|
||||
|
|
|
@ -4,13 +4,12 @@
|
|||
// license that can be found in the LICENSE file or at
|
||||
// https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
#include "packager/base/logging.h"
|
||||
#include "packager/base/strings/stringprintf.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
||||
namespace error {
|
||||
namespace {
|
||||
|
@ -80,5 +79,4 @@ std::ostream& operator<<(std::ostream& os, const Status& x) {
|
|||
return os;
|
||||
}
|
||||
|
||||
} // namespace media
|
||||
} // namespace shaka
|
|
@ -4,14 +4,36 @@
|
|||
// license that can be found in the LICENSE file or at
|
||||
// https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
#ifndef MEDIA_BASE_STATUS_H_
|
||||
#define MEDIA_BASE_STATUS_H_
|
||||
#ifndef PACKAGER_STATUS_H_
|
||||
#define PACKAGER_STATUS_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#if defined(SHARED_LIBRARY_BUILD)
|
||||
#if defined(OS_WIN)
|
||||
|
||||
#if defined(SHAKA_IMPLEMENTATION)
|
||||
#define SHAKA_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define SHAKA_EXPORT __declspec(dllimport)
|
||||
#endif // defined(SHAKA_IMPLEMENTATION)
|
||||
|
||||
#else // defined(OS_WIN)
|
||||
|
||||
#if defined(SHAKA_IMPLEMENTATION)
|
||||
#define SHAKA_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
#define SHAKA_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
#else // defined(SHARED_LIBRARY_BUILD)
|
||||
#define SHAKA_EXPORT
|
||||
#endif // defined(SHARED_LIBRARY_BUILD)
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
||||
namespace error {
|
||||
|
||||
|
@ -85,7 +107,7 @@ enum Code {
|
|||
|
||||
} // namespace error
|
||||
|
||||
class Status {
|
||||
class SHAKA_EXPORT Status {
|
||||
public:
|
||||
/// Creates a "successful" status.
|
||||
Status() : error_code_(error::OK) {}
|
||||
|
@ -170,9 +192,8 @@ class Status {
|
|||
// generated copy constructor and assignment operator.
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Status& x);
|
||||
SHAKA_EXPORT std::ostream& operator<<(std::ostream& os, const Status& x);
|
||||
|
||||
} // namespace media
|
||||
} // namespace shaka
|
||||
|
||||
#endif // MEDIA_BASE_STATUS_H_
|
||||
#endif // PACKAGER_STATUS_H_
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2014 Google Inc. 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
|
||||
|
||||
#ifndef PACKAGER_STATUS_TEST_UTIL_H_
|
||||
#define PACKAGER_STATUS_TEST_UTIL_H_
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "packager/status.h"
|
||||
|
||||
#define EXPECT_OK(val) EXPECT_EQ(shaka::Status::OK, (val))
|
||||
#define ASSERT_OK(val) ASSERT_EQ(shaka::Status::OK, (val))
|
||||
|
||||
#endif // PACKAGER_STATUS_TEST_UTIL_H_
|
|
@ -8,10 +8,9 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "packager/base/strings/string_number_conversions.h"
|
||||
#include "packager/media/base/status.h"
|
||||
#include "packager/status.h"
|
||||
|
||||
namespace shaka {
|
||||
namespace media {
|
||||
|
||||
static void CheckStatus(const Status& s,
|
||||
error::Code code,
|
||||
|
@ -166,5 +165,4 @@ TEST(Status, EqualsDifferentMessage) {
|
|||
Status(error::UNKNOWN, "another"));
|
||||
}
|
||||
|
||||
} // namespace media
|
||||
} // namespace shaka
|
Loading…
Reference in New Issue