From bbcca29013f4329e6706ef11ca9b3f2ccfa623eb Mon Sep 17 00:00:00 2001 From: Kongqun Yang Date: Thu, 19 May 2016 14:38:15 -0700 Subject: [PATCH] Move all code inside top level namespace Change-Id: I83bc081f523dbc5071796a79c2d89b7367ed8d27 --- packager/app/mpd_generator.cc | 2 +- packager/app/packager_main.cc | 32 +++++++++---------- packager/app/packager_util.h | 2 +- .../vod_media_info_dump_muxer_listener.cc | 2 +- packager/media/file/file.cc | 3 +- .../mpd/base/bandwidth_estimator_unittest.cc | 2 +- .../base/dash_iop_mpd_notifier_unittest.cc | 8 ++--- packager/mpd/base/mpd_utils.cc | 3 +- packager/mpd/base/xml/xml_node.cc | 12 +++---- packager/mpd/util/mpd_writer.cc | 2 -- packager/mpd/util/mpd_writer.h | 4 +-- 11 files changed, 29 insertions(+), 43 deletions(-) diff --git a/packager/app/mpd_generator.cc b/packager/app/mpd_generator.cc index b11ae38368..7292c35b99 100644 --- a/packager/app/mpd_generator.cc +++ b/packager/app/mpd_generator.cc @@ -62,7 +62,7 @@ ExitStatus RunMpdGenerator() { base::SplitString(FLAGS_base_urls, ',', &base_urls); } - edash_packager::MpdWriter mpd_writer; + MpdWriter mpd_writer; for (Iterator it = base_urls.begin(); it != base_urls.end(); ++it) mpd_writer.AddBaseUrl(*it); diff --git a/packager/app/packager_main.cc b/packager/app/packager_main.cc index ec103bdee4..76d954199b 100644 --- a/packager/app/packager_main.cc +++ b/packager/app/packager_main.cc @@ -47,7 +47,10 @@ DEFINE_bool(use_fake_clock_for_muxer, "creation time and modification time in outputs are set to 0. " "Should only be used for testing."); +namespace edash_packager { +namespace media { namespace { + const char kUsage[] = "Packager driver program. Usage:\n\n" "%s [flags] ...\n" @@ -89,44 +92,39 @@ enum ExitStatus { // CreateRemuxJobs() shouldn't treat text as a special case. std::string DetermineTextFileFormat(const std::string& file) { std::string content; - if (!edash_packager::media::File::ReadFileToString(file.c_str(), &content)) { + if (!File::ReadFileToString(file.c_str(), &content)) { LOG(ERROR) << "Failed to open file " << file << " to determine file format."; return ""; } - edash_packager::media::MediaContainerName container_name = - edash_packager::media::DetermineContainer( - reinterpret_cast(content.data()), content.size()); - if (container_name == edash_packager::media::CONTAINER_WEBVTT) { + MediaContainerName container_name = DetermineContainer( + reinterpret_cast(content.data()), content.size()); + if (container_name == CONTAINER_WEBVTT) { return "vtt"; - } else if (container_name == edash_packager::media::CONTAINER_TTML) { + } else if (container_name == CONTAINER_TTML) { return "ttml"; } return ""; } -edash_packager::media::FourCC GetProtectionScheme( - const std::string& protection_scheme) { +FourCC GetProtectionScheme(const std::string& protection_scheme) { if (protection_scheme == "cenc") { - return edash_packager::media::FOURCC_cenc; + return FOURCC_cenc; } else if (protection_scheme == "cens") { - return edash_packager::media::FOURCC_cens; + return FOURCC_cens; } else if (protection_scheme == "cbc1") { - return edash_packager::media::FOURCC_cbc1; + return FOURCC_cbc1; } else if (protection_scheme == "cbcs") { - return edash_packager::media::FOURCC_cbcs; + return FOURCC_cbcs; } else { LOG(ERROR) << "Unknown protection scheme: " << protection_scheme; - return edash_packager::media::FOURCC_NULL; + return FOURCC_NULL; } } } // namespace -namespace edash_packager { -namespace media { - // A fake clock that always return time 0 (epoch). Should only be used for // testing. class FakeClock : public base::Clock { @@ -473,7 +471,7 @@ int PackagerMain(int argc, char** argv) { if (!ValidateWidevineCryptoFlags() || !ValidateFixedCryptoFlags()) return kArgumentValidationFailed; - edash_packager::media::LibcryptoThreading libcrypto_threading; + LibcryptoThreading libcrypto_threading; // TODO(tinskip): Make InsertStreamDescriptor a member of // StreamDescriptorList. StreamDescriptorList stream_descriptors; diff --git a/packager/app/packager_util.h b/packager/app/packager_util.h index 4440c38923..9658fec977 100644 --- a/packager/app/packager_util.h +++ b/packager/app/packager_util.h @@ -50,7 +50,7 @@ bool AssignFlagsFromProfile(); bool GetMuxerOptions(MuxerOptions* muxer_options); /// Fill MpdOptions members using provided command line options. -bool GetMpdOptions(edash_packager::MpdOptions* mpd_options); +bool GetMpdOptions(MpdOptions* mpd_options); /// Select and add a stream from a provided set to a muxer. /// @param streams contains the set of MediaStreams from which to select. diff --git a/packager/media/event/vod_media_info_dump_muxer_listener.cc b/packager/media/event/vod_media_info_dump_muxer_listener.cc index 722b9961a1..789436d2c0 100644 --- a/packager/media/event/vod_media_info_dump_muxer_listener.cc +++ b/packager/media/event/vod_media_info_dump_muxer_listener.cc @@ -101,7 +101,7 @@ void VodMediaInfoDumpMuxerListener::OnNewSegment(const std::string& file_name, // static bool VodMediaInfoDumpMuxerListener::WriteMediaInfoToFile( - const edash_packager::MediaInfo& media_info, + const MediaInfo& media_info, const std::string& output_file_path) { std::string output_string; if (!google::protobuf::TextFormat::PrintToString(media_info, diff --git a/packager/media/file/file.cc b/packager/media/file/file.cc index e93b3ee1b6..17d47f748e 100644 --- a/packager/media/file/file.cc +++ b/packager/media/file/file.cc @@ -206,8 +206,7 @@ bool File::Copy(const char* from_file_name, const char* to_file_name) { return false; } - scoped_ptr - output_file(edash_packager::media::File::Open(to_file_name, "w")); + scoped_ptr output_file(File::Open(to_file_name, "w")); if (!output_file) { LOG(ERROR) << "Failed to write to " << to_file_name; return false; diff --git a/packager/mpd/base/bandwidth_estimator_unittest.cc b/packager/mpd/base/bandwidth_estimator_unittest.cc index 79c93dbcd6..a38016c6c8 100644 --- a/packager/mpd/base/bandwidth_estimator_unittest.cc +++ b/packager/mpd/base/bandwidth_estimator_unittest.cc @@ -93,4 +93,4 @@ TEST(BandwidthEstimatorTest, FirstOneBlock) { EXPECT_EQ(kExptectedEstimate, be.Estimate()); } -} // edash_packager +} // namespace edash_packager diff --git a/packager/mpd/base/dash_iop_mpd_notifier_unittest.cc b/packager/mpd/base/dash_iop_mpd_notifier_unittest.cc index 8235b118f0..ac1b0c147e 100644 --- a/packager/mpd/base/dash_iop_mpd_notifier_unittest.cc +++ b/packager/mpd/base/dash_iop_mpd_notifier_unittest.cc @@ -39,8 +39,7 @@ const uint32_t kDefaultAdaptationSetId = 0u; const uint32_t kDefaultRepresentationId = 1u; const int kDefaultGroupId = -1; -bool ElementEqual(const edash_packager::Element& lhs, - const edash_packager::Element& rhs) { +bool ElementEqual(const Element& lhs, const Element& rhs) { const bool all_equal_except_sublement_check = lhs.name == rhs.name && lhs.attributes.size() == rhs.attributes.size() && std::equal(lhs.attributes.begin(), lhs.attributes.end(), @@ -59,9 +58,8 @@ bool ElementEqual(const edash_packager::Element& lhs, return true; } -bool ContentProtectionElementEqual( - const edash_packager::ContentProtectionElement& lhs, - const edash_packager::ContentProtectionElement& rhs) { +bool ContentProtectionElementEqual(const ContentProtectionElement& lhs, + const ContentProtectionElement& rhs) { const bool all_equal_except_sublement_check = lhs.value == rhs.value && lhs.scheme_id_uri == rhs.scheme_id_uri && lhs.additional_attributes.size() == rhs.additional_attributes.size() && diff --git a/packager/mpd/base/mpd_utils.cc b/packager/mpd/base/mpd_utils.cc index a0b27626af..5ec87c1fb0 100644 --- a/packager/mpd/base/mpd_utils.cc +++ b/packager/mpd/base/mpd_utils.cc @@ -15,8 +15,7 @@ namespace edash_packager { namespace { -std::string TextCodecString( - const edash_packager::MediaInfo& media_info) { +std::string TextCodecString(const MediaInfo& media_info) { CHECK(media_info.has_text_info()); const std::string& format = media_info.text_info().format(); // DASH IOP mentions that the codec for ttml in mp4 is stpp. diff --git a/packager/mpd/base/xml/xml_node.cc b/packager/mpd/base/xml/xml_node.cc index 6eb0d413b2..d07dc96e30 100644 --- a/packager/mpd/base/xml/xml_node.cc +++ b/packager/mpd/base/xml/xml_node.cc @@ -17,16 +17,12 @@ #include "packager/mpd/base/media_info.pb.h" #include "packager/mpd/base/segment_info.h" -using edash_packager::xml::XmlNode; - -using edash_packager::MediaInfo; -typedef edash_packager::MediaInfo::AudioInfo AudioInfo; -typedef edash_packager::MediaInfo::VideoInfo VideoInfo; -typedef MediaInfo::ContentProtectionXml ContentProtectionXml; -typedef ContentProtectionXml::AttributeNameValuePair AttributeNameValuePair; - namespace edash_packager { +using xml::XmlNode; +typedef MediaInfo::AudioInfo AudioInfo; +typedef MediaInfo::VideoInfo VideoInfo; + namespace { const char kEC3Codec[] = "ec-3"; diff --git a/packager/mpd/util/mpd_writer.cc b/packager/mpd/util/mpd_writer.cc index a119207faf..78b0cc22e7 100644 --- a/packager/mpd/util/mpd_writer.cc +++ b/packager/mpd/util/mpd_writer.cc @@ -25,8 +25,6 @@ DEFINE_bool(generate_dash_if_iop_compliant_mpd, "and does not guarantee compliance. Off by default until players " "support IOP MPDs."); -using edash_packager::media::File; - namespace edash_packager { namespace { diff --git a/packager/mpd/util/mpd_writer.h b/packager/mpd/util/mpd_writer.h index a4f14ffb40..3bac92464e 100644 --- a/packager/mpd/util/mpd_writer.h +++ b/packager/mpd/util/mpd_writer.h @@ -19,12 +19,10 @@ #include "packager/mpd/base/mpd_options.h" namespace edash_packager { + namespace media { class File; } // namespace media -} // namespace edash_packager - -namespace edash_packager { class MediaInfo;