Serenity Operating System
at master 51 lines 987 B view raw
1/* 2 * Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#pragma once 8 9#include <AK/HashFunctions.h> 10#include <AK/Traits.h> 11#include <AK/Types.h> 12 13namespace Video { 14 15enum class TrackType : u32 { 16 Video, 17 Audio, 18 Subtitles, 19}; 20 21struct Track { 22public: 23 Track(TrackType type, size_t identifier) 24 : m_type(type) 25 , m_identifier(identifier) 26 { 27 } 28 29 TrackType type() { return m_type; } 30 size_t identifier() const { return m_identifier; } 31 32 bool operator==(Track const& other) const 33 { 34 return m_type == other.m_type && m_identifier == other.m_identifier; 35 } 36 unsigned hash() const 37 { 38 return pair_int_hash(to_underlying(m_type), m_identifier); 39 } 40 41private: 42 TrackType m_type; 43 size_t m_identifier; 44}; 45 46} 47 48template<> 49struct AK::Traits<Video::Track> : public GenericTraits<Video::Track> { 50 static unsigned hash(Video::Track const& t) { return t.hash(); } 51};