|
FFmpegfs Fuse Multi Media Filesystem 2.19
|
RAII wrapper for SwrContext. More...
#include <ffmpeg_swrcontext.h>
Public Member Functions | |
| FFmpeg_SwrContext () | |
| Construct an empty resampler-context wrapper. | |
| FFmpeg_SwrContext (SwrContext *ctx) | |
| Construct a wrapper taking ownership of an existing context. | |
| ~FFmpeg_SwrContext () | |
| Release the owned resampler context, if any. | |
| FFmpeg_SwrContext (const FFmpeg_SwrContext &)=delete | |
| FFmpeg_SwrContext & | operator= (const FFmpeg_SwrContext &)=delete |
| FFmpeg_SwrContext (FFmpeg_SwrContext &&ctx) noexcept | |
| Move-construct a resampler-context wrapper. | |
| FFmpeg_SwrContext & | operator= (FFmpeg_SwrContext &&ctx) noexcept |
| Move-assign a resampler-context wrapper. | |
| SwrContext * | get () const |
| Get the owned FFmpeg resampler context pointer. | |
| SwrContext ** | address () |
| Get a writable pointer-to-pointer for FFmpeg allocation APIs. | |
| SwrContext * | release () |
| Release ownership without freeing the resampler context. | |
| bool | reset (SwrContext *ctx=nullptr) |
| Replace the owned context. | |
| bool | empty () const |
| Check whether the wrapper currently owns a resampler context. | |
| operator bool () const | |
| Check whether the wrapper owns a valid context. | |
| operator SwrContext * () const | |
| Convert to the underlying resampler context pointer. | |
| SwrContext * | operator-> () const |
| Access members of the underlying resampler context. | |
Private Attributes | |
| SwrContext * | m_ctx |
| Pointer to underlying SwrContext. | |
RAII wrapper for SwrContext.
Owns a libswresample context and releases it with swr_free(). The wrapper is movable but not copyable.
Definition at line 28 of file ffmpeg_swrcontext.h.
| FFmpeg_SwrContext::FFmpeg_SwrContext | ( | ) |
Construct an empty resampler-context wrapper.
Definition at line 16 of file ffmpeg_swrcontext.cc.
|
explicit |
Construct a wrapper taking ownership of an existing context.
| [in] | ctx | Context pointer to take ownership of, or nullptr. |
Definition at line 21 of file ffmpeg_swrcontext.cc.
| FFmpeg_SwrContext::~FFmpeg_SwrContext | ( | ) |
Release the owned resampler context, if any.
Definition at line 26 of file ffmpeg_swrcontext.cc.
References reset().
|
noexcept |
Move-construct a resampler-context wrapper.
| [in,out] | ctx | Source wrapper whose context ownership is transferred. |
Definition at line 31 of file ffmpeg_swrcontext.cc.
| SwrContext ** FFmpeg_SwrContext::address | ( | ) |
Get a writable pointer-to-pointer for FFmpeg allocation APIs.
Any currently owned context is freed first so that FFmpeg can write a new context pointer without leaking the previous one.
Definition at line 50 of file ffmpeg_swrcontext.cc.
References m_ctx, and reset().
Referenced by FFmpeg_Transcoder::init_resampler().
| bool FFmpeg_SwrContext::empty | ( | ) | const |
Check whether the wrapper currently owns a resampler context.
Definition at line 78 of file ffmpeg_swrcontext.cc.
References m_ctx.
| SwrContext * FFmpeg_SwrContext::get | ( | ) | const |
Get the owned FFmpeg resampler context pointer.
Definition at line 45 of file ffmpeg_swrcontext.cc.
References m_ctx.
|
explicit |
Check whether the wrapper owns a valid context.
Definition at line 83 of file ffmpeg_swrcontext.cc.
| FFmpeg_SwrContext::operator SwrContext * | ( | ) | const |
Convert to the underlying resampler context pointer.
Definition at line 88 of file ffmpeg_swrcontext.cc.
| SwrContext * FFmpeg_SwrContext::operator-> | ( | ) | const |
Access members of the underlying resampler context.
Definition at line 93 of file ffmpeg_swrcontext.cc.
References m_ctx.
|
noexcept |
Move-assign a resampler-context wrapper.
| [in,out] | ctx | Source wrapper whose context ownership is transferred. |
Definition at line 36 of file ffmpeg_swrcontext.cc.
| SwrContext * FFmpeg_SwrContext::release | ( | ) |
Release ownership without freeing the resampler context.
Definition at line 56 of file ffmpeg_swrcontext.cc.
References m_ctx.
| bool FFmpeg_SwrContext::reset | ( | SwrContext * | ctx = nullptr | ) |
Replace the owned context.
| [in] | ctx | New context pointer to own, or nullptr to only reset. |
Definition at line 63 of file ffmpeg_swrcontext.cc.
References m_ctx.
Referenced by address(), FFmpeg_Transcoder::close_resample(), FFmpeg_Transcoder::init_resampler(), and ~FFmpeg_SwrContext().
|
private |
Pointer to underlying SwrContext.
Definition at line 115 of file ffmpeg_swrcontext.h.
Referenced by address(), empty(), get(), operator->(), release(), and reset().