Browse Source

Use ts_section_dump()

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

+ 3
- 8
tsfuncs_cat.c View File

@@ -151,14 +151,9 @@ void ts_cat_check_generator(struct ts_cat *cat) {
151 151
 }
152 152
 
153 153
 void ts_cat_dump(struct ts_cat *cat) {
154
-	int i;
155
-	ts_LOGf("CAT table\n");
156
-    for(i=0;i<cat->section_header->num_packets;i++) {
157
-        struct ts_header tshdr;
158
-        ts_packet_header_parse(cat->section_header->packet_data + (i * TS_PACKET_SIZE), &tshdr);
159
-        ts_packet_header_dump(&tshdr);
160
-    }
161
-    ts_section_header_dump(cat->section_header);
154
+	struct ts_section_header *sec = cat->section_header;
155
+
156
+	ts_section_dump(sec);
162 157
 
163 158
 	if (cat->program_info_size > 0) {
164 159
 		ts_LOGf("  * Descriptor dump:\n");

+ 4
- 8
tsfuncs_eit.c View File

@@ -242,15 +242,11 @@ struct ts_eit *ts_eit_copy(struct ts_eit *eit) {
242 242
 }
243 243
 
244 244
 void ts_eit_dump(struct ts_eit *eit) {
245
+	struct ts_section_header *sect = eit->section_header;
245 246
 	int i;
246
-	ts_LOGf("EIT table\n");
247
-	ts_LOGf("  * TS Packets\n");
248
-	for(i=0;i<eit->section_header->num_packets;i++) {
249
-		struct ts_header tshdr;
250
-		ts_packet_header_parse(eit->section_header->packet_data + (i * TS_PACKET_SIZE), &tshdr);
251
-		ts_packet_header_dump(&tshdr);
252
-	}
253
-	ts_section_header_dump(eit->section_header);
247
+
248
+	ts_section_dump(sect);
249
+
254 250
 	ts_LOGf("  * EIT data\n");
255 251
 	ts_LOGf("    * PID             : 0x%04x (%d)\n", eit->ts_header.pid, eit->ts_header.pid);
256 252
 	ts_LOGf("    * ts_stream_id    : 0x%04x (%d)\n", eit->transport_stream_id, eit->transport_stream_id);

+ 4
- 8
tsfuncs_nit.c View File

@@ -218,15 +218,11 @@ void ts_nit_check_generator(struct ts_nit *nit) {
218 218
 }
219 219
 
220 220
 void ts_nit_dump(struct ts_nit *nit) {
221
+	struct ts_section_header *sec = nit->section_header;
221 222
 	int i;
222
-	ts_LOGf("NIT table\n");
223
-	ts_LOGf("  * TS Packets\n");
224
-	for(i=0;i<nit->section_header->num_packets;i++) {
225
-		struct ts_header tshdr;
226
-		ts_packet_header_parse(nit->section_header->packet_data + (i * TS_PACKET_SIZE), &tshdr);
227
-		ts_packet_header_dump(&tshdr);
228
-	}
229
-	ts_section_header_dump(nit->section_header);
223
+
224
+	ts_section_dump(sec);
225
+
230 226
 	ts_LOGf("  * NIT data\n");
231 227
 	ts_LOGf("    * PID         : 0x%04x (%d)\n", nit->ts_header.pid, nit->ts_header.pid);
232 228
 	ts_LOGf("    * reserved1   : 0x%02x\n", nit->reserved1);

+ 4
- 7
tsfuncs_pat.c View File

@@ -179,14 +179,11 @@ void ts_pat_check_generator(struct ts_pat *pat) {
179 179
 }
180 180
 
181 181
 void ts_pat_dump(struct ts_pat *pat) {
182
+	struct ts_section_header *sec = pat->section_header;
182 183
 	int i;
183
-	ts_LOGf("PAT packet\n");
184
-    for(i=0;i<pat->section_header->num_packets;i++) {
185
-        struct ts_header tshdr;
186
-        ts_packet_header_parse(pat->section_header->packet_data + (i * TS_PACKET_SIZE), &tshdr);
187
-        ts_packet_header_dump(&tshdr);
188
-    }
189
-    ts_section_header_dump(pat->section_header);
184
+
185
+	ts_section_dump(sec);
186
+
190 187
 	ts_LOGf("  * PAT data\n");
191 188
 	ts_LOGf("    * num_programs: %d\n", pat->programs_num);
192 189
 	for (i=0;i<pat->programs_num;i++) {

+ 4
- 7
tsfuncs_pmt.c View File

@@ -230,14 +230,11 @@ void ts_pmt_check_generator(struct ts_pmt *pmt) {
230 230
 }
231 231
 
232 232
 void ts_pmt_dump(struct ts_pmt *pmt) {
233
+	struct ts_section_header *sec = pmt->section_header;
233 234
 	int i;
234
-	ts_LOGf("PMT packet\n");
235
-    for(i=0;i<pmt->section_header->num_packets;i++) {
236
-        struct ts_header tshdr;
237
-        ts_packet_header_parse(pmt->section_header->packet_data + (i * TS_PACKET_SIZE), &tshdr);
238
-        ts_packet_header_dump(&tshdr);
239
-    }
240
-    ts_section_header_dump(pmt->section_header);
235
+
236
+	ts_section_dump(sec);
237
+
241 238
 	ts_LOGf("  * PMT data\n");
242 239
 	ts_LOGf("    * PID         : %04x (%d)\n", pmt->ts_header.pid, pmt->ts_header.pid);
243 240
 	ts_LOGf("    * reserved1   : %d\n", pmt->reserved1);

+ 4
- 7
tsfuncs_sdt.c View File

@@ -193,14 +193,11 @@ void ts_sdt_check_generator(struct ts_sdt *sdt) {
193 193
 }
194 194
 
195 195
 void ts_sdt_dump(struct ts_sdt *sdt) {
196
+	struct ts_section_header *sec = sdt->section_header;
196 197
 	int i;
197
-	ts_LOGf("SDT packet\n");
198
-    for(i=0;i<sdt->section_header->num_packets;i++) {
199
-        struct ts_header tshdr;
200
-        ts_packet_header_parse(sdt->section_header->packet_data + (i * TS_PACKET_SIZE), &tshdr);
201
-        ts_packet_header_dump(&tshdr);
202
-    }
203
-    ts_section_header_dump(sdt->section_header);
198
+
199
+	ts_section_dump(sec);
200
+
204 201
 	ts_LOGf("  * SDT data\n");
205 202
 	ts_LOGf("    * PID         : %04x (%d)\n", sdt->ts_header.pid, sdt->ts_header.pid);
206 203
 	ts_LOGf("    * org_net_id  : %04x (%d)\n", sdt->original_network_id, sdt->original_network_id);

Loading…
Cancel
Save