[FFmpeg-devel] [RFC] libavdevice, audio output devices

Ivo ivop
Sun Nov 22 20:44:30 CET 2009


Hi,

Recently, an issue came up on -cvslog and as per Michael's suggestion, I'm 
posting it here, so it can be discussed.

First some context:


avformat.h:

#define AVFMT_FLAG_NONBLOCK     0x0004 \
		///< Do not block when reading packets from input.


alsa-audio-common.c:

    if (ctx->flags & AVFMT_FLAG_NONBLOCK) {
        flags = SND_PCM_NONBLOCK;
    }


oss_audio.c:

    if (!is_output)
        fcntl(audio_fd, F_SETFL, O_NONBLOCK);


Basically, alsa blocks on input and output if AVFMT_FLAG_NONBLOCK is not set 
and does not block on input and output if it is set. On the other hand, oss 
always blocks on output, and never blocks on input. If you look at the 
description in avformat.h, both are not functioning as is described.

My proposal would be to extend AVFMT_FLAG_NONBLOCK to non-blocking behaviour 
for output too and fix oss_audio. This leads to the greatest flexibility 
for third-party applications using libavdevice.

Regards,
--Ivo



More information about the ffmpeg-devel mailing list