blob: 395db8b384b94c774325b6261fcd4d3231181117 (
plain)
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
|
/*
* Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/HashFunctions.h>
#include <AK/Traits.h>
#include <AK/Types.h>
namespace Video {
enum class TrackType : u32 {
Video,
Audio,
Subtitles,
};
struct Track {
public:
Track(TrackType type, size_t identifier)
: m_type(type)
, m_identifier(identifier)
{
}
TrackType type() { return m_type; }
size_t identifier() const { return m_identifier; }
bool operator==(Track const& other) const
{
return m_type == other.m_type && m_identifier == other.m_identifier;
}
unsigned hash() const
{
return pair_int_hash(to_underlying(m_type), m_identifier);
}
private:
TrackType m_type;
size_t m_identifier;
};
}
template<>
struct AK::Traits<Video::Track> : public GenericTraits<Video::Track> {
static unsigned hash(Video::Track const& t) { return t.hash(); }
};
|