Browse Source

Stop calling test func and activate parser

Georgi Chorbadzhiyski 13 years ago
parent
commit
b995c89905
1 changed files with 13 additions and 9 deletions
  1. 13
    9
      tsdecrypt.c

+ 13
- 9
tsdecrypt.c View File

@@ -332,13 +332,12 @@ void camd35_test() {
332 332
 
333 333
 
334 334
 int main(int argc, char **argv) {
335
-	camd35_test();
336
-	return 0;
337
-
338 335
 	int fd = 0; // stdin
339 336
 
340 337
 	parse_options(argc, argv);
341 338
 
339
+	camd35_init_auth(camd35_user, camd35_pass);
340
+
342 341
 	struct ts_pat *pat = ts_pat_alloc();
343 342
 	struct ts_cat *cat = ts_cat_alloc();
344 343
 	struct ts_pmt *pmt = ts_pmt_alloc();
@@ -348,9 +347,12 @@ int main(int argc, char **argv) {
348 347
 	struct ts_privsec *last_ecm = NULL;
349 348
 	uint16_t pmt_pid = 0;
350 349
 
350
+	uint16_t ca_id = 0;
351 351
 	uint16_t emm_caid = 0, emm_pid = 0;
352 352
 	uint16_t ecm_caid = 0, ecm_pid = 0;
353
-	uint16_t program_id = 0;
353
+	uint16_t service_id = 0;
354
+	uint16_t ecm_counter = 0;
355
+
354 356
 	do {
355 357
 		uint8_t ts_packet[188];
356 358
 		ssize_t readen = read(fd, ts_packet, 188);
@@ -367,7 +369,7 @@ int main(int argc, char **argv) {
367 369
 					struct ts_pat_program *prg = pat->programs[i];
368 370
 					if (prg->pid) {
369 371
 						if (prg->program != 0) {
370
-							program_id = prg->program;
372
+							service_id = prg->program;
371 373
 							pmt_pid = prg->pid;
372 374
 						}
373 375
 					}
@@ -380,8 +382,10 @@ int main(int argc, char **argv) {
380 382
 		if (pid == 1) {
381 383
 			cat = ts_cat_push_packet(cat, ts_packet);
382 384
 			if (cat->initialized) {
383
-				if (req_CA_sys != CA_UNKNOWN)
385
+				if (req_CA_sys != CA_UNKNOWN) {
384 386
 					ts_get_emm_info(cat, req_CA_sys, &emm_caid, &emm_pid);
387
+					ca_id = emm_caid;
388
+				}
385 389
 				ts_cat_free(&cat);
386 390
 				cat = ts_cat_alloc();
387 391
 			}
@@ -403,12 +407,12 @@ int main(int argc, char **argv) {
403 407
 			}
404 408
 		}
405 409
 
406
-		if (0 && emm_pid && pid == emm_pid) {
410
+		if (emm_pid && pid == emm_pid) {
407 411
 			emm = ts_privsec_push_packet(emm, ts_packet);
408 412
 			if (emm->initialized) {
409 413
 				struct ts_header *th = &emm->ts_header;
410 414
 				struct ts_section_header *sec = emm->section_header;
411
-				//savefile(sec->section_data, sec->section_length + 3, TYPE_EMM);
415
+				camd35_send_emm(ca_id, sec->section_data, sec->section_length + 3);
412 416
 				char *data = ts_hex_dump(sec->section_data, sec->section_length, 0);
413 417
 				ts_LOGf("EMM dump | CAID: 0x%04x PID 0x%04x (%5d) Table: 0x%02x (%3d) Length: %4d Data: %s\n",
414 418
 					emm_caid,
@@ -440,7 +444,7 @@ int main(int argc, char **argv) {
440 444
 						min(last_ecm->section_header->section_length, ecm->section_header->section_length)) == 0;
441 445
 				}
442 446
 				if (!is_same) {
443
-					//savefile(sec->section_data, sec->section_length + 3, TYPE_ECM);
447
+					camd35_send_ecm(service_id, ca_id, ecm_counter++, sec->section_data, sec->section_length + 3);
444 448
 					char *data = ts_hex_dump(sec->section_data, sec->section_length, 0);
445 449
 					ts_LOGf("ECM dump | CAID: 0x%04x PID 0x%04x (%5d) Table: 0x%02x (%3d) Length: %4d Data: %s\n",
446 450
 						ecm_caid,

Loading…
Cancel
Save