diff --git a/packager/app/packager_main.cc b/packager/app/packager_main.cc index 08fd41b7f3..330f6978eb 100644 --- a/packager/app/packager_main.cc +++ b/packager/app/packager_main.cc @@ -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(); diff --git a/packager/app/packager_util.cc b/packager/app/packager_util.cc index 137cbc2638..d09c13607a 100644 --- a/packager/app/packager_util.cc +++ b/packager/app/packager_util.cc @@ -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 { diff --git a/packager/app/packager_util.h b/packager/app/packager_util.h index 6a8c141780..5b00865a79 100644 --- a/packager/app/packager_util.h +++ b/packager/app/packager_util.h @@ -29,7 +29,6 @@ namespace media { class MediaHandler; class KeySource; -class Status; struct ChunkingOptions; struct EncryptionOptions; struct MuxerOptions; diff --git a/packager/media/base/buffer_writer.h b/packager/media/base/buffer_writer.h index 7dab0c25da..7713875553 100644 --- a/packager/media/base/buffer_writer.h +++ b/packager/media/base/buffer_writer.h @@ -10,7 +10,7 @@ #include #include "packager/base/macros.h" -#include "packager/media/base/status.h" +#include "packager/status.h" namespace shaka { namespace media { diff --git a/packager/media/base/buffer_writer_unittest.cc b/packager/media/base/buffer_writer_unittest.cc index 80107e0e23..9bc6c6bad5 100644 --- a/packager/media/base/buffer_writer_unittest.cc +++ b/packager/media/base/buffer_writer_unittest.cc @@ -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; diff --git a/packager/media/base/fixed_key_source_unittest.cc b/packager/media/base/fixed_key_source_unittest.cc index e86f469f60..eb48065053 100644 --- a/packager/media/base/fixed_key_source_unittest.cc +++ b/packager/media/base/fixed_key_source_unittest.cc @@ -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 { \ diff --git a/packager/media/base/http_key_fetcher.h b/packager/media/base/http_key_fetcher.h index a668f58e3f..da4e650cdd 100644 --- a/packager/media/base/http_key_fetcher.h +++ b/packager/media/base/http_key_fetcher.h @@ -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 { diff --git a/packager/media/base/http_key_fetcher_unittest.cc b/packager/media/base/http_key_fetcher_unittest.cc index 6e4296a608..40fce9aef0 100644 --- a/packager/media/base/http_key_fetcher_unittest.cc +++ b/packager/media/base/http_key_fetcher_unittest.cc @@ -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"; diff --git a/packager/media/base/key_fetcher.h b/packager/media/base/key_fetcher.h index 4705062f63..c94cbdff33 100644 --- a/packager/media/base/key_fetcher.h +++ b/packager/media/base/key_fetcher.h @@ -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 { diff --git a/packager/media/base/key_source.h b/packager/media/base/key_source.h index 59932a9a9b..1cf1fc87d6 100644 --- a/packager/media/base/key_source.h +++ b/packager/media/base/key_source.h @@ -11,7 +11,7 @@ #include #include "packager/media/base/protection_system_specific_info.h" -#include "packager/media/base/status.h" +#include "packager/status.h" namespace shaka { namespace media { diff --git a/packager/media/base/media_base.gyp b/packager/media/base/media_base.gyp index c849a0e410..d214eedd14 100644 --- a/packager/media/base/media_base.gyp +++ b/packager/media/base/media_base.gyp @@ -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', diff --git a/packager/media/base/media_handler.h b/packager/media/base/media_handler.h index b7d1024786..85fc909047 100644 --- a/packager/media/base/media_handler.h +++ b/packager/media/base/media_handler.h @@ -12,9 +12,9 @@ #include #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 { diff --git a/packager/media/base/media_handler_test_base.cc b/packager/media/base/media_handler_test_base.cc index 6192f8a8c3..ca13d1c56f 100644 --- a/packager/media/base/media_handler_test_base.cc +++ b/packager/media/base/media_handler_test_base.cc @@ -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 { diff --git a/packager/media/base/muxer.h b/packager/media/base/muxer.h index 6adaa6f075..7839c0b28d 100644 --- a/packager/media/base/muxer.h +++ b/packager/media/base/muxer.h @@ -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 { diff --git a/packager/media/base/playready_key_source.cc b/packager/media/base/playready_key_source.cc index 8094d3979e..545a1446de 100644 --- a/packager/media/base/playready_key_source.cc +++ b/packager/media/base/playready_key_source.cc @@ -89,9 +89,9 @@ std::vector ConvertGuidEndianness(const std::vector& 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& key_id, - const std::vector& key, - std::vector* output) { +Status GeneratePlayReadyPsshData(const std::vector& key_id, + const std::vector& key, + std::vector* output) { CHECK(output); std::vector key_id_converted = ConvertGuidEndianness(key_id); std::vector encrypted_key_id(key_id_converted.size()); @@ -118,7 +118,7 @@ shaka::media::Status GeneratePlayReadyPsshData(const std::vector& key_i // 'PlayReady Header Object' document. Note data is in little endian format. std::vector record_value = std::vector(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(record_type & 0xff)); @@ -133,7 +133,7 @@ shaka::media::Status GeneratePlayReadyPsshData(const std::vector& 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& key_i *output = std::vector(writer_pr_header_object.Buffer(), writer_pr_header_object.Buffer() + writer_pr_header_object.Size()); - return shaka::media::Status::OK; + return Status::OK; } } // namespace diff --git a/packager/media/base/producer_consumer_queue.h b/packager/media/base/producer_consumer_queue.h index 9e07f785f1..b88ba49221 100644 --- a/packager/media/base/producer_consumer_queue.h +++ b/packager/media/base/producer_consumer_queue.h @@ -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 { diff --git a/packager/media/base/producer_consumer_queue_unittest.cc b/packager/media/base/producer_consumer_queue_unittest.cc index 3b1b26daa1..46868a9b5c 100644 --- a/packager/media/base/producer_consumer_queue_unittest.cc +++ b/packager/media/base/producer_consumer_queue_unittest.cc @@ -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 { diff --git a/packager/media/base/status_test_util_unittest.cc b/packager/media/base/status_test_util_unittest.cc index 2c333efcc3..c9fd2029d7 100644 --- a/packager/media/base/status_test_util_unittest.cc +++ b/packager/media/base/status_test_util_unittest.cc @@ -6,7 +6,7 @@ #include -#include "packager/media/base/test/status_test_util.h" +#include "packager/status_test_util.h" namespace shaka { namespace media { diff --git a/packager/media/base/test/status_test_util.h b/packager/media/base/test/status_test_util.h deleted file mode 100644 index 6eabf5ee24..0000000000 --- a/packager/media/base/test/status_test_util.h +++ /dev/null @@ -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 - -#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_ diff --git a/packager/media/base/widevine_key_source_unittest.cc b/packager/media/base/widevine_key_source_unittest.cc index 6490ae3bba..749d2ef2d9 100644 --- a/packager/media/base/widevine_key_source_unittest.cc +++ b/packager/media/base/widevine_key_source_unittest.cc @@ -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; diff --git a/packager/media/chunking/chunking_handler_unittest.cc b/packager/media/chunking/chunking_handler_unittest.cc index 3c8953c3e5..5e69169bd2 100644 --- a/packager/media/chunking/chunking_handler_unittest.cc +++ b/packager/media/chunking/chunking_handler_unittest.cc @@ -10,7 +10,7 @@ #include #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; diff --git a/packager/media/crypto/encryption_handler_unittest.cc b/packager/media/crypto/encryption_handler_unittest.cc index 7196881632..554e21f353 100644 --- a/packager/media/crypto/encryption_handler_unittest.cc +++ b/packager/media/crypto/encryption_handler_unittest.cc @@ -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 { diff --git a/packager/media/demuxer/demuxer.h b/packager/media/demuxer/demuxer.h index 31b57609a3..a9a45864b0 100644 --- a/packager/media/demuxer/demuxer.h +++ b/packager/media/demuxer/demuxer.h @@ -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 { diff --git a/packager/media/demuxer/demuxer_unittest.cc b/packager/media/demuxer/demuxer_unittest.cc index 2bc8b56fbc..6335f5c5de 100644 --- a/packager/media/demuxer/demuxer_unittest.cc +++ b/packager/media/demuxer/demuxer_unittest.cc @@ -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 { diff --git a/packager/media/formats/mp2t/ts_segmenter.cc b/packager/media/formats/mp2t/ts_segmenter.cc index 7d5209590b..f9e2dde3c3 100644 --- a/packager/media/formats/mp2t/ts_segmenter.cc +++ b/packager/media/formats/mp2t/ts_segmenter.cc @@ -9,8 +9,8 @@ #include #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 { diff --git a/packager/media/formats/mp2t/ts_segmenter.h b/packager/media/formats/mp2t/ts_segmenter.h index 468d5cafa0..87b270b21f 100644 --- a/packager/media/formats/mp2t/ts_segmenter.h +++ b/packager/media/formats/mp2t/ts_segmenter.h @@ -9,10 +9,10 @@ #include #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 { diff --git a/packager/media/formats/mp2t/ts_segmenter_unittest.cc b/packager/media/formats/mp2t/ts_segmenter_unittest.cc index 088eb51b80..4073d37c89 100644 --- a/packager/media/formats/mp2t/ts_segmenter_unittest.cc +++ b/packager/media/formats/mp2t/ts_segmenter_unittest.cc @@ -8,10 +8,10 @@ #include #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 { diff --git a/packager/media/formats/mp4/fragmenter.h b/packager/media/formats/mp4/fragmenter.h index d1eef2786a..36856e577a 100644 --- a/packager/media/formats/mp4/fragmenter.h +++ b/packager/media/formats/mp4/fragmenter.h @@ -11,7 +11,7 @@ #include #include "packager/base/logging.h" -#include "packager/media/base/status.h" +#include "packager/status.h" namespace shaka { namespace media { diff --git a/packager/media/formats/mp4/segmenter.h b/packager/media/formats/mp4/segmenter.h index 9956414c15..8e91ecbd68 100644 --- a/packager/media/formats/mp4/segmenter.h +++ b/packager/media/formats/mp4/segmenter.h @@ -12,8 +12,8 @@ #include #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 { diff --git a/packager/media/formats/webm/encryptor.h b/packager/media/formats/webm/encryptor.h index b0c5400ee0..e284be078b 100644 --- a/packager/media/formats/webm/encryptor.h +++ b/packager/media/formats/webm/encryptor.h @@ -9,7 +9,7 @@ #include -#include "packager/media/base/status.h" +#include "packager/status.h" #include "packager/third_party/libwebm/src/mkvmuxer.hpp" namespace shaka { diff --git a/packager/media/formats/webm/encryptor_unittest.cc b/packager/media/formats/webm/encryptor_unittest.cc index 42155450f1..13e2e275e4 100644 --- a/packager/media/formats/webm/encryptor_unittest.cc +++ b/packager/media/formats/webm/encryptor_unittest.cc @@ -9,8 +9,8 @@ #include #include #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 { diff --git a/packager/media/formats/webm/mkv_writer.h b/packager/media/formats/webm/mkv_writer.h index 2edae29e1c..4ce4b7432a 100644 --- a/packager/media/formats/webm/mkv_writer.h +++ b/packager/media/formats/webm/mkv_writer.h @@ -10,8 +10,8 @@ #include #include -#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 { diff --git a/packager/media/formats/webm/multi_segment_segmenter.h b/packager/media/formats/webm/multi_segment_segmenter.h index 0a7976cc88..af8b816f23 100644 --- a/packager/media/formats/webm/multi_segment_segmenter.h +++ b/packager/media/formats/webm/multi_segment_segmenter.h @@ -8,9 +8,9 @@ #define MEDIA_FORMATS_WEBM_MULTI_SEGMENT_SEGMENTER_H_ #include -#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 { diff --git a/packager/media/formats/webm/segmenter.h b/packager/media/formats/webm/segmenter.h index 0c73877870..69a7e22ed7 100644 --- a/packager/media/formats/webm/segmenter.h +++ b/packager/media/formats/webm/segmenter.h @@ -8,9 +8,9 @@ #define MEDIA_FORMATS_WEBM_SEGMENTER_H_ #include -#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 { diff --git a/packager/media/formats/webm/segmenter_test_base.h b/packager/media/formats/webm/segmenter_test_base.h index e77fc6637c..0e70610a6d 100644 --- a/packager/media/formats/webm/segmenter_test_base.h +++ b/packager/media/formats/webm/segmenter_test_base.h @@ -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 { diff --git a/packager/media/formats/webm/single_segment_segmenter.h b/packager/media/formats/webm/single_segment_segmenter.h index 9707705e32..811fd59599 100644 --- a/packager/media/formats/webm/single_segment_segmenter.h +++ b/packager/media/formats/webm/single_segment_segmenter.h @@ -10,8 +10,8 @@ #include "packager/media/formats/webm/segmenter.h" #include -#include "packager/media/base/status.h" #include "packager/media/formats/webm/mkv_writer.h" +#include "packager/status.h" namespace shaka { namespace media { diff --git a/packager/media/formats/webm/two_pass_single_segment_segmenter.h b/packager/media/formats/webm/two_pass_single_segment_segmenter.h index f84eee4e4c..ce916a3a33 100644 --- a/packager/media/formats/webm/two_pass_single_segment_segmenter.h +++ b/packager/media/formats/webm/two_pass_single_segment_segmenter.h @@ -10,9 +10,9 @@ #include #include -#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 { diff --git a/packager/media/formats/webvtt/webvtt_sample_converter.h b/packager/media/formats/webvtt/webvtt_sample_converter.h index 6355342b93..de2a9527f0 100644 --- a/packager/media/formats/webvtt/webvtt_sample_converter.h +++ b/packager/media/formats/webvtt/webvtt_sample_converter.h @@ -10,10 +10,10 @@ #include #include -#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 { diff --git a/packager/media/formats/webvtt/webvtt_sample_converter_unittest.cc b/packager/media/formats/webvtt/webvtt_sample_converter_unittest.cc index e6bb6bb48d..e9cbe744c0 100644 --- a/packager/media/formats/webvtt/webvtt_sample_converter_unittest.cc +++ b/packager/media/formats/webvtt/webvtt_sample_converter_unittest.cc @@ -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 { diff --git a/packager/media/formats/wvm/wvm_media_parser.cc b/packager/media/formats/wvm/wvm_media_parser.cc index e419c6b2f2..eee6fcd5f7 100644 --- a/packager/media/formats/wvm/wvm_media_parser.cc +++ b/packager/media/formats/wvm/wvm_media_parser.cc @@ -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) \ diff --git a/packager/media/trick_play/trick_play_handler_unittest.cc b/packager/media/trick_play/trick_play_handler_unittest.cc index 17be948fe3..560072f791 100644 --- a/packager/media/trick_play/trick_play_handler_unittest.cc +++ b/packager/media/trick_play/trick_play_handler_unittest.cc @@ -10,8 +10,8 @@ #include #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; diff --git a/packager/packager.cc b/packager/packager.cc index a8427994c7..2fbfb837fc 100644 --- a/packager/packager.cc +++ b/packager/packager.cc @@ -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 { diff --git a/packager/packager.gyp b/packager/packager.gyp index ea42eec564..cdc86d60fa 100644 --- a/packager/packager.gyp +++ b/packager/packager.gyp @@ -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', ], }, ], diff --git a/packager/packager.h b/packager/packager.h index 5237cd379d..5025ea212e 100644 --- a/packager/packager.h +++ b/packager/packager.h @@ -14,31 +14,7 @@ #include #include -// 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& 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(); diff --git a/packager/packager_test.cc b/packager/packager_test.cc index 36fc349b3c..49fb7cce6a 100644 --- a/packager/packager_test.cc +++ b/packager/packager_test.cc @@ -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 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. diff --git a/packager/media/base/status.cc b/packager/status.cc similarity index 96% rename from packager/media/base/status.cc rename to packager/status.cc index aa5c3802d9..b866e7ab36 100644 --- a/packager/media/base/status.cc +++ b/packager/status.cc @@ -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 diff --git a/packager/media/base/status.h b/packager/status.h similarity index 86% rename from packager/media/base/status.h rename to packager/status.h index 45f86d4880..28b3066890 100644 --- a/packager/media/base/status.h +++ b/packager/status.h @@ -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 #include +#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_ diff --git a/packager/status_test_util.h b/packager/status_test_util.h new file mode 100644 index 0000000000..2868f6597e --- /dev/null +++ b/packager/status_test_util.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 + +#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_ diff --git a/packager/media/base/status_unittest.cc b/packager/status_unittest.cc similarity index 97% rename from packager/media/base/status_unittest.cc rename to packager/status_unittest.cc index 7e994d13f9..4acc8f9729 100644 --- a/packager/media/base/status_unittest.cc +++ b/packager/status_unittest.cc @@ -8,10 +8,9 @@ #include #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