avcpp  2.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
Public Types | Public Member Functions | List of all members
av::VideoDecoderContext Class Reference

#include <codeccontext.h>

Inheritance diagram for av::VideoDecoderContext:
Inheritance graph
[legend]
Collaboration diagram for av::VideoDecoderContext:
Collaboration graph
[legend]

Public Types

using Parent = VideoCodecContext< VideoDecoderContext, Direction::Decoding >
 
- Public Types inherited from av::VideoCodecContext< VideoDecoderContext, Direction::Decoding >
using Parent = CodecContextBase< VideoDecoderContext, _direction, AVMEDIA_TYPE_VIDEO >
 

Public Member Functions

 VideoDecoderContext ()=default
 
 VideoDecoderContext (VideoDecoderContext &&other)
 
VideoDecoderContextoperator= (VideoDecoderContext &&other)
 
VideoFrame decode (const Packet &packet, OptionalErrorCode ec=throws(), bool autoAllocateFrame=true)
 decodeVideo - decode video packet More...
 
VideoFrame decode (const Packet &packet, size_t offset, size_t &decodedBytes, OptionalErrorCode ec=throws(), bool autoAllocateFrame=true)
 decodeVideo - decode video packet with additional parameters More...
 
- Public Member Functions inherited from av::VideoCodecContext< VideoDecoderContext, Direction::Decoding >
int width () const
 
int height () const
 
int codedWidth () const
 
int codedHeight () const
 
PixelFormat pixelFormat () const
 
int32_t globalQuality () const
 
int32_t gopSize () const
 
int bitRateTolerance () const
 
int maxBFrames () const
 
Rational sampleAspectRatio () const
 
void setWidth (int w)
 
void setHeight (int h)
 
void setCodedWidth (int w)
 
void setCodedHeight (int h)
 
void setPixelFormat (PixelFormat pixelFormat)
 
void setGlobalQuality (int32_t quality)
 
void setGopSize (int32_t size)
 
void setBitRateTolerance (int bitRateTolerance)
 
void setMaxBFrames (int maxBFrames)
 
void setSampleAspectRatio (const Rational &sampleAspectRatio)
 
- Public Member Functions inherited from av::CodecContextBase< VideoDecoderContext, _direction, AVMEDIA_TYPE_VIDEO >
 CodecContextBase ()
 
 CodecContextBase (const class Stream &st, const class Codec &codec=Codec())
 
 CodecContextBase (const Codec &codec)
 
 CodecContextBase (CodecContextBase &&other)
 
void setCodec (const Codec &codec, OptionalErrorCode ec=throws())
 
void setCodec (const Codec &codec, bool resetDefaults, OptionalErrorCode ec=throws())
 
AVMediaType codecType () const noexcept
 
- Public Member Functions inherited from av::CodecContext2
void open (OptionalErrorCode ec=throws())
 
void open (const Codec &codec, OptionalErrorCode ec=throws())
 
void open (class Dictionary &options, OptionalErrorCode ec=throws())
 
void open (class Dictionary &&options, OptionalErrorCode ec=throws())
 
void open (class Dictionary &options, const Codec &codec, OptionalErrorCode ec=throws())
 
void open (class Dictionary &&options, const Codec &codec, OptionalErrorCode ec=throws())
 
void close (OptionalErrorCode ec=throws())
 
bool isOpened () const noexcept
 
bool isValid () const noexcept
 
Rational timeBase () const noexcept
 
void setTimeBase (const Rational &value) noexcept
 
const Streamstream () const noexcept
 
Codec codec () const noexcept
 
void setOption (const std::string &key, const std::string &val, OptionalErrorCode ec=throws())
 
void setOption (const std::string &key, const std::string &val, int flags, OptionalErrorCode ec=throws())
 
int frameSize () const noexcept
 
int64_t frameNumber () const noexcept
 
bool isRefCountedFrames () const noexcept
 
void setRefCountedFrames (bool refcounted) const noexcept
 
int strict () const noexcept
 
void setStrict (int strict) noexcept
 
int64_t bitRate () const noexcept
 
std::pair< int64_t, int64_t > bitRateRange () const noexcept
 
void setBitRate (int64_t bitRate) noexcept
 
void setBitRateRange (const std::pair< int64_t, int64_t > &bitRateRange) noexcept
 
template<typename T >
std::pair< int, const std::error_category * > decodeCommon (T &outFrame, const class Packet &inPacket, size_t offset, int &frameFinished, int(*decodeProc)(AVCodecContext *, AVFrame *, int *, const AVPacket *))
 
template<typename T >
std::pair< int, const std::error_category * > encodeCommon (class Packet &outPacket, const T &inFrame, int &gotPacket, int(*encodeProc)(AVCodecContext *, AVPacket *, const AVFrame *, int *))
 
template<typename T >
std::pair< int, const std::error_category * > decodeCommon (T &outFrame, const Packet &inPacket, size_t offset, int &frameFinished, int(*decodeProc)(AVCodecContext *, AVFrame *, int *, const AVPacket *))
 
void copyContextFrom (const CodecContext2 &other, OptionalErrorCode ec=throws())
 Copy codec context from codec context associated with given stream or other codec context. More...
 
void setFlags (int flags) noexcept
 Access to CODEC_FLAG_* flags. More...
 
void addFlags (int flags) noexcept
 
void clearFlags (int flags) noexcept
 
int flags () noexcept
 
bool isFlags (int flags) noexcept
 
void setFlags2 (int flags) noexcept
 Access to CODEC_FLAG2_* flags. More...
 
void addFlags2 (int flags) noexcept
 
void clearFlags2 (int flags) noexcept
 
int flags2 () noexcept
 
bool isFlags2 (int flags) noexcept
 
- Public Member Functions inherited from FFWrapperPtr< AVCodecContext >
 FFWrapperPtr ()=default
 
 FFWrapperPtr (AVCodecContext *raw)
 
const AVCodecContext * raw () const
 
AVCodecContext * raw ()
 
void reset (AVCodecContext *raw=nullptr)
 
bool isNull () const
 
void _log (int level, const char *fmt) const
 
void _log (int level, const char *fmt, const Args &... args) const
 

Additional Inherited Members

- Protected Types inherited from av::CodecContext2
using BaseWrapper = FFWrapperPtr< AVCodecContext >
 
- Protected Member Functions inherited from av::CodecContextBase< VideoDecoderContext, _direction, AVMEDIA_TYPE_VIDEO >
VideoDecoderContextmoveOperator (VideoDecoderContext &&rhs)
 
void setCodec (const class Codec &codec, bool resetDefaults, Direction direction, AVMediaType type, OptionalErrorCode ec=throws())
 
- Protected Member Functions inherited from av::CodecContext2
void swap (CodecContext2 &other)
 
 CodecContext2 ()
 
 CodecContext2 (const class Stream &st, const class Codec &codec, Direction direction, AVMediaType type)
 
 CodecContext2 (const class Codec &codec, Direction direction, AVMediaType type)
 
 ~CodecContext2 ()
 
void setCodec (const class Codec &codec, bool resetDefaults, Direction direction, AVMediaType type, OptionalErrorCode ec=throws())
 
AVMediaType codecType (AVMediaType contextType) const noexcept
 
bool isValidForEncode (Direction direction, AVMediaType type) const noexcept
 
bool checkCodec (const Codec &codec, Direction direction, AVMediaType type, OptionalErrorCode ec)
 
void open (const Codec &codec, AVDictionary **options, OptionalErrorCode ec)
 
std::pair< int, const std::error_category * > decodeCommon (AVFrame *outFrame, const class Packet &inPacket, size_t offset, int &frameFinished, int(*decodeProc)(AVCodecContext *, AVFrame *, int *, const AVPacket *)) noexcept
 
std::pair< int, const std::error_category * > encodeCommon (class Packet &outPacket, const AVFrame *inFrame, int &gotPacket, int(*encodeProc)(AVCodecContext *, AVPacket *, const AVFrame *, int *)) noexcept
 
- Protected Member Functions inherited from av::noncopyable
 noncopyable ()=default
 
 noncopyable (const noncopyable &)=delete
 
void operator= (const noncopyable &)=delete
 
- Protected Attributes inherited from FFWrapperPtr< AVCodecContext >
AVCodecContext * m_raw
 

Member Typedef Documentation

◆ Parent

Constructor & Destructor Documentation

◆ VideoDecoderContext() [1/2]

av::VideoDecoderContext::VideoDecoderContext ( )
default

◆ VideoDecoderContext() [2/2]

av::VideoDecoderContext::VideoDecoderContext ( VideoDecoderContext &&  other)

Member Function Documentation

◆ decode() [1/2]

VideoFrame av::VideoDecoderContext::decode ( const Packet packet,
OptionalErrorCode  ec = throws(),
bool  autoAllocateFrame = true 
)

decodeVideo - decode video packet

Parameters
packetpacket to decode
[in,out]ecthis represents the error status on exit, if this is pre-initialized to av::throws the function will throw on error instead
autoAllocateFrameit true - output will be allocated at the ffmpeg internal, otherwise it will be allocated before decode proc call.
Returns
encoded video frame, if error: exception thrown or error code returns, in both cases output undefined.

◆ decode() [2/2]

VideoFrame av::VideoDecoderContext::decode ( const Packet packet,
size_t  offset,
size_t &  decodedBytes,
OptionalErrorCode  ec = throws(),
bool  autoAllocateFrame = true 
)

decodeVideo - decode video packet with additional parameters

Parameters
[in]packetpacket to decode
[in]offsetdata offset in packet
[out]decodedBytesamount of decoded bytes
[in,out]ecthis represents the error status on exit, if this is pre-initialized to av::throws the function will throw on error instead
autoAllocateFrameit true - output will be allocated at the ffmpeg internal, otherwise it will be allocated before decode proc call.
Returns
encoded video frame, if error: exception thrown or error code returns, in both cases output undefined.

◆ operator=()

VideoDecoderContext & av::VideoDecoderContext::operator= ( VideoDecoderContext &&  other)

The documentation for this class was generated from the following files: