StormByte-Multimedia 3.3.2
C++26 multimedia processing module of the StormByte suite
Loading...
Searching...
No Matches
track.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 * A written StormByte commercial agreement may license this original source
24 * on terms other than the LGPL, including specific use, distribution or
25 * linking arrangements such as static linking, as stated in that agreement.
26 * It does not grant rights to dependencies or waive their license conditions.
27 * Enabling WITH_GPL or WITH_NONFREE may include components with separate
28 * obligations for modification, linking (static or dynamic), redistribution
29 * or works that incorporate them. The person modifying, linking, packaging or
30 * distributing the resulting work is responsible for determining and meeting
31 * all applicable requirements, including any needed patent permissions.
32 * A StormByte commercial agreement does not provide those rights for GPL or
33 * nonfree components.
34 *
35 * Neither license grants any patent rights. Any patent licenses required
36 * to use this software or third-party components must be obtained separately
37 * from the patent holders.
38 *
39 * StormByte-Multimedia is distributed in the hope that it will be useful,
40 * but WITHOUT ANY WARRANTY; without even the implied warranty of
41 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42 * GNU Lesser General Public License for more details.
43 *
44 * You should have received a copy of the GNU Lesser General Public License
45 * version 3 along with StormByte-Multimedia. If not, see
46 * <https://www.gnu.org/licenses/lgpl-3.0.html>.
47 *
48 * SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-StormByte-Commercial
49 */
50
51#pragma once
52
56#include <StormByte/safe/clonable.hxx>
57#include <StormByte/safe/iterable.hxx>
58#include <StormByte/safe/vector.hxx>
59#include <StormByte/size.hxx>
60
66namespace StormByte {
72 namespace Multimedia {
78 namespace Pipeline {
96 public StormByte::Safe::Clonable<Track, StormByte::Safe::Shared<Track>> {
97 public:
102
108 Track(int in, enum StormByte::Multimedia::Type type) noexcept;
109
116 Track(int in, const Config::Base& config);
117
124 Track(int in, Config::Base&& config);
125
130 Track(const Track& other);
131
136 Track(Track&& other) noexcept;
137
141 virtual ~Track() noexcept override;
142
148 Track& operator=(const Track& other);
149
155 Track& operator=(Track&& other) noexcept;
156
160
167 PointerType Clone() const override;
168
175 PointerType Move() override;
176
181
186 inline enum StormByte::Multimedia::Type Type() const noexcept {
187 return m_type;
188 }
189
194 inline int In() const noexcept {
195 return m_in;
196 }
197
202 inline const Config::Base* Config() const noexcept {
203 return m_config.get();
204 }
205
209
210 private:
211 int m_in;
212 enum StormByte::Multimedia::Type m_type;
214 };
215 }
216 }
217}
218
224
230namespace StormByte {
236 namespace Multimedia {
242 namespace Pipeline {
254 private StormByte::Safe::Iterable<StormByte::Safe::Vector<StormByte::Safe::Shared<Track>>> {
255 private:
260
261 public:
266
271
276
281
285 Tracks() noexcept;
286
291 Tracks(const Tracks& other);
292
297 Tracks(Tracks&& other) noexcept;
298
302 virtual ~Tracks() noexcept;
303
309 Tracks& operator=(const Tracks& other);
310
316 Tracks& operator=(Tracks&& other) noexcept;
317
321
326
331 inline const_iterator begin() const noexcept {
332 return Iterable::begin();
333 }
334
339 inline const_iterator end() const noexcept {
340 return Iterable::end();
341 }
342
347 inline const_iterator cbegin() const noexcept {
348 return Iterable::cbegin();
349 }
350
355 inline const_iterator cend() const noexcept {
356 return Iterable::cend();
357 }
358
364 const Track& operator[](size_type index) const;
365
370 inline size_type size() const noexcept {
371 return Iterable::size();
372 }
373
378 inline bool empty() const noexcept {
379 return Iterable::empty();
380 }
381
386 void add(const Track& track);
387
392 void add(Track&& track);
393
397 };
398 }
399 }
400}
401
STORMBYTE_DECLARE_MAYBE_SAFE(StormByte::Buffer::Bridge)
Common destination-stream identity.
Definition base.hxx:142
One source stream that enters the tube.
Definition track.hxx:96
int In() const noexcept
Origin stream index.
Definition track.hxx:194
Track(int in, enum StormByte::Multimedia::Type type) noexcept
Track without a config leaf.
PointerType Move() override
Move into a new pointer.
Track(int in, const Config::Base &config)
Builds a track; clones config and copies its type.
const Config::Base * Config() const noexcept
Track config leaf, if any.
Definition track.hxx:202
virtual ~Track() noexcept override
Destructor.
Track(Track &&other) noexcept
Move constructor.
Track(const Track &other)
Copy constructor.
PointerType Clone() const override
Deep copy.
Track(int in, Config::Base &&config)
Builds a track; moves config and copies its type.
Ordered tube tracks.
Definition track.hxx:254
void add(Track &&track)
Appends track via Track::Move.
StormByte::Size size_type
Count type.
Definition track.hxx:270
const_iterator begin() const noexcept
Const begin.
Definition track.hxx:331
const_iterator cend() const noexcept
Const end.
Definition track.hxx:355
const Track & operator[](size_type index) const
Track at mux slot index.
StormByte::Safe::Vector< StormByte::Safe::Shared< Track > > ContainerType
Base-owned ordered track handles.
Definition track.hxx:265
const_iterator end() const noexcept
Const end.
Definition track.hxx:339
Iterable::const_iterator const_iterator
Read-only Safe iterator; dereference yields a shared track handle.
Definition track.hxx:275
size_type size() const noexcept
Element count.
Definition track.hxx:370
void add(const Track &track)
Appends a clone of track.
bool empty() const noexcept
Whether there are no tracks.
Definition track.hxx:378
const_iterator cbegin() const noexcept
Const begin.
Definition track.hxx:347
Multimedia module of the StormByte suite.
Pipeline Demux / decode / filter / encode / mux types.
Demux / decode / filter / encode / mux types.
Multimedia module of the StormByte suite.
Type
Kind of media stream or codec.
Definition type.hxx:72
Root namespace of the StormByte C++ suite.
#define STORMBYTE_MULTIMEDIA_PUBLIC
Definition visibility.h:61