1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:27:45 +00:00

LibVideo: Abstract media container format demuxing

This creates an abstract Demuxer class to allow multiple container
container formats to be easily used by video playback systems.
This commit is contained in:
Zaggy1024 2022-10-29 17:02:43 -05:00 committed by Andreas Kling
parent 3a2f6c700d
commit 0a4def1208
8 changed files with 327 additions and 36 deletions

View file

@ -0,0 +1,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(ByteBuffer const& 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; }
ByteBuffer const& data() const { return m_data; }
CodingIndependentCodePoints container_cicp() const { return m_container_cicp; }
Time timestamp() const { return m_timestamp; }
private:
ByteBuffer m_data;
CodingIndependentCodePoints m_container_cicp;
Time m_timestamp;
};
// FIXME: Add samples for audio, subtitles, etc.
}