DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs 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 edash_packager {
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 
52  int64_t duration() const { return duration_; }
54  void set_duration(int64_t duration) { duration_ = duration; }
55 
57  const std::vector<uint8_t>& data() const { return data_; }
59  std::vector<uint8_t>* mutable_data() { return &data_; }
60 
61  private:
62  uint8_t stream_id_ = 0;
63 
64  // These values mean "not set" when the value is less than 0.
65  int64_t dts_ = -1;
66  int64_t pts_ = -1;
67 
68  int64_t duration_ = 0;
69 
70  std::vector<uint8_t> data_;
71 
72  DISALLOW_COPY_AND_ASSIGN(PesPacket);
73 };
74 
75 } // namespace mp2t
76 } // namespace media
77 } // namespace edash_packager
78 
79 #endif // PACKAGER_MEDIA_FORMATS_MP2T_PES_PACKET_H_
Class that carries PES packet information.
Definition: pes_packet.h:20
const std::vector< uint8_t > & data() const
Definition: pes_packet.h:57
void set_stream_id(uint8_t stream_id)
Definition: pes_packet.h:28
std::vector< uint8_t > * mutable_data()
Definition: pes_packet.h:59
void set_duration(int64_t duration)
Definition: pes_packet.h:54