Move fourccs.h and rcheck.h to media/base

- FOURCC is not a mp4 only concept. It is also used elsewhere.
- RCHECK has been used outside formats/mp4.

Also updated the FOURCC enum names to match the actual fourcc code, e.g.
FOURCC_mdat for "mdat".

Change-Id: I5be02f12695882c0fb41d359305fb8ec01303a06
This commit is contained in:
KongQun Yang 2016-04-06 16:21:45 -07:00
parent ce55fbcae2
commit 0218d9c690
32 changed files with 386 additions and 402 deletions

View File

@ -14,6 +14,7 @@
#include "packager/base/logging.h"
#include "packager/base/strings/string_util.h"
#include "packager/media/base/bit_reader.h"
#include "packager/media/base/rcheck.h"
#include "packager/mpd/base/xml/scoped_xml_ptr.h"
namespace edash_packager {
@ -24,12 +25,6 @@ namespace media {
(static_cast<uint8_t>(b) << 16) | (static_cast<uint8_t>(c) << 8) | \
(static_cast<uint8_t>(d)))
#define RCHECK(x) \
do { \
if (!(x)) \
return false; \
} while (0)
#define UTF8_BYTE_ORDER_MARK "\xef\xbb\xbf"
// Helper function to read 2 bytes (16 bits, big endian) from a buffer.

View File

@ -0,0 +1,147 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef PACKAGER_MEDIA_BASE_FOURCCS_H_
#define PACKAGER_MEDIA_BASE_FOURCCS_H_
#include <string>
namespace edash_packager {
namespace media {
enum FourCC {
FOURCC_NULL = 0,
FOURCC_ID32 = 0x49443332,
FOURCC_PRIV = 0x50524956,
FOURCC_ac_3 = 0x61632d33, // "ac-3"
FOURCC_avc1 = 0x61766331,
FOURCC_avcC = 0x61766343,
FOURCC_bloc = 0x626C6F63,
FOURCC_cbc1 = 0x63626331,
FOURCC_cenc = 0x63656e63,
FOURCC_co64 = 0x636f3634,
FOURCC_ctim = 0x6374696d,
FOURCC_ctts = 0x63747473,
FOURCC_dac3 = 0x64616333,
FOURCC_dash = 0x64617368,
FOURCC_ddts = 0x64647473,
FOURCC_dec3 = 0x64656333,
FOURCC_dinf = 0x64696e66,
FOURCC_dref = 0x64726566,
FOURCC_dtsc = 0x64747363,
FOURCC_dtse = 0x64747365,
FOURCC_dtsh = 0x64747368,
FOURCC_dtsl = 0x6474736c,
FOURCC_dtsm = 0x6474732d, // "dts-"
FOURCC_dtsp = 0x6474732b, // "dts+"
FOURCC_ec_3 = 0x65632d33, // "ec-3"
FOURCC_edts = 0x65647473,
FOURCC_elst = 0x656c7374,
FOURCC_enca = 0x656e6361,
FOURCC_encv = 0x656e6376,
FOURCC_esds = 0x65736473,
FOURCC_free = 0x66726565,
FOURCC_frma = 0x66726d61,
FOURCC_ftyp = 0x66747970,
FOURCC_hdlr = 0x68646c72,
FOURCC_hev1 = 0x68657631,
FOURCC_hint = 0x68696e74,
FOURCC_hvc1 = 0x68766331,
FOURCC_hvcC = 0x68766343,
FOURCC_iden = 0x6964656e,
FOURCC_iso6 = 0x69736f36,
FOURCC_iods = 0x696f6473,
FOURCC_mdat = 0x6d646174,
FOURCC_mdhd = 0x6d646864,
FOURCC_mdia = 0x6d646961,
FOURCC_meco = 0x6d65636f,
FOURCC_mehd = 0x6d656864,
FOURCC_meta = 0x6d657461,
FOURCC_mfhd = 0x6d666864,
FOURCC_mfra = 0x6d667261,
FOURCC_minf = 0x6d696e66,
FOURCC_moof = 0x6d6f6f66,
FOURCC_moov = 0x6d6f6f76,
FOURCC_mp41 = 0x6d703431,
FOURCC_mp4a = 0x6d703461,
FOURCC_mp4v = 0x6d703476,
FOURCC_mvex = 0x6d766578,
FOURCC_mvhd = 0x6d766864,
FOURCC_pasp = 0x70617370,
FOURCC_payl = 0x7061796c,
FOURCC_pdin = 0x7064696e,
FOURCC_prft = 0x70726674,
FOURCC_pssh = 0x70737368,
FOURCC_saio = 0x7361696f,
FOURCC_saiz = 0x7361697a,
FOURCC_sbgp = 0x73626770,
FOURCC_schi = 0x73636869,
FOURCC_schm = 0x7363686d,
FOURCC_sdtp = 0x73647470,
FOURCC_seig = 0x73656967,
FOURCC_senc = 0x73656e63,
FOURCC_sgpd = 0x73677064,
FOURCC_sidx = 0x73696478,
FOURCC_sinf = 0x73696e66,
FOURCC_skip = 0x736b6970,
FOURCC_smhd = 0x736d6864,
FOURCC_soun = 0x736f756e,
FOURCC_ssix = 0x73736978,
FOURCC_stbl = 0x7374626c,
FOURCC_stco = 0x7374636f,
FOURCC_sthd = 0x73746864,
FOURCC_stsc = 0x73747363,
FOURCC_stsd = 0x73747364,
FOURCC_stss = 0x73747373,
FOURCC_stsz = 0x7374737a,
FOURCC_sttg = 0x73747467,
FOURCC_stts = 0x73747473,
FOURCC_styp = 0x73747970,
FOURCC_stz2 = 0x73747a32,
FOURCC_subt = 0x73756274,
FOURCC_tenc = 0x74656e63,
FOURCC_text = 0x74657874,
FOURCC_tfdt = 0x74666474,
FOURCC_tfhd = 0x74666864,
FOURCC_tkhd = 0x746b6864,
FOURCC_traf = 0x74726166,
FOURCC_trak = 0x7472616b,
FOURCC_trex = 0x74726578,
FOURCC_trun = 0x7472756e,
FOURCC_udta = 0x75647461,
FOURCC_url = 0x75726c20, // "url "
FOURCC_urn = 0x75726e20, // "urn "
FOURCC_uuid = 0x75756964,
FOURCC_vide = 0x76696465,
FOURCC_vlab = 0x766c6162,
FOURCC_vmhd = 0x766d6864,
FOURCC_vp08 = 0x76703038,
FOURCC_vp09 = 0x76703039,
FOURCC_vp10 = 0x76703130,
FOURCC_vpcC = 0x76706343,
FOURCC_vsid = 0x76736964,
FOURCC_vttC = 0x76747443,
FOURCC_vtta = 0x76747461,
FOURCC_vttc = 0x76747463,
FOURCC_vtte = 0x76747465,
FOURCC_wide = 0x77696465,
FOURCC_wvtt = 0x77767474,
};
const inline std::string FourCCToString(FourCC fourcc) {
char buf[5];
buf[0] = (fourcc >> 24) & 0xff;
buf[1] = (fourcc >> 16) & 0xff;
buf[2] = (fourcc >> 8) & 0xff;
buf[3] = (fourcc) & 0xff;
buf[4] = 0;
return std::string(buf);
}
} // namespace media
} // namespace edash_packager
#endif // PACKAGER_MEDIA_BASE_FOURCCS_H_

View File

@ -46,6 +46,7 @@
'encryption_modes.h',
'fixed_key_source.cc',
'fixed_key_source.h',
'fourccs.h',
'http_key_fetcher.cc',
'http_key_fetcher.h',
'key_fetcher.cc',
@ -72,6 +73,7 @@
'producer_consumer_queue.h',
'protection_system_specific_info.cc',
'protection_system_specific_info.h',
'rcheck.h',
'request_signer.cc',
'request_signer.h',
'rsa_key.cc',

View File

@ -7,9 +7,8 @@
#include "packager/media/base/protection_system_specific_info.h"
#include "packager/media/base/buffer_writer.h"
// Header-only files:
#include "packager/media/formats/mp4/fourccs.h"
#include "packager/media/formats/mp4/rcheck.h"
#include "packager/media/base/fourccs.h"
#include "packager/media/base/rcheck.h"
namespace edash_packager {
namespace media {
@ -52,7 +51,7 @@ bool ProtectionSystemSpecificInfo::Parse(const uint8_t* data,
RCHECK(reader.Read4(&size));
RCHECK(reader.Read4(&box_type));
RCHECK(size == data_size);
RCHECK(box_type == mp4::FOURCC_PSSH);
RCHECK(box_type == FOURCC_pssh);
RCHECK(reader.Read4(&version_and_flags));
version_ = (version_and_flags >> 24);
@ -84,7 +83,7 @@ bool ProtectionSystemSpecificInfo::Parse(const uint8_t* data,
std::vector<uint8_t> ProtectionSystemSpecificInfo::CreateBox() const {
DCHECK_EQ(kSystemIdSize, system_id_.size());
const uint32_t box_type = mp4::FOURCC_PSSH;
const uint32_t box_type = FOURCC_pssh;
const uint32_t version_and_flags = (static_cast<uint32_t>(version_) << 24);
const uint32_t pssh_data_size = pssh_data_.size();

View File

@ -0,0 +1,18 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef PACKAGER_MEDIA_BASE_RCHECK_H_
#define PACKAGER_MEDIA_BASE_RCHECK_H_
#include "packager/base/logging.h"
#define RCHECK(x) \
do { \
if (!(x)) { \
LOG(ERROR) << "Failure while processing: " << #x; \
return false; \
} \
} while (0)
#endif // PACKAGER_MEDIA_BASE_RCHECK_H_

View File

@ -18,17 +18,10 @@
#include "packager/media/base/http_key_fetcher.h"
#include "packager/media/base/producer_consumer_queue.h"
#include "packager/media/base/protection_system_specific_info.h"
#include "packager/media/base/rcheck.h"
#include "packager/media/base/request_signer.h"
#include "packager/media/base/widevine_pssh_data.pb.h"
#define RCHECK(x) \
do { \
if (!(x)) { \
LOG(ERROR) << "Failure while processing: " << #x; \
return false; \
} \
} while (0)
namespace edash_packager {
namespace {

View File

@ -9,8 +9,8 @@
#include "packager/base/strings/string_number_conversions.h"
#include "packager/base/strings/string_util.h"
#include "packager/media/base/buffer_reader.h"
#include "packager/media/base/rcheck.h"
#include "packager/media/filters/h264_parser.h"
#include "packager/media/formats/mp4/rcheck.h"
namespace edash_packager {
namespace media {

View File

@ -5,8 +5,8 @@
// https://developers.google.com/open-source/licenses/bsd
#include "packager/media/base/bit_reader.h"
#include "packager/media/base/rcheck.h"
#include "packager/media/filters/ec3_audio_util.h"
#include "packager/media/formats/mp4/rcheck.h"
namespace edash_packager {
namespace media {

View File

@ -9,7 +9,7 @@
#include "packager/base/strings/string_number_conversions.h"
#include "packager/base/strings/string_util.h"
#include "packager/media/base/buffer_reader.h"
#include "packager/media/formats/mp4/rcheck.h"
#include "packager/media/base/rcheck.h"
namespace edash_packager {
namespace media {

View File

@ -8,7 +8,7 @@
#include "packager/base/logging.h"
#include "packager/media/base/bit_reader.h"
#include "packager/media/formats/mp4/rcheck.h"
#include "packager/media/base/rcheck.h"
namespace edash_packager {
namespace media {

View File

@ -8,7 +8,7 @@
#include "packager/base/logging.h"
#include "packager/media/base/bit_reader.h"
#include "packager/media/formats/mp4/rcheck.h"
#include "packager/media/base/rcheck.h"
namespace edash_packager {
namespace media {

View File

@ -10,8 +10,8 @@
#include "packager/base/strings/string_util.h"
#include "packager/media/base/bit_reader.h"
#include "packager/media/base/buffer_writer.h"
#include "packager/media/base/rcheck.h"
#include "packager/base/strings/stringprintf.h"
#include "packager/media/formats/mp4/rcheck.h"
namespace edash_packager {
namespace media {

View File

@ -8,7 +8,7 @@
#include "packager/base/logging.h"
#include "packager/media/base/bit_reader.h"
#include "packager/media/formats/mp4/rcheck.h"
#include "packager/media/base/rcheck.h"
namespace {

View File

@ -9,7 +9,7 @@
#include <stdint.h>
#include "packager/media/formats/mp4/fourccs.h"
#include "packager/media/base/fourccs.h"
namespace edash_packager {
namespace media {

View File

@ -9,8 +9,8 @@
#include "packager/base/logging.h"
#include "packager/media/base/bit_reader.h"
#include "packager/media/base/macros.h"
#include "packager/media/base/rcheck.h"
#include "packager/media/formats/mp4/box_buffer.h"
#include "packager/media/formats/mp4/rcheck.h"
namespace {
const uint32_t kFourCCSize = 4;
@ -99,11 +99,11 @@ namespace {
TrackType FourCCToTrackType(FourCC fourcc) {
switch (fourcc) {
case FOURCC_VIDE:
case FOURCC_vide:
return kVideo;
case FOURCC_SOUN:
case FOURCC_soun:
return kAudio;
case FOURCC_TEXT:
case FOURCC_text:
return kText;
default:
return kInvalid;
@ -113,11 +113,11 @@ TrackType FourCCToTrackType(FourCC fourcc) {
FourCC TrackTypeToFourCC(TrackType track_type) {
switch (track_type) {
case kVideo:
return FOURCC_VIDE;
return FOURCC_vide;
case kAudio:
return FOURCC_SOUN;
return FOURCC_soun;
case kText:
return FOURCC_TEXT;
return FOURCC_text;
default:
return FOURCC_NULL;
}
@ -127,7 +127,7 @@ FourCC TrackTypeToFourCC(TrackType track_type) {
FileType::FileType() : major_brand(FOURCC_NULL), minor_version(0) {}
FileType::~FileType() {}
FourCC FileType::BoxType() const { return FOURCC_FTYP; }
FourCC FileType::BoxType() const { return FOURCC_ftyp; }
bool FileType::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -151,11 +151,11 @@ uint32_t FileType::ComputeSizeInternal() {
kFourCCSize * compatible_brands.size();
}
FourCC SegmentType::BoxType() const { return FOURCC_STYP; }
FourCC SegmentType::BoxType() const { return FOURCC_styp; }
ProtectionSystemSpecificHeader::ProtectionSystemSpecificHeader() {}
ProtectionSystemSpecificHeader::~ProtectionSystemSpecificHeader() {}
FourCC ProtectionSystemSpecificHeader::BoxType() const { return FOURCC_PSSH; }
FourCC ProtectionSystemSpecificHeader::BoxType() const { return FOURCC_pssh; }
bool ProtectionSystemSpecificHeader::ReadWriteInternal(BoxBuffer* buffer) {
if (buffer->Reading()) {
@ -176,7 +176,7 @@ uint32_t ProtectionSystemSpecificHeader::ComputeSizeInternal() {
SampleAuxiliaryInformationOffset::SampleAuxiliaryInformationOffset() {}
SampleAuxiliaryInformationOffset::~SampleAuxiliaryInformationOffset() {}
FourCC SampleAuxiliaryInformationOffset::BoxType() const { return FOURCC_SAIO; }
FourCC SampleAuxiliaryInformationOffset::BoxType() const { return FOURCC_saio; }
bool SampleAuxiliaryInformationOffset::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer));
@ -204,7 +204,7 @@ uint32_t SampleAuxiliaryInformationOffset::ComputeSizeInternal() {
SampleAuxiliaryInformationSize::SampleAuxiliaryInformationSize()
: default_sample_info_size(0), sample_count(0) {}
SampleAuxiliaryInformationSize::~SampleAuxiliaryInformationSize() {}
FourCC SampleAuxiliaryInformationSize::BoxType() const { return FOURCC_SAIZ; }
FourCC SampleAuxiliaryInformationSize::BoxType() const { return FOURCC_saiz; }
bool SampleAuxiliaryInformationSize::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer));
@ -297,7 +297,7 @@ uint32_t SampleEncryptionEntry::GetTotalSizeOfSubsamples() const {
SampleEncryption::SampleEncryption() : iv_size(0) {}
SampleEncryption::~SampleEncryption() {}
FourCC SampleEncryption::BoxType() const { return FOURCC_SENC; }
FourCC SampleEncryption::BoxType() const { return FOURCC_senc; }
bool SampleEncryption::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer));
@ -366,7 +366,7 @@ bool SampleEncryption::ParseFromSampleEncryptionData(
OriginalFormat::OriginalFormat() : format(FOURCC_NULL) {}
OriginalFormat::~OriginalFormat() {}
FourCC OriginalFormat::BoxType() const { return FOURCC_FRMA; }
FourCC OriginalFormat::BoxType() const { return FOURCC_frma; }
bool OriginalFormat::ReadWriteInternal(BoxBuffer* buffer) {
return ReadWriteHeaderInternal(buffer) && buffer->ReadWriteFourCC(&format);
@ -378,7 +378,7 @@ uint32_t OriginalFormat::ComputeSizeInternal() {
SchemeType::SchemeType() : type(FOURCC_NULL), version(0) {}
SchemeType::~SchemeType() {}
FourCC SchemeType::BoxType() const { return FOURCC_SCHM; }
FourCC SchemeType::BoxType() const { return FOURCC_schm; }
bool SchemeType::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -394,7 +394,7 @@ uint32_t SchemeType::ComputeSizeInternal() {
TrackEncryption::TrackEncryption()
: is_encrypted(false), default_iv_size(0), default_kid(16, 0) {}
TrackEncryption::~TrackEncryption() {}
FourCC TrackEncryption::BoxType() const { return FOURCC_TENC; }
FourCC TrackEncryption::BoxType() const { return FOURCC_tenc; }
bool TrackEncryption::ReadWriteInternal(BoxBuffer* buffer) {
if (!buffer->Reading()) {
@ -429,7 +429,7 @@ uint32_t TrackEncryption::ComputeSizeInternal() {
SchemeInfo::SchemeInfo() {}
SchemeInfo::~SchemeInfo() {}
FourCC SchemeInfo::BoxType() const { return FOURCC_SCHI; }
FourCC SchemeInfo::BoxType() const { return FOURCC_schi; }
bool SchemeInfo::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) && buffer->PrepareChildren() &&
@ -443,14 +443,14 @@ uint32_t SchemeInfo::ComputeSizeInternal() {
ProtectionSchemeInfo::ProtectionSchemeInfo() {}
ProtectionSchemeInfo::~ProtectionSchemeInfo() {}
FourCC ProtectionSchemeInfo::BoxType() const { return FOURCC_SINF; }
FourCC ProtectionSchemeInfo::BoxType() const { return FOURCC_sinf; }
bool ProtectionSchemeInfo::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
buffer->PrepareChildren() &&
buffer->ReadWriteChild(&format) &&
buffer->ReadWriteChild(&type));
if (type.type == FOURCC_CENC || type.type == FOURCC_CBC1)
if (type.type == FOURCC_cenc || type.type == FOURCC_cbc1)
RCHECK(buffer->ReadWriteChild(&info));
// Other protection schemes are silently ignored. Since the protection scheme
// type can't be determined until this box is opened, we return 'true' for
@ -476,7 +476,7 @@ MovieHeader::MovieHeader()
volume(1 << 8),
next_track_id(0) {}
MovieHeader::~MovieHeader() {}
FourCC MovieHeader::BoxType() const { return FOURCC_MVHD; }
FourCC MovieHeader::BoxType() const { return FOURCC_mvhd; }
bool MovieHeader::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer));
@ -519,7 +519,7 @@ TrackHeader::TrackHeader()
flags = kTrackEnabled | kTrackInMovie;
}
TrackHeader::~TrackHeader() {}
FourCC TrackHeader::BoxType() const { return FOURCC_TKHD; }
FourCC TrackHeader::BoxType() const { return FOURCC_tkhd; }
bool TrackHeader::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer));
@ -559,7 +559,7 @@ uint32_t TrackHeader::ComputeSizeInternal() {
SampleDescription::SampleDescription() : type(kInvalid) {}
SampleDescription::~SampleDescription() {}
FourCC SampleDescription::BoxType() const { return FOURCC_STSD; }
FourCC SampleDescription::BoxType() const { return FOURCC_stsd; }
bool SampleDescription::ReadWriteInternal(BoxBuffer* buffer) {
uint32_t count = 0;
@ -632,7 +632,7 @@ uint32_t SampleDescription::ComputeSizeInternal() {
DecodingTimeToSample::DecodingTimeToSample() {}
DecodingTimeToSample::~DecodingTimeToSample() {}
FourCC DecodingTimeToSample::BoxType() const { return FOURCC_STTS; }
FourCC DecodingTimeToSample::BoxType() const { return FOURCC_stts; }
bool DecodingTimeToSample::ReadWriteInternal(BoxBuffer* buffer) {
uint32_t count = decoding_time.size();
@ -654,7 +654,7 @@ uint32_t DecodingTimeToSample::ComputeSizeInternal() {
CompositionTimeToSample::CompositionTimeToSample() {}
CompositionTimeToSample::~CompositionTimeToSample() {}
FourCC CompositionTimeToSample::BoxType() const { return FOURCC_CTTS; }
FourCC CompositionTimeToSample::BoxType() const { return FOURCC_ctts; }
bool CompositionTimeToSample::ReadWriteInternal(BoxBuffer* buffer) {
uint32_t count = composition_offset.size();
@ -705,7 +705,7 @@ uint32_t CompositionTimeToSample::ComputeSizeInternal() {
SampleToChunk::SampleToChunk() {}
SampleToChunk::~SampleToChunk() {}
FourCC SampleToChunk::BoxType() const { return FOURCC_STSC; }
FourCC SampleToChunk::BoxType() const { return FOURCC_stsc; }
bool SampleToChunk::ReadWriteInternal(BoxBuffer* buffer) {
uint32_t count = chunk_info.size();
@ -731,7 +731,7 @@ uint32_t SampleToChunk::ComputeSizeInternal() {
SampleSize::SampleSize() : sample_size(0), sample_count(0) {}
SampleSize::~SampleSize() {}
FourCC SampleSize::BoxType() const { return FOURCC_STSZ; }
FourCC SampleSize::BoxType() const { return FOURCC_stsz; }
bool SampleSize::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -756,7 +756,7 @@ uint32_t SampleSize::ComputeSizeInternal() {
CompactSampleSize::CompactSampleSize() : field_size(0) {}
CompactSampleSize::~CompactSampleSize() {}
FourCC CompactSampleSize::BoxType() const { return FOURCC_STZ2; }
FourCC CompactSampleSize::BoxType() const { return FOURCC_stz2; }
bool CompactSampleSize::ReadWriteInternal(BoxBuffer* buffer) {
uint32_t sample_count = sizes.size();
@ -811,7 +811,7 @@ uint32_t CompactSampleSize::ComputeSizeInternal() {
ChunkOffset::ChunkOffset() {}
ChunkOffset::~ChunkOffset() {}
FourCC ChunkOffset::BoxType() const { return FOURCC_STCO; }
FourCC ChunkOffset::BoxType() const { return FOURCC_stco; }
bool ChunkOffset::ReadWriteInternal(BoxBuffer* buffer) {
uint32_t count = offsets.size();
@ -830,7 +830,7 @@ uint32_t ChunkOffset::ComputeSizeInternal() {
ChunkLargeOffset::ChunkLargeOffset() {}
ChunkLargeOffset::~ChunkLargeOffset() {}
FourCC ChunkLargeOffset::BoxType() const { return FOURCC_CO64; }
FourCC ChunkLargeOffset::BoxType() const { return FOURCC_co64; }
bool ChunkLargeOffset::ReadWriteInternal(BoxBuffer* buffer) {
uint32_t count = offsets.size();
@ -866,7 +866,7 @@ uint32_t ChunkLargeOffset::ComputeSizeInternal() {
SyncSample::SyncSample() {}
SyncSample::~SyncSample() {}
FourCC SyncSample::BoxType() const { return FOURCC_STSS; }
FourCC SyncSample::BoxType() const { return FOURCC_stss; }
bool SyncSample::ReadWriteInternal(BoxBuffer* buffer) {
uint32_t count = sample_number.size();
@ -889,7 +889,7 @@ uint32_t SyncSample::ComputeSizeInternal() {
SampleTable::SampleTable() {}
SampleTable::~SampleTable() {}
FourCC SampleTable::BoxType() const { return FOURCC_STBL; }
FourCC SampleTable::BoxType() const { return FOURCC_stbl; }
bool SampleTable::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -940,7 +940,7 @@ uint32_t SampleTable::ComputeSizeInternal() {
EditList::EditList() {}
EditList::~EditList() {}
FourCC EditList::BoxType() const { return FOURCC_ELST; }
FourCC EditList::BoxType() const { return FOURCC_elst; }
bool EditList::ReadWriteInternal(BoxBuffer* buffer) {
uint32_t count = edits.size();
@ -977,7 +977,7 @@ uint32_t EditList::ComputeSizeInternal() {
Edit::Edit() {}
Edit::~Edit() {}
FourCC Edit::BoxType() const { return FOURCC_EDTS; }
FourCC Edit::BoxType() const { return FOURCC_edts; }
bool Edit::ReadWriteInternal(BoxBuffer* buffer) {
return ReadWriteHeaderInternal(buffer) &&
@ -994,21 +994,21 @@ uint32_t Edit::ComputeSizeInternal() {
HandlerReference::HandlerReference() : handler_type(FOURCC_NULL) {}
HandlerReference::~HandlerReference() {}
FourCC HandlerReference::BoxType() const { return FOURCC_HDLR; }
FourCC HandlerReference::BoxType() const { return FOURCC_hdlr; }
bool HandlerReference::ReadWriteInternal(BoxBuffer* buffer) {
std::vector<uint8_t> handler_name;
if (!buffer->Reading()) {
switch (handler_type) {
case FOURCC_VIDE:
case FOURCC_vide:
handler_name.assign(kVideoHandlerName,
kVideoHandlerName + arraysize(kVideoHandlerName));
break;
case FOURCC_SOUN:
case FOURCC_soun:
handler_name.assign(kAudioHandlerName,
kAudioHandlerName + arraysize(kAudioHandlerName));
break;
case FOURCC_TEXT:
case FOURCC_text:
handler_name.assign(kTextHandlerName,
kTextHandlerName + arraysize(kTextHandlerName));
break;
@ -1032,13 +1032,13 @@ bool HandlerReference::ReadWriteInternal(BoxBuffer* buffer) {
uint32_t HandlerReference::ComputeSizeInternal() {
uint32_t box_size = HeaderSize() + kFourCCSize + 16; // 16 bytes Reserved
switch (handler_type) {
case FOURCC_VIDE:
case FOURCC_vide:
box_size += sizeof(kVideoHandlerName);
break;
case FOURCC_SOUN:
case FOURCC_soun:
box_size += sizeof(kAudioHandlerName);
break;
case FOURCC_TEXT:
case FOURCC_text:
box_size += sizeof(kTextHandlerName);
break;
case FOURCC_ID32:
@ -1168,7 +1168,7 @@ Metadata::Metadata() {}
Metadata::~Metadata() {}
FourCC Metadata::BoxType() const {
return FOURCC_META;
return FOURCC_meta;
}
bool Metadata::ReadWriteInternal(BoxBuffer* buffer) {
@ -1212,7 +1212,7 @@ uint32_t CodecConfigurationRecord::ComputeSizeInternal() {
PixelAspectRatio::PixelAspectRatio() : h_spacing(0), v_spacing(0) {}
PixelAspectRatio::~PixelAspectRatio() {}
FourCC PixelAspectRatio::BoxType() const { return FOURCC_PASP; }
FourCC PixelAspectRatio::BoxType() const { return FOURCC_pasp; }
bool PixelAspectRatio::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -1252,20 +1252,20 @@ bool VideoSampleEntry::ReadWriteInternal(BoxBuffer* buffer) {
const FourCC actual_format = GetActualFormat();
switch (actual_format) {
case FOURCC_AVC1:
case FOURCC_avc1:
compressor_name.assign(
kAvcCompressorName,
kAvcCompressorName + arraysize(kAvcCompressorName));
break;
case FOURCC_HEV1:
case FOURCC_HVC1:
case FOURCC_hev1:
case FOURCC_hvc1:
compressor_name.assign(
kHevcCompressorName,
kHevcCompressorName + arraysize(kHevcCompressorName));
break;
case FOURCC_VP08:
case FOURCC_VP09:
case FOURCC_VP10:
case FOURCC_vp08:
case FOURCC_vp09:
case FOURCC_vp10:
compressor_name.assign(
kVpcCompressorName,
kVpcCompressorName + arraysize(kVpcCompressorName));
@ -1296,11 +1296,11 @@ bool VideoSampleEntry::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(buffer->PrepareChildren());
if (format == FOURCC_ENCV) {
if (format == FOURCC_encv) {
if (buffer->Reading()) {
// Continue scanning until a recognized protection scheme is found,
// or until we run out of protection schemes.
while (sinf.type.type != FOURCC_CENC && sinf.type.type != FOURCC_CBC1) {
while (sinf.type.type != FOURCC_cenc && sinf.type.type != FOURCC_cbc1) {
if (!buffer->ReadWriteChild(&sinf))
return false;
}
@ -1311,17 +1311,17 @@ bool VideoSampleEntry::ReadWriteInternal(BoxBuffer* buffer) {
const FourCC actual_format = GetActualFormat();
switch (actual_format) {
case FOURCC_AVC1:
codec_config_record.box_type = FOURCC_AVCC;
case FOURCC_avc1:
codec_config_record.box_type = FOURCC_avcC;
break;
case FOURCC_HEV1:
case FOURCC_HVC1:
codec_config_record.box_type = FOURCC_HVCC;
case FOURCC_hev1:
case FOURCC_hvc1:
codec_config_record.box_type = FOURCC_hvcC;
break;
case FOURCC_VP08:
case FOURCC_VP09:
case FOURCC_VP10:
codec_config_record.box_type = FOURCC_VPCC;
case FOURCC_vp08:
case FOURCC_vp09:
case FOURCC_vp10:
codec_config_record.box_type = FOURCC_vpcC;
break;
default:
LOG(ERROR) << FourCCToString(actual_format) << " is not supported.";
@ -1343,7 +1343,7 @@ uint32_t VideoSampleEntry::ComputeSizeInternal() {
ElementaryStreamDescriptor::ElementaryStreamDescriptor() {}
ElementaryStreamDescriptor::~ElementaryStreamDescriptor() {}
FourCC ElementaryStreamDescriptor::BoxType() const { return FOURCC_ESDS; }
FourCC ElementaryStreamDescriptor::BoxType() const { return FOURCC_esds; }
bool ElementaryStreamDescriptor::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer));
@ -1375,7 +1375,7 @@ DTSSpecific::DTSSpecific()
avg_bitrate(0),
pcm_sample_depth(0) {}
DTSSpecific::~DTSSpecific() {}
FourCC DTSSpecific::BoxType() const { return FOURCC_DDTS; }
FourCC DTSSpecific::BoxType() const { return FOURCC_ddts; }
bool DTSSpecific::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -1408,7 +1408,7 @@ uint32_t DTSSpecific::ComputeSizeInternal() {
AC3Specific::AC3Specific() {}
AC3Specific::~AC3Specific() {}
FourCC AC3Specific::BoxType() const { return FOURCC_DAC3; }
FourCC AC3Specific::BoxType() const { return FOURCC_dac3; }
bool AC3Specific::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -1427,7 +1427,7 @@ uint32_t AC3Specific::ComputeSizeInternal() {
EC3Specific::EC3Specific() {}
EC3Specific::~EC3Specific() {}
FourCC EC3Specific::BoxType() const { return FOURCC_DEC3; }
FourCC EC3Specific::BoxType() const { return FOURCC_dec3; }
bool EC3Specific::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer));
@ -1481,11 +1481,11 @@ bool AudioSampleEntry::ReadWriteInternal(BoxBuffer* buffer) {
samplerate >>= 16;
RCHECK(buffer->PrepareChildren());
if (format == FOURCC_ENCA) {
if (format == FOURCC_enca) {
if (buffer->Reading()) {
// Continue scanning until a recognized protection scheme is found,
// or until we run out of protection schemes.
while (sinf.type.type != FOURCC_CENC && sinf.type.type != FOURCC_CBC1) {
while (sinf.type.type != FOURCC_cenc && sinf.type.type != FOURCC_cbc1) {
if (!buffer->ReadWriteChild(&sinf))
return false;
}
@ -1587,7 +1587,7 @@ uint32_t TextSampleEntry::ComputeSizeInternal() {
MediaHeader::MediaHeader()
: creation_time(0), modification_time(0), timescale(0), duration(0) {}
MediaHeader::~MediaHeader() {}
FourCC MediaHeader::BoxType() const { return FOURCC_MDHD; }
FourCC MediaHeader::BoxType() const { return FOURCC_mdhd; }
bool MediaHeader::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer));
@ -1615,7 +1615,7 @@ VideoMediaHeader::VideoMediaHeader()
flags = kVideoMediaHeaderFlags;
}
VideoMediaHeader::~VideoMediaHeader() {}
FourCC VideoMediaHeader::BoxType() const { return FOURCC_VMHD; }
FourCC VideoMediaHeader::BoxType() const { return FOURCC_vmhd; }
bool VideoMediaHeader::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
buffer->ReadWriteUInt16(&graphicsmode) &&
@ -1632,7 +1632,7 @@ uint32_t VideoMediaHeader::ComputeSizeInternal() {
SoundMediaHeader::SoundMediaHeader() : balance(0) {}
SoundMediaHeader::~SoundMediaHeader() {}
FourCC SoundMediaHeader::BoxType() const { return FOURCC_SMHD; }
FourCC SoundMediaHeader::BoxType() const { return FOURCC_smhd; }
bool SoundMediaHeader::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
buffer->ReadWriteUInt16(&balance) &&
@ -1662,7 +1662,7 @@ DataEntryUrl::DataEntryUrl() {
flags = kDataEntryUrlFlags;
}
DataEntryUrl::~DataEntryUrl() {}
FourCC DataEntryUrl::BoxType() const { return FOURCC_URL; }
FourCC DataEntryUrl::BoxType() const { return FOURCC_url; }
bool DataEntryUrl::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer));
if (buffer->Reading()) {
@ -1682,7 +1682,7 @@ DataReference::DataReference() {
data_entry.resize(1);
}
DataReference::~DataReference() {}
FourCC DataReference::BoxType() const { return FOURCC_DREF; }
FourCC DataReference::BoxType() const { return FOURCC_dref; }
bool DataReference::ReadWriteInternal(BoxBuffer* buffer) {
uint32_t entry_count = data_entry.size();
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -1704,7 +1704,7 @@ uint32_t DataReference::ComputeSizeInternal() {
DataInformation::DataInformation() {}
DataInformation::~DataInformation() {}
FourCC DataInformation::BoxType() const { return FOURCC_DINF; }
FourCC DataInformation::BoxType() const { return FOURCC_dinf; }
bool DataInformation::ReadWriteInternal(BoxBuffer* buffer) {
return ReadWriteHeaderInternal(buffer) &&
@ -1718,7 +1718,7 @@ uint32_t DataInformation::ComputeSizeInternal() {
MediaInformation::MediaInformation() {}
MediaInformation::~MediaInformation() {}
FourCC MediaInformation::BoxType() const { return FOURCC_MINF; }
FourCC MediaInformation::BoxType() const { return FOURCC_minf; }
bool MediaInformation::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -1763,7 +1763,7 @@ uint32_t MediaInformation::ComputeSizeInternal() {
Media::Media() {}
Media::~Media() {}
FourCC Media::BoxType() const { return FOURCC_MDIA; }
FourCC Media::BoxType() const { return FOURCC_mdia; }
bool Media::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -1798,7 +1798,7 @@ uint32_t Media::ComputeSizeInternal() {
Track::Track() {}
Track::~Track() {}
FourCC Track::BoxType() const { return FOURCC_TRAK; }
FourCC Track::BoxType() const { return FOURCC_trak; }
bool Track::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -1817,7 +1817,7 @@ uint32_t Track::ComputeSizeInternal() {
MovieExtendsHeader::MovieExtendsHeader() : fragment_duration(0) {}
MovieExtendsHeader::~MovieExtendsHeader() {}
FourCC MovieExtendsHeader::BoxType() const { return FOURCC_MEHD; }
FourCC MovieExtendsHeader::BoxType() const { return FOURCC_mehd; }
bool MovieExtendsHeader::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer));
@ -1841,7 +1841,7 @@ TrackExtends::TrackExtends()
default_sample_size(0),
default_sample_flags(0) {}
TrackExtends::~TrackExtends() {}
FourCC TrackExtends::BoxType() const { return FOURCC_TREX; }
FourCC TrackExtends::BoxType() const { return FOURCC_trex; }
bool TrackExtends::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -1862,7 +1862,7 @@ uint32_t TrackExtends::ComputeSizeInternal() {
MovieExtends::MovieExtends() {}
MovieExtends::~MovieExtends() {}
FourCC MovieExtends::BoxType() const { return FOURCC_MVEX; }
FourCC MovieExtends::BoxType() const { return FOURCC_mvex; }
bool MovieExtends::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -1890,7 +1890,7 @@ uint32_t MovieExtends::ComputeSizeInternal() {
Movie::Movie() {}
Movie::~Movie() {}
FourCC Movie::BoxType() const { return FOURCC_MOOV; }
FourCC Movie::BoxType() const { return FOURCC_moov; }
bool Movie::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -1924,7 +1924,7 @@ uint32_t Movie::ComputeSizeInternal() {
TrackFragmentDecodeTime::TrackFragmentDecodeTime() : decode_time(0) {}
TrackFragmentDecodeTime::~TrackFragmentDecodeTime() {}
FourCC TrackFragmentDecodeTime::BoxType() const { return FOURCC_TFDT; }
FourCC TrackFragmentDecodeTime::BoxType() const { return FOURCC_tfdt; }
bool TrackFragmentDecodeTime::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer));
@ -1940,7 +1940,7 @@ uint32_t TrackFragmentDecodeTime::ComputeSizeInternal() {
MovieFragmentHeader::MovieFragmentHeader() : sequence_number(0) {}
MovieFragmentHeader::~MovieFragmentHeader() {}
FourCC MovieFragmentHeader::BoxType() const { return FOURCC_MFHD; }
FourCC MovieFragmentHeader::BoxType() const { return FOURCC_mfhd; }
bool MovieFragmentHeader::ReadWriteInternal(BoxBuffer* buffer) {
return ReadWriteHeaderInternal(buffer) &&
@ -1959,7 +1959,7 @@ TrackFragmentHeader::TrackFragmentHeader()
default_sample_flags(0) {}
TrackFragmentHeader::~TrackFragmentHeader() {}
FourCC TrackFragmentHeader::BoxType() const { return FOURCC_TFHD; }
FourCC TrackFragmentHeader::BoxType() const { return FOURCC_tfhd; }
bool TrackFragmentHeader::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -2014,7 +2014,7 @@ uint32_t TrackFragmentHeader::ComputeSizeInternal() {
TrackFragmentRun::TrackFragmentRun() : sample_count(0), data_offset(0) {}
TrackFragmentRun::~TrackFragmentRun() {}
FourCC TrackFragmentRun::BoxType() const { return FOURCC_TRUN; }
FourCC TrackFragmentRun::BoxType() const { return FOURCC_trun; }
bool TrackFragmentRun::ReadWriteInternal(BoxBuffer* buffer) {
if (!buffer->Reading()) {
@ -2135,7 +2135,7 @@ uint32_t TrackFragmentRun::ComputeSizeInternal() {
SampleToGroup::SampleToGroup() : grouping_type(0), grouping_type_parameter(0) {}
SampleToGroup::~SampleToGroup() {}
FourCC SampleToGroup::BoxType() const { return FOURCC_SBGP; }
FourCC SampleToGroup::BoxType() const { return FOURCC_sbgp; }
bool SampleToGroup::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -2143,7 +2143,7 @@ bool SampleToGroup::ReadWriteInternal(BoxBuffer* buffer) {
if (version == 1)
RCHECK(buffer->ReadWriteUInt32(&grouping_type_parameter));
if (grouping_type != FOURCC_SEIG) {
if (grouping_type != FOURCC_seig) {
DCHECK(buffer->Reading());
DLOG(WARNING) << "Sample group "
<< FourCCToString(static_cast<FourCC>(grouping_type))
@ -2177,13 +2177,13 @@ CencSampleEncryptionInfoEntry::~CencSampleEncryptionInfoEntry() {};
SampleGroupDescription::SampleGroupDescription() : grouping_type(0) {}
SampleGroupDescription::~SampleGroupDescription() {}
FourCC SampleGroupDescription::BoxType() const { return FOURCC_SGPD; }
FourCC SampleGroupDescription::BoxType() const { return FOURCC_sgpd; }
bool SampleGroupDescription::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
buffer->ReadWriteUInt32(&grouping_type));
if (grouping_type != FOURCC_SEIG) {
if (grouping_type != FOURCC_seig) {
DCHECK(buffer->Reading());
DLOG(WARNING) << "Sample group '" << grouping_type << "' is not supported.";
return true;
@ -2254,7 +2254,7 @@ uint32_t SampleGroupDescription::ComputeSizeInternal() {
TrackFragment::TrackFragment() : decode_time_absent(false) {}
TrackFragment::~TrackFragment() {}
FourCC TrackFragment::BoxType() const { return FOURCC_TRAF; }
FourCC TrackFragment::BoxType() const { return FOURCC_traf; }
bool TrackFragment::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -2271,11 +2271,11 @@ bool TrackFragment::ReadWriteInternal(BoxBuffer* buffer) {
// with different grouping types. For common encryption, the relevant
// grouping type is 'seig'. Continue reading until 'seig' is found, or
// until running out of child boxes.
while (sample_to_group.grouping_type != FOURCC_SEIG &&
while (sample_to_group.grouping_type != FOURCC_seig &&
buffer->reader()->ChildExist(&sample_to_group)) {
RCHECK(buffer->reader()->ReadChild(&sample_to_group));
}
while (sample_group_description.grouping_type != FOURCC_SEIG &&
while (sample_group_description.grouping_type != FOURCC_seig &&
buffer->reader()->ChildExist(&sample_group_description)) {
RCHECK(buffer->reader()->ReadChild(&sample_group_description));
}
@ -2305,7 +2305,7 @@ uint32_t TrackFragment::ComputeSizeInternal() {
MovieFragment::MovieFragment() {}
MovieFragment::~MovieFragment() {}
FourCC MovieFragment::BoxType() const { return FOURCC_MOOF; }
FourCC MovieFragment::BoxType() const { return FOURCC_moof; }
bool MovieFragment::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -2340,7 +2340,7 @@ SegmentIndex::SegmentIndex()
earliest_presentation_time(0),
first_offset(0) {}
SegmentIndex::~SegmentIndex() {}
FourCC SegmentIndex::BoxType() const { return FOURCC_SIDX; }
FourCC SegmentIndex::BoxType() const { return FOURCC_sidx; }
bool SegmentIndex::ReadWriteInternal(BoxBuffer* buffer) {
RCHECK(ReadWriteHeaderInternal(buffer) &&
@ -2392,7 +2392,7 @@ uint32_t SegmentIndex::ComputeSizeInternal() {
MediaData::MediaData() : data_size(0) {}
MediaData::~MediaData() {}
FourCC MediaData::BoxType() const { return FOURCC_MDAT; }
FourCC MediaData::BoxType() const { return FOURCC_mdat; }
bool MediaData::ReadWriteInternal(BoxBuffer* buffer) {
NOTIMPLEMENTED() << "Actual data is parsed and written separately.";

View File

@ -8,10 +8,10 @@
#include <vector>
#include "packager/media/base/decrypt_config.h"
#include "packager/media/base/fourccs.h"
#include "packager/media/formats/mp4/aac_audio_specific_config.h"
#include "packager/media/formats/mp4/box.h"
#include "packager/media/formats/mp4/es_descriptor.h"
#include "packager/media/formats/mp4/fourccs.h"
namespace edash_packager {
namespace media {
@ -277,7 +277,7 @@ struct VideoSampleEntry : Box {
DECLARE_BOX_METHODS(VideoSampleEntry);
// Returns actual format of this sample entry.
FourCC GetActualFormat() const {
return format == FOURCC_ENCV ? sinf.format.format : format;
return format == FOURCC_encv ? sinf.format.format : format;
}
FourCC format;
@ -323,7 +323,7 @@ struct AudioSampleEntry : Box {
DECLARE_BOX_METHODS(AudioSampleEntry);
// Returns actual format of this sample entry.
FourCC GetActualFormat() const {
return format == FOURCC_ENCA ? sinf.format.format : format;
return format == FOURCC_enca ? sinf.format.format : format;
}
FourCC format;

View File

@ -46,7 +46,7 @@ class BoxDefinitionsTestGeneral : public testing::Test {
buffer.Swap(buffer_.get());
uint32_t skip_box_size = buffer.Size() + kBoxSize;
buffer_->AppendInt(skip_box_size);
buffer_->AppendInt(static_cast<uint32_t>(FOURCC_SKIP));
buffer_->AppendInt(static_cast<uint32_t>(FOURCC_skip));
buffer_->AppendBuffer(buffer);
bool err = false;
return BoxReader::ReadTopLevelBox(buffer_->Buffer(), buffer_->Size(), &err);
@ -133,17 +133,17 @@ class BoxDefinitionsTestGeneral : public testing::Test {
}
void Fill(FileType* ftyp) {
ftyp->major_brand = FOURCC_DASH;
ftyp->major_brand = FOURCC_dash;
ftyp->minor_version = 567;
ftyp->compatible_brands.push_back(FOURCC_ISO6);
ftyp->compatible_brands.push_back(FOURCC_MP41);
ftyp->compatible_brands.push_back(FOURCC_AVC1);
ftyp->compatible_brands.push_back(FOURCC_iso6);
ftyp->compatible_brands.push_back(FOURCC_mp41);
ftyp->compatible_brands.push_back(FOURCC_avc1);
}
void Modify(FileType* ftyp) {
ftyp->major_brand = FOURCC_MP41;
ftyp->major_brand = FOURCC_mp41;
ftyp->compatible_brands.clear();
ftyp->compatible_brands.push_back(FOURCC_DASH);
ftyp->compatible_brands.push_back(FOURCC_dash);
}
void Fill(ProtectionSystemSpecificHeader* pssh) {
@ -197,12 +197,12 @@ class BoxDefinitionsTestGeneral : public testing::Test {
senc->sample_encryption_entries[0].subsamples.clear();
}
void Fill(OriginalFormat* frma) { frma->format = FOURCC_AVC1; }
void Fill(OriginalFormat* frma) { frma->format = FOURCC_avc1; }
void Modify(OriginalFormat* frma) { frma->format = FOURCC_MP4A; }
void Modify(OriginalFormat* frma) { frma->format = FOURCC_mp4a; }
void Fill(SchemeType* schm) {
schm->type = FOURCC_CENC;
schm->type = FOURCC_cenc;
schm->version = 12344;
}
@ -297,9 +297,9 @@ class BoxDefinitionsTestGeneral : public testing::Test {
void Modify(Edit* edts) { Modify(&edts->list); }
void Fill(HandlerReference* hdlr) { hdlr->handler_type = FOURCC_VIDE; }
void Fill(HandlerReference* hdlr) { hdlr->handler_type = FOURCC_vide; }
void Modify(HandlerReference* hdlr) { hdlr->handler_type = FOURCC_SOUN; }
void Modify(HandlerReference* hdlr) { hdlr->handler_type = FOURCC_soun; }
void Fill(ID3v2* id3v2) {
id3v2->language.code = "eng";
@ -349,7 +349,7 @@ class BoxDefinitionsTestGeneral : public testing::Test {
}
void Fill(VideoSampleEntry* encv) {
encv->format = FOURCC_ENCV;
encv->format = FOURCC_encv;
encv->data_reference_index = 1;
encv->width = 800;
encv->height = 600;
@ -412,7 +412,7 @@ class BoxDefinitionsTestGeneral : public testing::Test {
}
void Fill(AudioSampleEntry* enca) {
enca->format = FOURCC_ENCA;
enca->format = FOURCC_enca;
enca->data_reference_index = 2;
enca->channelcount = 5;
enca->samplesize = 16;
@ -748,7 +748,7 @@ class BoxDefinitionsTestGeneral : public testing::Test {
}
void Fill(SampleToGroup* sbgp) {
sbgp->grouping_type = FOURCC_SEIG;
sbgp->grouping_type = FOURCC_seig;
sbgp->entries.resize(2);
sbgp->entries[0].sample_count = 3;
sbgp->entries[0].group_description_index = 0x10002;
@ -763,7 +763,7 @@ class BoxDefinitionsTestGeneral : public testing::Test {
}
void Fill(SampleGroupDescription* sgpd) {
sgpd->grouping_type = FOURCC_SEIG;
sgpd->grouping_type = FOURCC_seig;
sgpd->entries.resize(2);
sgpd->entries[0].is_encrypted = true;
sgpd->entries[0].iv_size = 8;
@ -1091,12 +1091,12 @@ TEST_F(BoxDefinitionsTest, MediaHandlerType) {
Media media_readback;
ASSERT_TRUE(ReadBack(&media_readback));
ASSERT_EQ(FOURCC_VIDE, media_readback.handler.handler_type);
ASSERT_EQ(FOURCC_vide, media_readback.handler.handler_type);
}
TEST_F(BoxDefinitionsTest, DTSSampleEntry) {
AudioSampleEntry entry;
entry.format = FOURCC_DTSE;
entry.format = FOURCC_dtse;
entry.data_reference_index = 2;
entry.channelcount = 5;
entry.samplesize = 16;
@ -1110,7 +1110,7 @@ TEST_F(BoxDefinitionsTest, DTSSampleEntry) {
TEST_F(BoxDefinitionsTest, AC3SampleEntry) {
AudioSampleEntry entry;
entry.format = FOURCC_AC3;
entry.format = FOURCC_ac_3;
entry.data_reference_index = 2;
entry.channelcount = 5;
entry.samplesize = 16;
@ -1125,7 +1125,7 @@ TEST_F(BoxDefinitionsTest, AC3SampleEntry) {
TEST_F(BoxDefinitionsTest, EC3SampleEntry) {
AudioSampleEntry entry;
entry.format = FOURCC_EAC3;
entry.format = FOURCC_ec_3;
entry.data_reference_index = 2;
entry.channelcount = 5;
entry.samplesize = 16;

View File

@ -42,7 +42,7 @@ BoxReader* BoxReader::ReadTopLevelBox(const uint8_t* buf,
return NULL;
// We don't require the complete box to be available for MDAT box.
if (reader->type() == FOURCC_MDAT)
if (reader->type() == FOURCC_mdat)
return reader.release();
if (!IsValidTopLevelBox(reader->type())) {
@ -77,21 +77,21 @@ bool BoxReader::StartTopLevelBox(const uint8_t* buf,
// static
bool BoxReader::IsValidTopLevelBox(const FourCC& type) {
switch (type) {
case FOURCC_FTYP:
case FOURCC_PDIN:
case FOURCC_BLOC:
case FOURCC_MOOV:
case FOURCC_MOOF:
case FOURCC_MFRA:
case FOURCC_MDAT:
case FOURCC_FREE:
case FOURCC_SKIP:
case FOURCC_META:
case FOURCC_MECO:
case FOURCC_STYP:
case FOURCC_SIDX:
case FOURCC_SSIX:
case FOURCC_PRFT:
case FOURCC_ftyp:
case FOURCC_pdin:
case FOURCC_bloc:
case FOURCC_moov:
case FOURCC_moof:
case FOURCC_mfra:
case FOURCC_mdat:
case FOURCC_free:
case FOURCC_skip:
case FOURCC_meta:
case FOURCC_meco:
case FOURCC_styp:
case FOURCC_sidx:
case FOURCC_ssix:
case FOURCC_prft:
return true;
default:
// Hex is used to show nonprintable characters and aid in debugging
@ -173,7 +173,7 @@ bool BoxReader::ReadHeader(bool* err) {
// 'mdat' box could have a 64-bit size; other boxes should be very small.
if (size > static_cast<uint64_t>(std::numeric_limits<int32_t>::max()) &&
type_ != FOURCC_MDAT) {
type_ != FOURCC_mdat) {
LOG(ERROR) << base::StringPrintf("Box '%s' size (%" PRIu64
") is too large.",
FourCCToString(type_).c_str(),

View File

@ -11,8 +11,8 @@
#include "packager/base/compiler_specific.h"
#include "packager/base/logging.h"
#include "packager/media/base/buffer_reader.h"
#include "packager/media/formats/mp4/fourccs.h"
#include "packager/media/formats/mp4/rcheck.h"
#include "packager/media/base/fourccs.h"
#include "packager/media/base/rcheck.h"
namespace edash_packager {
namespace media {

View File

@ -8,8 +8,8 @@
#include "packager/base/logging.h"
#include "packager/base/memory/scoped_ptr.h"
#include "packager/media/base/rcheck.h"
#include "packager/media/formats/mp4/box_buffer.h"
#include "packager/media/formats/mp4/rcheck.h"
namespace edash_packager {
namespace media {
@ -30,7 +30,7 @@ static const uint8_t kSkipBox[] = {
0x00};
struct FreeBox : Box {
FourCC BoxType() const override { return FOURCC_FREE; }
FourCC BoxType() const override { return FOURCC_free; }
bool ReadWriteInternal(BoxBuffer* buffer) override {
return true;
}
@ -41,7 +41,7 @@ struct FreeBox : Box {
};
struct PsshBox : Box {
FourCC BoxType() const override { return FOURCC_PSSH; }
FourCC BoxType() const override { return FOURCC_pssh; }
bool ReadWriteInternal(BoxBuffer* buffer) override {
return buffer->ReadWriteUInt32(&val);
}
@ -54,7 +54,7 @@ struct PsshBox : Box {
};
struct SkipBox : FullBox {
FourCC BoxType() const override { return FOURCC_SKIP; }
FourCC BoxType() const override { return FOURCC_skip; }
bool ReadWriteInternal(BoxBuffer* buffer) override {
RCHECK(ReadWriteHeaderInternal(buffer) && buffer->ReadWriteUInt8(&a) &&
buffer->ReadWriteUInt8(&b) && buffer->ReadWriteUInt16(&c) &&
@ -208,7 +208,7 @@ TEST_F(BoxReaderTest, SkippingBloc) {
EXPECT_FALSE(err);
EXPECT_TRUE(reader);
EXPECT_EQ(FOURCC_BLOC, reader->type());
EXPECT_EQ(FOURCC_bloc, reader->type());
}
} // namespace mp4

View File

@ -6,7 +6,7 @@
#include "packager/media/base/bit_reader.h"
#include "packager/media/base/buffer_writer.h"
#include "packager/media/formats/mp4/rcheck.h"
#include "packager/media/base/rcheck.h"
namespace edash_packager {
namespace media {

View File

@ -1,148 +0,0 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_FORMATS_MP4_FOURCCS_H_
#define MEDIA_FORMATS_MP4_FOURCCS_H_
#include <string>
namespace edash_packager {
namespace media {
namespace mp4 {
// TODO(rkuroiwa): Make these case sensitive. e.g. FOURCC_avc1.
enum FourCC {
FOURCC_NULL = 0,
FOURCC_ID32 = 0x49443332,
FOURCC_PRIV = 0x50524956,
FOURCC_AC3 = 0x61632d33, // This fourcc is "ac-3".
FOURCC_AVC1 = 0x61766331,
FOURCC_AVCC = 0x61766343,
FOURCC_BLOC = 0x626C6F63,
FOURCC_CBC1 = 0x63626331,
FOURCC_CENC = 0x63656e63,
FOURCC_CO64 = 0x636f3634,
FOURCC_CTTS = 0x63747473,
FOURCC_DAC3 = 0x64616333,
FOURCC_DASH = 0x64617368,
FOURCC_DDTS = 0x64647473,
FOURCC_DEC3 = 0x64656333,
FOURCC_DINF = 0x64696e66,
FOURCC_DREF = 0x64726566,
FOURCC_DTSC = 0x64747363,
FOURCC_DTSE = 0x64747365,
FOURCC_DTSH = 0x64747368,
FOURCC_DTSL = 0x6474736c,
FOURCC_DTSM = 0x6474732d,
FOURCC_DTSP = 0x6474732b,
FOURCC_EAC3 = 0x65632d33, // This fourcc is "ec-3".
FOURCC_EDTS = 0x65647473,
FOURCC_ELST = 0x656c7374,
FOURCC_ENCA = 0x656e6361,
FOURCC_ENCV = 0x656e6376,
FOURCC_ESDS = 0x65736473,
FOURCC_FREE = 0x66726565,
FOURCC_FRMA = 0x66726d61,
FOURCC_FTYP = 0x66747970,
FOURCC_HDLR = 0x68646c72,
FOURCC_HEV1 = 0x68657631,
FOURCC_HINT = 0x68696e74,
FOURCC_HVC1 = 0x68766331,
FOURCC_HVCC = 0x68766343,
FOURCC_ISO6 = 0x69736f36,
FOURCC_IODS = 0x696f6473,
FOURCC_MDAT = 0x6d646174,
FOURCC_MDHD = 0x6d646864,
FOURCC_MDIA = 0x6d646961,
FOURCC_MECO = 0x6d65636f,
FOURCC_MEHD = 0x6d656864,
FOURCC_META = 0x6d657461,
FOURCC_MFHD = 0x6d666864,
FOURCC_MFRA = 0x6d667261,
FOURCC_MINF = 0x6d696e66,
FOURCC_MOOF = 0x6d6f6f66,
FOURCC_MOOV = 0x6d6f6f76,
FOURCC_MP41 = 0x6d703431,
FOURCC_MP4A = 0x6d703461,
FOURCC_MP4V = 0x6d703476,
FOURCC_MVEX = 0x6d766578,
FOURCC_MVHD = 0x6d766864,
FOURCC_PASP = 0x70617370,
FOURCC_PDIN = 0x7064696e,
FOURCC_PRFT = 0x70726674,
FOURCC_PSSH = 0x70737368,
FOURCC_SAIO = 0x7361696f,
FOURCC_SAIZ = 0x7361697a,
FOURCC_SBGP = 0x73626770,
FOURCC_SCHI = 0x73636869,
FOURCC_SCHM = 0x7363686d,
FOURCC_SDTP = 0x73647470,
FOURCC_SEIG = 0x73656967,
FOURCC_SENC = 0x73656e63,
FOURCC_SGPD = 0x73677064,
FOURCC_SIDX = 0x73696478,
FOURCC_SINF = 0x73696e66,
FOURCC_SKIP = 0x736b6970,
FOURCC_SMHD = 0x736d6864,
FOURCC_SOUN = 0x736f756e,
FOURCC_SSIX = 0x73736978,
FOURCC_STBL = 0x7374626c,
FOURCC_STCO = 0x7374636f,
FOURCC_STSC = 0x73747363,
FOURCC_STSD = 0x73747364,
FOURCC_STSS = 0x73747373,
FOURCC_STSZ = 0x7374737a,
FOURCC_STTS = 0x73747473,
FOURCC_STYP = 0x73747970,
FOURCC_STZ2 = 0x73747a32,
FOURCC_SUBT = 0x73756274,
FOURCC_TENC = 0x74656e63,
FOURCC_TEXT = 0x74657874,
FOURCC_TFDT = 0x74666474,
FOURCC_TFHD = 0x74666864,
FOURCC_TKHD = 0x746b6864,
FOURCC_TRAF = 0x74726166,
FOURCC_TRAK = 0x7472616b,
FOURCC_TREX = 0x74726578,
FOURCC_TRUN = 0x7472756e,
FOURCC_UDTA = 0x75647461,
FOURCC_URL = 0x75726c20,
FOURCC_URN = 0x75726e20,
FOURCC_UUID = 0x75756964,
FOURCC_VIDE = 0x76696465,
FOURCC_VMHD = 0x766d6864,
FOURCC_VP08 = 0x76703038,
FOURCC_VP09 = 0x76703039,
FOURCC_VP10 = 0x76703130,
FOURCC_VPCC = 0x76706343,
FOURCC_WIDE = 0x77696465,
FOURCC_ctim = 0x6374696d,
FOURCC_iden = 0x6964656e,
FOURCC_payl = 0x7061796c,
FOURCC_sthd = 0x73746864,
FOURCC_sttg = 0x73747467,
FOURCC_vlab = 0x766c6162,
FOURCC_vsid = 0x76736964,
FOURCC_vttC = 0x76747443,
FOURCC_vtta = 0x76747461,
FOURCC_vttc = 0x76747463,
FOURCC_vtte = 0x76747465,
FOURCC_wvtt = 0x77767474,
};
const inline std::string FourCCToString(FourCC fourcc) {
char buf[5];
buf[0] = (fourcc >> 24) & 0xff;
buf[1] = (fourcc >> 16) & 0xff;
buf[2] = (fourcc >> 8) & 0xff;
buf[3] = (fourcc) & 0xff;
buf[4] = 0;
return std::string(buf);
}
} // namespace mp4
} // namespace media
} // namespace edash_packager
#endif // MEDIA_FORMATS_MP4_FOURCCS_H_

View File

@ -97,7 +97,7 @@ Status KeyRotationFragmenter::PrepareFragmentForEncryption(
// i.e. there is at most one key for the fragment. So there should be only
// one entry in SampleGroupDescription box and one entry in SampleToGroup box.
// Fill in SampleGroupDescription box information.
traf()->sample_group_description.grouping_type = FOURCC_SEIG;
traf()->sample_group_description.grouping_type = FOURCC_seig;
traf()->sample_group_description.entries.resize(1);
traf()->sample_group_description.entries[0].is_encrypted = true;
traf()->sample_group_description.entries[0].iv_size =
@ -105,7 +105,7 @@ Status KeyRotationFragmenter::PrepareFragmentForEncryption(
traf()->sample_group_description.entries[0].key_id = encryption_key()->key_id;
// Fill in SampleToGroup box information.
traf()->sample_to_group.grouping_type = FOURCC_SEIG;
traf()->sample_to_group.grouping_type = FOURCC_seig;
traf()->sample_to_group.entries.resize(1);
// sample_count is adjusted in |FinalizeFragment| later.
traf()->sample_to_group.entries[0].group_description_index =

View File

@ -32,7 +32,6 @@
'encrypting_fragmenter.h',
'es_descriptor.cc',
'es_descriptor.h',
'fourccs.h',
'fragmenter.cc',
'fragmenter.h',
'key_rotation_fragmenter.cc',
@ -43,7 +42,6 @@
'mp4_muxer.h',
'multi_segment_segmenter.cc',
'multi_segment_segmenter.h',
'rcheck.h',
'segmenter.cc',
'segmenter.h',
'single_segment_segmenter.cc',

View File

@ -17,6 +17,7 @@
#include "packager/media/base/key_source.h"
#include "packager/media/base/macros.h"
#include "packager/media/base/media_sample.h"
#include "packager/media/base/rcheck.h"
#include "packager/media/base/video_stream_info.h"
#include "packager/media/file/file.h"
#include "packager/media/file/file_closer.h"
@ -26,7 +27,6 @@
#include "packager/media/formats/mp4/box_definitions.h"
#include "packager/media/formats/mp4/box_reader.h"
#include "packager/media/formats/mp4/es_descriptor.h"
#include "packager/media/formats/mp4/rcheck.h"
#include "packager/media/formats/mp4/track_run_iterator.h"
namespace edash_packager {
@ -42,17 +42,17 @@ uint64_t Rescale(uint64_t time_in_old_scale,
VideoCodec FourCCToVideoCodec(FourCC fourcc) {
switch (fourcc) {
case FOURCC_AVC1:
case FOURCC_avc1:
return kCodecH264;
case FOURCC_HEV1:
case FOURCC_hev1:
return kCodecHEV1;
case FOURCC_HVC1:
case FOURCC_hvc1:
return kCodecHVC1;
case FOURCC_VP08:
case FOURCC_vp08:
return kCodecVP8;
case FOURCC_VP09:
case FOURCC_vp09:
return kCodecVP9;
case FOURCC_VP10:
case FOURCC_vp10:
return kCodecVP10;
default:
return kUnknownVideoCodec;
@ -61,21 +61,21 @@ VideoCodec FourCCToVideoCodec(FourCC fourcc) {
AudioCodec FourCCToAudioCodec(FourCC fourcc) {
switch(fourcc) {
case FOURCC_DTSC:
case FOURCC_dtsc:
return kCodecDTSC;
case FOURCC_DTSH:
case FOURCC_dtsh:
return kCodecDTSH;
case FOURCC_DTSL:
case FOURCC_dtsl:
return kCodecDTSL;
case FOURCC_DTSE:
case FOURCC_dtse:
return kCodecDTSE;
case FOURCC_DTSP:
case FOURCC_dtsp:
return kCodecDTSP;
case FOURCC_DTSM:
case FOURCC_dtsm:
return kCodecDTSM;
case FOURCC_AC3:
case FOURCC_ac_3:
return kCodecAC3;
case FOURCC_EAC3:
case FOURCC_ec_3:
return kCodecEAC3;
default:
return kUnknownAudioCodec;
@ -195,9 +195,9 @@ bool MP4MediaParser::LoadMoov(const std::string& file_path) {
<< "'";
return false;
}
if (box_type == FOURCC_MDAT) {
if (box_type == FOURCC_mdat) {
mdat_seen = true;
} else if (box_type == FOURCC_MOOV) {
} else if (box_type == FOURCC_moov) {
if (!mdat_seen) {
// 'moov' is before 'mdat'. Nothing to do.
break;
@ -246,7 +246,7 @@ bool MP4MediaParser::ParseBox(bool* err) {
if (reader.get() == NULL)
return false;
if (reader->type() == FOURCC_MDAT) {
if (reader->type() == FOURCC_mdat) {
// The code ends up here only if a MOOV box is not yet seen.
DCHECK(!moov_);
@ -258,9 +258,9 @@ bool MP4MediaParser::ParseBox(bool* err) {
// Set up mdat offset for ReadMDATsUntil().
mdat_tail_ = queue_.head() + reader->size();
if (reader->type() == FOURCC_MOOV) {
if (reader->type() == FOURCC_moov) {
*err = !ParseMoov(reader.get());
} else if (reader->type() == FOURCC_MOOF) {
} else if (reader->type() == FOURCC_moof) {
moof_head_ = queue_.head();
*err = !ParseMoof(reader.get());
@ -350,7 +350,7 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) {
std::vector<uint8_t> extra_data;
switch (actual_format) {
case FOURCC_MP4A:
case FOURCC_mp4a:
// Check if it is MPEG4 AAC defined in ISO 14496 Part 3 or
// supported MPEG2 AAC variants.
if (entry.esds.es_descriptor.IsAAC()) {
@ -399,27 +399,27 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) {
return false;
}
break;
case FOURCC_DTSC:
case FOURCC_dtsc:
FALLTHROUGH_INTENDED;
case FOURCC_DTSH:
case FOURCC_dtsh:
FALLTHROUGH_INTENDED;
case FOURCC_DTSL:
case FOURCC_dtsl:
FALLTHROUGH_INTENDED;
case FOURCC_DTSE:
case FOURCC_dtse:
FALLTHROUGH_INTENDED;
case FOURCC_DTSM:
case FOURCC_dtsm:
extra_data = entry.ddts.extra_data;
max_bitrate = entry.ddts.max_bitrate;
avg_bitrate = entry.ddts.avg_bitrate;
num_channels = entry.channelcount;
sampling_frequency = entry.samplerate;
break;
case FOURCC_AC3:
case FOURCC_ac_3:
extra_data = entry.dac3.data;
num_channels = entry.channelcount;
sampling_frequency = entry.samplerate;
break;
case FOURCC_EAC3:
case FOURCC_ec_3:
extra_data = entry.dec3.data;
num_channels = entry.channelcount;
sampling_frequency = entry.samplerate;
@ -469,7 +469,7 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) {
const FourCC actual_format = entry.GetActualFormat();
const VideoCodec video_codec = FourCCToVideoCodec(actual_format);
switch (actual_format) {
case FOURCC_AVC1: {
case FOURCC_avc1: {
AVCDecoderConfiguration avc_config;
if (!avc_config.Parse(entry.codec_config_record.data)) {
LOG(ERROR) << "Failed to parse avcc.";
@ -505,8 +505,8 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) {
}
break;
}
case FOURCC_HEV1:
case FOURCC_HVC1: {
case FOURCC_hev1:
case FOURCC_hvc1: {
HEVCDecoderConfiguration hevc_config;
if (!hevc_config.Parse(entry.codec_config_record.data)) {
LOG(ERROR) << "Failed to parse hevc.";
@ -516,9 +516,9 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) {
nalu_length_size = hevc_config.nalu_length_size();
break;
}
case FOURCC_VP08:
case FOURCC_VP09:
case FOURCC_VP10: {
case FOURCC_vp08:
case FOURCC_vp09:
case FOURCC_vp10: {
VPCodecConfiguration vp_config;
if (!vp_config.Parse(entry.codec_config_record.data)) {
LOG(ERROR) << "Failed to parse vpcc.";

View File

@ -10,6 +10,7 @@
#include "packager/base/time/time.h"
#include "packager/media/base/aes_encryptor.h"
#include "packager/media/base/audio_stream_info.h"
#include "packager/media/base/fourccs.h"
#include "packager/media/base/key_source.h"
#include "packager/media/base/media_sample.h"
#include "packager/media/base/media_stream.h"
@ -18,7 +19,6 @@
#include "packager/media/file/file.h"
#include "packager/media/formats/mp4/box_definitions.h"
#include "packager/media/formats/mp4/es_descriptor.h"
#include "packager/media/formats/mp4/fourccs.h"
#include "packager/media/formats/mp4/multi_segment_segmenter.h"
#include "packager/media/formats/mp4/single_segment_segmenter.h"
@ -43,17 +43,17 @@ void SetStartAndEndFromOffsetAndSize(size_t offset,
FourCC VideoCodecToFourCC(VideoCodec codec) {
switch (codec) {
case kCodecH264:
return FOURCC_AVC1;
return FOURCC_avc1;
case kCodecHEV1:
return FOURCC_HEV1;
return FOURCC_hev1;
case kCodecHVC1:
return FOURCC_HVC1;
return FOURCC_hvc1;
case kCodecVP8:
return FOURCC_VP08;
return FOURCC_vp08;
case kCodecVP9:
return FOURCC_VP09;
return FOURCC_vp09;
case kCodecVP10:
return FOURCC_VP10;
return FOURCC_vp10;
default:
return FOURCC_NULL;
}
@ -62,21 +62,21 @@ FourCC VideoCodecToFourCC(VideoCodec codec) {
FourCC AudioCodecToFourCC(AudioCodec codec) {
switch (codec) {
case kCodecAAC:
return FOURCC_MP4A;
return FOURCC_mp4a;
case kCodecAC3:
return FOURCC_AC3;
return FOURCC_ac_3;
case kCodecDTSC:
return FOURCC_DTSC;
return FOURCC_dtsc;
case kCodecDTSH:
return FOURCC_DTSH;
return FOURCC_dtsh;
case kCodecDTSL:
return FOURCC_DTSL;
return FOURCC_dtsl;
case kCodecDTSE:
return FOURCC_DTSE;
return FOURCC_dtse;
case kCodecDTSM:
return FOURCC_DTSM;
return FOURCC_dtsm;
case kCodecEAC3:
return FOURCC_EAC3;
return FOURCC_ec_3;
default:
return FOURCC_NULL;
}
@ -93,9 +93,9 @@ Status MP4Muxer::Initialize() {
scoped_ptr<FileType> ftyp(new FileType);
scoped_ptr<Movie> moov(new Movie);
ftyp->major_brand = FOURCC_DASH;
ftyp->compatible_brands.push_back(FOURCC_ISO6);
ftyp->compatible_brands.push_back(FOURCC_MP41);
ftyp->major_brand = FOURCC_dash;
ftyp->compatible_brands.push_back(FOURCC_iso6);
ftyp->compatible_brands.push_back(FOURCC_mp41);
if (streams().size() == 1 &&
streams()[0]->info()->stream_type() == kStreamVideo) {
const FourCC codec_fourcc = VideoCodecToFourCC(

View File

@ -10,7 +10,6 @@
#include <vector>
#include "packager/media/base/muxer.h"
#include "packager/media/formats/mp4/fourccs.h"
namespace edash_packager {
namespace media {

View File

@ -1,18 +0,0 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_FORMATS_MP4_RCHECK_H_
#define MEDIA_FORMATS_MP4_RCHECK_H_
#include "packager/base/logging.h"
#define RCHECK(x) \
do { \
if (!(x)) { \
LOG(ERROR) << "Failure while processing MP4: " << #x; \
return false; \
} \
} while (0)
#endif // MEDIA_FORMATS_MP4_RCHECK_H_

View File

@ -55,9 +55,9 @@ void GenerateSinf(const EncryptionKey& encryption_key,
sinf->format.format = old_type;
if (encryption_mode == kEncryptionModeAesCtr){
sinf->type.type = FOURCC_CENC;
sinf->type.type = FOURCC_cenc;
} else if (encryption_mode == kEncryptionModeAesCbc) {
sinf->type.type = FOURCC_CBC1;
sinf->type.type = FOURCC_cbc1;
}
sinf->type.version = kCencSchemeVersion;
@ -82,7 +82,7 @@ void GenerateEncryptedSampleEntry(const EncryptionKey& encryption_key,
// Convert the first entry to an encrypted entry.
VideoSampleEntry& entry = description->video_entries[0];
GenerateSinf(encryption_key, entry.format, encryption_mode, &entry.sinf);
entry.format = FOURCC_ENCV;
entry.format = FOURCC_encv;
} else {
DCHECK_EQ(kAudio, description->type);
DCHECK_EQ(1u, description->audio_entries.size());
@ -94,7 +94,7 @@ void GenerateEncryptedSampleEntry(const EncryptionKey& encryption_key,
// Convert the first entry to an encrypted entry.
AudioSampleEntry& entry = description->audio_entries[0];
GenerateSinf(encryption_key, entry.format, encryption_mode, &entry.sinf);
entry.format = FOURCC_ENCA;
entry.format = FOURCC_enca;
}
}

View File

@ -9,10 +9,10 @@
#include "packager/media/base/buffer_reader.h"
#include "packager/media/base/encryption_modes.h"
#include "packager/media/base/rcheck.h"
#include "packager/media/formats/mp4/chunk_info_iterator.h"
#include "packager/media/formats/mp4/composition_offset_iterator.h"
#include "packager/media/formats/mp4/decoding_time_iterator.h"
#include "packager/media/formats/mp4/rcheck.h"
#include "packager/media/formats/mp4/sync_sample_iterator.h"
namespace {
@ -602,10 +602,10 @@ scoped_ptr<DecryptConfig> TrackRunIterator::GetDecryptConfig() {
: video_description().sinf.type.type;
EncryptionMode decryption_mode;
switch (protection_scheme) {
case FOURCC_CENC:
case FOURCC_cenc:
decryption_mode = kEncryptionModeAesCtr;
break;
case FOURCC_CBC1:
case FOURCC_cbc1:
decryption_mode = kEncryptionModeAesCbc;
break;
default:

View File

@ -8,7 +8,6 @@
#include "packager/base/logging.h"
#include "packager/base/memory/scoped_ptr.h"
#include "packager/media/formats/mp4/box_definitions.h"
#include "packager/media/formats/mp4/rcheck.h"
#include "packager/media/formats/mp4/track_run_iterator.h"
namespace {
@ -87,7 +86,7 @@ class TrackRunIteratorTest : public testing::Test {
SampleDescription& desc1 =
moov_.tracks[0].media.information.sample_table.description;
AudioSampleEntry aud_desc;
aud_desc.format = FOURCC_MP4A;
aud_desc.format = FOURCC_mp4a;
aud_desc.sinf.info.track_encryption.is_encrypted = false;
desc1.type = kAudio;
desc1.audio_entries.push_back(aud_desc);
@ -99,7 +98,7 @@ class TrackRunIteratorTest : public testing::Test {
SampleDescription& desc2 =
moov_.tracks[1].media.information.sample_table.description;
VideoSampleEntry vid_desc;
vid_desc.format = FOURCC_AVC1;
vid_desc.format = FOURCC_avc1;
vid_desc.sinf.info.track_encryption.is_encrypted = false;
desc2.type = kVideo;
desc2.video_entries.push_back(vid_desc);
@ -155,7 +154,7 @@ class TrackRunIteratorTest : public testing::Test {
sinf = &stsd->audio_entries[0].sinf;
}
sinf->type.type = FOURCC_CENC;
sinf->type.type = FOURCC_cenc;
sinf->info.track_encryption.is_encrypted = true;
sinf->info.track_encryption.default_iv_size = 8;
sinf->info.track_encryption.default_kid.assign(kKeyId,

View File

@ -6,9 +6,9 @@
#include "packager/media/formats/mp4/video_slice_header_parser.h"
#include "packager/media/base/rcheck.h"
#include "packager/media/filters/avc_decoder_configuration.h"
#include "packager/media/filters/hevc_decoder_configuration.h"
#include "packager/media/formats/mp4/rcheck.h"
namespace edash_packager {
namespace media {