move mpd_options to its own file

Also always generates sidx box for segments for now.

Change-Id: I61f71ebd281195b737902b57557a345c8e0b0c66
This commit is contained in:
KongQun Yang 2014-12-12 16:13:48 -08:00
parent 2d3927e7cb
commit 7798a1b845
7 changed files with 40 additions and 25 deletions

View File

@ -64,6 +64,7 @@ void BufferWriter::AppendBuffer(const BufferWriter& buffer) {
Status BufferWriter::WriteToFile(File* file) {
DCHECK(file);
DCHECK(!buf_.empty());
size_t remaining_size = buf_.size();
const uint8_t* buf = &buf_[0];

View File

@ -39,7 +39,7 @@ void OffsetByteQueue::Pop(int count) {
}
void OffsetByteQueue::PeekAt(int64_t offset, const uint8_t** buf, int* size) {
DCHECK(offset >= head());
DCHECK_GE(offset, head());
if (offset < head() || offset >= tail()) {
*buf = NULL;
*size = 0;

View File

@ -159,9 +159,8 @@ Status MultiSegmentSegmenter::WriteSegment() {
styp_->Write(buffer.get());
}
// Generate sidx box only if |num_subsegments_per_sidx| is non-negative and
// the box contains multiple entries.
if (options().num_subsegments_per_sidx >= 0 && sidx()->references.size() > 1)
// If num_subsegments_per_sidx is negative, no SIDX box is generated.
if (options().num_subsegments_per_sidx >= 0)
sidx()->Write(buffer.get());
const size_t segment_size = buffer->Size() + fragment_buffer()->Size();

View File

@ -183,16 +183,6 @@ bool WriteXmlCharArrayToOutput(xmlChar* doc,
} // namespace
MpdOptions::MpdOptions()
: availability_time_offset(0),
minimum_update_period(0),
// TODO(tinskip): Set min_buffer_time in unit tests rather than here.
min_buffer_time(2.0),
time_shift_buffer_depth(0),
suggested_presentation_delay(0) {}
MpdOptions::~MpdOptions() {}
MpdBuilder::MpdBuilder(MpdType type, const MpdOptions& mpd_options)
: type_(type),
mpd_options_(mpd_options),

View File

@ -22,6 +22,7 @@
#include "packager/mpd/base/bandwidth_estimator.h"
#include "packager/mpd/base/content_protection_element.h"
#include "packager/mpd/base/media_info.pb.h"
#include "packager/mpd/base/mpd_options.h"
#include "packager/mpd/base/mpd_utils.h"
#include "packager/mpd/base/segment_info.h"
#include "packager/mpd/base/xml/scoped_xml_ptr.h"
@ -45,17 +46,6 @@ class RepresentationXmlNode;
} // namespace xml
struct MpdOptions {
MpdOptions();
~MpdOptions();
double availability_time_offset;
double minimum_update_period;
double min_buffer_time;
double time_shift_buffer_depth;
double suggested_presentation_delay;
};
/// This class generates DASH MPDs (Media Presentation Descriptions).
class MpdBuilder {
public:

View File

@ -0,0 +1,34 @@
// Copyright 2014 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#ifndef MPD_BASE_MPD_OPTIONS_H_
#define MPD_BASE_MPD_OPTIONS_H_
namespace edash_packager {
/// Defines Mpd Options.
struct MpdOptions {
MpdOptions()
: availability_time_offset(0),
minimum_update_period(0),
// TODO(tinskip): Set min_buffer_time in unit tests rather than here.
min_buffer_time(2.0),
time_shift_buffer_depth(0),
suggested_presentation_delay(0) {}
~MpdOptions() {};
double availability_time_offset;
double minimum_update_period;
double min_buffer_time;
double time_shift_buffer_depth;
double suggested_presentation_delay;
};
} // namespace edash_packager
#endif // MPD_BASE_MPD_OPTIONS_H_

View File

@ -40,6 +40,7 @@
'base/mpd_builder.cc',
'base/mpd_builder.h',
'base/mpd_notifier.h',
'base/mpd_options.h',
'base/mpd_utils.cc',
'base/mpd_utils.h',
'base/segment_info.h',