DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
pes_packet.h
1 // Copyright 2016 Google Inc. 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_PES_PACKET_H_
8 #define PACKAGER_MEDIA_FORMATS_MP2T_PES_PACKET_H_
9 
10 #include <stdint.h>
11 #include <vector>
12 
13 #include "packager/base/macros.h"
14 
15 namespace shaka {
16 namespace media {
17 namespace mp2t {
18 
20 class PesPacket {
21  public:
22  PesPacket();
23  ~PesPacket();
24 
26  uint8_t stream_id() const { return stream_id_; }
28  void set_stream_id(uint8_t stream_id) { stream_id_ = stream_id; }
29 
31  bool has_dts() const { return dts_ >= 0; }
33  bool has_pts() const { return pts_ >= 0; }
34 
36  int64_t dts() const { return dts_; }
38  void set_dts(int64_t dts) {
39  dts_ = dts;
40  }
41 
43  int64_t pts() const { return pts_; }
45  void set_pts(int64_t pts) {
46  pts_ = pts;
47  }
48 
49  const std::vector<uint8_t>& data() const { return data_; }
51  std::vector<uint8_t>* mutable_data() { return &data_; }
52 
53  private:
54  uint8_t stream_id_ = 0;
55 
56  // These values mean "not set" when the value is less than 0.
57  int64_t dts_ = -1;
58  int64_t pts_ = -1;
59 
60  std::vector<uint8_t> data_;
61 
62  DISALLOW_COPY_AND_ASSIGN(PesPacket);
63 };
64 
65 } // namespace mp2t
66 } // namespace media
67 } // namespace shaka
68 
69 #endif // PACKAGER_MEDIA_FORMATS_MP2T_PES_PACKET_H_
void set_stream_id(uint8_t stream_id)
Definition: pes_packet.h:28
void set_pts(int64_t pts)
Definition: pes_packet.h:45
uint8_t stream_id() const
Definition: pes_packet.h:26
void set_dts(int64_t dts)
Definition: pes_packet.h:38
Class that carries PES packet information.
Definition: pes_packet.h:20
std::vector< uint8_t > * mutable_data()
Definition: pes_packet.h:51