PageRenderTime 21ms CodeModel.GetById 15ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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