/* * Copyright (c) 2022, Gregory Bertilson * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include "DecoderError.h" #include "Sample.h" #include "Track.h" namespace Video { class Demuxer { public: virtual ~Demuxer() = default; virtual Vector get_tracks_for_type(TrackType type) = 0; DecoderErrorOr> 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(); } virtual DecoderErrorOr seek_to_most_recent_keyframe(Track track, size_t timestamp) = 0; virtual Time duration() = 0; protected: virtual DecoderErrorOr> get_next_sample_for_track(Track track) = 0; }; }