Browse Source

Add ts_crc32_section() helper function

Georgi Chorbadzhiyski 13 years ago
parent
commit
c1640d2105
2 changed files with 6 additions and 0 deletions
  1. 1
    0
      tsfuncs.h
  2. 5
    0
      tsfuncs_crc.c

+ 1
- 0
tsfuncs.h View File

234
 
234
 
235
 // CRC
235
 // CRC
236
 uint32_t        ts_crc32      (uint8_t *data, int data_size);
236
 uint32_t        ts_crc32      (uint8_t *data, int data_size);
237
+uint32_t		ts_crc32_section			(struct ts_section_header *section_header);
237
 
238
 
238
 // Misc
239
 // Misc
239
 int				dec2bcd						(int dec);
240
 int				dec2bcd						(int dec);

+ 5
- 0
tsfuncs_crc.c View File

38
 	}
38
 	}
39
 	return crc;
39
 	return crc;
40
 }
40
 }
41
+
42
+u_int32_t ts_crc32_section(struct ts_section_header *section_header) {
43
+	// +3 to include the first 3 bytes before section_length field
44
+	return ts_crc32(section_header->section_data, section_header->section_length + 3);
45
+}

Loading…
Cancel
Save