Browse Source

Remove checks from xxx_push_packet()

Georgi Chorbadzhiyski 9 years ago
parent
commit
2d661e6ead
6 changed files with 30 additions and 42 deletions
  1. 5 7
      tsfuncs_cat.c
  2. 5 7
      tsfuncs_eit.c
  3. 5 7
      tsfuncs_nit.c
  4. 5 7
      tsfuncs_pat.c
  5. 5 7
      tsfuncs_pmt.c
  6. 5 7
      tsfuncs_sdt.c

+ 5 - 7
tsfuncs_cat.c View File

@@ -41,7 +41,7 @@ struct ts_cat *ts_cat_push_packet(struct ts_cat *cat, uint8_t *ts_packet) {
41 41
 		memset(&section_header, 0, sizeof(struct ts_section_header));
42 42
 
43 43
 		uint8_t *section_data = ts_section_header_parse(ts_packet, &cat->ts_header, &section_header);
44
-		if (!section_data || !section_header.section_syntax_indicator) {
44
+		if (!section_data) {
45 45
 			memset(&cat->ts_header, 0, sizeof(struct ts_header));
46 46
 			goto OUT;
47 47
 		}
@@ -56,12 +56,10 @@ struct ts_cat *ts_cat_push_packet(struct ts_cat *cat, uint8_t *ts_packet) {
56 56
 	}
57 57
 
58 58
 	if (!cat->initialized) {
59
-		if (cat->section_header->section_syntax_indicator) {
60
-			ts_section_add_packet(cat->section_header, &ts_header, ts_packet);
61
-			if (cat->section_header->initialized) {
62
-				if (!ts_cat_parse(cat))
63
-					goto ERROR;
64
-			}
59
+		ts_section_add_packet(cat->section_header, &ts_header, ts_packet);
60
+		if (cat->section_header->initialized) {
61
+			if (!ts_cat_parse(cat))
62
+				goto ERROR;
65 63
 		}
66 64
 	}
67 65
 

+ 5 - 7
tsfuncs_eit.c View File

@@ -53,7 +53,7 @@ struct ts_eit *ts_eit_push_packet(struct ts_eit *eit, uint8_t *ts_packet) {
53 53
 		memset(&section_header, 0, sizeof(struct ts_section_header));
54 54
 
55 55
 		uint8_t *section_data = ts_section_header_parse(ts_packet, &eit->ts_header, &section_header);
56
-		if (!section_data || !section_header.section_syntax_indicator) {
56
+		if (!section_data) {
57 57
 			memset(&eit->ts_header, 0, sizeof(struct ts_header));
58 58
 			goto OUT;
59 59
 		}
@@ -69,12 +69,10 @@ struct ts_eit *ts_eit_push_packet(struct ts_eit *eit, uint8_t *ts_packet) {
69 69
 	}
70 70
 
71 71
 	if (!eit->initialized) {
72
-		if (eit->section_header->section_syntax_indicator) {
73
-			ts_section_add_packet(eit->section_header, &ts_header, ts_packet);
74
-			if (eit->section_header->initialized) {
75
-				if (!ts_eit_parse(eit))
76
-					goto ERROR;
77
-			}
72
+		ts_section_add_packet(eit->section_header, &ts_header, ts_packet);
73
+		if (eit->section_header->initialized) {
74
+			if (!ts_eit_parse(eit))
75
+				goto ERROR;
78 76
 		}
79 77
 	}
80 78
 

+ 5 - 7
tsfuncs_nit.c View File

@@ -54,7 +54,7 @@ struct ts_nit *ts_nit_push_packet(struct ts_nit *nit, uint8_t *ts_packet) {
54 54
 		memset(&section_header, 0, sizeof(struct ts_section_header));
55 55
 
56 56
 		uint8_t *section_data = ts_section_header_parse(ts_packet, &nit->ts_header, &section_header);
57
-		if (!section_data || !section_header.section_syntax_indicator)
57
+		if (!section_data)
58 58
 			goto OUT;
59 59
 		// table_id should be 0x40 (network_information_section - actual_network)
60 60
 		if (section_header.table_id != 0x40) {
@@ -67,12 +67,10 @@ struct ts_nit *ts_nit_push_packet(struct ts_nit *nit, uint8_t *ts_packet) {
67 67
 	}
68 68
 
69 69
 	if (!nit->initialized) {
70
-		if (nit->section_header->section_syntax_indicator) {
71
-			ts_section_add_packet(nit->section_header, &ts_header, ts_packet);
72
-			if (nit->section_header->initialized) {
73
-				if (!ts_nit_parse(nit))
74
-					goto ERROR;
75
-			}
70
+		ts_section_add_packet(nit->section_header, &ts_header, ts_packet);
71
+		if (nit->section_header->initialized) {
72
+			if (!ts_nit_parse(nit))
73
+				goto ERROR;
76 74
 		}
77 75
 	}
78 76
 

+ 5 - 7
tsfuncs_pat.c View File

@@ -50,7 +50,7 @@ struct ts_pat *ts_pat_push_packet(struct ts_pat *pat, uint8_t *ts_packet) {
50 50
 		memset(&section_header, 0, sizeof(struct ts_section_header));
51 51
 
52 52
 		uint8_t *section_data = ts_section_header_parse(ts_packet, &pat->ts_header, &section_header);
53
-		if (!section_data || !section_header.section_syntax_indicator) {
53
+		if (!section_data) {
54 54
 			memset(&pat->ts_header, 0, sizeof(struct ts_header));
55 55
 			goto OUT;
56 56
 		}
@@ -65,12 +65,10 @@ struct ts_pat *ts_pat_push_packet(struct ts_pat *pat, uint8_t *ts_packet) {
65 65
 	}
66 66
 
67 67
 	if (!pat->initialized) {
68
-		if (pat->section_header->section_syntax_indicator) {
69
-			ts_section_add_packet(pat->section_header, &ts_header, ts_packet);
70
-			if (pat->section_header->initialized) {
71
-				if (!ts_pat_parse(pat))
72
-					goto ERROR;
73
-			}
68
+		ts_section_add_packet(pat->section_header, &ts_header, ts_packet);
69
+		if (pat->section_header->initialized) {
70
+			if (!ts_pat_parse(pat))
71
+				goto ERROR;
74 72
 		}
75 73
 	}
76 74
 

+ 5 - 7
tsfuncs_pmt.c View File

@@ -51,7 +51,7 @@ struct ts_pmt *ts_pmt_push_packet(struct ts_pmt *pmt, uint8_t *ts_packet, uint16
51 51
 		memset(&section_header, 0, sizeof(struct ts_section_header));
52 52
 
53 53
 		uint8_t *section_data = ts_section_header_parse(ts_packet, &pmt->ts_header, &section_header);
54
-		if (!section_data || !section_header.section_syntax_indicator) {
54
+		if (!section_data) {
55 55
 			memset(&pmt->ts_header, 0, sizeof(struct ts_header));
56 56
 			goto OUT;
57 57
 		}
@@ -66,12 +66,10 @@ struct ts_pmt *ts_pmt_push_packet(struct ts_pmt *pmt, uint8_t *ts_packet, uint16
66 66
 	}
67 67
 
68 68
 	if (!pmt->initialized) {
69
-		if (pmt->section_header->section_syntax_indicator) {
70
-			ts_section_add_packet(pmt->section_header, &ts_header, ts_packet);
71
-			if (pmt->section_header->initialized) {
72
-				if (!ts_pmt_parse(pmt))
73
-					goto ERROR;
74
-			}
69
+		ts_section_add_packet(pmt->section_header, &ts_header, ts_packet);
70
+		if (pmt->section_header->initialized) {
71
+			if (!ts_pmt_parse(pmt))
72
+				goto ERROR;
75 73
 		}
76 74
 	}
77 75
 

+ 5 - 7
tsfuncs_sdt.c View File

@@ -51,7 +51,7 @@ struct ts_sdt *ts_sdt_push_packet(struct ts_sdt *sdt, uint8_t *ts_packet) {
51 51
 		memset(&section_header, 0, sizeof(struct ts_section_header));
52 52
 
53 53
 		uint8_t *section_data = ts_section_header_parse(ts_packet, &sdt->ts_header, &section_header);
54
-		if (!section_data || !section_header.section_syntax_indicator) {
54
+		if (!section_data) {
55 55
 			memset(&sdt->ts_header, 0, sizeof(struct ts_header));
56 56
 			goto OUT;
57 57
 		}
@@ -66,12 +66,10 @@ struct ts_sdt *ts_sdt_push_packet(struct ts_sdt *sdt, uint8_t *ts_packet) {
66 66
 	}
67 67
 
68 68
 	if (!sdt->initialized) {
69
-		if (sdt->section_header->section_syntax_indicator) {
70
-			ts_section_add_packet(sdt->section_header, &ts_header, ts_packet);
71
-			if (sdt->section_header->initialized) {
72
-				if (!ts_sdt_parse(sdt))
73
-					goto ERROR;
74
-			}
69
+		ts_section_add_packet(sdt->section_header, &ts_header, ts_packet);
70
+		if (sdt->section_header->initialized) {
71
+			if (!ts_sdt_parse(sdt))
72
+				goto ERROR;
75 73
 		}
76 74
 	}
77 75