Merge pull request #5039 from CEikermann/patch-1
[vuplus_xbmc] / xbmc / cdrip / EncoderFlac.h
1 #ifndef _ENCODERFLAC_H
2 #define _ENCODERFLAC_H
3
4 /*
5  *      Copyright (C) 2005-2013 Team XBMC
6  *      http://xbmc.org
7  *
8  *  This Program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2, or (at your option)
11  *  any later version.
12  *
13  *  This Program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with XBMC; see the file COPYING.  If not, see
20  *  <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #include "Encoder.h"
25 #include "DllFlacEnc.h"
26
27 class CEncoderFlac : public CEncoder
28 {
29 public:
30   CEncoderFlac();
31   virtual ~CEncoderFlac();
32   bool Init(const char* strFile, int iInChannels, int iInRate, int iInBits);
33   int Encode(int nNumBytesRead, uint8_t* pbtStream);
34   bool Close();
35
36 private:
37   DllFlacEnc m_dll;
38   FLAC__StreamEncoder *m_encoder;
39   FLAC__StreamMetadata *m_metadata[2];
40
41   static const int SAMPLES_BUF_SIZE = 1024 * 2;
42   FLAC__int32 *m_samplesBuf;
43
44   static FLAC__StreamEncoderWriteStatus write_callback(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data);
45 };
46
47 #endif // _ENCODERFLAC_H