Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
VideoPresentation.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "VideoDecoder.hpp"
4#include "LegacyBitmap.hpp"
5#include "LegacySequence.hpp"
7#include <memory>
8
9namespace monopoly::video
10{
12 {
13 std::uint64_t elapsedMicroseconds{};
14 std::uint64_t consumedAudioBytes{};
17 };
18
19 // Decoder output is top-down straight RGBA. The same image is published
20 // through RuntimeBitmapStore and the existing Overlay2D renderer.
21 [[nodiscard]] std::expected<data::LegacyBitmapRGBA8, std::string>
22 prepareVideoFrame(DecodedVideoFrame frame, const data::SequenceVideoData& options);
23 [[nodiscard]] std::expected<sequence::Matrix2D, std::string>
24 videoFrameTransform(std::uint32_t width, std::uint32_t height,
26 const sequence::Matrix2D& world);
27
29 binkDoubleSizeBounds(std::uint32_t width, std::uint32_t height) noexcept;
30
32 {
33 public:
36 Presentation(const Presentation&) = delete;
38 [[nodiscard]] std::expected<void, std::string> open(
39 const std::filesystem::path& file, bool enableAudio,
40 const DecoderOptions& options = {});
42 // sequence time supplies silent movies and the tail after shorter audio.
43 // Pausing does not consume PCM or advance the displayed movie clock.
44 [[nodiscard]] std::expected<PresentationClock, std::string> pump(
45 std::uint64_t sequenceMicroseconds, bool paused = false);
46 [[nodiscard]] std::expected<std::optional<DecodedVideoFrame>, std::string>
47 frameAt(std::uint64_t elapsedMicroseconds);
48 [[nodiscard]] std::expected<void, std::string> seek(
49 std::uint64_t timestampMicroseconds, std::uint64_t sequenceMicroseconds);
50 [[nodiscard]] std::expected<void, std::string> setGain(float gain);
51 [[nodiscard]] std::expected<void, std::string> setPitch(
52 std::uint32_t hertz, std::uint32_t originalHertz);
53 void setPanning(std::int32_t percentage) noexcept;
54 [[nodiscard]] bool videoDrained() const;
55 void stop() noexcept;
56 private:
57 struct Impl;
58 std::unique_ptr<Impl> impl_;
59 };
60}
std::uint32_t height
std::uint32_t width
unsigned index
std::size_t frame
std::expected< std::optional< DecodedVideoFrame >, std::string > frameAt(std::uint64_t elapsedMicroseconds)
std::expected< void, std::string > setPitch(std::uint32_t hertz, std::uint32_t originalHertz)
Presentation & operator=(const Presentation &)=delete
Presentation(const Presentation &)=delete
std::expected< PresentationClock, std::string > pump(std::uint64_t sequenceMicroseconds, bool paused=false)
std::expected< void, std::string > setGain(float gain)
void setPanning(std::int32_t percentage) noexcept
std::expected< void, std::string > open(const std::filesystem::path &file, bool enableAudio, const DecoderOptions &options={})
std::expected< void, std::string > seek(std::uint64_t timestampMicroseconds, std::uint64_t sequenceMicroseconds)
DecoderSnapshot snapshot() const
std::expected< sequence::Matrix2D, std::string > videoFrameTransform(std::uint32_t width, std::uint32_t height, const data::Sequence2DBoundingBoxAttribute &bounds, const sequence::Matrix2D &world)
std::expected< data::LegacyBitmapRGBA8, std::string > prepareVideoFrame(DecodedVideoFrame frame, const data::SequenceVideoData &options)
data::Sequence2DBoundingBoxAttribute binkDoubleSizeBounds(std::uint32_t width, std::uint32_t height) noexcept