Mercurial > pt1.oyama
comparison src/recpt1.c @ 146:066f33b2213a
EXPERIMENTAL: Select a particular program from multi-channel.
author | Naoya OYAMA <naoya.oyama@gmail.com> |
---|---|
date | Tue, 21 Aug 2012 04:21:11 +0900 |
parents | bf96eac4dbb1 |
children | a9f60d56d673 |
comparison
equal
deleted
inserted
replaced
145:4e39ce051c57 | 146:066f33b2213a |
---|---|
48 char mtext[MSGSZ]; | 48 char mtext[MSGSZ]; |
49 } pt1_message_buf; | 49 } pt1_message_buf; |
50 | 50 |
51 /* globals */ | 51 /* globals */ |
52 boolean f_exit = FALSE; | 52 boolean f_exit = FALSE; |
53 extern struct ushare_t *ut; | |
53 | 54 |
54 /* prototypes */ | 55 /* prototypes */ |
55 int tune(char *channel, thread_data *tdata, char *device); | 56 int tune(char *channel, thread_data *tdata, char *device); |
56 int close_tuner(thread_data *tdata); | 57 int close_tuner(thread_data *tdata); |
57 static int get_device_id_by_name ( const char *name ); | 58 static int get_device_id_by_name ( const char *name ); |
412 ARIB_STD_B25_BUFFER *eqbuf; | 413 ARIB_STD_B25_BUFFER *eqbuf; |
413 splitbuf_t splitbuf; | 414 splitbuf_t splitbuf; |
414 ARIB_STD_B25_BUFFER sbuf, dbuf, buf; | 415 ARIB_STD_B25_BUFFER sbuf, dbuf, buf; |
415 int code; | 416 int code; |
416 int split_select_finish = TSS_ERROR; | 417 int split_select_finish = TSS_ERROR; |
418 int old_sid = 0, new_sid = 0; | |
419 time_t split_start_time; | |
420 | |
421 time(&split_start_time); | |
417 | 422 |
418 buf.size = 0; | 423 buf.size = 0; |
419 buf.data = NULL; | 424 buf.data = NULL; |
420 splitbuf.size = 0; | 425 splitbuf.size = 0; |
421 splitbuf.buffer_length = 0; | 426 splitbuf.buffer_length = 0; |
450 use_b25 = FALSE; | 455 use_b25 = FALSE; |
451 } | 456 } |
452 else | 457 else |
453 buf = dbuf; | 458 buf = dbuf; |
454 } | 459 } |
455 | |
456 | 460 |
457 if(use_splitter) { | 461 if(use_splitter) { |
458 splitbuf.size = 0; | 462 splitbuf.size = 0; |
459 if(splitbuf.buffer_length < buf.size && buf.size > 0) { | 463 if(splitbuf.buffer_length < buf.size && buf.size > 0) { |
460 splitbuf.buffer = realloc(splitbuf.buffer, buf.size); | 464 splitbuf.buffer = realloc(splitbuf.buffer, buf.size); |
480 /* $BJ,N%BP>](BPID$B$,40A4$KCj=P$G$-$k$^$G=PNO$7$J$$(B | 484 /* $BJ,N%BP>](BPID$B$,40A4$KCj=P$G$-$k$^$G=PNO$7$J$$(B |
481 * 1$BICDxEYM>M5$r8+$k$H$$$$$+$b(B | 485 * 1$BICDxEYM>M5$r8+$k$H$$$$$+$b(B |
482 */ | 486 */ |
483 time_t cur_time; | 487 time_t cur_time; |
484 time(&cur_time); | 488 time(&cur_time); |
485 if(cur_time - data->start_time > 4) { | 489 if(cur_time - split_start_time > 4) { |
490 fprintf(stderr, "split_select cur_time out.\n"); | |
486 use_splitter = FALSE; | 491 use_splitter = FALSE; |
487 goto fin; | 492 goto fin; |
488 } | 493 } |
489 break; | 494 break; |
490 } | 495 } |
513 * 2.2.1 http_stream$B$N%3%T!<85$H$9$k$?$a$N%P%C%U%!$r(Balloc$B$9$k(B | 518 * 2.2.1 http_stream$B$N%3%T!<85$H$9$k$?$a$N%P%C%U%!$r(Balloc$B$9$k(B |
514 * 2.2.2 2.2.1$B$G(Balloc$B$7$?NN0h$K(B rader_func $B$,(B dequeue $B$7$?%9%H%j!<%`$J%G!<%?$r(Bmemcpy()$B$9$k(B | 519 * 2.2.2 2.2.1$B$G(Balloc$B$7$?NN0h$K(B rader_func $B$,(B dequeue $B$7$?%9%H%j!<%`$J%G!<%?$r(Bmemcpy()$B$9$k(B |
515 * 2.2.3 tdata->stream_queue $B$K(B 2.2.1 $B$N%]%$%s%?$r(B enqueue() $B$9$k(B | 520 * 2.2.3 tdata->stream_queue $B$K(B 2.2.1 $B$N%]%$%s%?$r(B enqueue() $B$9$k(B |
516 * 2.2.3.1 enqueue() $B$O(B tdata->stream_queue->mutex $B$r(B lock/unlock $B$7$F=q$-9~$_;~$NF1;~99?7$rKI;_$7$F$$$k(B | 521 * 2.2.3.1 enqueue() $B$O(B tdata->stream_queue->mutex $B$r(B lock/unlock $B$7$F=q$-9~$_;~$NF1;~99?7$rKI;_$7$F$$$k(B |
517 */ | 522 */ |
518 //fprintf (stderr, "reader_func() buf.size[%d]\n", buf.size); | 523 /* |
524 * DLNA $B$G$N(BSID$BJQ99$N<BAu<B83(B | |
525 */ | |
519 if ( use_dlna && buf.size > 0 ) { | 526 if ( use_dlna && buf.size > 0 ) { |
527 if ( use_splitter ) { | |
528 new_sid = atoi(ut->request_channel); | |
529 if ( old_sid != new_sid ) { | |
530 old_sid = new_sid; | |
531 split_shutdown(splitter); | |
532 splitter = split_startup(ut->request_channel, NULL, NULL); | |
533 if ( splitter == NULL ) { | |
534 fprintf (stderr, "reader_func() splitter RESTART FAILED.\n", old_sid, new_sid); | |
535 use_splitter = FALSE; | |
536 } | |
537 split_select_finish = TSS_ERROR; | |
538 free(qbuf); | |
539 qbuf = NULL; | |
540 time(&split_start_time); | |
541 continue; | |
542 } | |
543 } | |
520 do { | 544 do { |
521 eqbuf = malloc(sizeof(ARIB_STD_B25_BUFFER)); | 545 eqbuf = malloc(sizeof(ARIB_STD_B25_BUFFER)); |
522 if ( eqbuf == NULL ) { | 546 if ( eqbuf == NULL ) { |
523 fprintf (stderr, "Cannot malloc eqbuf memory. streaming abort.\n"); | 547 fprintf (stderr, "Cannot malloc eqbuf memory. streaming abort.\n"); |
524 use_dlna = FALSE; | 548 use_dlna = FALSE; |