winlin

add aac specification, iso-13818-7

不能预览此文件类型
@@ -48,6 +48,11 @@ SECTION 2 C TECHNICAL ELEMENTS @@ -48,6 +48,11 @@ SECTION 2 C TECHNICAL ELEMENTS
48 2.4.4.6 Conditional access Table 48 2.4.4.6 Conditional access Table
49 2.5 Program Stream bitstream requirements 49 2.5 Program Stream bitstream requirements
50 2.6 Program and program element descriptors 50 2.6 Program and program element descriptors
  51 + 2.6.2 Video stream descriptor
  52 + 2.6.4 Audio stream descriptor
  53 + 2.6.34 IBP descriptor
  54 + 2.6.37 Semantic definition of fields in MPEG-4 video descriptor
  55 + 2.6.38 MPEG-4 audio descriptor
51 2.7 Restrictions on the multiplexed stream semantics 56 2.7 Restrictions on the multiplexed stream semantics
52 Annex A ¨C CRC Decoder Model 57 Annex A ¨C CRC Decoder Model
53 */ 58 */
@@ -129,7 +134,9 @@ public: @@ -129,7 +134,9 @@ public:
129 int finish(); 134 int finish();
130 }; 135 };
131 136
132 -// TSHeader declares. 137 +/**
  138 +* 2.4.3.2 Transport Stream packet layer. page 36.
  139 +*/
133 class TSHeader 140 class TSHeader
134 { 141 {
135 public: 142 public:
@@ -367,6 +374,7 @@ public: @@ -367,6 +374,7 @@ public:
367 374
368 TSPayloadPMT(); 375 TSPayloadPMT();
369 virtual ~TSPayloadPMT(); 376 virtual ~TSPayloadPMT();
  377 + TSPMTESInfo* at(int index);
370 int demux(TSContext* ctx, TSPacket* pkt, u_int8_t* start, u_int8_t* last, u_int8_t*& p, TSMessage*& pmsg); 378 int demux(TSContext* ctx, TSPacket* pkt, u_int8_t* start, u_int8_t* last, u_int8_t*& p, TSMessage*& pmsg);
371 }; 379 };
372 380
@@ -375,10 +383,10 @@ public: @@ -375,10 +383,10 @@ public:
375 */ 383 */
376 enum TSPESStreamId 384 enum TSPESStreamId
377 { 385 {
378 - PES_program_stream_map = 0b10111100,  
379 - PES_private_stream_1 = 0b10111101,  
380 - PES_padding_stream = 0b10111110,  
381 - PES_private_stream_2 = 0b10111111, 386 + PES_program_stream_map = 0b10111100, // 0xbc
  387 + PES_private_stream_1 = 0b10111101, // 0xbd
  388 + PES_padding_stream = 0b10111110, // 0xbe
  389 + PES_private_stream_2 = 0b10111111, // 0xbf
382 390
383 // 110x xxxx 391 // 110x xxxx
384 // ISO/IEC 13818-3 or ISO/IEC 11172-3 or ISO/IEC 13818-7 or ISO/IEC 392 // ISO/IEC 13818-3 or ISO/IEC 11172-3 or ISO/IEC 13818-7 or ISO/IEC
@@ -389,24 +397,24 @@ enum TSPESStreamId @@ -389,24 +397,24 @@ enum TSPESStreamId
389 // 1110 xxxx 397 // 1110 xxxx
390 // ITU-T Rec. H.262 | ISO/IEC 13818-2 or ISO/IEC 11172-2 or ISO/IEC 398 // ITU-T Rec. H.262 | ISO/IEC 13818-2 or ISO/IEC 11172-2 or ISO/IEC
391 // 14496-2 video stream number xxxx 399 // 14496-2 video stream number xxxx
392 - // (stream_id>>5)&0x07 == PES_audio_prefix 400 + // (stream_id>>4)&0x0f == PES_audio_prefix
393 PES_video_prefix = 0b1110, 401 PES_video_prefix = 0b1110,
394 402
395 - PES_ECM_stream = 0b11110000,  
396 - PES_EMM_stream = 0b11110001,  
397 - PES_DSMCC_stream = 0b11110010,  
398 - PES_13522_stream = 0b11110011,  
399 - PES_H_222_1_type_A = 0b11110100,  
400 - PES_H_222_1_type_B = 0b11110101,  
401 - PES_H_222_1_type_C = 0b11110110,  
402 - PES_H_222_1_type_D = 0b11110111,  
403 - PES_H_222_1_type_E = 0b11111000,  
404 - PES_ancillary_stream = 0b11111001,  
405 - PES_SL_packetized_stream = 0b11111010,  
406 - PES_FlexMux_stream = 0b11111011, 403 + PES_ECM_stream = 0b11110000, // 0xf0
  404 + PES_EMM_stream = 0b11110001, // 0xf1
  405 + PES_DSMCC_stream = 0b11110010, // 0xf2
  406 + PES_13522_stream = 0b11110011, // 0xf3
  407 + PES_H_222_1_type_A = 0b11110100, // 0xf4
  408 + PES_H_222_1_type_B = 0b11110101, // 0xf5
  409 + PES_H_222_1_type_C = 0b11110110, // 0xf6
  410 + PES_H_222_1_type_D = 0b11110111, // 0xf7
  411 + PES_H_222_1_type_E = 0b11111000, // 0xf8
  412 + PES_ancillary_stream = 0b11111001, // 0xf9
  413 + PES_SL_packetized_stream = 0b11111010, // 0xfa
  414 + PES_FlexMux_stream = 0b11111011, // 0xfb
407 // reserved data stream 415 // reserved data stream
408 // 1111 1100 … 1111 1110 416 // 1111 1100 … 1111 1110
409 - PES_program_stream_directory= 0b11111111, 417 + PES_program_stream_directory= 0b11111111, // 0xff
410 }; 418 };
411 419
412 420
@@ -1005,6 +1013,11 @@ TSPayloadPMT::~TSPayloadPMT() @@ -1005,6 +1013,11 @@ TSPayloadPMT::~TSPayloadPMT()
1005 ES_info.clear(); 1013 ES_info.clear();
1006 } 1014 }
1007 1015
  1016 +TSPMTESInfo* TSPayloadPMT::at(int index)
  1017 +{
  1018 + return ES_info.at(index);
  1019 +}
  1020 +
1008 int TSPayloadPMT::demux(TSContext* ctx, TSPacket* pkt, u_int8_t* start, u_int8_t* last, u_int8_t*& p, TSMessage*& pmsg) 1021 int TSPayloadPMT::demux(TSContext* ctx, TSPacket* pkt, u_int8_t* start, u_int8_t* last, u_int8_t*& p, TSMessage*& pmsg)
1009 { 1022 {
1010 int ret = 0; 1023 int ret = 0;
@@ -1192,6 +1205,17 @@ int TSPayloadPES::demux(TSContext* ctx, TSPacket* pkt, u_int8_t* start, u_int8_t @@ -1192,6 +1205,17 @@ int TSPayloadPES::demux(TSContext* ctx, TSPacket* pkt, u_int8_t* start, u_int8_t
1192 { 1205 {
1193 int ret = 0; 1206 int ret = 0;
1194 1207
  1208 + if (!pkt->header->payload_unit_start_indicator) {
  1209 + TSMessage* msg = ctx->get_msg(pkt->header->pid);
  1210 + if (msg->packet_start_code_prefix != 0x01) {
  1211 + trace("ts+pes decode continous packet error, msg is empty.");
  1212 + return -1;
  1213 + }
  1214 + msg->append(p, last - p);
  1215 + msg->detach(ctx, pmsg);
  1216 + return ret;
  1217 + }
  1218 +
1195 char* pp = (char*)&packet_start_code_prefix; 1219 char* pp = (char*)&packet_start_code_prefix;
1196 pp[2] = *p++; 1220 pp[2] = *p++;
1197 pp[1] = *p++; 1221 pp[1] = *p++;
@@ -1478,16 +1502,6 @@ int TSPayload::demux(TSContext* ctx, TSPacket* pkt, u_int8_t* start, u_int8_t* l @@ -1478,16 +1502,6 @@ int TSPayload::demux(TSContext* ctx, TSPacket* pkt, u_int8_t* start, u_int8_t* l
1478 return pmt->demux(ctx, pkt, start, last, p, pmsg); 1502 return pmt->demux(ctx, pkt, start, last, p, pmsg);
1479 } 1503 }
1480 if (pid && (pid->type == TSPidTypeVideo || pid->type == TSPidTypeAudio)) { 1504 if (pid && (pid->type == TSPidTypeVideo || pid->type == TSPidTypeAudio)) {
1481 - if (!pkt->header->payload_unit_start_indicator) {  
1482 - TSMessage* msg = ctx->get_msg(pkt->header->pid);  
1483 - if (msg->packet_start_code_prefix != 0x01) {  
1484 - trace("ts+pes decode continous packet error, msg is empty.");  
1485 - return -1;  
1486 - }  
1487 - msg->append(p, last - p);  
1488 - msg->detach(ctx, pmsg);  
1489 - return ret;  
1490 - }  
1491 type = pid->type; 1505 type = pid->type;
1492 pes = new TSPayloadPES(); 1506 pes = new TSPayloadPES();
1493 return pes->demux(ctx, pkt, start, last, p, pmsg); 1507 return pes->demux(ctx, pkt, start, last, p, pmsg);