Name | |
---|---|
struct | AlignedAudioFrame AlignedAudioFrame is a frame of interleaved floating point audio samples with a given number of channels. |
struct | AlignedFrame A frame of aligned data that is passed to the rendering engine from the MediaReceiver. A DataFrame contains a time stamped frame of media, which might be video, audio and auxiliary data such as subtitles. A single DataFrame can contain one or multiple types of media. Which media types are included can be probed by nullptr-checking/size checking the data members. The struct has ownership of all data pointers included. The struct includes all logic for freeing the resources held by this struct and the user should therefore just make sure the struct itself is deallocated to ensure all resources are freed. |
Name | |
---|---|
using std::shared_ptr< AlignedAudioFrame > | AlignedAudioFramePtr |
using std::shared_ptr< const AlignedAudioFrame > | AlignedAudioFrameConstPtr |
using std::shared_ptr< AlignedFrame > | AlignedFramePtr |
Name | |
---|---|
AlignedAudioFramePtr | createAlignedAudioFrame(uint8_t numberOfChannels, uint32_t numberOfSamplesPerChannel) Create a new AudioFrame with a given amount of samples allocated and all samples initialized to 0.0f. |
using AlignedAudioFramePtr = std::shared_ptr<AlignedAudioFrame>;
using AlignedAudioFrameConstPtr = std::shared_ptr<const AlignedAudioFrame>;
using AlignedFramePtr = std::shared_ptr<AlignedFrame>;
AlignedAudioFramePtr createAlignedAudioFrame(
uint8_t numberOfChannels,
uint32_t numberOfSamplesPerChannel
)
Create a new AudioFrame with a given amount of samples allocated and all samples initialized to 0.0f.
Parameters:
Return: Shared pointer to the new AudioFrame
// Copyright (c) 2022, Edgeware AB. All rights reserved.
#pragma once
#include <array>
#include <iostream>
#include <memory>
#include <vector>
#include <cuda_runtime_api.h>
#include "DeviceMemory.h"
struct AlignedAudioFrame {
// The samples interleaved
std::vector<float> mSamples;
uint8_t mNumberOfChannels = 0;
uint32_t mNumberOfSamplesPerChannel = 0;
};
using AlignedAudioFramePtr = std::shared_ptr<AlignedAudioFrame>;
using AlignedAudioFrameConstPtr = std::shared_ptr<const AlignedAudioFrame>;
AlignedAudioFramePtr createAlignedAudioFrame(uint8_t numberOfChannels, uint32_t numberOfSamplesPerChannel);
struct AlignedFrame {
enum class CompressedVideoFormat {
kAvc, // H264
kHevc // H265
};
enum class PixelFormat {
kUnknown,
kNv12, // 8 bit per component 4:2:0 YUV format. Y plane followed by interleaved UV plane.
kP016, // 16 bit per component 4:2:0 YUV format. Y plane followed by interleaved UV plane.
kUyvy, // 8 bit per component 4:2:2 YUV format. U-Y-V-Y bytes interleaved.
kRgba, // 8 bit per component RGBA, ordered as R-G-B-A-R-G.. in memory.
kRgba64Le // 16 bit per component RGBA, ordered as R-G-B-A-R-G.. in memory with little endian words.
};
AlignedFrame() = default;
~AlignedFrame() = default;
AlignedFrame(AlignedFrame const&) = delete; // Copy construct
AlignedFrame& operator=(AlignedFrame const&) = delete; // Copy assign
int64_t mCaptureTimestamp = 0;
int64_t mRenderingTimestamp = 0;
// Video
std::shared_ptr<DeviceMemory> mVideoFrame = nullptr;
PixelFormat mPixelFormat = PixelFormat::kUnknown;
uint32_t mFrameRateN = 0;
uint32_t mFrameRateD = 0;
uint32_t mWidth = 0;
uint32_t mHeight = 0;
// Audio
AlignedAudioFramePtr mAudioFrame = nullptr;
uint32_t mAudioSamplingFrequency = 0;
};
using AlignedFramePtr = std::shared_ptr<AlignedFrame>;
Updated on 2023-06-13 at 17:00:17 +0200