2015-10-28 17:23:08 +00:00
|
|
|
// Copyright 2015 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 MEDIA_FORMATS_WEBM_MULTI_SEGMENT_SEGMENTER_H_
|
|
|
|
#define MEDIA_FORMATS_WEBM_MULTI_SEGMENT_SEGMENTER_H_
|
|
|
|
|
2016-08-17 17:41:40 +00:00
|
|
|
#include <memory>
|
2015-10-28 17:23:08 +00:00
|
|
|
#include "packager/media/base/status.h"
|
|
|
|
#include "packager/media/formats/webm/mkv_writer.h"
|
2016-08-17 17:41:40 +00:00
|
|
|
#include "packager/media/formats/webm/segmenter.h"
|
2015-10-28 17:23:08 +00:00
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
2015-10-28 17:23:08 +00:00
|
|
|
namespace media {
|
|
|
|
|
|
|
|
struct MuxerOptions;
|
|
|
|
|
|
|
|
namespace webm {
|
|
|
|
|
|
|
|
/// An implementation of a Segmenter for a multi-segment. Since this does not
|
|
|
|
/// use seeking, it does not matter if the underlying files support seeking.
|
|
|
|
class MultiSegmentSegmenter : public Segmenter {
|
|
|
|
public:
|
|
|
|
explicit MultiSegmentSegmenter(const MuxerOptions& options);
|
|
|
|
~MultiSegmentSegmenter() override;
|
|
|
|
|
|
|
|
/// @name Segmenter implementation overrides.
|
|
|
|
/// @{
|
2016-04-15 23:00:27 +00:00
|
|
|
bool GetInitRangeStartAndEnd(uint64_t* start, uint64_t* end) override;
|
|
|
|
bool GetIndexRangeStartAndEnd(uint64_t* start, uint64_t* end) override;
|
2015-10-28 17:23:08 +00:00
|
|
|
/// @}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Segmenter implementation overrides.
|
2017-03-16 20:56:11 +00:00
|
|
|
Status DoInitialize() override;
|
2015-10-28 17:23:08 +00:00
|
|
|
Status DoFinalize() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Segmenter implementation overrides.
|
|
|
|
Status NewSubsegment(uint64_t start_timescale) override;
|
|
|
|
Status NewSegment(uint64_t start_timescale) override;
|
|
|
|
|
|
|
|
Status FinalizeSegment();
|
|
|
|
|
2016-08-17 17:41:40 +00:00
|
|
|
std::unique_ptr<MkvWriter> writer_;
|
2015-10-28 17:23:08 +00:00
|
|
|
uint32_t num_segment_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(MultiSegmentSegmenter);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace webm
|
|
|
|
} // namespace media
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|
2015-10-28 17:23:08 +00:00
|
|
|
|
|
|
|
#endif // MEDIA_FORMATS_WEBM_MULTI_SEGMENT_SEGMENTER_H_
|