[release] version bump to 13.0 beta1
[vuplus_xbmc] / xbmc / cores / AudioEngine / Sinks / AESinkAUDIOTRACK.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 "Interfaces/AESink.h"
23 #include "Utils/AEDeviceInfo.h"
24 #include "threads/CriticalSection.h"
25
26 class AERingBuffer;
27 namespace jni
28 {
29 class CJNIAudioTrack;
30 };
31
32 class CAESinkAUDIOTRACK : public IAESink
33 {
34 public:
35   virtual const char *GetName() { return "AUDIOTRACK"; }
36
37   CAESinkAUDIOTRACK();
38   virtual ~CAESinkAUDIOTRACK();
39
40   virtual bool Initialize(AEAudioFormat &format, std::string &device);
41   virtual void Deinitialize();
42
43   virtual double       GetDelay        ();
44   virtual double       GetCacheTotal   ();
45   virtual unsigned int AddPackets      (uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false);
46   virtual void         Drain           ();
47   virtual bool         HasVolume       ();
48   virtual void         SetVolume       (float scale);
49   static void          EnumerateDevicesEx(AEDeviceInfoList &list, bool force = false);
50
51 private:
52   jni::CJNIAudioTrack  *m_at_jni;
53   // m_frames_written must wrap at UINT32_MAX
54   uint32_t              m_frames_written;
55
56   static CAEDeviceInfo m_info;
57   AEAudioFormat      m_format;
58   AEAudioFormat      m_lastFormat;
59   double             m_volume;
60   volatile int       m_min_frames;
61   int16_t           *m_alignedS16;
62   unsigned int       m_sink_frameSize;
63   bool               m_passthrough;
64   double             m_audiotrackbuffer_sec;
65 };