winlin

for #250, the ts packet and adaptation field.

@@ -402,6 +402,14 @@ SrsMpegtsFrame::SrsMpegtsFrame() @@ -402,6 +402,14 @@ SrsMpegtsFrame::SrsMpegtsFrame()
402 402
403 SrsTsPacket::SrsTsPacket() 403 SrsTsPacket::SrsTsPacket()
404 { 404 {
  405 + sync_byte = 0;
  406 + transport_error_indicator = 0;
  407 + payload_unit_start_indicator = 0;
  408 + transport_priority = 0;
  409 + pid = SrsTsPidPAT;
  410 + transport_scrambling_control = SrsTsScrambledDisabled;
  411 + adaption_field_control = SrsTsAdaptationFieldTypeReserved;
  412 + continuity_counter = 0;
405 adaptation_field = NULL; 413 adaptation_field = NULL;
406 } 414 }
407 415
@@ -410,6 +418,46 @@ SrsTsPacket::~SrsTsPacket() @@ -410,6 +418,46 @@ SrsTsPacket::~SrsTsPacket()
410 srs_freep(adaptation_field); 418 srs_freep(adaptation_field);
411 } 419 }
412 420
  421 +SrsTsAdaptationField::SrsTsAdaptationField()
  422 +{
  423 + adaption_field_length = 0;
  424 + discontinuity_indicator = 0;
  425 + random_access_indicator = 0;
  426 + elementary_stream_priority_indicator = 0;
  427 + PCR_flag = 0;
  428 + OPCR_flag = 0;
  429 + splicing_point_flag = 0;
  430 + transport_private_data_flag = 0;
  431 + adaptation_field_extension_flag = 0;
  432 + program_clock_reference_base = 0;
  433 + program_clock_reference_extension = 0;
  434 + original_program_clock_reference_base = 0;
  435 + original_program_clock_reference_extension = 0;
  436 + splice_countdown = 0;
  437 + transport_private_data_length = 0;
  438 + transport_private_data = NULL;
  439 + adaptation_field_extension_length = 0;
  440 + ltw_flag = 0;
  441 + piecewise_rate_flag = 0;
  442 + seamless_splice_flag = 0;
  443 + ltw_valid_flag = 0;
  444 + ltw_offset = 0;
  445 + piecewise_rate = 0;
  446 + splice_type = 0;
  447 + DTS_next_AU0 = 0;
  448 + marker_bit0 = 0;
  449 + DTS_next_AU1 = 0;
  450 + marker_bit1 = 0;
  451 + DTS_next_AU2 = 0;
  452 + marker_bit2 = 0;
  453 + nb_af_ext_reserved = 0;
  454 + nb_af_reserved = 0;
  455 +}
  456 +
  457 +SrsTsAdaptationField::~SrsTsAdaptationField()
  458 +{
  459 +}
  460 +
413 SrsTSMuxer::SrsTSMuxer(SrsFileWriter* w) 461 SrsTSMuxer::SrsTSMuxer(SrsFileWriter* w)
414 { 462 {
415 writer = w; 463 writer = w;
@@ -40,6 +40,7 @@ class SrsFileReader; @@ -40,6 +40,7 @@ class SrsFileReader;
40 class SrsAvcAacCodec; 40 class SrsAvcAacCodec;
41 class SrsCodecSample; 41 class SrsCodecSample;
42 class SrsSimpleBuffer; 42 class SrsSimpleBuffer;
  43 +class SrsTsAdaptationField;
43 44
44 // Transport Stream packets are 188 bytes in length. 45 // Transport Stream packets are 188 bytes in length.
45 #define SRS_TS_PACKET_SIZE 188 46 #define SRS_TS_PACKET_SIZE 188
@@ -106,10 +107,6 @@ enum SrsTsAdaptationFieldType @@ -106,10 +107,6 @@ enum SrsTsAdaptationFieldType
106 SrsTsAdaptationFieldTypeBoth = 0x03, 107 SrsTsAdaptationFieldTypeBoth = 0x03,
107 }; 108 };
108 109
109 -class SrsTsAdaptationField  
110 -{  
111 -};  
112 -  
113 /** 110 /**
114 * the packet in ts stream, 111 * the packet in ts stream,
115 * 2.4.3.2 Transport Stream packet layer, hls-mpeg-ts-iso13818-1.pdf, page 36 112 * 2.4.3.2 Transport Stream packet layer, hls-mpeg-ts-iso13818-1.pdf, page 36
@@ -118,11 +115,14 @@ class SrsTsAdaptationField @@ -118,11 +115,14 @@ class SrsTsAdaptationField
118 class SrsTsPacket 115 class SrsTsPacket
119 { 116 {
120 private: 117 private:
  118 + // 1B
121 /** 119 /**
122 * The sync_byte is a fixed 8-bit field whose value is '0100 0111' (0x47). Sync_byte emulation in the choice of 120 * The sync_byte is a fixed 8-bit field whose value is '0100 0111' (0x47). Sync_byte emulation in the choice of
123 * values for other regularly occurring fields, such as PID, should be avoided. 121 * values for other regularly occurring fields, such as PID, should be avoided.
124 */ 122 */
125 int8_t sync_byte; //8bits 123 int8_t sync_byte; //8bits
  124 +
  125 + // 2B
126 /** 126 /**
127 * The transport_error_indicator is a 1-bit flag. When set to '1' it indicates that at least 127 * The transport_error_indicator is a 1-bit flag. When set to '1' it indicates that at least
128 * 1 uncorrectable bit error exists in the associated Transport Stream packet. This bit may be set to '1' by entities external to 128 * 1 uncorrectable bit error exists in the associated Transport Stream packet. This bit may be set to '1' by entities external to
@@ -166,6 +166,8 @@ private: @@ -166,6 +166,8 @@ private:
166 * Table 2-3). 166 * Table 2-3).
167 */ 167 */
168 SrsTsPid pid; //13bits 168 SrsTsPid pid; //13bits
  169 +
  170 + // 1B
169 /** 171 /**
170 * This 2-bit field indicates the scrambling mode of the Transport Stream packet payload. 172 * This 2-bit field indicates the scrambling mode of the Transport Stream packet payload.
171 * The Transport Stream packet header, and the adaptation field when present, shall not be scrambled. In the case of a null 173 * The Transport Stream packet header, and the adaptation field when present, shall not be scrambled. In the case of a null
@@ -207,6 +209,304 @@ public: @@ -207,6 +209,304 @@ public:
207 }; 209 };
208 210
209 /** 211 /**
  212 +* the adaption field of ts packet.
  213 +* 2.4.3.5 Semantic definition of fields in adaptation field, hls-mpeg-ts-iso13818-1.pdf, page 39
  214 +* Table 2-6 ¨C Transport Stream adaptation field, hls-mpeg-ts-iso13818-1.pdf, page 40
  215 +*/
  216 +class SrsTsAdaptationField
  217 +{
  218 +private:
  219 + // 1B
  220 + /**
  221 + * The adaptation_field_length is an 8-bit field specifying the number of bytes in the
  222 + * adaptation_field immediately following the adaptation_field_length. The value 0 is for inserting a single stuffing byte in
  223 + * a Transport Stream packet. When the adaptation_field_control value is '11', the value of the adaptation_field_length shall
  224 + * be in the range 0 to 182. When the adaptation_field_control value is '10', the value of the adaptation_field_length shall
  225 + * be 183. For Transport Stream packets carrying PES packets, stuffing is needed when there is insufficient PES packet data
  226 + * to completely fill the Transport Stream packet payload bytes. Stuffing is accomplished by defining an adaptation field
  227 + * longer than the sum of the lengths of the data elements in it, so that the payload bytes remaining after the adaptation field
  228 + * exactly accommodates the available PES packet data. The extra space in the adaptation field is filled with stuffing bytes.
  229 + *
  230 + * This is the only method of stuffing allowed for Transport Stream packets carrying PES packets. For Transport Stream
  231 + * packets carrying PSI, an alternative stuffing method is described in 2.4.4.
  232 + */
  233 + u_int8_t adaption_field_length; //8bits
  234 + // 1B
  235 + /**
  236 + * This is a 1-bit field which when set to '1' indicates that the discontinuity state is true for the
  237 + * current Transport Stream packet. When the discontinuity_indicator is set to '0' or is not present, the discontinuity state is
  238 + * false. The discontinuity indicator is used to indicate two types of discontinuities, system time-base discontinuities and
  239 + * continuity_counter discontinuities.
  240 + *
  241 + * A system time-base discontinuity is indicated by the use of the discontinuity_indicator in Transport Stream packets of a
  242 + * PID designated as a PCR_PID (refer to 2.4.4.9). When the discontinuity state is true for a Transport Stream packet of a
  243 + * PID designated as a PCR_PID, the next PCR in a Transport Stream packet with that same PID represents a sample of a
  244 + * new system time clock for the associated program. The system time-base discontinuity point is defined to be the instant
  245 + * in time when the first byte of a packet containing a PCR of a new system time-base arrives at the input of the T-STD.
  246 + * The discontinuity_indicator shall be set to '1' in the packet in which the system time-base discontinuity occurs. The
  247 + * discontinuity_indicator bit may also be set to '1' in Transport Stream packets of the same PCR_PID prior to the packet
  248 + * which contains the new system time-base PCR. In this case, once the discontinuity_indicator has been set to '1', it shall
  249 + * continue to be set to '1' in all Transport Stream packets of the same PCR_PID up to and including the Transport Stream
  250 + * packet which contains the first PCR of the new system time-base. After the occurrence of a system time-base
  251 + * discontinuity, no fewer than two PCRs for the new system time-base shall be received before another system time-base
  252 + * discontinuity can occur. Further, except when trick mode status is true, data from no more than two system time-bases
  253 + * shall be present in the set of T-STD buffers for one program at any time.
  254 + *
  255 + * Prior to the occurrence of a system time-base discontinuity, the first byte of a Transport Stream packet which contains a
  256 + * PTS or DTS which refers to the new system time-base shall not arrive at the input of the T-STD. After the occurrence of
  257 + * a system time-base discontinuity, the first byte of a Transport Stream packet which contains a PTS or DTS which refers
  258 + * to the previous system time-base shall not arrive at the input of the T-STD.
  259 + *
  260 + * A continuity_counter discontinuity is indicated by the use of the discontinuity_indicator in any Transport Stream packet.
  261 + * When the discontinuity state is true in any Transport Stream packet of a PID not designated as a PCR_PID, the
  262 + * continuity_counter in that packet may be discontinuous with respect to the previous Transport Stream packet of the same
  263 + * PID. When the discontinuity state is true in a Transport Stream packet of a PID that is designated as a PCR_PID, the
  264 + * continuity_counter may only be discontinuous in the packet in which a system time-base discontinuity occurs. A
  265 + * continuity counter discontinuity point occurs when the discontinuity state is true in a Transport Stream packet and the
  266 + * continuity_counter in the same packet is discontinuous with respect to the previous Transport Stream packet of the same
  267 + * PID. A continuity counter discontinuity point shall occur at most one time from the initiation of the discontinuity state
  268 + * until the conclusion of the discontinuity state. Furthermore, for all PIDs that are not designated as PCR_PIDs, when the
  269 + * discontinuity_indicator is set to '1' in a packet of a specific PID, the discontinuity_indicator may be set to '1' in the next
  270 + * Transport Stream packet of that same PID, but shall not be set to '1' in three consecutive Transport Stream packet of that
  271 + * same PID.
  272 + *
  273 + * For the purpose of this clause, an elementary stream access point is defined as follows:
  274 + * Video ¨C The first byte of a video sequence header.
  275 + * Audio ¨C The first byte of an audio frame.
  276 + *
  277 + * After a continuity counter discontinuity in a Transport packet which is designated as containing elementary stream data,
  278 + * the first byte of elementary stream data in a Transport Stream packet of the same PID shall be the first byte of an
  279 + * elementary stream access point or in the case of video, the first byte of an elementary stream access point or a
  280 + * sequence_end_code followed by an access point. Each Transport Stream packet which contains elementary stream data
  281 + * with a PID not designated as a PCR_PID, and in which a continuity counter discontinuity point occurs, and in which a
  282 + * PTS or DTS occurs, shall arrive at the input of the T-STD after the system time-base discontinuity for the associated
  283 + * program occurs. In the case where the discontinuity state is true, if two consecutive Transport Stream packets of the same
  284 + * PID occur which have the same continuity_counter value and have adaptation_field_control values set to '01' or '11', the
  285 + * second packet may be discarded. A Transport Stream shall not be constructed in such a way that discarding such a packet
  286 + * will cause the loss of PES packet payload data or PSI data.
  287 + *
  288 + * After the occurrence of a discontinuity_indicator set to '1' in a Transport Stream packet which contains PSI information,
  289 + * a single discontinuity in the version_number of PSI sections may occur. At the occurrence of such a discontinuity, a
  290 + * version of the TS_program_map_sections of the appropriate program shall be sent with section_length = = 13 and the
  291 + * current_next_indicator = = 1, such that there are no program_descriptors and no elementary streams described. This shall
  292 + * then be followed by a version of the TS_program_map_section for each affected program with the version_number
  293 + * incremented by one and the current_next_indicator = = 1, containing a complete program definition. This indicates a
  294 + * version change in PSI data.
  295 + */
  296 + int8_t discontinuity_indicator; //1bit
  297 + /**
  298 + * The random_access_indicator is a 1-bit field that indicates that the current Transport
  299 + * Stream packet, and possibly subsequent Transport Stream packets with the same PID, contain some information to aid
  300 + * random access at this point. Specifically, when the bit is set to '1', the next PES packet to start in the payload of Transport
  301 + * Stream packets with the current PID shall contain the first byte of a video sequence header if the PES stream type (refer
  302 + * to Table 2-29) is 1 or 2, or shall contain the first byte of an audio frame if the PES stream type is 3 or 4. In addition, in
  303 + * the case of video, a presentation timestamp shall be present in the PES packet containing the first picture following the
  304 + * sequence header. In the case of audio, the presentation timestamp shall be present in the PES packet containing the first
  305 + * byte of the audio frame. In the PCR_PID the random_access_indicator may only be set to '1' in Transport Stream packet
  306 + * containing the PCR fields.
  307 + */
  308 + int8_t random_access_indicator; //1bit
  309 + /**
  310 + * The elementary_stream_priority_indicator is a 1-bit field. It indicates, among
  311 + * packets with the same PID, the priority of the elementary stream data carried within the payload of this Transport Stream
  312 + * packet. A '1' indicates that the payload has a higher priority than the payloads of other Transport Stream packets. In the
  313 + * case of video, this field may be set to '1' only if the payload contains one or more bytes from an intra-coded slice. A
  314 + * value of '0' indicates that the payload has the same priority as all other packets which do not have this bit set to '1'.
  315 + */
  316 + int8_t elementary_stream_priority_indicator; //1bit
  317 + /**
  318 + * The PCR_flag is a 1-bit flag. A value of '1' indicates that the adaptation_field contains a PCR field coded in
  319 + * two parts. A value of '0' indicates that the adaptation field does not contain any PCR field.
  320 + */
  321 + int8_t PCR_flag; //1bit
  322 + /**
  323 + * The OPCR_flag is a 1-bit flag. A value of '1' indicates that the adaptation_field contains an OPCR field
  324 + * coded in two parts. A value of '0' indicates that the adaptation field does not contain any OPCR field.
  325 + */
  326 + int8_t OPCR_flag; //1bit
  327 + /**
  328 + * The splicing_point_flag is a 1-bit flag. When set to '1', it indicates that a splice_countdown field
  329 + * shall be present in the associated adaptation field, specifying the occurrence of a splicing point. A value of '0' indicates
  330 + * that a splice_countdown field is not present in the adaptation field.
  331 + */
  332 + int8_t splicing_point_flag; //1bit
  333 + /**
  334 + * The transport_private_data_flag is a 1-bit flag. A value of '1' indicates that the
  335 + * adaptation field contains one or more private_data bytes. A value of '0' indicates the adaptation field does not contain any
  336 + * private_data bytes.
  337 + */
  338 + int8_t transport_private_data_flag; //1bit
  339 + /**
  340 + * The adaptation_field_extension_flag is a 1-bit field which when set to '1' indicates
  341 + * the presence of an adaptation field extension. A value of '0' indicates that an adaptation field extension is not present in
  342 + * the adaptation field.
  343 + */
  344 + int8_t adaptation_field_extension_flag; //1bit
  345 +
  346 + // if PCR_flag, 6B
  347 + /**
  348 + * The program_clock_reference (PCR) is a
  349 + * 42-bit field coded in two parts. The first part, program_clock_reference_base, is a 33-bit field whose value is given by
  350 + * PCR_base(i), as given in equation 2-2. The second part, program_clock_reference_extension, is a 9-bit field whose value
  351 + * is given by PCR_ext(i), as given in equation 2-3. The PCR indicates the intended time of arrival of the byte containing
  352 + * the last bit of the program_clock_reference_base at the input of the system target decoder.
  353 + */
  354 + int64_t program_clock_reference_base; //33bits
  355 + //6bits reserved.
  356 + int16_t program_clock_reference_extension; //9bits
  357 +
  358 + // if OPCR_flag, 6B
  359 + /**
  360 + * The optional original
  361 + * program reference (OPCR) is a 42-bit field coded in two parts. These two parts, the base and the extension, are coded
  362 + * identically to the two corresponding parts of the PCR field. The presence of the OPCR is indicated by the OPCR_flag.
  363 + * The OPCR field shall be coded only in Transport Stream packets in which the PCR field is present. OPCRs are permitted
  364 + * in both single program and multiple program Transport Streams.
  365 + *
  366 + * OPCR assists in the reconstruction of a single program Transport Stream from another Transport Stream. When
  367 + * reconstructing the original single program Transport Stream, the OPCR may be copied to the PCR field. The resulting
  368 + * PCR value is valid only if the original single program Transport Stream is reconstructed exactly in its entirety. This
  369 + * would include at least any PSI and private data packets which were present in the original Transport Stream and would
  370 + * possibly require other private arrangements. It also means that the OPCR must be an identical copy of its associated PCR
  371 + * in the original single program Transport Stream.
  372 + */
  373 + int64_t original_program_clock_reference_base; //33bits
  374 + //6bits reserved.
  375 + int16_t original_program_clock_reference_extension; //9bits
  376 +
  377 + // if splicing_point_flag, 1B
  378 + /**
  379 + * The splice_countdown is an 8-bit field, representing a value which may be positive or negative. A
  380 + * positive value specifies the remaining number of Transport Stream packets, of the same PID, following the associated
  381 + * Transport Stream packet until a splicing point is reached. Duplicate Transport Stream packets and Transport Stream
  382 + * packets which only contain adaptation fields are excluded. The splicing point is located immediately after the last byte of
  383 + * the Transport Stream packet in which the associated splice_countdown field reaches zero. In the Transport Stream packet
  384 + * where the splice_countdown reaches zero, the last data byte of the Transport Stream packet payload shall be the last byte
  385 + * of a coded audio frame or a coded picture. In the case of video, the corresponding access unit may or may not be
  386 + * terminated by a sequence_end_code. Transport Stream packets with the same PID, which follow, may contain data from
  387 + * a different elementary stream of the same type.
  388 + *
  389 + * The payload of the next Transport Stream packet of the same PID (duplicate packets and packets without payload being
  390 + * excluded) shall commence with the first byte of a PES packet.In the case of audio, the PES packet payload shall
  391 + * commence with an access point. In the case of video, the PES packet payload shall commence with an access point, or
  392 + * with a sequence_end_code, followed by an access point. Thus, the previous coded audio frame or coded picture aligns
  393 + * with the packet boundary, or is padded to make this so. Subsequent to the splicing point, the countdown field may also
  394 + * be present. When the splice_countdown is a negative number whose value is minus n(-n), it indicates that the associated
  395 + * Transport Stream packet is the n-th packet following the splicing point (duplicate packets and packets without payload
  396 + * being excluded).
  397 + *
  398 + * For the purposes of this subclause, an access point is defined as follows:
  399 + * Video ¨C The first byte of a video_sequence_header.
  400 + * Audio ¨C The first byte of an audio frame.
  401 + */
  402 + int8_t splice_countdown; //8bits
  403 +
  404 + // if transport_private_data_flag, 1+p[0] B
  405 + /**
  406 + * The transport_private_data_length is an 8-bit field specifying the number of
  407 + * private_data bytes immediately following the transport private_data_length field. The number of private_data bytes shall
  408 + * not be such that private data extends beyond the adaptation field.
  409 + */
  410 + u_int8_t transport_private_data_length; //8bits
  411 + char* transport_private_data; //[transport_private_data_length]bytes
  412 +
  413 + // if adaptation_field_extension_flag, 2+x B
  414 + /**
  415 + * The adaptation_field_extension_length is an 8-bit field. It indicates the number of
  416 + * bytes of the extended adaptation field data immediately following this field, including reserved bytes if present.
  417 + */
  418 + u_int8_t adaptation_field_extension_length; //8bits
  419 + /**
  420 + * This is a 1-bit field which when set to '1' indicates the presence of the ltw_offset
  421 + * field.
  422 + */
  423 + int8_t ltw_flag; //1bit
  424 + /**
  425 + * This is a 1-bit field which when set to '1' indicates the presence of the piecewise_rate field.
  426 + */
  427 + int8_t piecewise_rate_flag; //1bit
  428 + /**
  429 + * This is a 1-bit flag which when set to '1' indicates that the splice_type and DTS_next_AU fields
  430 + * are present. A value of '0' indicates that neither splice_type nor DTS_next_AU fields are present. This field shall not be
  431 + * set to '1' in Transport Stream packets in which the splicing_point_flag is not set to '1'. Once it is set to '1' in a Transport
  432 + * Stream packet in which the splice_countdown is positive, it shall be set to '1' in all the subsequent Transport Stream
  433 + * packets of the same PID that have the splicing_point_flag set to '1', until the packet in which the splice_countdown
  434 + * reaches zero (including this packet). When this flag is set, if the elementary stream carried in this PID is an audio stream,
  435 + * the splice_type field shall be set to '0000'. If the elementary stream carried in this PID is a video stream, it shall fulfil the
  436 + * constraints indicated by the splice_type value.
  437 + */
  438 + int8_t seamless_splice_flag; //1bit
  439 + //5bits reserved
  440 + // if ltw_flag, 2B
  441 + /**
  442 + * (legal time window_valid_flag) ¨C This is a 1-bit field which when set to '1' indicates that the value of the
  443 + * ltw_offset shall be valid. A value of '0' indicates that the value in the ltw_offset field is undefined.
  444 + */
  445 + int8_t ltw_valid_flag; //1bit
  446 + /**
  447 + * (legal time window offset) ¨C This is a 15-bit field, the value of which is defined only if the ltw_valid flag has
  448 + * a value of '1'. When defined, the legal time window offset is in units of (300/fs) seconds, where fs is the system clock
  449 + * frequency of the program that this PID belongs to, and fulfils:
  450 + * offset = t1(i) ¨C t(i)
  451 + * ltw_offset = offset//1
  452 + * where i is the index of the first byte of this Transport Stream packet, offset is the value encoded in this field, t(i) is the
  453 + * arrival time of byte i in the T-STD, and t1(i) is the upper bound in time of a time interval called the Legal Time Window
  454 + * which is associated with this Transport Stream packet.
  455 + */
  456 + int16_t ltw_offset; //15bits
  457 + // if piecewise_rate_flag, 3B
  458 + //2bits reserved
  459 + /**
  460 + * The meaning of this 22-bit field is only defined when both the ltw_flag and the ltw_valid_flag are set
  461 + * to '1'. When defined, it is a positive integer specifying a hypothetical bitrate R which is used to define the end times of
  462 + * the Legal Time Windows of Transport Stream packets of the same PID that follow this packet but do not include the
  463 + * legal_time_window_offset field.
  464 + */
  465 + int32_t piecewise_rate; //22bits
  466 + // if seamless_splice_flag, 5B
  467 + /**
  468 + * This is a 4-bit field. From the first occurrence of this field onwards, it shall have the same value in all the
  469 + * subsequent Transport Stream packets of the same PID in which it is present, until the packet in which the
  470 + * splice_countdown reaches zero (including this packet). If the elementary stream carried in that PID is an audio stream,
  471 + * this field shall have the value '0000'. If the elementary stream carried in that PID is a video stream, this field indicates the
  472 + * conditions that shall be respected by this elementary stream for splicing purposes. These conditions are defined as a
  473 + * function of profile, level and splice_type in Table 2-7 through Table 2-16.
  474 + */
  475 + int8_t splice_type; //4bits
  476 + /**
  477 + * (decoding time stamp next access unit) ¨C This is a 33-bit field, coded in three parts. In the case of
  478 + * continuous and periodic decoding through this splicing point it indicates the decoding time of the first access unit
  479 + * following the splicing point. This decoding time is expressed in the time base which is valid in the Transport Stream
  480 + * packet in which the splice_countdown reaches zero. From the first occurrence of this field onwards, it shall have the
  481 + * same value in all the subsequent Transport Stream packets of the same PID in which it is present, until the packet in
  482 + * which the splice_countdown reaches zero (including this packet).
  483 + */
  484 + int8_t DTS_next_AU0; //3bits
  485 + int8_t marker_bit0; //1bit
  486 + int16_t DTS_next_AU1; //15bits
  487 + int8_t marker_bit1; //1bit
  488 + int16_t DTS_next_AU2; //15bits
  489 + int8_t marker_bit2; //1bit
  490 + // left bytes.
  491 + /**
  492 + * This is a fixed 8-bit value equal to '1111 1111' that can be inserted by the encoder. It is discarded by the
  493 + * decoder.
  494 + */
  495 + int nb_af_ext_reserved;
  496 +
  497 + // left bytes.
  498 + /**
  499 + * This is a fixed 8-bit value equal to '1111 1111' that can be inserted by the encoder. It is discarded by the
  500 + * decoder.
  501 + */
  502 + int nb_af_reserved;
  503 +public:
  504 + SrsTsAdaptationField();
  505 + virtual ~SrsTsAdaptationField();
  506 +public:
  507 +};
  508 +
  509 +/**
210 * write data from frame(header info) and buffer(data) to ts file. 510 * write data from frame(header info) and buffer(data) to ts file.
211 * it's a simple object wrapper for utility from nginx-rtmp: SrsMpegtsWriter 511 * it's a simple object wrapper for utility from nginx-rtmp: SrsMpegtsWriter
212 */ 512 */