Browse Source

Add ts_section_is_same()

Georgi Chorbadzhiyski 9 years ago
parent
commit
5bb2e42c9b
2 changed files with 15 additions and 0 deletions
  1. 2
    0
      tsfuncs.h
  2. 13
    0
      tsfuncs_sections.c

+ 2
- 0
tsfuncs.h View File

@@ -77,6 +77,8 @@ uint8_t *					ts_section_header_parse		(uint8_t *ts_packet, struct ts_header *ts
77 77
 void						ts_section_header_generate	(uint8_t *ts_packet, struct ts_section_header *ts_section_header, uint8_t start);
78 78
 void						ts_section_header_dump		(struct ts_section_header *t);
79 79
 
80
+int ts_section_is_same(struct ts_section_header *s1, struct ts_section_header *s2);
81
+
80 82
 uint8_t *					ts_section_data_alloc_section	();
81 83
 uint8_t *					ts_section_data_alloc_packet	();
82 84
 

+ 13
- 0
tsfuncs_sections.c View File

@@ -73,6 +73,19 @@ void ts_section_header_generate(uint8_t *ts_packet, struct ts_section_header *ts
73 73
 	ts_packet[start + 7] = ts_section_header->last_section_number;
74 74
 }
75 75
 
76
+int ts_section_is_same(struct ts_section_header *s1, struct ts_section_header *s2) {
77
+	if (s1->CRC != s2->CRC)
78
+		return 0;
79
+
80
+	if (s1->version_number != s2->version_number)
81
+		return 0;
82
+
83
+	if (s1->section_number != s2->section_number)
84
+		return 0;
85
+
86
+	return 1; // Should be the same
87
+}
88
+
76 89
 #define IN(x, a, b) \
77 90
 	(x >= a && x <= b)
78 91
 

Loading…
Cancel
Save