diff --git a/src/708.c b/src/708.c index 510b7fc1..70be9fe5 100644 --- a/src/708.c +++ b/src/708.c @@ -143,6 +143,7 @@ void clearTV (cc708_service_decoder *decoder, int buffer) // Buffer => 1 or 2 void printTVtoSRT (cc708_service_decoder *decoder, int which) { + /* tvscreen *tv = (which==1)? &decoder->tv1:&decoder->tv2; */ unsigned h1,m1,s1,ms1; unsigned h2,m2,s2,ms2; LLONG ms_start= decoder->current_visible_start_ms; @@ -208,6 +209,7 @@ void printTVtoSRT (cc708_service_decoder *decoder, int which) void printTVtoConsole (cc708_service_decoder *decoder, int which) { + /* tvscreen *tv = (which==1)? &decoder->tv1:&decoder->tv2; */ char tbuf1[15],tbuf2[15]; print_mstime2buf (decoder->current_visible_start_ms,tbuf1); print_mstime2buf (get_visible_end(),tbuf2); diff --git a/src/asf_functions.c b/src/asf_functions.c index 0ae1dcd9..6c73c5b9 100644 --- a/src/asf_functions.c +++ b/src/asf_functions.c @@ -796,6 +796,8 @@ LLONG asf_getmoredata(void) int MediaObjectSize = 0; int PresentationTimems = 0; //Payload ms time stamp int extsize = 0; + // int32_t dwVersion = 0; + // int32_t unknown = 0; int64_t rtStart = 0; // dvr-ms 100ns time stamp start int64_t rtEnd = 0; // dvr-ms 100ns time stamp end @@ -825,8 +827,12 @@ LLONG asf_getmoredata(void) } if ( PayloadExtPTSEntry[PayloadStreamNumber] > 0 ) { + // dwVersion = *((uint32_t*)(reppos+0)); + // unknown = *((uint32_t*)(reppos+4)); rtStart = *((int64_t*)(reppos+8)); rtEnd = *((int64_t*)(reppos+16)); + + //printf("dwVersion: %d unknown: 0x%04X\n", dwVersion, unknown); } // Avoid problems with unset PTS times diff --git a/src/avc_functions.c b/src/avc_functions.c index ef7383f4..f937174c 100644 --- a/src/avc_functions.c +++ b/src/avc_functions.c @@ -820,10 +820,44 @@ void slice_header (unsigned char *heabuf, unsigned char *heaend, int nal_unit_ty { fatal(EXIT_BUG_BUG, "AVC: pic_order_cnt_type == 1 not yet supported."); } - /* else */ - /* { */ - /* //TODO Calculate picture order count (POC) according to 8.2.1 */ - /* } */ + #if 0 + else + { + /* CFS: Warning!!: Untested stuff, copied from specs (8.2.1.3) */ + LLONG FrameNumOffset = 0; + if (IdrPicFlag == 1) + FrameNumOffset=0; + else if (lastframe_num > frame_num) + FrameNumOffset = lastframe_num + maxframe_num; + else + FrameNumOffset = lastframe_num; + + LLONG tempPicOrderCnt=0; + if (IdrPicFlag == 1) + tempPicOrderCnt=0; + else if (nal_ref_idc == 0) + tempPicOrderCnt = 2*(FrameNumOffset + frame_num) -1 ; + else + tempPicOrderCnt = 2*(FrameNumOffset + frame_num); + + LLONG TopFieldOrderCnt = tempPicOrderCnt; + LLONG BottomFieldOrderCnt = tempPicOrderCnt; + + if (!field_pic_flag) { + TopFieldOrderCnt = tempPicOrderCnt; + BottomFieldOrderCnt = tempPicOrderCnt; + } else if (bottom_field_flag) + BottomFieldOrderCnt = tempPicOrderCnt; + else + TopFieldOrderCnt = tempPicOrderCnt; + + //pic_order_cnt_lsb=tempPicOrderCnt; + //pic_order_cnt_lsb=u(&q1,tempPicOrderCnt); + //fatal(EXIT_BUG_BUG, "AVC: pic_order_cnt_type != 0 not yet supported."); + //TODO + // Calculate picture order count (POC) according to 8.2.1 + } + #endif // The rest of the data in slice_header() is currently unused. // A reference pic (I or P is always the last displayed picture of a POC diff --git a/src/bitstream.h b/src/bitstream.h index 843f56ba..a28b276c 100644 --- a/src/bitstream.h +++ b/src/bitstream.h @@ -36,6 +36,8 @@ struct bitstream #define read_i32(bstream) (int32_t)bitstream_get_num(bstream,4,1) #define read_i64(bstream) (int64_t)bitstream_get_num(bstream,8,1) +#define skip_u32(bstream) (void)bitstream_get_num(bstream,4,1) + #define next_u8(bstream) (uint8_t)bitstream_get_num(bstream,1,0) #define next_u16(bstream) (uint16_t)bitstream_get_num(bstream,2,0) #define next_u32(bstream) (uint32_t)bitstream_get_num(bstream,4,0) diff --git a/src/es_functions.c b/src/es_functions.c index 3c17b555..c5fc89be 100644 --- a/src/es_functions.c +++ b/src/es_functions.c @@ -253,7 +253,7 @@ static int es_video_sequence(struct bitstream *esstream) // Sequence_end_code if (startcode == 0xB7) { - (void) read_u32(esstream); // Advance bitstream + skip_u32(esstream); // Advance bitstream no_bitstream_error = 0; break; } @@ -488,7 +488,7 @@ static int sequence_ext(struct bitstream *esstream) return 0; } - (void) read_u32(esstream); // Advance + skip_u32(esstream); // Advance // Read extension_start_code_identifier unsigned extension_id = (unsigned) read_bits(esstream, 4); @@ -905,7 +905,7 @@ static int pic_coding_ext(struct bitstream *esstream) return 0; } - (void) read_u32(esstream); // Advance + skip_u32(esstream); // Advance // Read extension_start_code_identifier unsigned extension_id = (unsigned int) read_bits(esstream, 4); @@ -996,7 +996,7 @@ static int extension_and_user_data(struct bitstream *esstream, int udtype) if ( startcode == 0xB2 || startcode == 0xB5 ) { - (void) read_u32(esstream); // Advance bitstream + skip_u32(esstream); // Advance bitstream unsigned char *dstart = esstream->pos; // Advanve esstream to the next startcode. Verify that @@ -1114,7 +1114,7 @@ static int read_pic_data(struct bitstream *esstream) if ( startcode >= 0x01 && startcode <= 0xAF ) { - (void) read_u32(esstream); // Advance bitstream + skip_u32(esstream); // Advance bitstream search_start_code(esstream); // Skip this slice } } diff --git a/src/general_loop.c b/src/general_loop.c index d770b1b4..ffda75ac 100644 --- a/src/general_loop.c +++ b/src/general_loop.c @@ -279,6 +279,7 @@ void processhex (char *filename) while(fgets(line, max-1, fr) != NULL) { char *c1, *c2=NULL; // Positions for first and second colons + /* int len; */ long timing; if (line[0]==';') // Skip comments continue; @@ -288,6 +289,7 @@ void processhex (char *filename) continue; *c1=0; *c2=0; + /* len=atoi (line); */ timing=atol (c1+2)*(MPEG_CLOCK_FREQ/1000); current_pts=timing; if (pts_set==0) @@ -378,8 +380,10 @@ void processhex (char *filename) else { unsigned char magic=bytes[0]; + /* unsigned extra_field_flag=magic&1; */ unsigned caption_count=((magic>>1)&0x1F); unsigned filler=((magic>>6)&1); + /* unsigned pattern=((magic>>7)&1); */ int always_ff=1; int current_field=0; if (filler==0 && caption_count*6==byte_count-1) // Note that we are ignoring the extra field for now... diff --git a/src/stream_functions.c b/src/stream_functions.c index f9019f0a..38a80b3d 100644 --- a/src/stream_functions.c +++ b/src/stream_functions.c @@ -174,6 +174,7 @@ int detect_myth( void ) } int read_pts_pes(unsigned char*header, int len) { + /* unsigned int peslen = 0; */ LLONG bits_9; unsigned int bits_10; unsigned int bits_11; @@ -188,6 +189,8 @@ int read_pts_pes(unsigned char*header, int len) return -1; + /* peslen = header[4] << 8 | header[5]; */ + if (header[7] & 0x80) { bits_9 = ((LLONG) header[9] & 0x0E) << 29; // PTS 32..30 - Must be LLONG to prevent overflow @@ -258,6 +261,7 @@ int read_video_pes_header (unsigned char *nextheader, int *headerlength, int sbu } *headerlength += (int) nextheader[8]; int falsepes = 0; + /* int pesext = 0; */ // Avoid false positives, check --- not really needed if ( (nextheader[7]&0xC0) == 0x80 ) { @@ -314,6 +318,7 @@ int read_video_pes_header (unsigned char *nextheader, int *headerlength, int sbu falsepes = 1; } hskip += 1; + /* pesext = 1; */ } if ( !falsepes ) { diff --git a/src/ts_tables.c b/src/ts_tables.c index 1f636781..2cefaa96 100644 --- a/src/ts_tables.c +++ b/src/ts_tables.c @@ -658,7 +658,7 @@ void process_ccx_mpeg_descriptor (unsigned char *data, unsigned length) { char c1=data[i+2], c2=data[i+3], c3=data[i+4]; unsigned teletext_type=(data[i+5]&0xF8)>>3; // 5 MSB - //unsigned magazine_number=data[i+5]&0x7; // 3 LSB + // unsigned magazine_number=data[i+5]&0x7; // 3 LSB unsigned teletext_page_number=data[i+6]; dbg_print (CCX_DMT_PMT, " ISO639: %c%c%c\n",c1>=0x20?c1:' ', c2>=0x20?c2:' ', diff --git a/src/xds.c b/src/xds.c index 33d47e69..d902dfb6 100644 --- a/src/xds.c +++ b/src/xds.c @@ -376,11 +376,18 @@ void xds_do_copy_generation_management_system (unsigned c1, unsigned c2) static char rcd[256]; int changed=0; unsigned c1_6=(c1&0x40)>>6; + /* unsigned unused1=(c1&0x20)>>5; */ unsigned cgms_a_b4=(c1&0x10)>>4; unsigned cgms_a_b3=(c1&0x8)>>3; unsigned aps_b2=(c1&0x4)>>2; unsigned aps_b1=(c1&0x2)>>1; + /* unsigned asb_0=(c1&0x1); */ unsigned c2_6=(c2&0x40)>>6; + /* unsigned c2_5=(c2&0x20)>>5; */ + /* unsigned c2_4=(c2&0x10)>>4; */ + /* unsigned c2_3=(c2&0x8)>>3; */ + /* unsigned c2_2=(c2&0x4)>>2; */ + /* unsigned c2_1=(c2&0x2)>>1; */ unsigned rcd0=(c2&0x1); if (!c1_6 || !c2_6) // These must be high. If not, not following specs return; @@ -530,11 +537,13 @@ int xds_do_current_and_future () int hour = cur_xds_payload[3] & 0x1f; // 5 bits int date = cur_xds_payload[4] & 0x1f; // 5 bits int month = cur_xds_payload[5] & 0xf; // 4 bits + /* int changed=0; */ if (current_xds_min!=min || current_xds_hour!=hour || current_xds_date!=date || current_xds_month!=month) { + /* changed=1; */ xds_start_time_shown=0; current_xds_min=min; current_xds_hour=hour; @@ -825,6 +834,7 @@ int xds_do_misc () was_proc=1; if (cur_xds_payload_length<5) // We need 2 data bytes break; + // int b6 = (cur_xds_payload[2] & 0x40) >>6; // Bit 6 should always be 1 int dst = (cur_xds_payload[2] & 0x20) >>5; // Daylight Saving Time int hour = cur_xds_payload[2] & 0x1f; // 5 bits dbg_print(CCX_DMT_XDS, "Local Time Zone: %02d DST: %d\n",