diff options
author | Mark Purcell <msp@debian.org> | 2009-05-03 20:16:46 +1000 |
---|---|---|
committer | etobi <git@e-tobi.net> | 2013-09-03 09:48:45 +0200 |
commit | 109c7947d6a11a2a54eff1b19615ed80ea2f0602 (patch) | |
tree | 5708ced3485e2a6e021ff159a56f22374c8feecc /util/gnutv/gnutv_data.c | |
parent | a535707334f245ca1b14570e941a7524c7ca09d7 (diff) | |
parent | 9a5228e0f2b898367b7943d294be58caf6ce8bb3 (diff) | |
download | linux-dvb-apps-109c7947d6a11a2a54eff1b19615ed80ea2f0602.tar.gz |
Imported Debian patch 1.1.1+rev1273-1debian/1.1.1+rev1273-1
Diffstat (limited to 'util/gnutv/gnutv_data.c')
-rw-r--r-- | util/gnutv/gnutv_data.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/util/gnutv/gnutv_data.c b/util/gnutv/gnutv_data.c index 7ac0f23..54ccdde 100644 --- a/util/gnutv/gnutv_data.c +++ b/util/gnutv/gnutv_data.c @@ -77,7 +77,7 @@ static struct pid_fd *pid_fds = NULL; static int pid_fds_count = 0; void gnutv_data_start(int _output_type, - int ffaudiofd, int _adapter_id, int _demux_id, + int ffaudiofd, int _adapter_id, int _demux_id, int buffer_size, char *outfile, char* outif, struct addrinfo *_outaddrs, int _usertp) { @@ -114,6 +114,14 @@ void gnutv_data_start(int _output_type, exit(1); } + // optionally set dvr buffer size + if (buffer_size > 0) { + if (dvbdemux_set_buffer(dvrfd, buffer_size) != 0) { + fprintf(stderr, "Failed to set DVR buffer size\n"); + exit(1); + } + } + pthread_create(&outputthread, NULL, fileoutputthread_func, NULL); break; @@ -142,6 +150,14 @@ void gnutv_data_start(int _output_type, exit(1); } + // optionally set dvr buffer size + if (buffer_size > 0) { + if (dvbdemux_set_buffer(dvrfd, buffer_size) != 0) { + fprintf(stderr, "Failed to set DVR buffer size\n"); + exit(1); + } + } + pthread_create(&outputthread, NULL, udpoutputthread_func, NULL); break; } @@ -220,19 +236,27 @@ static void *fileoutputthread_func(void* arg) pollfd.events = POLLIN|POLLPRI|POLLERR; while(!outputthread_shutdown) { - if (poll(&pollfd, 1, 1000) != 1) - continue; - if (pollfd.revents & POLLERR) { + if (poll(&pollfd, 1, 1000) == -1) { if (errno == EINTR) continue; - fprintf(stderr, "DVR device read failure\n"); + fprintf(stderr, "DVR device poll failure\n"); return 0; } + if (pollfd.revents == 0) + continue; + int size = read(dvrfd, buf, sizeof(buf)); if (size < 0) { if (errno == EINTR) continue; + + if (errno == EOVERFLOW) { + // The error flag has been cleared, next read should succeed. + fprintf(stderr, "DVR overflow\n"); + continue; + } + fprintf(stderr, "DVR device read failure\n"); return 0; } |