Remove the name after TODO
The change is made using command: find . -regex ".*/\(app\|media\|mpd\)/.*\.\(cc\|h\|gyp\)" -exec sed -i 's,TODO(\w\+),TODO,g' {} \; Then scan through the files and reformat them properly. Change-Id: I13836cde38b9e30daf1fd8a847e203337f883e1b
This commit is contained in:
parent
ed5ecd64fd
commit
5f3c0f7181
|
@ -50,7 +50,7 @@ AesCtrEncryptor::~AesCtrEncryptor() {}
|
||||||
|
|
||||||
bool AesCtrEncryptor::InitializeWithRandomIv(const std::vector<uint8>& key,
|
bool AesCtrEncryptor::InitializeWithRandomIv(const std::vector<uint8>& key,
|
||||||
uint8 iv_size) {
|
uint8 iv_size) {
|
||||||
// TODO(kqyang): should we use RAND_bytes provided by openssl instead?
|
// TODO: Should we use RAND_bytes provided by openssl instead?
|
||||||
std::vector<uint8> iv(iv_size, 0);
|
std::vector<uint8> iv(iv_size, 0);
|
||||||
base::RandBytes(&iv[0], iv_size);
|
base::RandBytes(&iv[0], iv_size);
|
||||||
return InitializeWithIv(key, iv);
|
return InitializeWithIv(key, iv);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
namespace media {
|
namespace media {
|
||||||
|
|
||||||
// TODO(scherkus): Move the contents of this file elsewhere.
|
// TODO: Move the contents of this file elsewhere.
|
||||||
|
|
||||||
// Indicates an invalid or missing timestamp.
|
// Indicates an invalid or missing timestamp.
|
||||||
extern inline base::TimeDelta kNoTimestamp() {
|
extern inline base::TimeDelta kNoTimestamp() {
|
||||||
|
|
|
@ -60,8 +60,7 @@ class DecryptConfig {
|
||||||
// Initialization vector.
|
// Initialization vector.
|
||||||
const std::string iv_;
|
const std::string iv_;
|
||||||
|
|
||||||
// TODO(fgalligan): Remove |data_offset_| if there is no plan to use it in
|
// TODO: Remove |data_offset_| if there is no plan to use it in the future.
|
||||||
// the future.
|
|
||||||
// Amount of data to be discarded before applying subsample information.
|
// Amount of data to be discarded before applying subsample information.
|
||||||
const int data_offset_;
|
const int data_offset_;
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ Status Demuxer::Initialize() {
|
||||||
return Status(error::PARSER_FAILURE,
|
return Status(error::PARSER_FAILURE,
|
||||||
"Cannot parse media file " + file_name_);
|
"Cannot parse media file " + file_name_);
|
||||||
|
|
||||||
// TODO(kqyang): Does not look clean. Consider refactoring later.
|
// TODO: Does not look clean. Consider refactoring later.
|
||||||
Status status;
|
Status status;
|
||||||
while (!init_event_received_) {
|
while (!init_event_received_) {
|
||||||
if (!(status = Parse()).ok())
|
if (!(status = Parse()).ok())
|
||||||
|
|
|
@ -30,7 +30,7 @@ class EncryptorSource {
|
||||||
virtual Status Initialize() = 0;
|
virtual Status Initialize() = 0;
|
||||||
|
|
||||||
// Refresh the encryptor. NOP except for key rotation encryptor source.
|
// Refresh the encryptor. NOP except for key rotation encryptor source.
|
||||||
// TODO(kqyang): Do we need to pass in duration or fragment number?
|
// TODO: Do we need to pass in duration or fragment number?
|
||||||
virtual void RefreshEncryptor() {}
|
virtual void RefreshEncryptor() {}
|
||||||
|
|
||||||
// Create an encryptor from this encryptor source. The encryptor will be
|
// Create an encryptor from this encryptor source. The encryptor will be
|
||||||
|
|
|
@ -38,7 +38,7 @@ class HttpFetcher {
|
||||||
// A simple HttpFetcher implementation using happyhttp.
|
// A simple HttpFetcher implementation using happyhttp.
|
||||||
class SimpleHttpFetcher : public HttpFetcher {
|
class SimpleHttpFetcher : public HttpFetcher {
|
||||||
public:
|
public:
|
||||||
// TODO(kqyang): Add timeout support.
|
// TODO: Add timeout support.
|
||||||
SimpleHttpFetcher();
|
SimpleHttpFetcher();
|
||||||
virtual ~SimpleHttpFetcher();
|
virtual ~SimpleHttpFetcher();
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ class MediaParser {
|
||||||
// Called when there is new data to parse.
|
// Called when there is new data to parse.
|
||||||
//
|
//
|
||||||
// Returns true if the parse succeeds.
|
// Returns true if the parse succeeds.
|
||||||
// TODO(kqyang): change to return Status.
|
// TODO: Change to return Status.
|
||||||
virtual bool Parse(const uint8* buf, int size) = 0;
|
virtual bool Parse(const uint8* buf, int size) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -43,7 +43,7 @@ class MediaSample : public base::RefCountedThreadSafe<MediaSample> {
|
||||||
//
|
//
|
||||||
// Calling any method other than end_of_stream() on the resulting buffer
|
// Calling any method other than end_of_stream() on the resulting buffer
|
||||||
// is disallowed.
|
// is disallowed.
|
||||||
// TODO(kqyang): do we need it?
|
// TODO: Do we need it?
|
||||||
static scoped_refptr<MediaSample> CreateEOSBuffer();
|
static scoped_refptr<MediaSample> CreateEOSBuffer();
|
||||||
|
|
||||||
int64 dts() const {
|
int64 dts() const {
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
#include "media/base/http_fetcher.h"
|
#include "media/base/http_fetcher.h"
|
||||||
#include "media/base/request_signer.h"
|
#include "media/base/request_signer.h"
|
||||||
|
|
||||||
// TODO(kqyang): Move media/mp4/rcheck.h to media/base/.
|
// TODO: Move media/mp4/rcheck.h to media/base/. Remove this definition and use
|
||||||
// Remove this definition and use RCHECK in rcheck.h instead.
|
// RCHECK in rcheck.h instead.
|
||||||
#define RCHECK(x) \
|
#define RCHECK(x) \
|
||||||
do { \
|
do { \
|
||||||
if (!(x)) { \
|
if (!(x)) { \
|
||||||
|
@ -70,7 +70,7 @@ bool GetPssh(const base::DictionaryValue& track_dict,
|
||||||
std::vector<uint8>* pssh) {
|
std::vector<uint8>* pssh) {
|
||||||
DCHECK(pssh);
|
DCHECK(pssh);
|
||||||
|
|
||||||
// TODO(kqyang): Add support for multiple pssh.
|
// TODO: Add support for multiple pssh.
|
||||||
const base::ListValue* pssh_list;
|
const base::ListValue* pssh_list;
|
||||||
RCHECK(track_dict.GetList("pssh", &pssh_list));
|
RCHECK(track_dict.GetList("pssh", &pssh_list));
|
||||||
// Invariant check. We don't want to crash in release mode if possible.
|
// Invariant check. We don't want to crash in release mode if possible.
|
||||||
|
@ -186,7 +186,7 @@ void WidevineEncryptorSource::FillRequest(const std::string& content_id,
|
||||||
|
|
||||||
base::DictionaryValue request_dict;
|
base::DictionaryValue request_dict;
|
||||||
request_dict.SetString("content_id", content_id_base64_string);
|
request_dict.SetString("content_id", content_id_base64_string);
|
||||||
// TODO(kqyang): Do we care about policy?
|
// TODO: Determine the need for policy.
|
||||||
request_dict.SetString("policy", "");
|
request_dict.SetString("policy", "");
|
||||||
|
|
||||||
// Build tracks.
|
// Build tracks.
|
||||||
|
|
|
@ -20,8 +20,8 @@ class StreamInfo;
|
||||||
|
|
||||||
namespace event {
|
namespace event {
|
||||||
|
|
||||||
// TODO(rkuroiwa): Need a solution to report a problem to the user. One idea is
|
// TODO: Need a solution to report a problem to the user. One idea is to add
|
||||||
// to add GetStatus() method somewhere (maybe in MuxerListener, maybe not).
|
// GetStatus() method somewhere (maybe in MuxerListener, maybe not).
|
||||||
class MuxerListener {
|
class MuxerListener {
|
||||||
public:
|
public:
|
||||||
enum ContainerType {
|
enum ContainerType {
|
||||||
|
|
|
@ -125,7 +125,7 @@ void VodMediaInfoDumpMuxerListener::OnMediaEnd(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_encrypted) {
|
if (is_encrypted) {
|
||||||
// TODO(rkuroiwa): Use the return value to set error status.
|
// TODO: Use the return value to set error status.
|
||||||
AddContentProtectionElements(container_type_, scheme_id_uri_, &media_info);
|
AddContentProtectionElements(container_type_, scheme_id_uri_, &media_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ class VodMediaInfoDumpMuxerListener : public MuxerListener {
|
||||||
uint32 time_scale,
|
uint32 time_scale,
|
||||||
ContainerType container_type) OVERRIDE;
|
ContainerType container_type) OVERRIDE;
|
||||||
|
|
||||||
// TODO(rkuroiwa): Make an Event structure for passing parameters.
|
// TODO: Make an Event structure for passing parameters.
|
||||||
virtual void OnMediaEnd(const std::vector<StreamInfo*>& stream_infos,
|
virtual void OnMediaEnd(const std::vector<StreamInfo*>& stream_infos,
|
||||||
bool has_init_range,
|
bool has_init_range,
|
||||||
uint64 init_range_start,
|
uint64 init_range_start,
|
||||||
|
|
|
@ -113,7 +113,7 @@ void AddVideoInfo(const VideoStreamInfo* video_stream_info,
|
||||||
if (!extra_data.empty()) {
|
if (!extra_data.empty()) {
|
||||||
video_info->set_decoder_config(&extra_data[0], extra_data.size());
|
video_info->set_decoder_config(&extra_data[0], extra_data.size());
|
||||||
}
|
}
|
||||||
// TODO(rkuroiwa): Get frame duration.
|
// TODO: Get frame duration.
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddAudioInfo(const AudioStreamInfo* audio_stream_info,
|
void AddAudioInfo(const AudioStreamInfo* audio_stream_info,
|
||||||
|
@ -182,8 +182,8 @@ bool GenerateMediaInfo(const MuxerOptions& muxer_options,
|
||||||
MediaInfo* media_info) {
|
MediaInfo* media_info) {
|
||||||
DCHECK(media_info);
|
DCHECK(media_info);
|
||||||
if (file_size == 0) {
|
if (file_size == 0) {
|
||||||
// TODO(rkuroiwa): bandwidth is a required field for MPD. But without the
|
// TODO: |bandwidth| is a required field for MPD. But without the file size,
|
||||||
// file size, AFAIK there's not much I can do. Fail silently?
|
// AFAIK there's not much I can do. Fail silently?
|
||||||
LOG(ERROR) << "File size not specified.";
|
LOG(ERROR) << "File size not specified.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,6 @@ uint32 AACAudioSpecificConfig::GetOutputSamplesPerSecond(bool sbr_in_mimetype)
|
||||||
// The following code is written according to ISO 14496 Part 3 Table 1.11 and
|
// The following code is written according to ISO 14496 Part 3 Table 1.11 and
|
||||||
// Table 1.22. (Table 1.11 refers to the capping to 48000, Table 1.22 refers
|
// Table 1.22. (Table 1.11 refers to the capping to 48000, Table 1.22 refers
|
||||||
// to SBR doubling the AAC sample rate.)
|
// to SBR doubling the AAC sample rate.)
|
||||||
// TODO(acolwell) : Extend sample rate cap to 96kHz for Level 5 content.
|
|
||||||
DCHECK_GT(frequency_, 0);
|
DCHECK_GT(frequency_, 0);
|
||||||
return std::min(2 * frequency_, 48000u);
|
return std::min(2 * frequency_, 48000u);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1449,7 +1449,7 @@ bool TrackFragmentHeader::ReadWrite(BoxBuffer* buffer) {
|
||||||
RCHECK(FullBox::ReadWrite(buffer) &&
|
RCHECK(FullBox::ReadWrite(buffer) &&
|
||||||
buffer->ReadWriteUInt32(&track_id));
|
buffer->ReadWriteUInt32(&track_id));
|
||||||
|
|
||||||
// TODO(kqyang): we should support base-data-offset-present.
|
// TODO: We should support base-data-offset-present.
|
||||||
// Media Source specific: reject tracks that set 'base-data-offset-present'.
|
// Media Source specific: reject tracks that set 'base-data-offset-present'.
|
||||||
// Although the Media Source requires that 'default-base-is-moof' (14496-12
|
// Although the Media Source requires that 'default-base-is-moof' (14496-12
|
||||||
// Amendment 2) be set, we omit this check as many otherwise-valid files in
|
// Amendment 2) be set, we omit this check as many otherwise-valid files in
|
||||||
|
@ -1514,13 +1514,12 @@ bool TrackFragmentRun::ReadWrite(BoxBuffer* buffer) {
|
||||||
if (data_offset_present) {
|
if (data_offset_present) {
|
||||||
RCHECK(buffer->ReadWriteUInt32(&data_offset));
|
RCHECK(buffer->ReadWriteUInt32(&data_offset));
|
||||||
} else {
|
} else {
|
||||||
// TODO(kqyang): this is incorrect. If the data-offset is not present,
|
// TODO: If the data-offset is not present, then the data for this run
|
||||||
// then the data for this run starts immediately after the data of the
|
// starts immediately after the data of the previous run, or at the
|
||||||
// previous run, or at the base-data-offset defined by the track fragment
|
// base-data-offset defined by the track fragment header if this is the
|
||||||
// header if this is the first run in a track fragment, If the data-offset
|
// first run in a track fragment. If the data-offset is present, it is
|
||||||
// is present, it is relative to the base-data-offset established in the
|
// relative to the base-data-offset established in the track fragment
|
||||||
// track fragment header.
|
// header.
|
||||||
// data_offset = 0;
|
|
||||||
NOTIMPLEMENTED();
|
NOTIMPLEMENTED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ bool ESDescriptor::ParseDecoderSpecificInfo(BitReader* reader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESDescriptor::Write(BufferWriter* writer) const {
|
void ESDescriptor::Write(BufferWriter* writer) const {
|
||||||
// TODO(kqyang): Consider writing Descriptor classes.
|
// TODO: Consider writing Descriptor classes.
|
||||||
// ElementaryStreamDescriptor, DecoderConfigDescriptor, SLConfigDescriptor,
|
// ElementaryStreamDescriptor, DecoderConfigDescriptor, SLConfigDescriptor,
|
||||||
// DecoderSpecificInfoDescriptor.
|
// DecoderSpecificInfoDescriptor.
|
||||||
DCHECK(writer);
|
DCHECK(writer);
|
||||||
|
|
|
@ -87,7 +87,7 @@ Status MP4Fragmenter::AddSample(scoped_refptr<MediaSample> sample) {
|
||||||
if (normalize_presentation_timestamp_) {
|
if (normalize_presentation_timestamp_) {
|
||||||
// Normalize PTS to start from 0. Some players do not like non-zero
|
// Normalize PTS to start from 0. Some players do not like non-zero
|
||||||
// presentation starting time.
|
// presentation starting time.
|
||||||
// TODO(kqyang): Do we need to add an EditList?
|
// TODO: Do we need to add an EditList?
|
||||||
if (presentation_start_time_ == kInvalidTime) {
|
if (presentation_start_time_ == kInvalidTime) {
|
||||||
presentation_start_time_ = pts;
|
presentation_start_time_ = pts;
|
||||||
pts = 0;
|
pts = 0;
|
||||||
|
@ -188,7 +188,7 @@ void MP4Fragmenter::FinalizeFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MP4Fragmenter::GenerateSegmentReference(SegmentReference* reference) {
|
void MP4Fragmenter::GenerateSegmentReference(SegmentReference* reference) {
|
||||||
// TODO(kqyang): support daisy chain??
|
// TODO: Support daisy chain?
|
||||||
reference->reference_type = false;
|
reference->reference_type = false;
|
||||||
reference->subsegment_duration = fragment_duration_;
|
reference->subsegment_duration = fragment_duration_;
|
||||||
reference->starts_with_sap = StartsWithSAP();
|
reference->starts_with_sap = StartsWithSAP();
|
||||||
|
|
|
@ -58,8 +58,8 @@ Status MP4GeneralSegmenter::Initialize(
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(rkuroiwa): Maybe GetInitRange() should return true. Init segment does
|
// TODO: Maybe GetInitRange() should return true. Init segment does exist and we
|
||||||
// exist and we know the size and offset.
|
// know the size and offset.
|
||||||
bool MP4GeneralSegmenter::GetInitRange(size_t* offset, size_t* size) {
|
bool MP4GeneralSegmenter::GetInitRange(size_t* offset, size_t* size) {
|
||||||
DLOG(INFO) << "MP4GeneralSegmenter outputs init segment: "
|
DLOG(INFO) << "MP4GeneralSegmenter outputs init segment: "
|
||||||
<< options().output_file_name;
|
<< options().output_file_name;
|
||||||
|
@ -154,7 +154,7 @@ Status MP4GeneralSegmenter::WriteSegment() {
|
||||||
"Cannot open file for append " + options().output_file_name);
|
"Cannot open file for append " + options().output_file_name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO(kqyang): generate the segment template name.
|
// TODO: Generate the segment template name.
|
||||||
file_name = options().segment_template;
|
file_name = options().segment_template;
|
||||||
ReplaceSubstringsAfterOffset(
|
ReplaceSubstringsAfterOffset(
|
||||||
&file_name, 0, "$Number$", base::UintToString(++num_segments_));
|
&file_name, 0, "$Number$", base::UintToString(++num_segments_));
|
||||||
|
|
|
@ -161,15 +161,12 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) {
|
||||||
Rescale(moov_->header.duration, moov_->header.timescale, timescale);
|
Rescale(moov_->header.duration, moov_->header.timescale, timescale);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(strobe): Only the first audio and video track present in a file are
|
|
||||||
// used. (Track selection is better accomplished via Source IDs, though, so
|
|
||||||
// adding support for track selection within a stream is low-priority.)
|
|
||||||
const SampleDescription& samp_descr =
|
const SampleDescription& samp_descr =
|
||||||
track->media.information.sample_table.description;
|
track->media.information.sample_table.description;
|
||||||
|
|
||||||
// TODO(strobe): When codec reconfigurations are supported, detect and send
|
// TODO: When codec reconfigurations are supported, detect and send a codec
|
||||||
// a codec reconfiguration for fragments using a sample description index
|
// reconfiguration for fragments using a sample description index different
|
||||||
// different from the previous one
|
// from the previous one.
|
||||||
size_t desc_idx = 0;
|
size_t desc_idx = 0;
|
||||||
|
|
||||||
// Read sample description index from mvex if it exists otherwise read
|
// Read sample description index from mvex if it exists otherwise read
|
||||||
|
@ -192,8 +189,6 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) {
|
||||||
desc_idx -= 1; // BMFF descriptor index is one-based
|
desc_idx -= 1; // BMFF descriptor index is one-based
|
||||||
|
|
||||||
if (track->media.handler.type == kAudio) {
|
if (track->media.handler.type == kAudio) {
|
||||||
// TODO(kqyang): do we need to support multiple audio or video streams in
|
|
||||||
// a single file?
|
|
||||||
RCHECK(!has_audio_);
|
RCHECK(!has_audio_);
|
||||||
|
|
||||||
RCHECK(!samp_descr.audio_entries.empty());
|
RCHECK(!samp_descr.audio_entries.empty());
|
||||||
|
@ -263,8 +258,6 @@ bool MP4MediaParser::ParseMoov(BoxReader* reader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (track->media.handler.type == kVideo) {
|
if (track->media.handler.type == kVideo) {
|
||||||
// TODO(kqyang): do we need to support multiple audio or video streams in
|
|
||||||
// a single file?
|
|
||||||
RCHECK(!has_video_);
|
RCHECK(!has_video_);
|
||||||
|
|
||||||
RCHECK(!samp_descr.video_entries.empty());
|
RCHECK(!samp_descr.video_entries.empty());
|
||||||
|
@ -326,9 +319,6 @@ bool MP4MediaParser::ParseMoof(BoxReader* reader) {
|
||||||
|
|
||||||
void MP4MediaParser::EmitNeedKeyIfNecessary(
|
void MP4MediaParser::EmitNeedKeyIfNecessary(
|
||||||
const std::vector<ProtectionSystemSpecificHeader>& headers) {
|
const std::vector<ProtectionSystemSpecificHeader>& headers) {
|
||||||
// TODO(strobe): ensure that the value of init_data (all PSSH headers
|
|
||||||
// concatenated in arbitrary order) matches the EME spec.
|
|
||||||
// See https://www.w3.org/Bugs/Public/show_bug.cgi?id=17673.
|
|
||||||
if (headers.empty())
|
if (headers.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ Status MP4VODSegmenter::FinalizeSegment() {
|
||||||
refs[0].sap_delta_time + refs[0].earliest_presentation_time;
|
refs[0].sap_delta_time + refs[0].earliest_presentation_time;
|
||||||
for (uint32 i = 1; i < sidx()->references.size(); ++i) {
|
for (uint32 i = 1; i < sidx()->references.size(); ++i) {
|
||||||
vod_ref.referenced_size += refs[i].referenced_size;
|
vod_ref.referenced_size += refs[i].referenced_size;
|
||||||
// TODO(kqyang): should we calculate subsegment duration by subtracting
|
// TODO: Should we calculate subsegment duration by subtracting
|
||||||
// earliest_presentation time instead?
|
// earliest_presentation time instead?
|
||||||
vod_ref.subsegment_duration += refs[i].subsegment_duration;
|
vod_ref.subsegment_duration += refs[i].subsegment_duration;
|
||||||
vod_ref.earliest_presentation_time = std::min(
|
vod_ref.earliest_presentation_time = std::min(
|
||||||
|
|
|
@ -397,7 +397,6 @@ bool TrackRunIterator::AuxInfoNeedsToBeCached() {
|
||||||
return is_encrypted() && aux_info_size() > 0 && cenc_info_.size() == 0;
|
return is_encrypted() && aux_info_size() > 0 && cenc_info_.size() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(kqyang): Revisit later. We might not need to cache cenc info.
|
|
||||||
// This implementation currently only caches CENC auxiliary info.
|
// This implementation currently only caches CENC auxiliary info.
|
||||||
bool TrackRunIterator::CacheAuxInfo(const uint8* buf, int buf_size) {
|
bool TrackRunIterator::CacheAuxInfo(const uint8* buf, int buf_size) {
|
||||||
RCHECK(AuxInfoNeedsToBeCached() && buf_size >= aux_info_size());
|
RCHECK(AuxInfoNeedsToBeCached() && buf_size >= aux_info_size());
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "third_party/libxml/src/include/libxml/tree.h"
|
#include "third_party/libxml/src/include/libxml/tree.h"
|
||||||
#include "third_party/libxml/src/include/libxml/xmlstring.h"
|
#include "third_party/libxml/src/include/libxml/xmlstring.h"
|
||||||
|
|
||||||
// TODO(rkuroiwa): If performance is a problem work on fine grained locking.
|
// TODO: If performance is a problem, work on fine grained locking.
|
||||||
namespace dash_packager {
|
namespace dash_packager {
|
||||||
|
|
||||||
using xml::XmlNode;
|
using xml::XmlNode;
|
||||||
|
@ -33,8 +33,8 @@ std::string GetMimeType(
|
||||||
case MediaInfo::CONTAINER_MP4:
|
case MediaInfo::CONTAINER_MP4:
|
||||||
return prefix + "/mp4";
|
return prefix + "/mp4";
|
||||||
case MediaInfo::CONTAINER_MPEG2_TS:
|
case MediaInfo::CONTAINER_MPEG2_TS:
|
||||||
// TODO(rkuroiwa): Find out whether uppercase or lowercase should be used
|
// TODO: Find out whether uppercase or lowercase should be used for mp2t.
|
||||||
// for mp2t. DASH MPD spec uses lowercase but RFC3555 says uppercase.
|
// DASH MPD spec uses lowercase but RFC3555 says uppercase.
|
||||||
return prefix + "/MP2T";
|
return prefix + "/MP2T";
|
||||||
case MediaInfo::CONTAINER_WEBM:
|
case MediaInfo::CONTAINER_WEBM:
|
||||||
return prefix + "/webm";
|
return prefix + "/webm";
|
||||||
|
@ -112,7 +112,7 @@ bool MpdBuilder::WriteMpd() {
|
||||||
std::string mpd;
|
std::string mpd;
|
||||||
bool result = ToStringImpl(&mpd);
|
bool result = ToStringImpl(&mpd);
|
||||||
|
|
||||||
// TODO(rkuroiwa): Write to file, after interface change.
|
// TODO: Write to file, after interface change.
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ bool MpdBuilder::ToStringImpl(std::string* output) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(rkuroiwa): This function is too big.
|
// TODO: This function is too big.
|
||||||
xmlDocPtr MpdBuilder::GenerateMpd() {
|
xmlDocPtr MpdBuilder::GenerateMpd() {
|
||||||
// Setup nodes.
|
// Setup nodes.
|
||||||
static const char kXmlVersion[] = "1.0";
|
static const char kXmlVersion[] = "1.0";
|
||||||
|
@ -152,7 +152,7 @@ xmlDocPtr MpdBuilder::GenerateMpd() {
|
||||||
XmlNode mpd("MPD");
|
XmlNode mpd("MPD");
|
||||||
AddMpdNameSpaceInfo(&mpd);
|
AddMpdNameSpaceInfo(&mpd);
|
||||||
|
|
||||||
// TODO(rkuroiwa): Currently set to 2. Does this need calculation?
|
// TODO: Currently set to 2. Does this need calculation?
|
||||||
const float kMinBufferTime = 2.0f;
|
const float kMinBufferTime = 2.0f;
|
||||||
mpd.SetStringAttribute("minBufferTime", SecondsToXmlDuration(kMinBufferTime));
|
mpd.SetStringAttribute("minBufferTime", SecondsToXmlDuration(kMinBufferTime));
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ bool Representation::Init() {
|
||||||
const bool has_audio_info = media_info_.audio_info_size() > 0;
|
const bool has_audio_info = media_info_.audio_info_size() > 0;
|
||||||
|
|
||||||
if (!has_video_info && !has_audio_info) {
|
if (!has_video_info && !has_audio_info) {
|
||||||
// TODO(rkuroiwa): Allow text input.
|
// TODO: Allow text input.
|
||||||
// This is an error. Segment information can be in AdaptationSet, Period, or
|
// This is an error. Segment information can be in AdaptationSet, Period, or
|
||||||
// MPD but the interface does not provide a way to set them.
|
// MPD but the interface does not provide a way to set them.
|
||||||
// See 5.3.9.1 ISO 23009-1:2012 for segment info.
|
// See 5.3.9.1 ISO 23009-1:2012 for segment info.
|
||||||
|
@ -323,8 +323,8 @@ bool Representation::Init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (media_info_.container_type() == MediaInfo::CONTAINER_UNKNOWN) {
|
if (media_info_.container_type() == MediaInfo::CONTAINER_UNKNOWN) {
|
||||||
// TODO(rkuroiwa): This might not be the right behavior. Maybe somehow
|
// TODO: This might not be the right behavior. Maybe somehow infer from
|
||||||
// infer from something else like media file name?
|
// something else like media file name?
|
||||||
LOG(ERROR) << "'container_type' in MediaInfo cannot be CONTAINER_UNKNOWN.";
|
LOG(ERROR) << "'container_type' in MediaInfo cannot be CONTAINER_UNKNOWN.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -354,10 +354,9 @@ bool Representation::AddNewSegment(uint64 start_time, uint64 duration) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(rkuroiwa): We don't need to create a node every single time. Make an
|
// TODO: We don't need to create a node every single time. Make an internal copy
|
||||||
// internal copy of this element. Then move most of the logic to
|
// of this element. Then move most of the logic to RepresentationXmlNode so that
|
||||||
// RepresentationXmlNode so that all the work is done in it so that this class
|
// all the work is done in it so that this class just becomes a thin layer.
|
||||||
// just becomes a thin layer.
|
|
||||||
//
|
//
|
||||||
// Uses info in |media_info_| and |content_protection_elements_| to create a
|
// Uses info in |media_info_| and |content_protection_elements_| to create a
|
||||||
// "Representation" node.
|
// "Representation" node.
|
||||||
|
@ -399,15 +398,14 @@ xml::ScopedXmlPtr<xmlNode>::type Representation::GetXml() {
|
||||||
if (!representation.AddContentProtectionElementsFromMediaInfo(media_info_))
|
if (!representation.AddContentProtectionElementsFromMediaInfo(media_info_))
|
||||||
return xml::ScopedXmlPtr<xmlNode>::type();
|
return xml::ScopedXmlPtr<xmlNode>::type();
|
||||||
|
|
||||||
// TODO(rkuroiwa): Add TextInfo.
|
// TODO: Add TextInfo.
|
||||||
if (HasVODOnlyFields(media_info_) &&
|
if (HasVODOnlyFields(media_info_) &&
|
||||||
!representation.AddVODOnlyInfo(media_info_)) {
|
!representation.AddVODOnlyInfo(media_info_)) {
|
||||||
LOG(ERROR) << "Failed to add VOD segment info.";
|
LOG(ERROR) << "Failed to add VOD segment info.";
|
||||||
return xml::ScopedXmlPtr<xmlNode>::type();
|
return xml::ScopedXmlPtr<xmlNode>::type();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(rkuroiwa): Handle Live case. Handle data in
|
// TODO: Handle Live case. Handle data in segment_starttime_duration_pairs_.
|
||||||
// segment_starttime_duration_pairs_.
|
|
||||||
return representation.PassScopedPtr();
|
return representation.PassScopedPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,8 @@
|
||||||
#include "mpd/base/mpd_utils.h"
|
#include "mpd/base/mpd_utils.h"
|
||||||
#include "mpd/base/xml/scoped_xml_ptr.h"
|
#include "mpd/base/xml/scoped_xml_ptr.h"
|
||||||
|
|
||||||
// TODO(rkuroiwa): For classes with |id_|, consider removing the field and let
|
// TODO: For classes with |id_|, consider removing the field and let the MPD
|
||||||
// the MPD (XML) generation functions take care of assigning an ID to each
|
// (XML) generation functions take care of assigning an ID to each element.
|
||||||
// element.
|
|
||||||
namespace dash_packager {
|
namespace dash_packager {
|
||||||
|
|
||||||
class AdaptationSet;
|
class AdaptationSet;
|
||||||
|
@ -52,8 +51,8 @@ class MpdBuilder {
|
||||||
// The returned pointer is owned by this object.
|
// The returned pointer is owned by this object.
|
||||||
AdaptationSet* AddAdaptationSet();
|
AdaptationSet* AddAdaptationSet();
|
||||||
|
|
||||||
// TODO(rkuroiwa): Once File interface is defined, make this method take a
|
// TODO: Once File interface is defined, make this method take a pointer to a
|
||||||
// pointer to a File.
|
// File.
|
||||||
// This will write to stdout until File interface is defined.
|
// This will write to stdout until File interface is defined.
|
||||||
bool WriteMpd();
|
bool WriteMpd();
|
||||||
bool ToString(std::string* output);
|
bool ToString(std::string* output);
|
||||||
|
@ -77,7 +76,7 @@ class MpdBuilder {
|
||||||
|
|
||||||
std::list<std::string> base_urls_;
|
std::list<std::string> base_urls_;
|
||||||
|
|
||||||
// TODO(rkuroiwa): I don't like locks.
|
// TODO: Investigate alternatives to locks.
|
||||||
base::Lock lock_;
|
base::Lock lock_;
|
||||||
base::AtomicSequenceNumber adaptation_set_counter_;
|
base::AtomicSequenceNumber adaptation_set_counter_;
|
||||||
base::AtomicSequenceNumber representation_counter_;
|
base::AtomicSequenceNumber representation_counter_;
|
||||||
|
|
|
@ -51,7 +51,7 @@ TEST_F(StaticMpdBuilderTest, VideoAndAudio) {
|
||||||
MediaInfo audio_media_info = GetTestMediaInfo(kFileNameAudioMediaInfo1);
|
MediaInfo audio_media_info = GetTestMediaInfo(kFileNameAudioMediaInfo1);
|
||||||
|
|
||||||
// The order matters here to check against expected output.
|
// The order matters here to check against expected output.
|
||||||
// TODO(rkuroiwa): Investigate if I can deal with IDs and order elements
|
// TODO: Investigate if I can deal with IDs and order elements
|
||||||
// deterministically.
|
// deterministically.
|
||||||
AdaptationSet* video_adaptation_set = mpd_.AddAdaptationSet();
|
AdaptationSet* video_adaptation_set = mpd_.AddAdaptationSet();
|
||||||
ASSERT_TRUE(video_adaptation_set);
|
ASSERT_TRUE(video_adaptation_set);
|
||||||
|
@ -72,7 +72,6 @@ TEST_F(StaticMpdBuilderTest, VideoAndAudio) {
|
||||||
|
|
||||||
// MPD schema has strict ordering. AudioChannelConfiguration must appear before
|
// MPD schema has strict ordering. AudioChannelConfiguration must appear before
|
||||||
// ContentProtection.
|
// ContentProtection.
|
||||||
// TODO(rkuroiwa): Enable this when implemented.
|
|
||||||
TEST_F(StaticMpdBuilderTest, AudioChannelConfigurationWithContentProtection) {
|
TEST_F(StaticMpdBuilderTest, AudioChannelConfigurationWithContentProtection) {
|
||||||
MediaInfo encrypted_audio_media_info =
|
MediaInfo encrypted_audio_media_info =
|
||||||
GetTestMediaInfo(kFileNameEncytpedAudioMediaInfo);
|
GetTestMediaInfo(kFileNameEncytpedAudioMediaInfo);
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace dash_packager {
|
||||||
// container is for an AdaptationSet.
|
// container is for an AdaptationSet.
|
||||||
class SimpleVodMpdNotifier : public MpdNotifier {
|
class SimpleVodMpdNotifier : public MpdNotifier {
|
||||||
public:
|
public:
|
||||||
// TODO(rkuroiwa): Take File pointer for MPD output.
|
// TODO: Take File pointer for MPD output.
|
||||||
// MpdBuilder must be initialized before passing a pointer to this object.
|
// MpdBuilder must be initialized before passing a pointer to this object.
|
||||||
// The ownership of |mpd_builder| does not transfer to this object and it must
|
// The ownership of |mpd_builder| does not transfer to this object and it must
|
||||||
// be non-NULL.
|
// be non-NULL.
|
||||||
|
|
|
@ -340,7 +340,7 @@ bool RepresentationXmlNode::AddAudioInfo(
|
||||||
|
|
||||||
AddAudioSamplingRateInfo(repeated_audio_info);
|
AddAudioSamplingRateInfo(repeated_audio_info);
|
||||||
|
|
||||||
// TODO(rkuroiwa): Find out where language goes.
|
// TODO: Find out where language goes.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,9 +55,9 @@ class XmlNode {
|
||||||
// any methods of this object, except the destructor, is undefined.
|
// any methods of this object, except the destructor, is undefined.
|
||||||
xmlNodePtr Release();
|
xmlNodePtr Release();
|
||||||
|
|
||||||
// TODO(rkuroiwa): This isn't elegant. The only place this is used is when
|
// TODO: This isn't elegant. The only place this is used is when getting the
|
||||||
// getting the duration of the MPD. Maybe make MpdXmlNode that does stuff
|
// duration of the MPD. Maybe make MpdXmlNode that does stuff internally, for
|
||||||
// internally, for example get 'duration' from all Representation nodes?
|
// example get 'duration' from all Representation nodes?
|
||||||
xmlNodePtr GetRawPtr();
|
xmlNodePtr GetRawPtr();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -100,7 +100,7 @@ class AdaptationSetXmlNode : public RepresentationBaseXmlNode {
|
||||||
};
|
};
|
||||||
|
|
||||||
// RepresentationType in MPD.
|
// RepresentationType in MPD.
|
||||||
// TODO(rkuroiwa): Maybe provide methods to add mimetype, codecs, and bandwidth?
|
// TODO: Maybe provide methods to add mimetype, codecs, and bandwidth?
|
||||||
class RepresentationXmlNode : public RepresentationBaseXmlNode {
|
class RepresentationXmlNode : public RepresentationBaseXmlNode {
|
||||||
public:
|
public:
|
||||||
typedef ::google::protobuf::RepeatedPtrField<MediaInfo_VideoInfo>
|
typedef ::google::protobuf::RepeatedPtrField<MediaInfo_VideoInfo>
|
||||||
|
@ -119,7 +119,7 @@ class RepresentationXmlNode : public RepresentationBaseXmlNode {
|
||||||
|
|
||||||
// Check MediaInfo protobuf definition for which fields are specific to VOD.
|
// Check MediaInfo protobuf definition for which fields are specific to VOD.
|
||||||
bool AddVODOnlyInfo(const MediaInfo& media_info);
|
bool AddVODOnlyInfo(const MediaInfo& media_info);
|
||||||
// TODO(rkuroiwa): Add Live info.
|
// TODO: Add Live info.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Add AudioChannelConfiguration elements. This will add multiple
|
// Add AudioChannelConfiguration elements. This will add multiple
|
||||||
|
|
|
@ -15,10 +15,9 @@ namespace xml {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// TODO(rkuroiwa): Add XmlStringCompare() that does not care about the
|
// TODO: Add XmlStringCompare() that does not care about the prettiness of the
|
||||||
// prettiness of the string representation of the XML. We currently use
|
// string representation of the XML. We currently use CollapseWhitespaceASCII()
|
||||||
// CollapseWhitespaceASCII() with carefully handcrafted expectations so that we
|
// with carefully handcrafted expectations so that we can compare the result.
|
||||||
// can compare the result.
|
|
||||||
|
|
||||||
// Template so that it works for ContentProtectionXml and
|
// Template so that it works for ContentProtectionXml and
|
||||||
// ContentProtectionXml::Element.
|
// ContentProtectionXml::Element.
|
||||||
|
|
|
@ -156,7 +156,7 @@ void MpdWriter::AddBaseUrl(const std::string& base_url) {
|
||||||
base_urls_.push_back(base_url);
|
base_urls_.push_back(base_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(rkuroiwa): The only use case we have for this is static profile, i.e.
|
// TODO: The only use case we have for this is static profile, i.e.
|
||||||
// VOD. But we might want to support dynamic profile for live.
|
// VOD. But we might want to support dynamic profile for live.
|
||||||
bool MpdWriter::WriteMpdToString(std::string* output) {
|
bool MpdWriter::WriteMpdToString(std::string* output) {
|
||||||
CHECK(output);
|
CHECK(output);
|
||||||
|
@ -180,7 +180,7 @@ bool MpdWriter::WriteMpdToString(std::string* output) {
|
||||||
bool MpdWriter::WriteMpdToFile(const char* file_name) {
|
bool MpdWriter::WriteMpdToFile(const char* file_name) {
|
||||||
CHECK(file_name);
|
CHECK(file_name);
|
||||||
|
|
||||||
// TODO(rkuroiwa): MpdBuilder doesn't take File pointer yet. Once it does,
|
// TODO: MpdBuilder doesn't take File pointer yet. Once it does,
|
||||||
// skip intermediate ToString().
|
// skip intermediate ToString().
|
||||||
std::string mpd;
|
std::string mpd;
|
||||||
if (!WriteMpdToString(&mpd)) {
|
if (!WriteMpdToString(&mpd)) {
|
||||||
|
@ -194,7 +194,7 @@ bool MpdWriter::WriteMpdToFile(const char* file_name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(kqyang): If File::Write() changes to best effort write-all then remove
|
// TODO: If File::Write() changes to best effort write-all then remove
|
||||||
// this loop.
|
// this loop.
|
||||||
const char* mpd_char_ptr = mpd.data();
|
const char* mpd_char_ptr = mpd.data();
|
||||||
size_t mpd_bytes_left = mpd.size();
|
size_t mpd_bytes_left = mpd.size();
|
||||||
|
|
|
@ -80,7 +80,6 @@ TEST(MpdWriterTest, VideoAudioMediaInfo) {
|
||||||
kFileNameExpectedMpdOutputAudio1AndVideo1));
|
kFileNameExpectedMpdOutputAudio1AndVideo1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(rkuroiwa): Enable this when implemented.
|
|
||||||
TEST(MpdWriterTest, EncryptedAudioMediaInfo) {
|
TEST(MpdWriterTest, EncryptedAudioMediaInfo) {
|
||||||
MpdWriter mpd_writer;
|
MpdWriter mpd_writer;
|
||||||
base::FilePath encrypted_audio_media_info =
|
base::FilePath encrypted_audio_media_info =
|
||||||
|
|
Loading…
Reference in New Issue