Merge pull request #26220 from 78andyp/blurayfixes
[xbmc.git] / xbmc / utils / DiscsUtils.h
blob08752eaa1c3a9723038acbabd97b1cc61446b356
1 /*
2 * Copyright (C) 2022 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 <string>
13 namespace UTILS
15 namespace DISCS
18 /*! \brief Abstracts a disc type
20 enum class DiscType
22 UNKNOWN, ///< the default value, the application doesn't know what the device is
23 DVD, ///< dvd disc
24 BLURAY ///< blu-ray disc
27 /*! \brief Abstracts the info the app knows about a disc (type, name, serial)
29 struct DiscInfo
31 /*! \brief The disc type, \sa DiscType */
32 DiscType type{DiscType::UNKNOWN};
33 /*! \brief The disc serial number */
34 std::string serial;
35 /*! \brief The disc label (equivalent to the mount point label) */
36 std::string name;
38 /*! \brief Check if the info is empty (e.g. after probing)
39 \return true if the info is empty, false otherwise
41 bool empty() { return (type == DiscType::UNKNOWN && name.empty() && serial.empty()); }
43 /*! \brief Clears all the DiscInfo members
45 void clear()
47 type = DiscType::UNKNOWN;
48 name.clear();
49 serial.clear();
53 /*! \brief Try to obtain the disc info (type, name, serial) of a given media path
54 \param[in, out] info The disc info struct
55 \param mediaPath The disc mediapath (e.g. /dev/cdrom, D\://, etc)
56 \return true if getting the disc info was successfull
58 bool GetDiscInfo(DiscInfo& info, const std::string& mediaPath);
60 /*! \brief Try to probe the provided media path as a DVD
61 \param mediaPath The disc mediapath (e.g. /dev/cdrom, D\://, etc)
62 \return the DiscInfo for the given media path (might be an empty struct)
64 DiscInfo ProbeDVDDiscInfo(const std::string& mediaPath);
66 /*! \brief Try to probe the provided media path as a Bluray
67 \param mediaPath The disc mediapath (e.g. /dev/cdrom, D\://, etc)
68 \return the DiscInfo for the given media path (might be an empty struct)
70 DiscInfo ProbeBlurayDiscInfo(const std::string& mediaPath);
72 } // namespace DISCS
73 } // namespace UTILS