summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibVideo/Sample.h
blob: 0a186103ccb12a67745e32556bfbcb212ea06ada (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
/*
 * Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/ByteBuffer.h>
#include <AK/Time.h>
#include <LibVideo/Color/CodingIndependentCodePoints.h>

namespace Video {

class Sample {
public:
    virtual ~Sample() = default;

    virtual bool is_video_sample() const { return false; }
};

class VideoSample : public Sample {
public:
    VideoSample(ReadonlyBytes data, CodingIndependentCodePoints container_cicp, Time timestamp)
        : m_data(data)
        , m_container_cicp(container_cicp)
        , m_timestamp(timestamp)
    {
    }

    bool is_video_sample() const override { return true; }
    ReadonlyBytes const& data() const { return m_data; }
    CodingIndependentCodePoints container_cicp() const { return m_container_cicp; }
    Time timestamp() const { return m_timestamp; }

private:
    ReadonlyBytes m_data;
    CodingIndependentCodePoints m_container_cicp;
    Time m_timestamp;
};

// FIXME: Add samples for audio, subtitles, etc.

}