1 .. -*- coding: utf-8; mode: rst -*-
3 .. _audio_function_calls:
17 This system call opens a named audio device (e.g.
18 /dev/dvb/adapter0/audio0) for subsequent use. When an open() call has
19 succeeded, the device will be ready for use. The significance of
20 blocking or non-blocking mode is described in the documentation for
21 functions where there is a difference. It does not affect the semantics
22 of the open() call itself. A device opened in blocking mode can later be
23 put into non-blocking mode (and vice versa) using the F_SETFL command
24 of the fcntl system call. This is a standard system call, documented in
25 the Linux manual page for fcntl. Only one user can open the Audio Device
26 in O_RDWR mode. All other attempts to open the device in this mode will
27 fail, and an error code will be returned. If the Audio Device is opened
28 in O_RDONLY mode, the only ioctl call that can be used is
29 AUDIO_GET_STATUS. All other call will return with an error code.
33 int open(const char *deviceName, int flags);
46 - const char *deviceName
48 - Name of specific audio device.
54 - A bit-wise OR of the following flags:
59 - O_RDONLY read-only access
64 - O_RDWR read/write access
69 - O_NONBLOCK open in non-blocking mode
74 - (blocking mode is the default)
90 - Device driver not loaded/available.
96 - Device or resource busy.
113 This system call closes a previously opened audio device.
132 - File descriptor returned by a previous call to open().
148 - fd is not a valid open file descriptor.
159 This system call can only be used if AUDIO_SOURCE_MEMORY is selected
160 in the ioctl call AUDIO_SELECT_SOURCE. The data provided shall be in
161 PES format. If O_NONBLOCK is not specified the function will block
162 until buffer space is available. The amount of data to be transferred is
167 size_t write(int fd, const void *buf, size_t count);
182 - File descriptor returned by a previous call to open().
188 - Pointer to the buffer containing the PES data.
210 - Mode AUDIO_SOURCE_MEMORY not selected.
216 - Attempted to write more data than the internal buffer can hold.
222 - fd is not a valid open file descriptor.
233 This ioctl call asks the Audio Device to stop playing the current
238 int ioctl(int fd, int request = AUDIO_STOP);
253 - File descriptor returned by a previous call to open().
259 - Equals AUDIO_STOP for this command.
264 On success 0 is returned, on error -1 and the ``errno`` variable is set
265 appropriately. The generic error codes are described at the
266 :ref:`Generic Error Codes <gen-errors>` chapter.
276 This ioctl call asks the Audio Device to start playing an audio stream
277 from the selected source.
281 int ioctl(int fd, int request = AUDIO_PLAY);
296 - File descriptor returned by a previous call to open().
302 - Equals AUDIO_PLAY for this command.
307 On success 0 is returned, on error -1 and the ``errno`` variable is set
308 appropriately. The generic error codes are described at the
309 :ref:`Generic Error Codes <gen-errors>` chapter.
319 This ioctl call suspends the audio stream being played. Decoding and
320 playing are paused. It is then possible to restart again decoding and
321 playing process of the audio stream using AUDIO_CONTINUE command.
325 int ioctl(int fd, int request = AUDIO_PAUSE);
340 - File descriptor returned by a previous call to open().
346 - Equals AUDIO_PAUSE for this command.
351 On success 0 is returned, on error -1 and the ``errno`` variable is set
352 appropriately. The generic error codes are described at the
353 :ref:`Generic Error Codes <gen-errors>` chapter.
363 This ioctl restarts the decoding and playing process previously paused
364 with AUDIO_PAUSE command.
368 int ioctl(int fd, int request = AUDIO_CONTINUE);
383 - File descriptor returned by a previous call to open().
389 - Equals AUDIO_CONTINUE for this command.
394 On success 0 is returned, on error -1 and the ``errno`` variable is set
395 appropriately. The generic error codes are described at the
396 :ref:`Generic Error Codes <gen-errors>` chapter.
399 .. _AUDIO_SELECT_SOURCE:
406 This ioctl call informs the audio device which source shall be used for
407 the input data. The possible sources are demux or memory. If
408 AUDIO_SOURCE_MEMORY is selected, the data is fed to the Audio Device
409 through the write command.
413 int ioctl(int fd, int request = AUDIO_SELECT_SOURCE,
414 audio_stream_source_t source);
429 - File descriptor returned by a previous call to open().
435 - Equals AUDIO_SELECT_SOURCE for this command.
439 - audio_stream_source_t source
441 - Indicates the source that shall be used for the Audio stream.
446 On success 0 is returned, on error -1 and the ``errno`` variable is set
447 appropriately. The generic error codes are described at the
448 :ref:`Generic Error Codes <gen-errors>` chapter.
458 This ioctl is for DVB devices only. To control a V4L2 decoder use the
459 V4L2 :ref:`VIDIOC_DECODER_CMD` with the
460 ``V4L2_DEC_CMD_START_MUTE_AUDIO`` flag instead.
462 This ioctl call asks the audio device to mute the stream that is
463 currently being played.
467 int ioctl(int fd, int request = AUDIO_SET_MUTE, boolean state);
482 - File descriptor returned by a previous call to open().
488 - Equals AUDIO_SET_MUTE for this command.
494 - Indicates if audio device shall mute or not.
504 - FALSE Audio Un-mute
509 On success 0 is returned, on error -1 and the ``errno`` variable is set
510 appropriately. The generic error codes are described at the
511 :ref:`Generic Error Codes <gen-errors>` chapter.
514 .. _AUDIO_SET_AV_SYNC:
521 This ioctl call asks the Audio Device to turn ON or OFF A/V
526 int ioctl(int fd, int request = AUDIO_SET_AV_SYNC, boolean state);
541 - File descriptor returned by a previous call to open().
547 - Equals AUDIO_AV_SYNC for this command.
553 - Tells the DVB subsystem if A/V synchronization shall be ON or OFF.
568 On success 0 is returned, on error -1 and the ``errno`` variable is set
569 appropriately. The generic error codes are described at the
570 :ref:`Generic Error Codes <gen-errors>` chapter.
573 .. _AUDIO_SET_BYPASS_MODE:
575 AUDIO_SET_BYPASS_MODE
576 =====================
580 This ioctl call asks the Audio Device to bypass the Audio decoder and
581 forward the stream without decoding. This mode shall be used if streams
582 that can’t be handled by the DVB system shall be decoded. Dolby
583 DigitalTM streams are automatically forwarded by the DVB subsystem if
584 the hardware can handle it.
588 int ioctl(int fd, int request = AUDIO_SET_BYPASS_MODE, boolean mode);
603 - File descriptor returned by a previous call to open().
609 - Equals AUDIO_SET_BYPASS_MODE for this command.
615 - Enables or disables the decoding of the current Audio stream in
621 - TRUE Bypass is disabled
626 - FALSE Bypass is enabled
631 On success 0 is returned, on error -1 and the ``errno`` variable is set
632 appropriately. The generic error codes are described at the
633 :ref:`Generic Error Codes <gen-errors>` chapter.
636 .. _AUDIO_CHANNEL_SELECT:
643 This ioctl is for DVB devices only. To control a V4L2 decoder use the
644 V4L2 ``V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK`` control instead.
646 This ioctl call asks the Audio Device to select the requested channel if
651 int ioctl(int fd, int request = AUDIO_CHANNEL_SELECT,
652 audio_channel_select_t);
667 - File descriptor returned by a previous call to open().
673 - Equals AUDIO_CHANNEL_SELECT for this command.
677 - audio_channel_select_t ch
679 - Select the output format of the audio (mono left/right, stereo).
684 On success 0 is returned, on error -1 and the ``errno`` variable is set
685 appropriately. The generic error codes are described at the
686 :ref:`Generic Error Codes <gen-errors>` chapter.
689 .. _AUDIO_BILINGUAL_CHANNEL_SELECT:
691 AUDIO_BILINGUAL_CHANNEL_SELECT
692 ==============================
696 This ioctl is obsolete. Do not use in new drivers. It has been replaced
697 by the V4L2 ``V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK`` control
698 for MPEG decoders controlled through V4L2.
700 This ioctl call asks the Audio Device to select the requested channel
701 for bilingual streams if possible.
705 int ioctl(int fd, int request = AUDIO_BILINGUAL_CHANNEL_SELECT,
706 audio_channel_select_t);
721 - File descriptor returned by a previous call to open().
727 - Equals AUDIO_BILINGUAL_CHANNEL_SELECT for this command.
731 - audio_channel_select_t ch
733 - Select the output format of the audio (mono left/right, stereo).
738 On success 0 is returned, on error -1 and the ``errno`` variable is set
739 appropriately. The generic error codes are described at the
740 :ref:`Generic Error Codes <gen-errors>` chapter.
750 This ioctl is obsolete. Do not use in new drivers. If you need this
751 functionality, then please contact the linux-media mailing list
752 (`https://linuxtv.org/lists.php <https://linuxtv.org/lists.php>`__).
754 This ioctl call asks the Audio Device to return the current PTS
759 int ioctl(int fd, int request = AUDIO_GET_PTS, __u64 *pts);
774 - File descriptor returned by a previous call to open().
780 - Equals AUDIO_GET_PTS for this command.
786 - Returns the 33-bit timestamp as defined in ITU T-REC-H.222.0 /
789 The PTS should belong to the currently played frame if possible,
790 but may also be a value close to it like the PTS of the last
791 decoded frame or the last PTS extracted by the PES parser.
796 On success 0 is returned, on error -1 and the ``errno`` variable is set
797 appropriately. The generic error codes are described at the
798 :ref:`Generic Error Codes <gen-errors>` chapter.
801 .. _AUDIO_GET_STATUS:
808 This ioctl call asks the Audio Device to return the current state of the
813 int ioctl(int fd, int request = AUDIO_GET_STATUS, struct audio_status
829 - File descriptor returned by a previous call to open().
835 - Equals AUDIO_GET_STATUS for this command.
839 - struct audio_status *status
841 - Returns the current state of Audio Device.
846 On success 0 is returned, on error -1 and the ``errno`` variable is set
847 appropriately. The generic error codes are described at the
848 :ref:`Generic Error Codes <gen-errors>` chapter.
851 .. _AUDIO_GET_CAPABILITIES:
853 AUDIO_GET_CAPABILITIES
854 ======================
858 This ioctl call asks the Audio Device to tell us about the decoding
859 capabilities of the audio hardware.
863 int ioctl(int fd, int request = AUDIO_GET_CAPABILITIES, unsigned int
879 - File descriptor returned by a previous call to open().
885 - Equals AUDIO_GET_CAPABILITIES for this command.
891 - Returns a bit array of supported sound formats.
896 On success 0 is returned, on error -1 and the ``errno`` variable is set
897 appropriately. The generic error codes are described at the
898 :ref:`Generic Error Codes <gen-errors>` chapter.
901 .. _AUDIO_CLEAR_BUFFER:
908 This ioctl call asks the Audio Device to clear all software and hardware
909 buffers of the audio decoder device.
913 int ioctl(int fd, int request = AUDIO_CLEAR_BUFFER);
928 - File descriptor returned by a previous call to open().
934 - Equals AUDIO_CLEAR_BUFFER for this command.
939 On success 0 is returned, on error -1 and the ``errno`` variable is set
940 appropriately. The generic error codes are described at the
941 :ref:`Generic Error Codes <gen-errors>` chapter.
951 This ioctl selects which sub-stream is to be decoded if a program or
952 system stream is sent to the video device. If no audio stream type is
953 set the id has to be in [0xC0,0xDF] for MPEG sound, in [0x80,0x87] for
954 AC3 and in [0xA0,0xA7] for LPCM. More specifications may follow for
955 other stream types. If the stream type is set the id just specifies the
956 substream id of the audio stream and only the first 5 bits are
961 int ioctl(int fd, int request = AUDIO_SET_ID, int id);
976 - File descriptor returned by a previous call to open().
982 - Equals AUDIO_SET_ID for this command.
988 - audio sub-stream id
993 On success 0 is returned, on error -1 and the ``errno`` variable is set
994 appropriately. The generic error codes are described at the
995 :ref:`Generic Error Codes <gen-errors>` chapter.
1005 This ioctl lets you adjust the mixer settings of the audio decoder.
1009 int ioctl(int fd, int request = AUDIO_SET_MIXER, audio_mixer_t
1025 - File descriptor returned by a previous call to open().
1031 - Equals AUDIO_SET_ID for this command.
1035 - audio_mixer_t *mix
1042 On success 0 is returned, on error -1 and the ``errno`` variable is set
1043 appropriately. The generic error codes are described at the
1044 :ref:`Generic Error Codes <gen-errors>` chapter.
1047 .. _AUDIO_SET_STREAMTYPE:
1049 AUDIO_SET_STREAMTYPE
1050 ====================
1054 This ioctl tells the driver which kind of audio stream to expect. This
1055 is useful if the stream offers several audio sub-streams like LPCM and
1060 int ioctl(fd, int request = AUDIO_SET_STREAMTYPE, int type);
1075 - File descriptor returned by a previous call to open().
1081 - Equals AUDIO_SET_STREAMTYPE for this command.
1092 On success 0 is returned, on error -1 and the ``errno`` variable is set
1093 appropriately. The generic error codes are described at the
1094 :ref:`Generic Error Codes <gen-errors>` chapter.
1107 - type is not a valid or supported stream type.
1111 .. _AUDIO_SET_EXT_ID:
1118 This ioctl can be used to set the extension id for MPEG streams in DVD
1119 playback. Only the first 3 bits are recognized.
1123 int ioctl(fd, int request = AUDIO_SET_EXT_ID, int id);
1138 - File descriptor returned by a previous call to open().
1144 - Equals AUDIO_SET_EXT_ID for this command.
1150 - audio sub_stream_id
1155 On success 0 is returned, on error -1 and the ``errno`` variable is set
1156 appropriately. The generic error codes are described at the
1157 :ref:`Generic Error Codes <gen-errors>` chapter.
1170 - id is not a valid id.
1174 .. _AUDIO_SET_ATTRIBUTES:
1176 AUDIO_SET_ATTRIBUTES
1177 ====================
1181 This ioctl is intended for DVD playback and allows you to set certain
1182 information about the audio stream.
1186 int ioctl(fd, int request = AUDIO_SET_ATTRIBUTES, audio_attributes_t
1202 - File descriptor returned by a previous call to open().
1208 - Equals AUDIO_SET_ATTRIBUTES for this command.
1212 - audio_attributes_t attr
1214 - audio attributes according to section ??
1219 On success 0 is returned, on error -1 and the ``errno`` variable is set
1220 appropriately. The generic error codes are described at the
1221 :ref:`Generic Error Codes <gen-errors>` chapter.
1234 - attr is not a valid or supported attribute setting.
1238 .. _AUDIO_SET_KARAOKE:
1245 This ioctl allows one to set the mixer settings for a karaoke DVD.
1249 int ioctl(fd, int request = AUDIO_SET_KARAOKE, audio_karaoke_t
1265 - File descriptor returned by a previous call to open().
1271 - Equals AUDIO_SET_KARAOKE for this command.
1275 - audio_karaoke_t *karaoke
1277 - karaoke settings according to section ??.
1282 On success 0 is returned, on error -1 and the ``errno`` variable is set
1283 appropriately. The generic error codes are described at the
1284 :ref:`Generic Error Codes <gen-errors>` chapter.
1297 - karaoke is not a valid or supported karaoke setting.
1302 .. ------------------------------------------------------------------------------
1303 .. This file was automatically converted from DocBook-XML with the dbxml
1304 .. library (https://github.com/return42/sphkerneldoc). The origin XML comes
1305 .. from the linux kernel, refer to:
1307 .. * https://github.com/torvalds/linux/tree/master/Documentation/DocBook
1308 .. ------------------------------------------------------------------------------