1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/*
* Copyright (C) 2022 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
#include <string>
namespace UTILS
{
namespace DISCS
{
/*! \brief Abstracts a disc type
*/
enum class DiscType
{
UNKNOWN, ///< the default value, the application doesn't know what the device is
DVD, ///< dvd disc
BLURAY ///< blu-ray disc
};
/*! \brief Abstracts the info the app knows about a disc (type, name, serial)
*/
struct DiscInfo
{
/*! \brief The disc type, \sa DiscType */
DiscType type{DiscType::UNKNOWN};
/*! \brief The disc serial number */
std::string serial;
/*! \brief The disc label (equivalent to the mount point label) */
std::string name;
/*! \brief Check if the info is empty (e.g. after probing)
\return true if the info is empty, false otherwise
*/
bool empty() { return (type == DiscType::UNKNOWN && name.empty() && serial.empty()); }
/*! \brief Clears all the DiscInfo members
*/
void clear()
{
type = DiscType::UNKNOWN;
name.clear();
serial.clear();
}
};
/*! \brief Try to obtain the disc info (type, name, serial) of a given media path
\param[in, out] info The disc info struct
\param mediaPath The disc mediapath (e.g. /dev/cdrom, D\://, etc)
\return true if getting the disc info was successfull
*/
bool GetDiscInfo(DiscInfo& info, const std::string& mediaPath);
/*! \brief Try to probe the provided media path as a DVD
\param mediaPath The disc mediapath (e.g. /dev/cdrom, D\://, etc)
\return the DiscInfo for the given media path (might be an empty struct)
*/
DiscInfo ProbeDVDDiscInfo(const std::string& mediaPath);
/*! \brief Try to probe the provided media path as a Bluray
\param mediaPath The disc mediapath (e.g. /dev/cdrom, D\://, etc)
\return the DiscInfo for the given media path (might be an empty struct)
*/
DiscInfo ProbeBlurayDiscInfo(const std::string& mediaPath);
} // namespace DISCS
} // namespace UTILS
|