Shaka Packager SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
ts_section_psi.h
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef MEDIA_FORMATS_MP2T_TS_SECTION_PSI_H_
6 #define MEDIA_FORMATS_MP2T_TS_SECTION_PSI_H_
7 
8 #include "packager/base/compiler_specific.h"
9 #include "packager/media/base/byte_queue.h"
10 #include "packager/media/formats/mp2t/ts_section.h"
11 
12 namespace shaka {
13 namespace media {
14 
15 class BitReader;
16 
17 namespace mp2t {
18 
19 class TsSectionPsi : public TsSection {
20  public:
21  TsSectionPsi();
22  ~TsSectionPsi() override;
23 
24  // TsSection implementation.
25  bool Parse(bool payload_unit_start_indicator,
26  const uint8_t* buf,
27  int size) override;
28  void Flush() override;
29  void Reset() override;
30 
31  // Parse the content of the PSI section.
32  virtual bool ParsePsiSection(BitReader* bit_reader) = 0;
33 
34  // Reset the state of the PSI section.
35  virtual void ResetPsiSection() = 0;
36 
37  private:
38  void ResetPsiState();
39 
40  // Bytes of the current PSI.
41  ByteQueue psi_byte_queue_;
42 
43  // Do not start parsing before getting a unit start indicator.
44  bool wait_for_pusi_;
45 
46  // Number of leading bytes to discard (pointer field).
47  int leading_bytes_to_discard_;
48 
49  DISALLOW_COPY_AND_ASSIGN(TsSectionPsi);
50 };
51 
52 } // namespace mp2t
53 } // namespace media
54 } // namespace shaka
55 
56 #endif
57 
A class to read bit streams.
Definition: bit_reader.h:17