Mercurial > pt1.oyama
diff src/recpt1.c @ 183:27e5f99f8991
Delete ES out function. Merge Yazawa's tssplitter_lite. Add liner option.
author | Naoya OYAMA <naoya.oyama@gmail.com> |
---|---|
date | Mon, 05 May 2014 22:08:21 +0900 |
parents | a0bc3700a496 |
children | dc0d3addfd18 |
line wrap: on
line diff
--- a/src/recpt1.c Mon May 05 21:59:36 2014 +0900 +++ b/src/recpt1.c Mon May 05 22:08:21 2014 +0900 @@ -203,7 +203,7 @@ // $BJ*M}%A%c%s%M%kJQ99;~$K$O(B splitter $B$O6/@)E*$K:F5/F0$5$;$k(B pthread_mutex_lock(&tdata->splitter_mutex); split_shutdown(splitter); - splitter = split_startup(sid_list, NULL, NULL); + splitter = split_startup(sid_list); if (splitter->sid_list == NULL) { fprintf (stderr, "reader_func() splitter RESTART FAILED.\n"); tdata->splitter = NULL; @@ -547,7 +547,7 @@ struct sockaddr_in *addr = NULL; BUFSZ *qbuf; ARIB_STD_B25_BUFFER *eqbuf; - splitbuf_t splitbuf; + static splitbuf_t splitbuf; ARIB_STD_B25_BUFFER sbuf, dbuf, buf; int code; @@ -556,9 +556,6 @@ buf.size = 0; buf.data = NULL; - splitbuf.size = 0; - splitbuf.buffer_length = 0; - splitbuf.buffer = NULL; if(wfd == -1) fileless = TRUE; @@ -594,15 +591,15 @@ if(use_splitter) { pthread_mutex_lock(&data->splitter_mutex); - splitbuf.size = 0; - if(splitbuf.buffer_length < buf.size && buf.size > 0) { + splitbuf.buffer_filled = 0; + /* allocate split buffer */ + if(splitbuf.buffer_size < buf.size && buf.size > 0) { splitbuf.buffer = realloc(splitbuf.buffer, buf.size); - if(NULL == splitbuf.buffer) { - fprintf(stderr, "splitbuf.buffer realloc failed\n"); + if(splitbuf.buffer == NULL) { + fprintf(stderr, "split buffer allocation failed\n"); use_splitter = FALSE; goto fin; } - splitbuf.buffer_length = buf.size; } while(buf.size) { @@ -631,15 +628,17 @@ } /* $BJ,N%BP>]0J30$r$U$k$$Mn$H$9(B */ code = split_ts(data->splitter, &buf, &splitbuf); - if(code != TSS_SUCCESS) { + if(code == TSS_NULL) { + fprintf(stderr, "PMT reading..\n"); + } else if(code != TSS_SUCCESS) { fprintf(stderr, "split_ts failed\n"); break; - } + } break; } /* while */ - buf.size = splitbuf.size; + buf.size = splitbuf.buffer_size; buf.data = splitbuf.buffer; fin: pthread_mutex_unlock(&data->splitter_mutex); @@ -736,12 +735,16 @@ if(use_splitter) { /* $BJ,N%BP>]0J30$r$U$k$$Mn$H$9(B */ code = split_ts(data->splitter, &buf, &splitbuf); - if(code != TSS_SUCCESS) { + if(code == TSS_NULL) { + data->splitter->split_select_finish = TSS_ERROR; + fprintf(stderr, "PMT reading..\n"); + } + else if(code != TSS_SUCCESS) { + fprintf(stderr, "split_ts failed\n"); break; } - buf.data = splitbuf.buffer; - buf.size = splitbuf.size; + buf.size = splitbuf.buffer_size; } if(!fileless && !file_err) { @@ -764,7 +767,7 @@ if(use_splitter) { free(splitbuf.buffer); splitbuf.buffer = NULL; - splitbuf.buffer_length = 0; + //splitbuf.buffer_length = 0; } break; @@ -1263,7 +1266,7 @@ } /* initialize splitter */ if(use_splitter) { - splitter = split_startup(sid_list, es_name_prefix, start_time); + splitter = split_startup(sid_list); if(splitter->sid_list == NULL) { fprintf(stderr, "Cannot start TS splitter\n"); return 1;