comparison src/recpt1.c @ 166:726fe10d9e4a

Code refactoring. Change channel shuld be done in http_open(). Delete unnecessary code, variables.
author Naoya OYAMA <naoya.oyama@gmail.com>
date Tue, 02 Oct 2012 21:57:40 +0900
parents 7d8a5bb874ad
children 061ef2cd98f0
comparison
equal deleted inserted replaced
165:3ffef0e5b80a 166:726fe10d9e4a
600 BUFSZ *qbuf; 600 BUFSZ *qbuf;
601 ARIB_STD_B25_BUFFER *eqbuf; 601 ARIB_STD_B25_BUFFER *eqbuf;
602 splitbuf_t splitbuf; 602 splitbuf_t splitbuf;
603 ARIB_STD_B25_BUFFER sbuf, dbuf, buf; 603 ARIB_STD_B25_BUFFER sbuf, dbuf, buf;
604 int code; 604 int code;
605 pt1_message_buf mbuf;
606 int msqid;
607 int msgflg = IPC_CREAT | 0666;
608 605
609 if (use_splitter) 606 if (use_splitter)
610 time(&data->splitter->split_start_time); 607 time(&data->splitter->split_start_time);
611 608
612 buf.size = 0; 609 buf.size = 0;
712 */ 709 */
713 /* 710 /*
714 * DLNA $B$G$NJ*M}%A%c%s%M%k!&(BSID$BJQ99$N<BAu<B83(B 711 * DLNA $B$G$NJ*M}%A%c%s%M%k!&(BSID$BJQ99$N<BAu<B83(B
715 */ 712 */
716 if ( use_dlna && buf.size > 0 ) { 713 if ( use_dlna && buf.size > 0 ) {
717 if (use_splitter && (ut->tp) && (ut->sid)) {
718 if (strcmp(data->ch, ut->tp) ||
719 strcmp(data->sid_list, ut->sid)) {
720 if ((msqid = msgget((key_t)getpid(), msgflg)) < 0) {
721 // $B%(%i!<;~$O%A%c%s%M%kJQ99%j%/%(%9%H$O$J$+$C$?$3$H$K$9$k(B
722 // $B$J$`$J$`(B
723 fprintf(stderr, "msgget error.\n");
724 ut->tp = data->ch;
725 free(qbuf);
726 qbuf = NULL;
727 ut->sid = data->sid_list;
728 continue;
729 }
730
731 mbuf.mtype = 1;
732 snprintf(mbuf.mtext, sizeof(mbuf.mtext),
733 "ch=%s t=%d e=%d i=%s",
734 ut->tp, 0, 0, ut->sid);
735 if (msgsnd(msqid, &mbuf, strlen(mbuf.mtext)+1, IPC_NOWAIT) < 0) {
736 // $B%(%i!<;~$O%A%c%s%M%kJQ99%j%/%(%9%H$O$J$+$C$?$3$H$K$9$k(B
737 // $B$J$`$J$`(B
738 fprintf(stderr, "msgsend error.\n");
739 ut->tp = data->ch;
740 ut->sid = data->sid_list;
741 free(qbuf);
742 qbuf = NULL;
743 continue;
744 }
745 free(qbuf);
746 qbuf = NULL;
747 continue;
748 }
749 }
750 do { 714 do {
751 eqbuf = malloc(sizeof(ARIB_STD_B25_BUFFER)); 715 eqbuf = malloc(sizeof(ARIB_STD_B25_BUFFER));
752 if ( eqbuf == NULL ) { 716 if ( eqbuf == NULL ) {
753 fprintf (stderr, "Cannot malloc eqbuf memory. streaming abort.\n"); 717 fprintf (stderr, "Cannot malloc eqbuf memory. streaming abort.\n");
754 use_dlna = FALSE; 718 use_dlna = FALSE;