pulse_audio_common.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 "libavutil/attributes.h"
  22. #include "libavcodec/avcodec.h"
  23. #include "pulse_audio_common.h"
  24. pa_sample_format_t av_cold codec_id_to_pulse_format(int codec_id)
  25. {
  26. switch (codec_id) {
  27. case AV_CODEC_ID_PCM_U8: return PA_SAMPLE_U8;
  28. case AV_CODEC_ID_PCM_ALAW: return PA_SAMPLE_ALAW;
  29. case AV_CODEC_ID_PCM_MULAW: return PA_SAMPLE_ULAW;
  30. case AV_CODEC_ID_PCM_S16LE: return PA_SAMPLE_S16LE;
  31. case AV_CODEC_ID_PCM_S16BE: return PA_SAMPLE_S16BE;
  32. case AV_CODEC_ID_PCM_F32LE: return PA_SAMPLE_FLOAT32LE;
  33. case AV_CODEC_ID_PCM_F32BE: return PA_SAMPLE_FLOAT32BE;
  34. case AV_CODEC_ID_PCM_S32LE: return PA_SAMPLE_S32LE;
  35. case AV_CODEC_ID_PCM_S32BE: return PA_SAMPLE_S32BE;
  36. case AV_CODEC_ID_PCM_S24LE: return PA_SAMPLE_S24LE;
  37. case AV_CODEC_ID_PCM_S24BE: return PA_SAMPLE_S24BE;
  38. default: return PA_SAMPLE_INVALID;
  39. }
  40. }