Rialto 0.1
Rialto media pipeline API
Loading...
Searching...
No Matches
MediaCommon.h
Go to the documentation of this file.
1/*
2 * If not stated otherwise in this file or this component's LICENSE file the
3 * following copyright and licenses apply:
4 *
5 * Copyright 2022 Sky UK
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20#ifndef FIREBOLT_RIALTO_MEDIA_COMMON_H_
21#define FIREBOLT_RIALTO_MEDIA_COMMON_H_
22
30#include <limits>
31#include <optional>
32#include <stddef.h>
33#include <stdint.h>
34#include <utility>
35#include <vector>
36
37namespace firebolt::rialto
38{
42constexpr int32_t kInvalidSessionId{-1};
43
47constexpr uint32_t kInvalidAudioChannels{0};
48
52constexpr uint32_t kInvalidAudioSampleRate{0};
53
57constexpr int32_t kUndefinedSize{0};
58
62constexpr uint32_t kInvalidLimitBuffering{std::numeric_limits<uint32_t>::max()};
63
67constexpr uint64_t kUndefinedPosition{std::numeric_limits<uint64_t>::max()};
68
73{
74 UNKNOWN,
75 AUDIO,
76 VIDEO,
77 SUBTITLE
78};
79
84{
85 UNKNOWN,
86 AUDIO,
87 VIDEO,
88 VIDEO_DOLBY_VISION,
89 SUBTITLE
90};
91
95enum class AudioEaseType
96{
97 LINEAR = 0,
98 INCUBIC,
99 OUTCUBIC
100};
101
105enum class MediaType
106{
107 UNKNOWN,
108 MSE
109};
110
116{
117 OK,
118 EOS,
119 ERROR,
122};
123
136enum class NetworkState
137{
138 UNKNOWN,
139 IDLE,
140 BUFFERING,
142 BUFFERED,
143 STALLED,
147};
148
159{
160 UNKNOWN,
161 IDLE,
162 PLAYING,
163 PAUSED,
164 SEEKING,
165 SEEK_DONE,
166 STOPPED,
168 FAILURE
169};
170
174enum class Format
175{
176 S8,
177 U8,
178 S16LE,
179 S16BE,
180 U16LE,
181 U16BE,
182 S24_32LE,
183 S24_32BE,
184 U24_32LE,
185 U24_32BE,
186 S32LE,
187 S32BE,
188 U32LE,
189 U32BE,
190 S24LE,
191 S24BE,
192 U24LE,
193 U24BE,
194 S20LE,
195 S20BE,
196 U20LE,
197 U20BE,
198 S18LE,
199 S18BE,
200 U18LE,
201 U18BE,
202 F32LE,
203 F32BE,
204 F64LE,
205 F64BE
206};
207
211enum class Layout
212{
213 INTERLEAVED,
214 NON_INTERLEAVED
215};
216
221{
224 std::vector<uint8_t> codecSpecificConfig;
225 std::optional<Format> format;
226 std::optional<Layout> layout;
227 std::optional<uint64_t> channelMask;
228 std::vector<std::vector<uint8_t>> streamHeader;
229 std::optional<bool>
231};
232
239{
240 OK,
241 NO_SPACE,
242 ERROR
243};
244
250{
253};
254
259{
260 uint32_t maxWidth;
261 uint32_t maxHeight;
262};
263
274
279{
280 uint64_t processed;
281 uint64_t dropped;
282};
283
298
303{
304 UNKNOWN,
305 TEMPORARY,
308};
309
313enum class InitDataType
314{
315 UNKNOWN,
316 CENC,
317 KEY_IDS,
318 WEBM,
319 DRMHEADER
320};
321
325enum class KeyStatus
326{
327 USABLE,
328 EXPIRED,
330 PENDING,
331 INTERNAL_ERROR,
332 RELEASED
333};
334
339{
340 UNDEFINED,
341 NAL,
342 AU
343};
344
348enum class StreamFormat
349{
350 UNDEFINED,
351 RAW,
352 AVC,
353 BYTE_STREAM,
354 HVC1,
355 HEV1
356};
357
361typedef std::vector<std::pair<std::vector<unsigned char>, KeyStatus>> KeyStatusVector;
362
367{
368 uint32_t offsetMain;
369 uint32_t lengthMain;
370 uint32_t offsetWrap;
371 uint32_t lengthWrap;
372};
373
378{
379 uint32_t rate;
380 uint32_t channels;
381 uint32_t sampleSize;
383 bool isSigned;
384 bool isFloat;
385};
386
397
402{
403 UNKNOWN,
404 IDLE,
405 PLAYING,
406 PAUSED,
408 FAILURE
409};
410
414enum class CipherMode
415{
416 UNKNOWN,
417 CENC, /* AES-CTR scheme */
418 CBC1, /* AES-CBC scheme */
419 CENS, /* AES-CTR subsample pattern encryption scheme */
420 CBCS /* AES-CBC subsample pattern encryption scheme */
421};
422
427{
428 int32_t numerator;
429 int32_t denominator;
430};
431
436{
437 BUFFER,
438 STRING
439};
440
445{
446 std::vector<uint8_t> data{};
447 CodecDataType type{CodecDataType::BUFFER};
448};
449
454{
455 UNKNOWN,
456 DECRYPTION, /* Player failed to decrypt a buffer and the frame has been dropped */
457 OUTPUT_PROTECTION /* HDCP output protection failure */
458};
459
463enum class EaseType
464{
465 EASE_LINEAR,
466 EASE_IN_CUBIC,
467 EASE_OUT_CUBIC
468};
469
474{
475 int64_t currentPosition{-1};
476 double volume{1.0};
477};
478
483{
485 ENABLED,
486 DISABLED
487};
488} // namespace firebolt::rialto
489
490#endif // FIREBOLT_RIALTO_MEDIA_COMMON_H_
AddSegmentStatus
AddSegmentStatus.
Definition MediaCommon.h:239
CodecDataType
Codec data type.
Definition MediaCommon.h:436
EaseType
Ease type for audio volume changes.
Definition MediaCommon.h:464
SegmentAlignment
The alignment of media segment.
Definition MediaCommon.h:339
NetworkState
The Network State.
Definition MediaCommon.h:137
constexpr uint64_t kUndefinedPosition
The value of undefined position.
Definition MediaCommon.h:67
MediaType
The media type of media to be played.
Definition MediaCommon.h:106
SourceConfigType
Shows the types of source configuration.
Definition MediaCommon.h:84
PlaybackError
None fatal asynchronous errors reported by the player.
Definition MediaCommon.h:454
constexpr uint32_t kInvalidAudioSampleRate
The value of an invalid audio sampling rate.
Definition MediaCommon.h:52
StreamFormat
The Stream Format of media segment.
Definition MediaCommon.h:349
constexpr uint32_t kInvalidAudioChannels
The value of an invalid audio channels number.
Definition MediaCommon.h:47
LimitedDurationLicense
Limited duration license state.
Definition MediaCommon.h:483
constexpr uint32_t kInvalidLimitBuffering
The value of an invalid limitBuffering.
Definition MediaCommon.h:62
PlaybackState
The Playback State.
Definition MediaCommon.h:159
KeySessionType
The media key session type.
Definition MediaCommon.h:303
WebAudioPlayerState
The Web Audio Player State.
Definition MediaCommon.h:402
CipherMode
Cipher mode for common encryption, see https://www.iso.org/obp/ui/#iso:std:iso-iec:23001:-7:ed-3:v1:e...
Definition MediaCommon.h:415
AudioEaseType
The supported audio ease types.
Definition MediaCommon.h:96
std::vector< std::pair< std::vector< unsigned char >, KeyStatus > > KeyStatusVector
A vector of key ID/key status pairs.
Definition MediaCommon.h:361
constexpr int32_t kUndefinedSize
The value of an undefined size.
Definition MediaCommon.h:57
MediaSourceType
The supported types of media source.
Definition MediaCommon.h:73
constexpr int32_t kInvalidSessionId
The value of an invalid key session.
Definition MediaCommon.h:42
Format
The Format of the audio samples. Used by the raw audio media types.
Definition MediaCommon.h:175
MediaKeyErrorStatus
The error return status for session management methods.
Definition MediaCommon.h:288
MediaSourceStatus
The media source status. This is the status of the source after a read.
Definition MediaCommon.h:116
Layout
The layout of channels within a buffer. Used by the raw audio media types.
Definition MediaCommon.h:212
InitDataType
The init data type.
Definition MediaCommon.h:314
KeyStatus
The key status.
Definition MediaCommon.h:326
Audio specific configuration.
Definition MediaCommon.h:221
std::vector< std::vector< uint8_t > > streamHeader
Definition MediaCommon.h:228
std::vector< uint8_t > codecSpecificConfig
Definition MediaCommon.h:224
uint32_t numberOfChannels
Definition MediaCommon.h:222
std::optional< uint64_t > channelMask
Definition MediaCommon.h:227
std::optional< Layout > layout
Definition MediaCommon.h:226
uint32_t sampleRate
Definition MediaCommon.h:223
std::optional< Format > format
Definition MediaCommon.h:225
std::optional< bool > framed
Definition MediaCommon.h:230
Codec data with type.
Definition MediaCommon.h:445
CodecDataType type
Definition MediaCommon.h:447
std::vector< uint8_t > data
Definition MediaCommon.h:446
Fraction type.
Definition MediaCommon.h:427
int32_t denominator
Definition MediaCommon.h:429
int32_t numerator
Definition MediaCommon.h:428
Information about the shared memory required for writting data.
Definition MediaCommon.h:268
uint32_t mediaDataOffset
Definition MediaCommon.h:271
uint32_t metadataOffset
Definition MediaCommon.h:270
uint32_t maxMetadataBytes
Definition MediaCommon.h:269
uint32_t maxMediaBytes
Definition MediaCommon.h:272
Struct containing current playback information.
Definition MediaCommon.h:474
int64_t currentPosition
Definition MediaCommon.h:475
double volume
Definition MediaCommon.h:476
The information provided in a QOS update.
Definition MediaCommon.h:279
uint64_t dropped
Definition MediaCommon.h:281
uint64_t processed
Definition MediaCommon.h:280
A pair describing the clear and encrypted bytes in a sub-sample.
Definition MediaCommon.h:250
size_t numClearBytes
Definition MediaCommon.h:251
size_t numEncryptedBytes
Definition MediaCommon.h:252
Video decoder requirements used to allocate a suitable decoder for a MediaPipeline session.
Definition MediaCommon.h:259
uint32_t maxHeight
Definition MediaCommon.h:261
uint32_t maxWidth
Definition MediaCommon.h:260
Pcm config information.
Definition MediaCommon.h:378
uint32_t rate
Definition MediaCommon.h:379
uint32_t sampleSize
Definition MediaCommon.h:381
bool isSigned
Definition MediaCommon.h:383
bool isFloat
Definition MediaCommon.h:384
uint32_t channels
Definition MediaCommon.h:380
bool isBigEndian
Definition MediaCommon.h:382
Information about the shared memory required for writting data for the web audio playback.
Definition MediaCommon.h:367
uint32_t offsetMain
Definition MediaCommon.h:368
uint32_t lengthMain
Definition MediaCommon.h:369
uint32_t offsetWrap
Definition MediaCommon.h:370
uint32_t lengthWrap
Definition MediaCommon.h:371
Type dependent configuration data.
Definition MediaCommon.h:391
WebAudioPcmConfig pcm
PCM audio configuration.
Definition MediaCommon.h:395