Commit 3ef2529d authored by Alexey Sokolov's avatar Alexey Sokolov Committed by Hugo Beauzée-Luyssen

Protect enums from accidental cast to int

Signed-off-by: 's avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent 212aeab1
......@@ -41,7 +41,7 @@ class Media : public Internal<libvlc_media_t>
{
public:
enum FromType
enum class FromType
{
/**
* Create a media for a certain file path.
......@@ -62,6 +62,10 @@ public:
*/
AsNode,
};
// To be able to write Media::FromLocation
constexpr static FromType FromPath = FromType::FromPath;
constexpr static FromType FromLocation = FromType::FromLocation;
constexpr static FromType AsNode = FromType::AsNode;
/**
* @brief Media Constructs a libvlc Media instance
......
......@@ -80,13 +80,17 @@ private:
class MediaTrack
{
public:
enum Type
enum class Type
{
Unknown = -1,
Audio,
Video,
Subtitle
};
constexpr static Type Unknown = Type::Unknown;
constexpr static Type Audio = Type::Audio;
constexpr static Type Video = Type::Video;
constexpr static Type Subtitle = Type::Subtitle;
uint32_t codec() const
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment