2022-08-26 15:44:59 +00:00
|
|
|
// Copyright 2015 Google LLC. All rights reserved.
|
2015-10-28 17:23:08 +00:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
|
2017-12-20 00:56:36 +00:00
|
|
|
#ifndef PACKAGER_MEDIA_FORMATS_WEBM_MULTI_SEGMENT_SEGMENTER_H_
|
|
|
|
#define PACKAGER_MEDIA_FORMATS_WEBM_MULTI_SEGMENT_SEGMENTER_H_
|
2015-10-28 17:23:08 +00:00
|
|
|
|
2016-08-17 17:41:40 +00:00
|
|
|
#include <memory>
|
2020-07-28 04:32:56 +00:00
|
|
|
|
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"
|
2022-12-17 05:40:00 +00:00
|
|
|
#include "packager/status/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.
|
|
|
|
/// @{
|
2021-08-04 18:56:44 +00:00
|
|
|
Status FinalizeSegment(int64_t start_timestamp,
|
|
|
|
int64_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.
|
2021-08-04 18:56:44 +00:00
|
|
|
Status NewSegment(int64_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_;
|
2020-07-28 04:32:56 +00:00
|
|
|
std::string temp_file_name_;
|
2015-10-28 17:23:08 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2017-12-20 00:56:36 +00:00
|
|
|
#endif // PACKAGER_MEDIA_FORMATS_WEBM_MULTI_SEGMENT_SEGMENTER_H_
|