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.
11 #include "MediaSource.h"
17 #include "cdioSupport.h"
20 namespace MEDIA_DETECT
24 /*! \brief Abstracts a generic storage device type*/
27 UNKNOWN
, /*!< the storage type is unknown */
28 OPTICAL
/*!< an optical device (e.g. DVD or Bluray) */
31 /*! \brief Abstracts a generic storage device */
34 /*! Device name/label */
36 /*! Device mountpoint/path */
38 /*! The storage type (e.g. OPTICAL) */
39 STORAGE::Type type
{STORAGE::Type::UNKNOWN
};
41 } // namespace STORAGE
42 } // namespace MEDIA_DETECT
44 class IStorageEventsCallback
47 virtual ~IStorageEventsCallback() = default;
49 /*! \brief Callback executed when a new storage device is added
50 * @param device the storage device
52 virtual void OnStorageAdded(const MEDIA_DETECT::STORAGE::StorageDevice
& device
) = 0;
54 /*! \brief Callback executed when a new storage device is safely removed
55 * @param device the storage device
57 virtual void OnStorageSafelyRemoved(const MEDIA_DETECT::STORAGE::StorageDevice
& device
) = 0;
59 /*! \brief Callback executed when a new storage device is unsafely removed
60 * @param device the storage device
62 virtual void OnStorageUnsafelyRemoved(const MEDIA_DETECT::STORAGE::StorageDevice
& device
) = 0;
65 class IStorageProvider
68 virtual ~IStorageProvider() = default;
70 virtual void Initialize() = 0;
71 virtual void Stop() = 0;
73 virtual void GetLocalDrives(VECSOURCES
&localDrives
) = 0;
74 virtual void GetRemovableDrives(VECSOURCES
&removableDrives
) = 0;
75 virtual std::string
GetFirstOpticalDeviceFileName()
78 return std::string(MEDIA_DETECT::CLibcdio::GetInstance()->GetDeviceFileName());
84 virtual bool Eject(const std::string
& mountpath
) = 0;
86 virtual std::vector
<std::string
> GetDiskUsage() = 0;
88 virtual bool PumpDriveChangeEvents(IStorageEventsCallback
*callback
) = 0;
90 /**\brief Called by media manager to create platform storage provider
92 * This method used to create platform specified storage provider
94 static std::unique_ptr
<IStorageProvider
> CreateInstance();