2 * Copyright (C) 2010-2012 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
24 #include "AESinkProfiler.h"
28 #include "Utils/AEUtil.h"
29 #include "utils/StdString.h"
30 #include "utils/log.h"
31 #include "utils/TimeUtils.h"
32 #include "settings/GUISettings.h"
34 CAESinkProfiler::CAESinkProfiler()
38 CAESinkProfiler::~CAESinkProfiler()
42 bool CAESinkProfiler::Initialize(AEAudioFormat &format, std::string &device)
44 if (AE_IS_RAW(format.m_dataFormat))
47 format.m_sampleRate = 192000;
48 format.m_channelLayout = AE_CH_LAYOUT_7_1;
49 format.m_dataFormat = AE_FMT_S32LE;
50 format.m_frames = 30720;
51 format.m_frameSamples = format.m_channelLayout.Count();
52 format.m_frameSize = format.m_frameSamples * sizeof(float);
56 void CAESinkProfiler::Deinitialize()
60 bool CAESinkProfiler::IsCompatible(const AEAudioFormat format, const std::string device)
62 if (AE_IS_RAW(format.m_dataFormat))
65 if (format.m_dataFormat != AE_FMT_FLOAT)
71 double CAESinkProfiler::GetDelay()
76 unsigned int CAESinkProfiler::AddPackets(uint8_t *data, unsigned int frames)
78 int64_t ts = CurrentHostCounter();
79 CLog::Log(LOGDEBUG, "CAESinkProfiler::AddPackets - latency %f ms", (float)(ts - m_ts) / 1000000.0f);
84 void CAESinkProfiler::Drain()
88 void CAESinkProfiler::EnumerateDevices (AEDeviceList &devices, bool passthrough)
90 devices.push_back(AEDevice("Profiler", "Profiler"));