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/formats/webm/mkv_writer.h"
|
2016-08-17 17:41:40 +00:00
|
|
|
#include "packager/media/formats/webm/segmenter.h"
|
2017-06-29 22:23:53 +00:00
|
|
|
#include "packager/status.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.
|
|
|
|
/// @{
|
2017-05-13 00:02:12 +00:00
|
|
|
Status FinalizeSegment(uint64_t start_timestamp,
|
|
|
|
uint64_t duration_timestamp,
|
2017-02-24 01:17:47 +00:00
|
|
|
bool is_subsegment) override;
|
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;
|
2017-05-01 23:17:09 +00:00
|
|
|
std::vector<Range> GetSegmentRanges() 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.
|
2017-05-13 00:02:12 +00:00
|
|
|
Status NewSegment(uint64_t start_timestamp, bool is_subsegment) override;
|
2015-10-28 17:23:08 +00:00
|
|
|
|
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_
|