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)



On Mon, 2 Jun 2003, Johannes Stezenbach wrote:

> 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.

Thanks for the advice. I'll give this a try, but I'm not sure if it'll 
make any difference. I made the audio stream non-blocking, and since it is 
a much lower data rate than the video stream, I think it should work. But 
I agree select() it a neater way of doing it.

I'll let you know,

James.



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



Home | Main Index | Thread Index