OSDN Git Service

HLS試作
[iptd/iPTd.git] / src / mpeg2 / ts / Header.cpp
1 /*
2  *  Header.cpp
3  */
4 #include "mpeg2/ts/Header.h"
5
6 namespace MPEG2
7 {
8 namespace TS
9 {
10
11 const uint8_t SYNC_BYTE     = 0x47;
12 const uint8_t PACKET_SIZE   = 188;
13
14 Header::Header(uint8_t *packet)
15 {
16     _sync_byte                  = packet[0x00];
17     _transport_error            = (packet[0x01] & 0x80) >> 7;
18     _payload_unit_start         = (packet[0x01] & 0x40) >> 6;
19     _transport_priority         = (packet[0x01] & 0x20) >> 5;
20     _pid                        = ((packet[0x01] << 8) + packet[0x02]) & 0x1FFF;
21     _transport_scramble_control = (packet[0x03] & 0xc0) >> 6;
22     _adaptation_field_control   = (packet[0x03] & 0x30) >> 4;
23     _continuty_counter          = packet[0x03] & 0x0F;
24 }
25
26 } // TS
27 } // MPEG2