ladybird/Userland/Libraries/LibVideo/Containers/Demuxer.h
Zaggy1024 9cf7e8c5aa LibVideo: Reorganize demuxer file hierarchy and rename Matroska files
As new demuxers are added, this will get quite full of files, so it'll
be good to have a separate folder for these.

To avoid too many chained namespaces, the Containers subdirectory is
not also a namespace, but the Matroska folder is for the sake of
separating the multiple classes for parsed information entering the
Video namespace.
2022-11-25 23:28:39 +01:00

39 lines
983 B
C++

/*
* Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/NonnullOwnPtr.h>
#include <LibCore/Object.h>
#include <LibVideo/DecoderError.h>
#include <LibVideo/Sample.h>
#include <LibVideo/Track.h>
namespace Video {
class Demuxer {
public:
virtual ~Demuxer() = default;
virtual Vector<Track> get_tracks_for_type(TrackType type) = 0;
DecoderErrorOr<NonnullOwnPtr<VideoSample>> get_next_video_sample_for_track(Track track)
{
VERIFY(track.type() == TrackType::Video);
auto sample = TRY(get_next_sample_for_track(track));
VERIFY(sample->is_video_sample());
return sample.release_nonnull<VideoSample>();
}
virtual DecoderErrorOr<void> seek_to_most_recent_keyframe(Track track, size_t timestamp) = 0;
virtual Time duration() = 0;
protected:
virtual DecoderErrorOr<NonnullOwnPtr<Sample>> get_next_sample_for_track(Track track) = 0;
};
}