Browse Source

Enable section_generate to create simple sections in addition to extended

Georgi Chorbadzhiyski 9 years ago
parent
commit
af28bc001e
1 changed files with 9 additions and 7 deletions
  1. 9
    7
      tsfuncs_sections.c

+ 9
- 7
tsfuncs_sections.c View File

@@ -63,15 +63,17 @@ void ts_section_header_generate(uint8_t *ts_packet, struct ts_section_header *ts
63 63
 	ts_packet[start + 1] |= ts_section_header->section_length           >> 8;		// 1111xxxx xxxxxxxx
64 64
 	ts_packet[start + 2]  = ts_section_header->section_length           &~ 0xff00;	// 1111xxxx xxxxxxxx
65 65
 
66
-	ts_packet[start + 3]  = ts_section_header->ts_id_number             >> 8;		// xxxxxxxx xxxxxxxx
67
-	ts_packet[start + 4]  = ts_section_header->ts_id_number             &~ 0xff00;
66
+	if (ts_section_header->section_syntax_indicator) { // Extended table syntax
67
+		ts_packet[start + 3]  = ts_section_header->ts_id_number             >> 8;		// xxxxxxxx xxxxxxxx
68
+		ts_packet[start + 4]  = ts_section_header->ts_id_number             &~ 0xff00;
68 69
 
69
-	ts_packet[start + 5]  = ts_section_header->reserved2                 << 6;		// xx111111
70
-	ts_packet[start + 5] |= ts_section_header->version_number            << 1;		// 11xxxxx1
71
-	ts_packet[start + 5] |= ts_section_header->current_next_indicator;				// 1111111x
70
+		ts_packet[start + 5]  = ts_section_header->reserved2                 << 6;		// xx111111
71
+		ts_packet[start + 5] |= ts_section_header->version_number            << 1;		// 11xxxxx1
72
+		ts_packet[start + 5] |= ts_section_header->current_next_indicator;				// 1111111x
72 73
 
73
-	ts_packet[start + 6] = ts_section_header->section_number;
74
-	ts_packet[start + 7] = ts_section_header->last_section_number;
74
+		ts_packet[start + 6] = ts_section_header->section_number;
75
+		ts_packet[start + 7] = ts_section_header->last_section_number;
76
+	}
75 77
 }
76 78
 
77 79
 int ts_section_is_same(struct ts_section_header *s1, struct ts_section_header *s2) {

Loading…
Cancel
Save