[release] version bump to 13.0 beta1
[vuplus_xbmc] / xbmc / cores / AudioEngine / Engines / ActiveAE / ActiveAEResample.h
1 #pragma once
2 /*
3  *      Copyright (C) 2010-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
22 #include "DllAvUtil.h"
23 #include "DllSwResample.h"
24 #include "Utils/AEChannelInfo.h"
25 #include "Utils/AEAudioFormat.h"
26 #include "ActiveAEBuffer.h"
27 #include "Interfaces/AE.h"
28
29 namespace ActiveAE
30 {
31
32 class CActiveAEResample
33 {
34 public:
35   CActiveAEResample();
36   virtual ~CActiveAEResample();
37   bool Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, bool upmix, bool normalize, CAEChannelInfo *remapLayout, AEQuality quality);
38   int Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, double ratio);
39   int64_t GetDelay(int64_t base);
40   int GetBufferedSamples();
41   int CalcDstSampleCount(int src_samples, int dst_rate, int src_rate);
42   int GetSrcBufferSize(int samples);
43   int GetDstBufferSize(int samples);
44   static uint64_t GetAVChannelLayout(CAEChannelInfo &info);
45 //  static CAEChannelInfo GetAEChannelLayout(uint64_t layout);
46   static AVSampleFormat GetAVSampleFormat(AEDataFormat format);
47   static AEDataFormat GetAESampleFormat(AVSampleFormat format, int bits);
48   static uint64_t GetAVChannel(enum AEChannel aechannel);
49   int GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout);
50
51 protected:
52   DllAvUtil m_dllAvUtil;
53   DllSwResample m_dllSwResample;
54   bool m_loaded;
55   uint64_t m_src_chan_layout, m_dst_chan_layout;
56   int m_src_rate, m_dst_rate;
57   int m_src_channels, m_dst_channels;
58   AVSampleFormat m_src_fmt, m_dst_fmt;
59   int m_src_bits, m_dst_bits;
60   SwrContext *m_pContext;
61   double m_rematrix[AE_CH_MAX][AE_CH_MAX];
62 };
63
64 }