diff options
-rw-r--r-- | sound/core/oss/pcm_oss.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index fc11572c48cf..c058713dd567 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -633,6 +633,22 @@ static long snd_pcm_alsa_frames(struct snd_pcm_substream *substream, long bytes) | |||
633 | return bytes_to_frames(runtime, (buffer_size * bytes) / runtime->oss.buffer_bytes); | 633 | return bytes_to_frames(runtime, (buffer_size * bytes) / runtime->oss.buffer_bytes); |
634 | } | 634 | } |
635 | 635 | ||
636 | /* define extended formats in the recent OSS versions (if any) */ | ||
637 | /* linear formats */ | ||
638 | #define AFMT_S32_LE 0x00001000 | ||
639 | #define AFMT_S32_BE 0x00002000 | ||
640 | #define AFMT_S24_LE 0x00008000 | ||
641 | #define AFMT_S24_BE 0x00010000 | ||
642 | #define AFMT_S24_PACKED 0x00040000 | ||
643 | |||
644 | /* other supported formats */ | ||
645 | #define AFMT_FLOAT 0x00004000 | ||
646 | #define AFMT_SPDIF_RAW 0x00020000 | ||
647 | |||
648 | /* unsupported formats */ | ||
649 | #define AFMT_AC3 0x00000400 | ||
650 | #define AFMT_VORBIS 0x00000800 | ||
651 | |||
636 | static int snd_pcm_oss_format_from(int format) | 652 | static int snd_pcm_oss_format_from(int format) |
637 | { | 653 | { |
638 | switch (format) { | 654 | switch (format) { |
@@ -646,6 +662,13 @@ static int snd_pcm_oss_format_from(int format) | |||
646 | case AFMT_U16_LE: return SNDRV_PCM_FORMAT_U16_LE; | 662 | case AFMT_U16_LE: return SNDRV_PCM_FORMAT_U16_LE; |
647 | case AFMT_U16_BE: return SNDRV_PCM_FORMAT_U16_BE; | 663 | case AFMT_U16_BE: return SNDRV_PCM_FORMAT_U16_BE; |
648 | case AFMT_MPEG: return SNDRV_PCM_FORMAT_MPEG; | 664 | case AFMT_MPEG: return SNDRV_PCM_FORMAT_MPEG; |
665 | case AFMT_S32_LE: return SNDRV_PCM_FORMAT_S32_LE; | ||
666 | case AFMT_S32_BE: return SNDRV_PCM_FORMAT_S32_BE; | ||
667 | case AFMT_S24_LE: return SNDRV_PCM_FORMAT_S24_LE; | ||
668 | case AFMT_S24_BE: return SNDRV_PCM_FORMAT_S24_BE; | ||
669 | case AFMT_S24_PACKED: return SNDRV_PCM_FORMAT_S24_3LE; | ||
670 | case AFMT_FLOAT: return SNDRV_PCM_FORMAT_FLOAT; | ||
671 | case AFMT_SPDIF_RAW: return SNDRV_PCM_FORMAT_IEC958_SUBFRAME; | ||
649 | default: return SNDRV_PCM_FORMAT_U8; | 672 | default: return SNDRV_PCM_FORMAT_U8; |
650 | } | 673 | } |
651 | } | 674 | } |
@@ -663,6 +686,13 @@ static int snd_pcm_oss_format_to(int format) | |||
663 | case SNDRV_PCM_FORMAT_U16_LE: return AFMT_U16_LE; | 686 | case SNDRV_PCM_FORMAT_U16_LE: return AFMT_U16_LE; |
664 | case SNDRV_PCM_FORMAT_U16_BE: return AFMT_U16_BE; | 687 | case SNDRV_PCM_FORMAT_U16_BE: return AFMT_U16_BE; |
665 | case SNDRV_PCM_FORMAT_MPEG: return AFMT_MPEG; | 688 | case SNDRV_PCM_FORMAT_MPEG: return AFMT_MPEG; |
689 | case SNDRV_PCM_FORMAT_S32_LE: return AFMT_S32_LE; | ||
690 | case SNDRV_PCM_FORMAT_S32_BE: return AFMT_S32_BE; | ||
691 | case SNDRV_PCM_FORMAT_S24_LE: return AFMT_S24_LE; | ||
692 | case SNDRV_PCM_FORMAT_S24_BE: return AFMT_S24_BE; | ||
693 | case SNDRV_PCM_FORMAT_S24_3LE: return AFMT_S24_PACKED; | ||
694 | case SNDRV_PCM_FORMAT_FLOAT: return AFMT_FLOAT; | ||
695 | case SNDRV_PCM_FORMAT_IEC958_SUBFRAME: return AFMT_SPDIF_RAW; | ||
666 | default: return -EINVAL; | 696 | default: return -EINVAL; |
667 | } | 697 | } |
668 | } | 698 | } |
@@ -1725,7 +1755,10 @@ static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file) | |||
1725 | return AFMT_MU_LAW | AFMT_U8 | | 1755 | return AFMT_MU_LAW | AFMT_U8 | |
1726 | AFMT_S16_LE | AFMT_S16_BE | | 1756 | AFMT_S16_LE | AFMT_S16_BE | |
1727 | AFMT_S8 | AFMT_U16_LE | | 1757 | AFMT_S8 | AFMT_U16_LE | |
1728 | AFMT_U16_BE; | 1758 | AFMT_U16_BE | |
1759 | AFMT_S32_LE | AFMT_S32_BE | | ||
1760 | AFMT_S24_LE | AFMT_S24_LE | | ||
1761 | AFMT_S24_PACKED; | ||
1729 | params = kmalloc(sizeof(*params), GFP_KERNEL); | 1762 | params = kmalloc(sizeof(*params), GFP_KERNEL); |
1730 | if (!params) | 1763 | if (!params) |
1731 | return -ENOMEM; | 1764 | return -ENOMEM; |