21 enum class VideoFmt : int {
37 enum class AudioFmt : int {
64 inline bool IsEncodedVideoFormat(VideoFmt fmt)
66 return fmt == VideoFmt::H264;
74 inline bool IsRawVideoFormat(VideoFmt fmt)
76 return !(fmt == VideoFmt::Unknown || fmt == VideoFmt::Unsupported) && !IsEncodedVideoFormat(fmt);
85 inline bool IsEncodedAudioFormat(AudioFmt fmt)
87 return fmt == AudioFmt::Aac || fmt == AudioFmt::Opus;
96 inline bool IsRawAudioFormat(AudioFmt fmt)
98 return !(fmt == AudioFmt::Unknown || fmt == AudioFmt::Unsupported) && !IsEncodedAudioFormat(fmt);
108 VideoFmt fmt = VideoFmt::Unknown;
122 AudioFmt fmt = AudioFmt::Unknown;
141 video.fmt = VideoFmt::Unknown;
154 if (type == DataType::Audio)
156 else if (type == DataType::Video)
168 if (type == DataType::Audio)
170 else if (type == DataType::Video)
182 MediaDesc(VideoFmt fmt, int32_t w = 0, int32_t h = 0, int32_t fps = 0) : type(DataType::Video)
196 MediaDesc(AudioFmt fmt, int32_t ch = 0, int32_t sr = 0) : type(DataType::Audio)
199 audio.numChannels = ch;
200 audio.sampleRate = sr;
222 if (lhs.
type == DataType::Unknown || rhs.
type == DataType::Unknown)
227 if (lhs.
type == DataType::Audio) {
232 }
else if (lhs.
type == DataType::Video) {
245 bool eq = lhs == rhs;
293 MediaTransform(VideoFmt fmtIn, VideoFmt fmtOut, std::string name =
"") : in(fmtIn), out(fmtOut), friendlyName(name) {}
301 MediaTransform(AudioFmt fmtIn, AudioFmt fmtOut, std::string name =
"") : in(fmtIn), out(fmtOut), friendlyName(name) {}
312 if (in.type == DataType::Audio) {
313 if (in.audio.numChannels != 0 && out.audio.numChannels == 0)
314 out.audio.numChannels = in.audio.numChannels;
315 else if (in.audio.numChannels == 0 && out.audio.numChannels != 0)
316 in.audio.numChannels = out.audio.numChannels;
318 if (in.audio.sampleRate != 0 && out.audio.sampleRate == 0)
319 out.audio.sampleRate = in.audio.sampleRate;
320 else if (in.audio.sampleRate == 0 && out.audio.sampleRate != 0)
321 in.audio.sampleRate = out.audio.sampleRate;
322 }
else if (in.type == DataType::Video) {
323 if (in.video.width != 0 && out.video.width == 0)
324 out.video.width = in.video.width;
325 else if (in.video.width == 0 && out.video.width != 0)
326 in.video.width = out.video.width;
328 if (in.video.height != 0 && out.video.height == 0)
329 out.video.height = in.video.height;
330 else if (in.video.height == 0 && out.video.height != 0)
331 in.video.height = out.video.height;
342 template<
typename T,
typename U>
343 inline std::unique_ptr<T[]> reinterpret_unique_pointer_cast(std::unique_ptr<U[]> &&old)
345 return std::unique_ptr<T[]>(
reinterpret_cast<T *
>(old.release()));
371 buffer = std::make_unique<uint8_t[]>(dataSize);
386 buffer = std::make_unique<uint8_t[]>(dataSize);
387 memcpy(buffer.get(), data, dataSize);
402 buffer = std::make_unique<uint8_t[]>(dataSize);
403 memcpy(buffer.get(), data, dataSize);
419 buffer = std::move(data);
435 buffer = reinterpret_unique_pointer_cast<uint8_t>(std::move(data));
454 buffer = std::move(other.
buffer);
467 buffer = std::move(other.
buffer);
481 buffer = std::make_unique<uint8_t[]>(size);
482 memcpy(buffer.get(), other.
buffer.get(), size);
495 buffer = std::make_unique<uint8_t[]>(size);
496 memcpy(buffer.get(), other.
buffer.get(), size);
524 int R5_SDK_CORE_EXPORT parseProvisions(
const std::string &jsonData, std::vector<ProvisionDesc> &provisions);
532 int R5_SDK_CORE_EXPORT writeProvisions(
const std::vector<ProvisionDesc> &provisions, std::string &jsonData);
VideoFmt fmt
video pixel format
Definition: r5data.h:108
int fmtFull
negative values for ffmpeg codec id
Definition: r5data.h:123
int height
transcoding video height
Definition: r5data.h:513
Video data description.
Definition: r5data.h:105
AudioFmt fmt
audio sample format
Definition: r5data.h:122
Audio data description.
Definition: r5data.h:119
int fps
transcoding frame rate
Definition: r5data.h:514
int fmtFull
negative values for ffmpeg codec id
Definition: r5data.h:109
int bitrate
transcoding bitrate
Definition: r5data.h:515
Transcoding provision level description It can be used to control transcoding instance by Red5Pro Str...
Definition: r5data.h:510
int width
transcoding video width
Definition: r5data.h:512