A video frame for encoding and decoding. More...
#include <cvb/codec_bridge/frame.hpp>
Public Member Functions | |
int | Width () const |
Get the frame width. More... | |
int | Height () const |
Get the frame height. More... | |
Size2D< int > | Size () const |
Get the frame size. More... | |
int64_t | PresentationTimeStamp () const |
Get the frame presentation time stamp. More... | |
void | SetPresentationTimeStamp (int64_t value) |
Set the presentation time stamp for this frame. More... | |
CodecBridge::PixelFormat | PixelFormat () const |
Get the frame pixel format. More... | |
void | UserData (void *buffer, size_t &size) const |
Get the user data if available. More... | |
Rational | TimeBase () const |
Get the time base for this frame. More... | |
void | SetUserData (void *buffer, size_t size) |
Set the user data for this frame. More... | |
void | DeleteUserData () |
Delete user data. More... | |
std::unique_ptr< Image > | AsImage () const |
Get this frame as image. More... | |
int | PlanesCount () const noexcept |
Get the number of planes in this frame. More... | |
PlanePtr | Plane (int index) const |
Get a plane of this frame at the given index. More... | |
Static Public Member Functions | |
static std::unique_ptr< Frame > | Create (Size2D< int > size, CodecBridge::PixelFormat format, uint8_t *buffer) |
Creates a frame as view on external memory. More... | |
static std::unique_ptr< Frame > | Create (Size2D< int > size, CodecBridge::PixelFormat format) |
Creates a frame. More... | |
A video frame for encoding and decoding.
|
inline |
Get this frame as image.
Any | exception derived from std::exception including CvbException. |
This method does not copy data. The image and the frame will share the ownership of the buffer. An exception will be thrown if the pixel format of the frame cannot be represented ans image.
|
inlinestatic |
Creates a frame.
[in] | size | The size of the frame. |
[in] | format | The pixel format (compatible with FFmpeg). |
Any | exception derived from std::exception including CvbException. |
The buffer for the frame is allocated internally.
|
inlinestatic |
Creates a frame as view on external memory.
[in] | size | The size of the frame |
[in] | format | The pixel format (compatible with FFmpeg) |
[in] | buffer | The buffer with the frame content. |
Any | exception derived from std::exception including CvbException. |
The buffer must be large enough to match the given size and format.
|
inline |
Delete user data.
Any | exception derived from std::exception including CvbException. |
If there is no user data, this method does nothing.
|
inline |
Get the frame height.
Any | exception derived from std::exception including CvbException. |
|
inline |
Get the frame pixel format.
Any | exception derived from std::exception including CvbException. |
Get a plane of this frame at the given index.
Any | exception derived from std::exception including CvbException. |
RGB frames will contain only one 3D plane.
|
inlinenoexcept |
Get the number of planes in this frame.
Any | exception derived from std::exception including CvbException. |
|
inline |
Get the frame presentation time stamp.
Any | exception derived from std::exception including CvbException. |
The presentation time stamp is set by the decoder when decoding.
|
inline |
Set the presentation time stamp for this frame.
[in] | value | The presentation time stamp. |
Any | exception derived from std::exception including CvbException. |
Before encoding the frame the presentation timestamp must be set.
|
inline |
Set the user data for this frame.
Any | exception derived from std::exception including CvbException. |
Some encoders support encoding user data alongside the frame. Usually this feature must be enabled manually in the encoder (udu_sei option).
|
inline |
Get the frame size.
Any | exception derived from std::exception including CvbException. |
|
inline |
Get the time base for this frame.
Any | exception derived from std::exception including CvbException. |
The time base is set by the decoder when decoding. Encoders will ignore the value from the frame and use their own time base.
|
inline |
Get the user data if available.
[in,out] | buffer | Buffer to hold the user data, or null to read the required size. |
[in,out] | size | Size of the buffer to hold the user data. Will be filled with the required size if buffer is null. |
Any | exception derived from std::exception including CvbException. |
|
inline |
Get the frame width.
Any | exception derived from std::exception including CvbException. |