On Mon, 2 Jun 2003, Johannes Stezenbach wrote:

> [EMAIL PROTECTED] 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 [EMAIL PROTECTED] with "unsubscribe linux-dvb" as 
subject.

Reply via email to