comparison arib25/src/arib_std_b25.c @ 54:080414aa8f21

updated to arib25 0.2.4
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sun, 13 Sep 2009 02:57:13 +0900
parents 41a5481db56f
children 521d796003b2
comparison
equal deleted inserted replaced
53:41a5481db56f 54:080414aa8f21
406 static void extract_emm_fixed_part(EMM_FIXED_PART *dst, uint8_t *src); 406 static void extract_emm_fixed_part(EMM_FIXED_PART *dst, uint8_t *src);
407 407
408 static uint8_t *resync(uint8_t *head, uint8_t *tail, int32_t unit); 408 static uint8_t *resync(uint8_t *head, uint8_t *tail, int32_t unit);
409 static uint8_t *resync_force(uint8_t *head, uint8_t *tail, int32_t unit); 409 static uint8_t *resync_force(uint8_t *head, uint8_t *tail, int32_t unit);
410 410
411 static uint32_t crc32(uint8_t *head, uint8_t *tail);
412
411 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 413 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
412 interface method implementation 414 interface method implementation
413 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ 415 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
414 static void release_arib_std_b25(void *std_b25) 416 static void release_arib_std_b25(void *std_b25)
415 { 417 {
566 } 568 }
567 569
568 extract_ts_header(&hdr, curr); 570 extract_ts_header(&hdr, curr);
569 crypt = hdr.transport_scrambling_control; 571 crypt = hdr.transport_scrambling_control;
570 pid = hdr.pid; 572 pid = hdr.pid;
573
574 if(hdr.transport_error_indicator != 0){
575 /* bit error - append output buffer without parsing */
576 if(!append_work_buffer(&(prv->dbuf), curr, 188)){
577 r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
578 goto LAST;
579 }
580 goto NEXT;
581 }
571 582
572 if( (pid == 0x1fff) && (prv->strip) ){ 583 if( (pid == 0x1fff) && (prv->strip) ){
573 goto NEXT; 584 goto NEXT;
574 } 585 }
575 586
587 if( (crypt != 0) && 598 if( (crypt != 0) &&
588 (hdr.adaptation_field_control & 0x01) ){ 599 (hdr.adaptation_field_control & 0x01) ){
589 600
590 if(prv->map[pid].type == PID_MAP_TYPE_OTHER){ 601 if(prv->map[pid].type == PID_MAP_TYPE_OTHER){
591 dec = (DECRYPTOR_ELEM *)(prv->map[pid].target); 602 dec = (DECRYPTOR_ELEM *)(prv->map[pid].target);
603 }else if( (prv->map[pid].type == 0) &&
604 (prv->decrypt.count == 1) ){
605 dec = prv->decrypt.head;
592 }else{ 606 }else{
593 dec = NULL; 607 dec = NULL;
594 } 608 }
595 609
596 if( (dec != NULL) && (dec->m2 != NULL) ){ 610 if( (dec != NULL) && (dec->m2 != NULL) ){
994 unsigned char *buf; 1008 unsigned char *buf;
995 unsigned char *tail; 1009 unsigned char *tail;
996 1010
997 head = prv->sbuf.head; 1011 head = prv->sbuf.head;
998 tail = prv->sbuf.tail; 1012 tail = prv->sbuf.tail;
999 1013
1000 buf = head; 1014 buf = head;
1001 memset(count, 0, sizeof(count)); 1015 memset(count, 0, sizeof(count));
1002 1016
1003 // 1st step, count up 0x47 interval 1017 // 1st step, count up 0x47 interval
1004 while( (buf+188) < tail ){ 1018 while( (buf+188) < tail ){
1793 1807
1794 extract_ts_header(&hdr, curr); 1808 extract_ts_header(&hdr, curr);
1795 crypt = hdr.transport_scrambling_control; 1809 crypt = hdr.transport_scrambling_control;
1796 pid = hdr.pid; 1810 pid = hdr.pid;
1797 1811
1812 if(hdr.transport_error_indicator != 0){
1813 /* bit error - append output buffer without parsing */
1814 if(!append_work_buffer(&(prv->dbuf), curr, 188)){
1815 r = ARIB_STD_B25_ERROR_NO_ENOUGH_MEMORY;
1816 goto LAST;
1817 }
1818 goto NEXT;
1819 }
1820
1798 if( (pid == 0x1fff) && (prv->strip) ){ 1821 if( (pid == 0x1fff) && (prv->strip) ){
1799 /* strip null(padding) stream */ 1822 /* strip null(padding) stream */
1800 goto NEXT; 1823 goto NEXT;
1801 } 1824 }
1802 1825