StormByte C++ Library: Multimedia module 0.0.9999
StormByte-Multimedia is a StormByte library module for parsing configuration files
Loading...
Searching...
No Matches
frame.hxx
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024-2026 David C. Manuelda (StormBytePP)
3 *
4 * This file is part of StormByte-Multimedia.
5 *
6 * StormByte-Multimedia original source is dual-licensed:
7 *
8 * 1. GNU Lesser General Public License v3.0 (or later)
9 * You may redistribute and/or modify this file under the terms of the
10 * GNU Lesser General Public License as published by the Free Software
11 * Foundation, either version 3 of the License, or (at your option)
12 * any later version.
13 *
14 * 2. Commercial license
15 * Alternatively, this file may be used under the terms of a commercial
16 * license agreement with the copyright holder
17 * (David C. Manuelda <StormByte@gmail.com>).
18 *
19 * Both licenses apply only to original StormByte-Multimedia source in this
20 * file. Third-party components — including FFmpeg and embedded trained data —
21 * remain under their own licenses and are not covered by the commercial grant.
22 *
23 * Neither license grants any patent rights. Any patent licenses required
24 * to use this software or third-party components must be obtained separately
25 * from the patent holders.
26 *
27 * StormByte-Multimedia is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU Lesser General Public License for more details.
31 *
32 * You should have received a copy of the GNU Lesser General Public License
33 * version 3 along with StormByte-Multimedia. If not, see
34 * <https://www.gnu.org/licenses/lgpl-3.0.html>.
35 *
36 * SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-StormByte-Commercial
37 */
38
39#pragma once
40
41#include <StormByte/buffer/fifo.hxx>
48
49#include <cstdint>
50#include <memory>
51#include <optional>
52#include <string>
53#include <vector>
54
77 friend class Backend::Pipeline::Frame;
78 friend class Decoder;
79 friend class Encoder;
80 friend class Filter::FFmpeg;
81 friend Decoder& operator>>(Decoder& decoder, Frame& frame) noexcept;
82 friend Frame& operator>>(Frame& frame, Encoder& encoder) noexcept;
83
84 public:
85 using PointerType = std::shared_ptr<Frame>;
86
98 Frame() noexcept;
99
117 Frame(int track, enum StormByte::Multimedia::Type type, enum Producer producer,
118 StormByte::Buffer::FIFO payload,
119 std::optional<Property::Duration> pts,
120 std::optional<Property::Duration> duration,
121 std::optional<Property::Video> video,
122 std::vector<class SideData> attachments,
123 std::optional<Property::Audio> audio,
124 std::uint64_t serial,
125 std::uint64_t part) noexcept;
126
135 Frame(Frame&& other) noexcept;
136
140 ~Frame() noexcept override;
141
149 Frame& operator=(Frame&& other) noexcept;
150
164 inline const std::optional<Property::Duration>& Pts() const noexcept {
165 return m_pts;
166 }
167
178 inline const std::optional<Property::Duration>& Dts() const noexcept {
179 return m_dts;
180 }
181
186 inline const std::optional<Property::Duration>& Duration() const noexcept {
187 return m_duration;
188 }
189
194 inline const std::optional<std::string>& Language() const noexcept {
195 return m_language;
196 }
197
202 inline const std::optional<std::string>& Title() const noexcept {
203 return m_title;
204 }
205
224 inline const std::optional<std::uint64_t>& Serial() const noexcept {
225 return m_serial;
226 }
227
234 inline std::uint64_t Part() const noexcept {
235 return m_part;
236 }
237
251 inline const std::optional<Property::Video>& Video() const noexcept {
252 return m_video;
253 }
254
259 inline const std::optional<Property::Audio>& Audio() const noexcept {
260 return m_audio;
261 }
262
268 inline const std::vector<class SideData>& Attachments() const noexcept {
269 return m_attachments;
270 }
271
288 StormByte::Buffer::FIFO& Payload() noexcept;
289
294 inline const StormByte::Buffer::FIFO& Payload() const noexcept {
295 return m_payload;
296 }
297
302 private:
317 Frame(const Frame& other) noexcept;
318
327 Frame& operator=(const Frame& other) noexcept;
328
337 void Bind(std::unique_ptr<Backend::Pipeline::Frame> backend) noexcept;
338
345 void BecomeEmpty() noexcept;
346
353 Item::PointerType Clone() const override;
354
362 Item::PointerType Move() override;
363
364 StormByte::Buffer::FIFO m_payload;
365 std::optional<Property::Duration> m_pts;
366 std::optional<Property::Duration> m_dts;
367 std::optional<Property::Duration> m_duration;
368 std::optional<Property::Video> m_video;
369 std::optional<Property::Audio> m_audio;
370 std::optional<std::string> m_language;
371 std::optional<std::string> m_title;
372 std::vector<class SideData> m_attachments;
373 std::optional<std::uint64_t> m_serial;
374 std::uint64_t m_part;
375 std::unique_ptr<Backend::Pipeline::Frame> m_backend;
376 };
377}
Decodes packets of one origin track into frames.
Definition decoder.hxx:141
Encodes frames of one output track into packets.
Definition encoder.hxx:103
Abstract base for every StormByte Multimedia filter.
Definition ffmpeg.hxx:226
One decoded access unit.
Definition frame.hxx:76
const std::optional< Property::Duration > & Duration() const noexcept
Frame duration on the stream clock.
Definition frame.hxx:186
const std::vector< class SideData > & Attachments() const noexcept
Raw side data captured at receive.
Definition frame.hxx:268
const std::optional< std::string > & Language() const noexcept
Stream language tag copied from File metadata.
Definition frame.hxx:194
friend Decoder & operator>>(Decoder &decoder, Frame &frame) noexcept
const std::optional< std::uint64_t > & Serial() const noexcept
Monotonic lineage id assigned when the unit enters the pipe.
Definition frame.hxx:224
std::shared_ptr< Frame > PointerType
Definition frame.hxx:85
StormByte::Buffer::FIFO & Payload() noexcept
Payload.
const std::optional< std::string > & Title() const noexcept
Stream title tag copied from File metadata.
Definition frame.hxx:202
const std::optional< Property::Duration > & Dts() const noexcept
Decode timestamp on the stream clock.
Definition frame.hxx:178
friend Frame & operator>>(Frame &frame, Encoder &encoder) noexcept
const std::optional< Property::Video > & Video() const noexcept
Video properties (includes HDR10 when set).
Definition frame.hxx:251
const std::optional< Property::Audio > & Audio() const noexcept
Audio properties (layout, rate, channels).
Definition frame.hxx:259
std::uint64_t Part() const noexcept
Sub-id inside Serial when one demuxed unit yields several frames.
Definition frame.hxx:234
Facade shared by Frame and Packet.
Definition item.hxx:91
One side-data blob attached to a Frame or Packet.
Definition side_data.hxx:90
Demux / decode / filter / encode / mux types.
Producer
Definition typedefs.hxx:105
Type
Kind of media stream or codec.
Definition type.hxx:55
#define STORMBYTE_MULTIMEDIA_PUBLIC
Imported symbol.
Definition visibility.h:47