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
This commit is contained in:
KongQun Yang 2014-06-20 14:45:09 -07:00
parent 895989b4b0
commit 0f49af6cc1
6 changed files with 38 additions and 17 deletions

View File

@ -6,6 +6,8 @@
#include "media/base/media_sample.h"
#include <inttypes.h>
#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

View File

@ -6,6 +6,8 @@
#include "media/base/muxer_util.h"
#include <inttypes.h>
#include <string>
#include <vector>
@ -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") {

View File

@ -6,6 +6,8 @@
#include "media/base/stream_info.h"
#include <inttypes.h>
#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(),

View File

@ -4,6 +4,8 @@
#include "media/formats/mp4/box_reader.h"
#include <inttypes.h>
#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<uint64>(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;

View File

@ -4,6 +4,8 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#include <inttypes.h>
#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[] = "<S t=\"%lu\" d=\"%lu\" r=\"%lu\"/>\n";
const char kSElementTemplateWithoutR[] = "<S t=\"%lu\" d=\"%lu\"/>\n";
const char kSElementTemplate[] =
"<S t=\"%" PRIu64 "\" d=\"%" PRIu64 "\" r=\"%" PRIu64 "\"/>\n";
const char kSElementTemplateWithoutR[] =
"<S t=\"%" PRIu64 "\" d=\"%" PRIu64 "\"/>\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<MpdBuilder::kDynamic> {
" 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<MpdBuilder::kDynamic> {
}
// 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"
" <Period start=\"PT0S\">\n"
" <AdaptationSet id=\"0\">\n"
" <Representation id=\"0\" bandwidth=\"%lu\" "
" <Representation id=\"0\" bandwidth=\"%" PRIu64 "\" "
"codecs=\"avc1.010101\" mimeType=\"video/mp4\" width=\"720\" "
"height=\"480\">\n"
" <SegmentTemplate timescale=\"1000\" "
@ -227,7 +231,7 @@ class TimeShiftBufferDepthTest : public SegmentTemplateTest {
" 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: \"$Number$.mp4\"\n";
@ -252,7 +256,7 @@ class TimeShiftBufferDepthTest : public SegmentTemplateTest {
"timeShiftBufferDepth=\"PT%dS\">\n"
" <Period start=\"PT0S\">\n"
" <AdaptationSet id=\"0\">\n"
" <Representation id=\"0\" bandwidth=\"%lu\" "
" <Representation id=\"0\" bandwidth=\"%" PRIu64 "\" "
"codecs=\"avc1.010101\" mimeType=\"video/mp4\" width=\"720\" "
"height=\"480\">\n"
" <SegmentTemplate timescale=\"1000\" "

View File

@ -42,6 +42,7 @@
'media/formats/mpeg/mpeg.gyp:mpeg',
'mpd/mpd.gyp:mpd_builder',
'third_party/gflags/gflags.gyp:gflags',
'third_party/openssl/openssl.gyp:openssl',
],
'conditions': [
[ 'os_posix == 1', {