Clean up clang compilation errors.

Clang from Chromium enforces Chromium styles:
http://www.chromium.org/developers/coding-style,
http://www.chromium.org/developers/coding-style/chromium-style-checker-errors.

Change-Id: I8070739489a8109380578d1797801e981d119793
This commit is contained in:
Kongqun Yang 2014-01-15 16:52:07 -08:00 committed by KongQun Yang
parent 3da90d8bad
commit 8095e21c96
14 changed files with 66 additions and 30 deletions

View File

@ -6,6 +6,7 @@
#include <sstream> #include <sstream>
#include "base/logging.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "media/base/limits.h" #include "media/base/limits.h"
@ -66,8 +67,10 @@ std::string AudioStreamInfo::GetCodecString(AudioCodec codec,
return "opus"; return "opus";
case kCodecAAC: case kCodecAAC:
return "mp4a.40." + base::UintToString(audio_object_type); return "mp4a.40." + base::UintToString(audio_object_type);
default:
NOTIMPLEMENTED() << "Codec: " << codec;
return "unknown";
} }
return "unknown";
} }
} // namespace media } // namespace media

View File

@ -47,8 +47,6 @@ class AudioStreamInfo : public StreamInfo {
size_t extra_data_size, size_t extra_data_size,
bool is_encrypted); bool is_encrypted);
virtual ~AudioStreamInfo();
// Returns true if this object has appropriate configuration values, false // Returns true if this object has appropriate configuration values, false
// otherwise. // otherwise.
virtual bool IsValidConfig() const OVERRIDE; virtual bool IsValidConfig() const OVERRIDE;
@ -69,6 +67,8 @@ class AudioStreamInfo : public StreamInfo {
static std::string GetCodecString(AudioCodec codec, uint8 audio_object_type); static std::string GetCodecString(AudioCodec codec, uint8 audio_object_type);
private: private:
virtual ~AudioStreamInfo();
AudioCodec codec_; AudioCodec codec_;
uint8 sample_bits_; uint8 sample_bits_;
uint8 num_channels_; uint8 num_channels_;

View File

@ -0,0 +1,18 @@
// Copyright (c) 2013 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.
#include "media/base/muxer_options.h"
namespace media {
MuxerOptions::MuxerOptions()
: single_segment(false),
segment_duration(0),
fragment_duration(0),
segment_sap_aligned(false),
fragment_sap_aligned(false),
num_subsegments_per_sidx(0) {}
MuxerOptions::~MuxerOptions() {}
} // namespace media

View File

@ -10,6 +10,9 @@
namespace media { namespace media {
struct MuxerOptions { struct MuxerOptions {
MuxerOptions();
~MuxerOptions();
// Generate a single segment for each media presentation. This option // Generate a single segment for each media presentation. This option
// should be set for on demand profile. // should be set for on demand profile.
bool single_segment; bool single_segment;

View File

@ -443,6 +443,9 @@ const uint8 kTestSignature_2048[] = {
namespace media { namespace media {
RsaTestSet::RsaTestSet() {}
RsaTestSet::~RsaTestSet() {}
RsaTestData::RsaTestData() { RsaTestData::RsaTestData() {
test_set_3072_bits_.test_message = kTestMessage; test_set_3072_bits_.test_message = kTestMessage;
test_set_3072_bits_.public_key.assign( test_set_3072_bits_.public_key.assign(

View File

@ -15,6 +15,9 @@ namespace media {
// Self generated test vector to verify algorithm stability. // Self generated test vector to verify algorithm stability.
struct RsaTestSet { struct RsaTestSet {
RsaTestSet();
~RsaTestSet();
std::string public_key; std::string public_key;
std::string private_key; std::string private_key;
std::string test_message; std::string test_message;

View File

@ -28,7 +28,6 @@ class StreamInfo : public base::RefCountedThreadSafe<StreamInfo> {
const uint8* extra_data, const uint8* extra_data,
size_t extra_data_size, size_t extra_data_size,
bool is_encrypted); bool is_encrypted);
virtual ~StreamInfo();
// Returns true if this object has appropriate configuration values, false // Returns true if this object has appropriate configuration values, false
// otherwise. // otherwise.
@ -50,6 +49,10 @@ class StreamInfo : public base::RefCountedThreadSafe<StreamInfo> {
void set_duration(int duration) { duration_ = duration; } void set_duration(int duration) { duration_ = duration; }
protected:
friend class base::RefCountedThreadSafe<StreamInfo>;
virtual ~StreamInfo();
private: private:
// Whether the stream is Audio or Video. // Whether the stream is Audio or Video.
StreamType stream_type_; StreamType stream_type_;

View File

@ -38,8 +38,6 @@ class VideoStreamInfo : public StreamInfo {
size_t extra_data_size, size_t extra_data_size,
bool is_encrypted); bool is_encrypted);
virtual ~VideoStreamInfo();
// Returns true if this object has appropriate configuration values, false // Returns true if this object has appropriate configuration values, false
// otherwise. // otherwise.
virtual bool IsValidConfig() const OVERRIDE; virtual bool IsValidConfig() const OVERRIDE;
@ -60,6 +58,8 @@ class VideoStreamInfo : public StreamInfo {
uint8 level); uint8 level);
private: private:
virtual ~VideoStreamInfo();
VideoCodec codec_; VideoCodec codec_;
uint16 width_; uint16 width_;
uint16 height_; uint16 height_;

View File

@ -538,19 +538,20 @@ bool CompactSampleSize::ReadWrite(BoxBuffer* buffer) {
buffer->ReadWriteUInt32(&sample_count)); buffer->ReadWriteUInt32(&sample_count));
// Reserve one more entry if field size is 4 bits. // Reserve one more entry if field size is 4 bits.
sizes.resize(sample_count + (field_size == 4 ? 1 : 0)); sizes.resize(sample_count + (field_size == 4 ? 1 : 0), 0);
switch (field_size) { switch (field_size) {
case 4: case 4:
for (uint32 i = 0; i < sample_count; ++i) { for (uint32 i = 0; i < sample_count; i += 2) {
uint8 size;
if (!buffer->Reading()) {
DCHECK(sizes[i] < 16 && sizes[i+1] < 16);
size = (sizes[i] << 4) | (++i < sample_count ? sizes[i] : 0);
}
RCHECK(buffer->ReadWriteUInt8(&size));
if (buffer->Reading()) { if (buffer->Reading()) {
uint8 size = 0;
RCHECK(buffer->ReadWriteUInt8(&size));
sizes[i] = size >> 4; sizes[i] = size >> 4;
sizes[++i] = size & 0x0F; sizes[i + 1] = size & 0x0F;
} else {
DCHECK_LT(sizes[i], 16);
DCHECK_LT(sizes[i + 1], 16);
uint8 size = (sizes[i] << 4) | sizes[i + 1];
RCHECK(buffer->ReadWriteUInt8(&size));
} }
} }
break; break;

View File

@ -752,39 +752,39 @@ TYPED_TEST_CASE(BoxDefinitionsTestGeneral, Boxes);
TYPED_TEST(BoxDefinitionsTestGeneral, WriteReadbackCompare) { TYPED_TEST(BoxDefinitionsTestGeneral, WriteReadbackCompare) {
TypeParam box; TypeParam box;
LOG(INFO) << "Processing " << FourCCToString(box.BoxType()); LOG(INFO) << "Processing " << FourCCToString(box.BoxType());
Fill(&box); this->Fill(&box);
box.Write(this->buffer_.get()); box.Write(this->buffer_.get());
TypeParam box_readback; TypeParam box_readback;
ASSERT_TRUE(ReadBack(&box_readback)); ASSERT_TRUE(this->ReadBack(&box_readback));
ASSERT_EQ(box, box_readback); ASSERT_EQ(box, box_readback);
} }
TYPED_TEST(BoxDefinitionsTestGeneral, WriteModifyWrite) { TYPED_TEST(BoxDefinitionsTestGeneral, WriteModifyWrite) {
TypeParam box; TypeParam box;
LOG(INFO) << "Processing " << FourCCToString(box.BoxType()); LOG(INFO) << "Processing " << FourCCToString(box.BoxType());
Fill(&box); this->Fill(&box);
// Save the expected version set earlier in function |Fill|, then clear // Save the expected version set earlier in function |Fill|, then clear
// the version, expecting box.Write set version as expected. // the version, expecting box.Write set version as expected.
uint8 version = GetAndClearVersion(&box); uint8 version = this->GetAndClearVersion(&box);
box.Write(this->buffer_.get()); box.Write(this->buffer_.get());
EXPECT_EQ(version, GetAndClearVersion(&box)); EXPECT_EQ(version, this->GetAndClearVersion(&box));
this->buffer_->Clear(); this->buffer_->Clear();
Modify(&box); this->Modify(&box);
version = GetAndClearVersion(&box); version = this->GetAndClearVersion(&box);
box.Write(this->buffer_.get()); box.Write(this->buffer_.get());
EXPECT_EQ(version, GetAndClearVersion(&box)); EXPECT_EQ(version, this->GetAndClearVersion(&box));
TypeParam box_readback; TypeParam box_readback;
ASSERT_TRUE(ReadBack(&box_readback)); ASSERT_TRUE(this->ReadBack(&box_readback));
ASSERT_EQ(box, box_readback); ASSERT_EQ(box, box_readback);
} }
TYPED_TEST(BoxDefinitionsTestGeneral, Empty) { TYPED_TEST(BoxDefinitionsTestGeneral, Empty) {
TypeParam box; TypeParam box;
LOG(INFO) << "Processing " << FourCCToString(box.BoxType()); LOG(INFO) << "Processing " << FourCCToString(box.BoxType());
if (IsOptional(&box)) { if (this->IsOptional(&box)) {
ASSERT_EQ(0, box.ComputeSize()); ASSERT_EQ(0, box.ComputeSize());
} else { } else {
ASSERT_NE(0, box.ComputeSize()); ASSERT_NE(0, box.ComputeSize());

View File

@ -33,7 +33,7 @@ struct FreeBox : Box {
return true; return true;
} }
virtual FourCC BoxType() const OVERRIDE { return FOURCC_FREE; } virtual FourCC BoxType() const OVERRIDE { return FOURCC_FREE; }
virtual uint32 ComputeSize() { virtual uint32 ComputeSize() OVERRIDE {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return 0; return 0;
} }
@ -44,7 +44,7 @@ struct PsshBox : Box {
return buffer->ReadWriteUInt32(&val); return buffer->ReadWriteUInt32(&val);
} }
virtual FourCC BoxType() const OVERRIDE { return FOURCC_PSSH; } virtual FourCC BoxType() const OVERRIDE { return FOURCC_PSSH; }
virtual uint32 ComputeSize() { virtual uint32 ComputeSize() OVERRIDE {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return 0; return 0;
} }
@ -70,7 +70,7 @@ struct SkipBox : FullBox {
return buffer->TryReadWriteChild(&empty); return buffer->TryReadWriteChild(&empty);
} }
virtual FourCC BoxType() const OVERRIDE { return FOURCC_SKIP; } virtual FourCC BoxType() const OVERRIDE { return FOURCC_SKIP; }
virtual uint32 ComputeSize() { virtual uint32 ComputeSize() OVERRIDE {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return 0; return 0;
} }

View File

@ -32,7 +32,7 @@ class MP4GeneralSegmenter : public MP4Segmenter {
MP4GeneralSegmenter(const MuxerOptions& options, MP4GeneralSegmenter(const MuxerOptions& options,
scoped_ptr<FileType> ftyp, scoped_ptr<FileType> ftyp,
scoped_ptr<Movie> moov); scoped_ptr<Movie> moov);
~MP4GeneralSegmenter(); virtual ~MP4GeneralSegmenter();
// MP4Segmenter implementations. // MP4Segmenter implementations.
virtual Status Initialize(EncryptorSource* encryptor_source, virtual Status Initialize(EncryptorSource* encryptor_source,

View File

@ -29,7 +29,7 @@ class MP4VODSegmenter : public MP4Segmenter {
MP4VODSegmenter(const MuxerOptions& options, MP4VODSegmenter(const MuxerOptions& options,
scoped_ptr<FileType> ftyp, scoped_ptr<FileType> ftyp,
scoped_ptr<Movie> moov); scoped_ptr<Movie> moov);
~MP4VODSegmenter(); virtual ~MP4VODSegmenter();
// MP4Segmenter implementations. // MP4Segmenter implementations.
virtual Status Initialize(EncryptorSource* encryptor_source, virtual Status Initialize(EncryptorSource* encryptor_source,

View File

@ -47,6 +47,8 @@
'media/base/media_stream.h', 'media/base/media_stream.h',
'media/base/muxer.cc', 'media/base/muxer.cc',
'media/base/muxer.h', 'media/base/muxer.h',
'media/base/muxer_options.cc',
'media/base/muxer_options.h',
'media/base/rsa_key.cc', 'media/base/rsa_key.cc',
'media/base/rsa_key.h', 'media/base/rsa_key.h',
'media/base/status.cc', 'media/base/status.cc',