pulse_audio_common.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Pulseaudio input
  3. * Copyright (c) 2011 Luca Barbato <lu_zero@gentoo.org>
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include "pulse_audio_common.h"
  22. #include "libavutil/attributes.h"
  23. pa_sample_format_t av_cold ff_codec_id_to_pulse_format(enum AVCodecID codec_id)
  24. {
  25. switch (codec_id) {
  26. case AV_CODEC_ID_PCM_U8: return PA_SAMPLE_U8;
  27. case AV_CODEC_ID_PCM_ALAW: return PA_SAMPLE_ALAW;
  28. case AV_CODEC_ID_PCM_MULAW: return PA_SAMPLE_ULAW;
  29. case AV_CODEC_ID_PCM_S16LE: return PA_SAMPLE_S16LE;
  30. case AV_CODEC_ID_PCM_S16BE: return PA_SAMPLE_S16BE;
  31. case AV_CODEC_ID_PCM_F32LE: return PA_SAMPLE_FLOAT32LE;
  32. case AV_CODEC_ID_PCM_F32BE: return PA_SAMPLE_FLOAT32BE;
  33. case AV_CODEC_ID_PCM_S32LE: return PA_SAMPLE_S32LE;
  34. case AV_CODEC_ID_PCM_S32BE: return PA_SAMPLE_S32BE;
  35. case AV_CODEC_ID_PCM_S24LE: return PA_SAMPLE_S24LE;
  36. case AV_CODEC_ID_PCM_S24BE: return PA_SAMPLE_S24BE;
  37. default: return PA_SAMPLE_INVALID;
  38. }
  39. }