4 * Copyright (C) 2005-2013 Team XBMC
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)
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.
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/>.
23 #if (defined HAVE_CONFIG_H) && (!defined TARGET_WINDOWS)
26 #include "threads/CriticalSection.h"
27 #include "PlatformDefs.h"
30 #include "cores/AudioEngine/Utils/AEChannelInfo.h"
33 #include "DllAvCodec.h"
35 typedef struct stDVDAudioFrame DVDAudioFrame;
40 typedef struct {double pts; double timestamp; double duration;} TPTSItem;
42 std::queue<TPTSItem> m_queue;
43 CCriticalSection m_sync;
47 void Add(double pts, double delay, double duration, double timestamp);
49 double Current(double timestamp);
58 CDVDAudio(volatile bool& bStop);
61 void RegisterAudioCallback(IAudioCallback* pCallback);
62 void UnRegisterAudioCallback();
64 void SetVolume(float fVolume);
65 void SetDynamicRangeCompression(long drc);
66 float GetCurrentAttenuation();
69 bool Create(const DVDAudioFrame &audioframe, AVCodecID codec, bool needresampler);
70 bool IsValidFormat(const DVDAudioFrame &audioframe);
72 unsigned int AddPackets(const DVDAudioFrame &audioframe);
73 double GetDelay(); // returns the time it takes to play a packet if we add one at this time
74 double GetPlayingPts();
75 void SetPlayingPts(double pts);
76 double GetCacheTime(); // returns total amount of data cached in audio output at this time
77 double GetCacheTotal(); // returns total amount the audio device can buffer
82 void SetSpeed(int iSpeed);
83 void SetResampleRatio(double ratio);
85 IAEStream *m_pAudioStream;
87 CPTSOutputQueue m_time;
88 unsigned int AddPacketsRenderer(unsigned char* data, unsigned int len, CSingleLock &lock);
89 uint8_t* m_pBuffer; // should be [m_dwPacketSize]
90 unsigned int m_iBufferSize;
91 unsigned int m_dwPacketSize;
92 CCriticalSection m_critSection;
96 double m_SecondsPerByte;
98 CAEChannelInfo m_channelLayout;
101 volatile bool& m_bStop;
102 IAudioCallback* m_pAudioCallback; //the viz audio callback
103 //counter that will go from 0 to m_iSpeed-1 and reset, data will only be output when speedstep is 0