3 * Copyright (C) 2010-2013 Team XBMC
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)
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.
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/>.
22 #include "DllAvUtil.h"
23 #include "DllSwResample.h"
24 #include "cores/AudioEngine/Utils/AEAudioFormat.h"
25 #include "cores/AudioEngine/Interfaces/AE.h"
34 uint64_t channel_layout;
41 * the variables here follow ffmpeg naming
46 CSoundPacket(SampleConfig conf, int samples);
48 uint8_t **data; // array with pointers to planes of data
50 AEDataFormat internal_format; // used when carrying pass through
51 int bytes_per_sample; // bytes per sample and per channel
52 int linesize; // see ffmpeg, required for planar formats
53 int planes; // 1 for non planar formats, #channels for planar
54 int nb_samples; // number of frames used
55 int max_nb_samples; // max number of frames this packet can hold
58 class CActiveAEBufferPool;
65 CSampleBuffer *Acquire();
68 CActiveAEBufferPool *pool;
69 unsigned int timestamp;
73 class CActiveAEBufferPool
76 CActiveAEBufferPool(AEAudioFormat format);
77 virtual ~CActiveAEBufferPool();
78 virtual bool Create(unsigned int totaltime);
79 CSampleBuffer *GetFreeBuffer();
80 void ReturnBuffer(CSampleBuffer *buffer);
81 AEAudioFormat m_format;
82 std::deque<CSampleBuffer*> m_allSamples;
83 std::deque<CSampleBuffer*> m_freeSamples;
86 class CActiveAEResample;
88 class CActiveAEBufferPoolResample : public CActiveAEBufferPool
91 CActiveAEBufferPoolResample(AEAudioFormat inputFormat, AEAudioFormat outputFormat, AEQuality quality);
92 virtual ~CActiveAEBufferPoolResample();
93 virtual bool Create(unsigned int totaltime, bool remap, bool upmix, bool normalize = true);
94 void ChangeResampler();
95 bool ResampleBuffers(unsigned int timestamp = 0);
98 AEAudioFormat m_inputFormat;
99 std::deque<CSampleBuffer*> m_inputSamples;
100 std::deque<CSampleBuffer*> m_outputSamples;
101 CSampleBuffer *m_procSample;
102 CActiveAEResample *m_resampler;
103 uint8_t *m_planes[16];
107 bool m_changeResampler;
108 double m_resampleRatio;
109 AEQuality m_resampleQuality;