[WASAPI] set stream audio category
[xbmc.git] / xbmc / cores / VideoPlayer / AudioSinkAE.h
blobe2aff528aa1146ee3eb1f48d6e002067075d71dd
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "cores/AudioEngine/Interfaces/AE.h"
12 #include "cores/AudioEngine/Interfaces/AEStream.h"
13 #include "cores/AudioEngine/Utils/AEChannelInfo.h"
14 #include "threads/CriticalSection.h"
16 #include <atomic>
17 #include <mutex>
19 #include "PlatformDefs.h"
21 extern "C" {
22 #include <libavcodec/avcodec.h>
25 typedef struct stDVDAudioFrame DVDAudioFrame;
27 class CDVDClock;
29 class CAudioSinkAE : IAEClockCallback
31 public:
32 explicit CAudioSinkAE(CDVDClock *clock);
33 ~CAudioSinkAE() override;
35 void SetVolume(float fVolume);
36 void SetDynamicRangeCompression(long drc);
37 void Pause();
38 void Resume();
39 bool Create(const DVDAudioFrame &audioframe, AVCodecID codec, bool needresampler);
40 bool IsValidFormat(const DVDAudioFrame &audioframe);
41 void Destroy(bool finish);
42 unsigned int AddPackets(const DVDAudioFrame &audioframe);
43 double GetPlayingPts();
44 double GetCacheTime();
45 double GetCacheTotal(); // returns total time a stream can buffer
46 double GetMaxDelay(); // returns total time of audio in AE for the stream
47 double GetDelay(); // returns the time it takes to play a packet if we add one at this time
48 double GetSyncError();
49 void SetSyncErrorCorrection(double correction);
51 /*!
52 * \brief Returns the resample ratio, or 0.0 if unknown/invalid
54 double GetResampleRatio();
56 void SetResampleMode(int mode);
57 void Flush();
58 void Drain();
59 void AbortAddPackets();
61 double GetClock() override;
62 double GetClockSpeed() override;
64 CAEStreamInfo::DataType GetPassthroughStreamType(AVCodecID codecId, int samplerate, int profile);
66 protected:
67 IAE::StreamPtr m_pAudioStream;
68 double m_playingPts;
69 double m_timeOfPts;
70 double m_syncError;
71 unsigned int m_syncErrorTime;
72 double m_resampleRatio = 0.0; // invalid
73 CCriticalSection m_critSection;
75 AEDataFormat m_dataFormat;
76 unsigned int m_sampleRate;
77 int m_iBitsPerSample;
78 bool m_bPassthrough;
79 CAEChannelInfo m_channelLayout;
80 CAEStreamInfo::DataType m_dataType;
81 bool m_bPaused;
83 std::atomic_bool m_bAbort;
84 CDVDClock *m_pClock;