Merge pull request #1129 from jmarshallnz/remove_smb_auth_details_in_add_source
[vuplus_xbmc] / xbmc / cores / dvdplayer / DVDAudio.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2008 Team XBMC
5  *      http://www.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, write to
19  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20  *  http://www.gnu.org/copyleft/gpl.html
21  *
22  */
23
24 #if (defined HAVE_CONFIG_H) && (!defined WIN32)
25   #include "config.h"
26 #endif
27 #include "threads/CriticalSection.h"
28 #include "PlatformDefs.h"
29
30 #include "cores/AudioEngine/Utils/AEChannelInfo.h"
31 class IAEStream;
32
33 #ifndef _LINUX
34 enum CodecID;
35 #else
36 extern "C" {
37 #if (defined USE_EXTERNAL_FFMPEG)
38   #if (defined HAVE_LIBAVCODEC_AVCODEC_H)
39     #include <libavcodec/avcodec.h>
40   #elif (defined HAVE_FFMPEG_AVCODEC_H)
41     #include <ffmpeg/avcodec.h>
42   #endif
43 #else
44   #include "libavcodec/avcodec.h"
45 #endif
46 }
47 #endif
48 typedef struct stDVDAudioFrame DVDAudioFrame;
49
50 class CSingleLock;
51
52 class CDVDAudio
53 {
54 public:
55   CDVDAudio(volatile bool& bStop);
56   ~CDVDAudio();
57
58   void SetVolume(float fVolume);
59   void SetDynamicRangeCompression(long drc);
60   float GetCurrentAttenuation();
61   void Pause();
62   void Resume();
63   bool Create(const DVDAudioFrame &audioframe, CodecID codec, bool needresampler);
64   bool IsValidFormat(const DVDAudioFrame &audioframe);
65   void Destroy();
66   DWORD AddPackets(const DVDAudioFrame &audioframe);
67   double GetDelay(); // returns the time it takes to play a packet if we add one at this time
68   double GetCacheTime();  // returns total amount of data cached in audio output at this time
69   double GetCacheTotal(); // returns total amount the audio device can buffer
70   void Flush();
71   void Finish();
72   void Drain();
73
74   void SetSpeed(int iSpeed);
75   void SetResampleRatio(double ratio);
76
77   IAEStream *m_pAudioStream;
78 protected:
79   DWORD AddPacketsRenderer(unsigned char* data, DWORD len, CSingleLock &lock);
80   BYTE* m_pBuffer; // should be [m_dwPacketSize]
81   DWORD m_iBufferSize;
82   DWORD m_dwPacketSize;
83   CCriticalSection m_critSection;
84
85   int m_iBitrate;
86   int m_iBitsPerSample;
87   double m_SecondsPerByte;
88   bool m_bPassthrough;
89   CAEChannelInfo m_channelLayout;
90   bool m_bPaused;
91
92   volatile bool& m_bStop;
93   //counter that will go from 0 to m_iSpeed-1 and reset, data will only be output when speedstep is 0
94   //int m_iSpeedStep;
95 };