Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: Help on use of DMX_OUT_TAP (II)



jng_junk@greenmail.demon.co.uk wrote:
...
>   if (type == DMX_PES_AUDIO) flags |= O_NONBLOCK;
...
>   while (1) {
>     int bytes;
> 
>     /* Video. */
>     bytes = read(video_fd, buf, sizeof(buf));
>     if (bytes < 0) {
> 	fprintf(stderr, "Errno %d: ", errno);
> 	perror("video_fd read");
>     } else {
>       fprintf(stderr, "Read %d bytes from video_fd.\n", bytes);
>     }
> 
>     /* Audio. */
>     bytes = read(audio_fd, buf, sizeof(buf));
>     if (bytes < 0) {
>       if (errno != EAGAIN) {
> 	fprintf(stderr, "Errno %d: ", errno);
> 	perror("audio_fd read");
>       }
>     } else {
>       fprintf(stderr, "Read %d bytes from audio_fd.\n", bytes);
>     }
>   }

This can't work. You must use select() or poll() to wait for
data to arrive, then read() from the file descriptor which is ready.

Johannes


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index