Shaka Packager SDK
Loading...
Searching...
No Matches
ts_writer.h
1// Copyright 2016 Google LLC. All rights reserved.
2//
3// Use of this source code is governed by a BSD-style
4// license that can be found in the LICENSE file or at
5// https://developers.google.com/open-source/licenses/bsd
6
7#ifndef PACKAGER_MEDIA_FORMATS_MP2T_TS_WRITER_H_
8#define PACKAGER_MEDIA_FORMATS_MP2T_TS_WRITER_H_
9
10#include <list>
11#include <map>
12#include <memory>
13#include <optional>
14#include <vector>
15
16#include <packager/file.h>
17#include <packager/file/file_closer.h>
18#include <packager/media/base/buffer_writer.h>
19#include <packager/media/formats/mp2t/continuity_counter.h>
20#include <optional>
21
22namespace shaka {
23namespace media {
24namespace mp2t {
25
26class PesPacket;
27class ProgramMapTableWriter;
28
31class TsWriter {
32 public:
33 explicit TsWriter(std::unique_ptr<ProgramMapTableWriter> pmt_writer);
34 virtual ~TsWriter();
35
39 virtual bool NewSegment(BufferWriter* buffer);
40
42 virtual void SignalEncrypted();
43
49 virtual bool AddPesPacket(std::unique_ptr<PesPacket> pes_packet,
50 BufferWriter* buffer);
51
52 private:
53 TsWriter(const TsWriter&) = delete;
54 TsWriter& operator=(const TsWriter&) = delete;
55
56 // True if further segments generated by this instance should be encrypted.
57 bool encrypted_ = false;
58
59 ContinuityCounter pat_continuity_counter_;
60 ContinuityCounter elementary_stream_continuity_counter_;
61
62 std::unique_ptr<ProgramMapTableWriter> pmt_writer_;
63};
64
65} // namespace mp2t
66} // namespace media
67} // namespace shaka
68
69#endif // PACKAGER_MEDIA_FORMATS_MP2T_TS_WRITER_H_
virtual bool NewSegment(BufferWriter *buffer)
Definition ts_writer.cc:170
virtual bool AddPesPacket(std::unique_ptr< PesPacket > pes_packet, BufferWriter *buffer)
Definition ts_writer.cc:191
virtual void SignalEncrypted()
Signals the writer that the rest of the segments are encrypted.
Definition ts_writer.cc:187
All the methods that are virtual are virtual for mocking.