[linux-dvb] API ioctls for Bypass and RAW Audio

Oliver Endriss o.endriss at gmx.de
Sun Oct 23 00:52:18 CEST 2005


Dr. Werner Fink wrote:
> Hi,
> 
> is there really no one out here which want to be able to
> use RAW Audio streams? That means replaying Audio without
> the needs of a PES remuxer?  The hardware can do it, the
> firmware will support it ... but the DVB API 3 and
> DVB API 4 seems not be designed for this approach.
> 
> How to extend the DVB API 3 for RAW Audio replay?
> Do I need a new ioctl or should I extend
> AUDIO_SELECT_SOURCE by something like AUDIO_SOURCE_MEMORY_RAW
> or use the AUDIO_SET_STREAMTYPE and define a type
> class AUDIO_CAP_RAW_XXX.

Hm - nobody seems to care about raw audio output.
Should we drop it for now?

> On Wed, Oct 19, 2005 at 06:56:16PM +0200, Dr. Werner Fink wrote:
> > just finished two steps in the firmware for the FF DVB cards of TT.
> > The first is the possiblity of AC3 for Live channels and the other
> > if the playback of RAW Audio like Mpeg Audio, PCM, AC3, and DTS.
> > 
> > Therefore I'd like to ask about some ioctls which aren't
> > very well documented in the dvb-kernel.
> > 
> > I guess that for switching the firmware into bypass for the next
> > Audio PID of a Live channel the ioctl:
> > 
> >      AUDIO_SET_BYPASS_MODE
> > 
> > is usable, isn't it?

The tuxbox project uses AUDIO_SET_BYPASS_MODE in the useDD() routine:

void hardware::useDD(bool use)
{
        if (old_DD_state == use)
                return;
        int fd = open(AUDIO_DEV, O_RDWR);
        if (use)
        {
                ioctl(fd, AUDIO_SET_BYPASS_MODE, 0);
        }
        else
        {
                ioctl(fd, AUDIO_SET_BYPASS_MODE, 1);
        }
        close(fd);
        old_DD_state = use;
}

So AUDIO_SET_BYPASS_MODE seems to be a reasonable way to enable
live AC3.

> > Which ioctl should be used for playpack RAW Audio?  I've found
> > two ioctl's:
> > 
> >      AUDIO_SET_STREAMTYPE
> > 
> > and
> > 
> >      AUDIO_SET_ATTRIBUTES
> > 
> > ...  currently the first one is NOP in av7110.c and the second
> > is not implemented.  For the second I've found in audio.h of
> > the API for the user space:
> > 
> >   typedef uint16_t audio_attributes_t;
> >   /*   bits: descr. */
> >   /*   15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, */
> >   /*   12    multichannel extension */
> >   /*   11-10 audio type (0=not spec, 1=language included) */
> >   /*    9- 8 audio application mode (0=not spec, 1=karaoke, 2=surround) */
> >   /*    7- 6 Quantization / DRC (mpeg audio: 1=DRC exists)(lpcm: 0=16bit,  */
> >   /*    5- 4 Sample frequency fs (0=48kHz, 1=96kHz) */
> >   /*    2- 0 number of audio channels (n+1 channels) */
> > 
> > it seems that for the bit field 5-4 the value 2 for 44.1kHz and
> > the value 3 for 32kHz are missed.
> > 
> > For what the ioctls AUDIO_SET_STREAMTYPE and AUDIO_SET_ATTRIBUTES
> > should by used.

The tuxbox people use AUDIO_SET_STREAMTYPE this way:

void Decoder::SetStreamType(int type)
{
        uint val=0;
        switch ( type )
        {
                case TYPE_ES:
                        val=0;
                        break;
                case TYPE_PES:
                        val=1;
                        break;
                case TYPE_MPEG1:
                        val=2;
                        break;
        }
        if (fd.audio != -1 && ::ioctl(fd.audio, AUDIO_SET_STREAMTYPE, val)<0 )
                eDebug("AUDIO_SET_STREAMTYPE failed (%m)");
}

The API is very vague about these ioctls.
[Stream] type is an int but acceptable values are not defined anywhere.

Maybe the API designers could comment on this.

Oliver

-- 
--------------------------------------------------------
VDR Remote Plugin available at
http://www.escape-edv.de/endriss/vdr/
--------------------------------------------------------



More information about the linux-dvb mailing list