[XAudio2] avoid leak + fix voice creation for closest match
[xbmc.git] / xbmc / Autorun.h
blobac0f7d4bdc54d322ed02632e32f8191d11af7125
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 // CAutorun - Autorun for different Cd Media
12 // like DVD Movies or XBOX Games
14 // by Bobbin007 in 2003
19 #ifdef HAS_OPTICAL_DRIVE
21 #include <memory>
22 #include <string>
23 #include <utility>
24 #include <vector>
26 struct IntegerSettingOption;
28 namespace XFILE
30 class IDirectory;
33 class CSetting;
35 enum AutoCDAction
37 AUTOCD_NONE = 0,
38 AUTOCD_PLAY,
39 AUTOCD_RIP
42 namespace MEDIA_DETECT
44 class CAutorun
46 public:
47 CAutorun();
48 virtual ~CAutorun();
49 static bool CanResumePlayDVD(const std::string& path);
50 static bool PlayDisc(const std::string& path="", bool bypassSettings = false, bool startFromBeginning = false);
51 static bool PlayDiscAskResume(const std::string& path="");
52 bool IsEnabled() const;
53 void Enable();
54 void Disable();
55 void HandleAutorun();
57 /*! \brief Execute the autorun. Used for example to automatically rip cds or play optical discs
58 * @param path the path for the item (e.g. the disc path)
59 * @return true if some action was executed, false otherwise
61 static bool ExecuteAutorun(const std::string& path);
63 static void SettingOptionAudioCdActionsFiller(const std::shared_ptr<const CSetting>& setting,
64 std::vector<IntegerSettingOption>& list,
65 int& current,
66 void* data);
68 protected:
69 static bool RunDisc(XFILE::IDirectory* pDir, const std::string& strDrive, int& nAddedToPlaylist, bool bRoot, bool bypassSettings, bool startFromBeginning);
70 bool m_bEnable;
74 #endif