Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 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_MP2T_TS_PACKET_H_ | |
| 6 #define MEDIA_MP2T_TS_PACKET_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 | |
| 10 namespace media { | |
| 11 | |
| 12 class BitReader; | |
| 13 | |
| 14 namespace mp2t { | |
| 15 | |
| 16 class TsPacket { | |
| 17 public: | |
| 18 static const int kPacketSize = 188; | |
| 19 | |
| 20 // Return the number of bytes to discard | |
| 21 // to be synchronized on a TS syncword. | |
| 22 static int Sync(const uint8* buf, int size); | |
| 23 | |
| 24 // Parse a TS packet. | |
| 25 // Return a TsPacket only when parsing was successful. | |
| 26 // Return NULL otherwise. | |
| 27 static TsPacket* Parse(const uint8* buf, int size); | |
| 28 | |
| 29 ~TsPacket(); | |
| 30 | |
| 31 // TS header accessors. | |
| 32 bool payload_unit_start_indicator() const { | |
| 33 return payload_unit_start_indicator_; | |
| 34 } | |
| 35 int pid() const { | |
| 36 return pid_; | |
| 37 } | |
| 38 int continuity_counter() const { | |
| 39 return continuity_counter_; | |
| 40 } | |
| 41 bool discontinuity_indicator() const { | |
| 42 return discontinuity_indicator_; | |
| 43 } | |
| 44 bool random_access_indicator() const { | |
| 45 return random_access_indicator_; | |
| 46 } | |
| 47 | |
| 48 // Return the offset and the size of the payload. | |
| 49 const uint8* GetPayload() const; | |
|
acolwell GONE FROM CHROMIUM
2013/09/16 06:19:30
nit: s/GetPayload()/payload/ and inline since this
damienv1
2013/09/17 02:58:22
Done.
| |
| 50 int GetPayloadSize() const; | |
|
acolwell GONE FROM CHROMIUM
2013/09/16 06:19:30
s/GetPayloadSize/payload_size and inline
damienv1
2013/09/17 02:58:22
Done.
| |
| 51 | |
| 52 private: | |
| 53 TsPacket(); | |
| 54 | |
| 55 bool ParseHeader(BitReader* bit_reader); | |
| 56 bool ParseAdaptationField(BitReader* bit_reader, | |
| 57 int adaptation_field_length); | |
| 58 | |
| 59 // Size of the payload. | |
| 60 const uint8* payload_; | |
| 61 int payload_size_; | |
| 62 | |
| 63 // TS header. | |
| 64 bool payload_unit_start_indicator_; | |
| 65 int pid_; | |
| 66 int continuity_counter_; | |
| 67 | |
| 68 // Params from the adaptation field. | |
| 69 bool discontinuity_indicator_; | |
| 70 bool random_access_indicator_; | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(TsPacket); | |
| 73 }; | |
| 74 | |
| 75 } // namespace mp2t | |
| 76 } // namespace media | |
| 77 | |
| 78 #endif | |
| 79 | |
| OLD | NEW |