/xbmc/cores/paplayer/FLACcodec.h

http://github.com/xbmc/xbmc · C Header · 58 lines · 31 code · 7 blank · 20 comment · 0 complexity · 4eee17af4946ca7175dd64970fa28161 MD5 · raw file

  1. #pragma once
  2. /*
  3. * Copyright (C) 2005-2013 Team XBMC
  4. * http://xbmc.org
  5. *
  6. * This Program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2, or (at your option)
  9. * any later version.
  10. *
  11. * This Program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with XBMC; see the file COPYING. If not, see
  18. * <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. #include "CachingCodec.h"
  22. #include "DllLibFlac.h"
  23. class FLACCodec : public CachingCodec
  24. {
  25. public:
  26. FLACCodec();
  27. virtual ~FLACCodec();
  28. virtual bool Init(const CStdString &strFile, unsigned int filecache);
  29. virtual void DeInit();
  30. virtual int64_t Seek(int64_t iSeekTime);
  31. virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize);
  32. virtual bool CanInit();
  33. virtual CAEChannelInfo GetChannelInfo() {return m_ChannelInfo;}
  34. private:
  35. // I/O callbacks for the flac decoder
  36. static FLAC__StreamDecoderReadStatus DecoderReadCallback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
  37. static FLAC__StreamDecoderSeekStatus DecoderSeekCallback(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data);
  38. static FLAC__StreamDecoderTellStatus DecoderTellCallback(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
  39. static FLAC__StreamDecoderLengthStatus DecoderLengthCallback(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data);
  40. static FLAC__bool DecoderEofCallback(const FLAC__StreamDecoder *decoder, void *client_data);
  41. static FLAC__StreamDecoderWriteStatus DecoderWriteCallback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
  42. static void DecoderMetadataCallback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
  43. static void DecoderErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
  44. void FreeDecoder();
  45. DllLibFlac m_dll;
  46. BYTE* m_pBuffer; // buffer to hold the decoded audio data
  47. int m_BufferSize; // size of buffer is filled with decoded audio data
  48. int m_MaxFrameSize; // size of a single decoded frame
  49. FLAC__StreamDecoder* m_pFlacDecoder;
  50. CAEChannelInfo m_ChannelInfo;
  51. };