From 0f49af6cc16cebe2f6202abbceebee6570d75f5d Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Fri, 20 Jun 2014 14:45:09 -0700 Subject: [PATCH] Fix problems on 32-bit fresh linux box There are two different problems: 1. int64/uint64 formatting: %lu formats unsigned long. However, the definition of long is different on 32-bit machine and 64-bit machine. We need to use a macro to format int64/uint64 correctly. 2. The packager target is dependent on openssl. Change-Id: I5d51a500c3cb8bcd4b4049ab7ec5a985ac486a76 --- media/base/media_sample.cc | 16 ++++++++++++---- media/base/muxer_util.cc | 8 +++++--- media/base/stream_info.cc | 4 +++- media/formats/mp4/box_reader.cc | 8 ++++++-- mpd/base/mpd_builder_unittest.cc | 18 +++++++++++------- packager.gyp | 1 + 6 files changed, 38 insertions(+), 17 deletions(-) diff --git a/media/base/media_sample.cc b/media/base/media_sample.cc index 74e0cb023e..7083beb72c 100644 --- a/media/base/media_sample.cc +++ b/media/base/media_sample.cc @@ -6,6 +6,8 @@ #include "media/base/media_sample.h" +#include + #include "base/logging.h" #include "base/strings/stringprintf.h" #include "media/base/decrypt_config.h" @@ -62,10 +64,16 @@ std::string MediaSample::ToString() const { if (end_of_stream()) return "End of stream sample\n"; return base::StringPrintf( - "dts: %ld\n pts: %ld\n duration: %ld\n is_key_frame: %s\n size: %zu\n " - "side_data_size: %zu\n is_encrypted: %s\n", - dts_, pts_, duration_, is_key_frame_ ? "true" : "false", data_.size(), - side_data_.size(), decrypt_config_ ? "true" : "false"); + "dts: %" PRId64 "\n pts: %" PRId64 "\n duration: %" PRId64 "\n " + "is_key_frame: %s\n size: %zu\n side_data_size: %zu\n " + "is_encrypted: %s\n", + dts_, + pts_, + duration_, + is_key_frame_ ? "true" : "false", + data_.size(), + side_data_.size(), + decrypt_config_ ? "true" : "false"); } } // namespace media diff --git a/media/base/muxer_util.cc b/media/base/muxer_util.cc index db5428cd93..1931608e0f 100644 --- a/media/base/muxer_util.cc +++ b/media/base/muxer_util.cc @@ -6,6 +6,8 @@ #include "media/base/muxer_util.h" +#include + #include #include @@ -126,11 +128,11 @@ std::string GetSegmentName(const std::string& segment_template, if (format_pos != std::string::npos) { format_tag = splits[i].substr(format_pos); DCHECK(ValidateFormatTag(format_tag)); - // Replace %d formatting with %lu formatting to correctly format uint64. - format_tag = format_tag.substr(0, format_tag.size() - 1) + "lu"; + // Replace %d formatting to correctly format uint64. + format_tag = format_tag.substr(0, format_tag.size() - 1) + PRIu64; } else { // Default format tag "%01d", modified to format uint64 correctly. - format_tag = "%01lu"; + format_tag = "%01" PRIu64; } if (identifier == "Number") { diff --git a/media/base/stream_info.cc b/media/base/stream_info.cc index 387e510ca0..ba149f611e 100644 --- a/media/base/stream_info.cc +++ b/media/base/stream_info.cc @@ -6,6 +6,8 @@ #include "media/base/stream_info.h" +#include + #include "base/logging.h" #include "base/strings/stringprintf.h" @@ -36,7 +38,7 @@ StreamInfo::~StreamInfo() {} std::string StreamInfo::ToString() const { return base::StringPrintf( - "type: %s\n codec_string: %s\n time_scale: %d\n duration: %lu " + "type: %s\n codec_string: %s\n time_scale: %d\n duration: %" PRIu64 " " "(%.1f seconds)\n language: %s\n is_encrypted: %s\n", (stream_type_ == kStreamAudio ? "Audio" : "Video"), codec_string_.c_str(), diff --git a/media/formats/mp4/box_reader.cc b/media/formats/mp4/box_reader.cc index 00c69c2f9d..cff08298e9 100644 --- a/media/formats/mp4/box_reader.cc +++ b/media/formats/mp4/box_reader.cc @@ -4,6 +4,8 @@ #include "media/formats/mp4/box_reader.h" +#include + #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/strings/stringprintf.h" @@ -158,7 +160,8 @@ bool BoxReader::ReadHeader(bool* err) { // The box should have at least the size of what have been parsed. if (size < pos()) { - LOG(ERROR) << base::StringPrintf("Box '%s' with size (%lu) is invalid.", + LOG(ERROR) << base::StringPrintf("Box '%s' with size (%" PRIu64 + ") is invalid.", FourCCToString(type_).c_str(), size); *err = true; @@ -167,7 +170,8 @@ bool BoxReader::ReadHeader(bool* err) { // 'mdat' box could have a 64-bit size; other boxes should be very small. if (size > static_cast(kint32max) && type_ != FOURCC_MDAT) { - LOG(ERROR) << base::StringPrintf("Box '%s' size (%lu) is too large.", + LOG(ERROR) << base::StringPrintf("Box '%s' size (%" PRIu64 + ") is too large.", FourCCToString(type_).c_str(), size); *err = true; diff --git a/mpd/base/mpd_builder_unittest.cc b/mpd/base/mpd_builder_unittest.cc index 975a9c36a0..5e86a96eaf 100644 --- a/mpd/base/mpd_builder_unittest.cc +++ b/mpd/base/mpd_builder_unittest.cc @@ -4,6 +4,8 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd +#include + #include "base/file_util.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" @@ -19,8 +21,10 @@ namespace dash_packager { namespace { -const char kSElementTemplate[] = "\n"; -const char kSElementTemplateWithoutR[] = "\n"; +const char kSElementTemplate[] = + "\n"; +const char kSElementTemplateWithoutR[] = + "\n"; const int kDefaultStartNumber = 1; // Get 'id' attribute from |node|, convert it to std::string and convert it to a @@ -108,7 +112,7 @@ class DynamicMpdBuilderTest : public MpdBuilderTest { " height: 480\n" " time_scale: 10\n" "}\n" - "reference_time_scale: %lu\n" + "reference_time_scale: %u\n" "container_type: 1\n" "init_segment_name: \"init.mp4\"\n" "segment_template: \"$Time$.mp4\"\n"; @@ -117,7 +121,7 @@ class DynamicMpdBuilderTest : public MpdBuilderTest { } // TODO(rkuroiwa): Make this a global constant in anonymous namespace. - uint64 DefaultTimeScale() const { return 1000; }; + uint32 DefaultTimeScale() const { return 1000; }; }; class SegmentTemplateTest : public DynamicMpdBuilderTest { @@ -173,7 +177,7 @@ class SegmentTemplateTest : public DynamicMpdBuilderTest { "type=\"dynamic\" profiles=\"urn:mpeg:dash:profile:isoff-live:2011\">\n" " \n" " \n" - " \n" " \n" " \n" " \n" - " \n" "