FFmpegfs Fuse Multi Media Filesystem 2.19
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
FFmpeg_SwsContext Class Reference

RAII wrapper for SwsContext. More...

#include <ffmpeg_swscontext.h>

Public Member Functions

 FFmpeg_SwsContext ()
 Construct an empty scaler-context wrapper.
 
 FFmpeg_SwsContext (SwsContext *ctx)
 Construct a wrapper taking ownership of an existing context.
 
 ~FFmpeg_SwsContext ()
 Release the owned scaler context, if any.
 
 FFmpeg_SwsContext (const FFmpeg_SwsContext &)=delete
 
FFmpeg_SwsContextoperator= (const FFmpeg_SwsContext &)=delete
 
 FFmpeg_SwsContext (FFmpeg_SwsContext &&ctx) noexcept
 Move-construct a scaler-context wrapper.
 
FFmpeg_SwsContextoperator= (FFmpeg_SwsContext &&ctx) noexcept
 Move-assign a scaler-context wrapper.
 
SwsContext * get () const
 Get the owned FFmpeg scaler context pointer.
 
SwsContext * release ()
 Release ownership without freeing the scaler context.
 
bool reset (SwsContext *ctx=nullptr)
 Replace the owned context.
 
bool empty () const
 Check whether the wrapper currently owns a scaler context.
 
 operator bool () const
 Check whether the wrapper owns a valid context.
 
 operator SwsContext * () const
 Convert to the underlying scaler context pointer.
 
SwsContext * operator-> () const
 Access members of the underlying scaler context.
 

Private Attributes

SwsContext * m_ctx
 Pointer to underlying SwsContext.
 

Detailed Description

RAII wrapper for SwsContext.

Owns a libswscale context and releases it with sws_freeContext(). The wrapper is movable but not copyable.

Definition at line 28 of file ffmpeg_swscontext.h.

Constructor & Destructor Documentation

◆ FFmpeg_SwsContext() [1/3]

FFmpeg_SwsContext::FFmpeg_SwsContext ( )

Construct an empty scaler-context wrapper.

Definition at line 16 of file ffmpeg_swscontext.cc.

◆ FFmpeg_SwsContext() [2/3]

FFmpeg_SwsContext::FFmpeg_SwsContext ( SwsContext *  ctx)
explicit

Construct a wrapper taking ownership of an existing context.

Parameters
[in]ctxContext pointer to take ownership of, or nullptr.

Definition at line 21 of file ffmpeg_swscontext.cc.

◆ ~FFmpeg_SwsContext()

FFmpeg_SwsContext::~FFmpeg_SwsContext ( )

Release the owned scaler context, if any.

Definition at line 26 of file ffmpeg_swscontext.cc.

References reset().

◆ FFmpeg_SwsContext() [3/3]

FFmpeg_SwsContext::FFmpeg_SwsContext ( FFmpeg_SwsContext &&  ctx)
noexcept

Move-construct a scaler-context wrapper.

Parameters
[in,out]ctxSource wrapper whose context ownership is transferred.

Definition at line 31 of file ffmpeg_swscontext.cc.

Member Function Documentation

◆ empty()

bool FFmpeg_SwsContext::empty ( ) const

Check whether the wrapper currently owns a scaler context.

Returns
true if no context is owned, false otherwise.

Definition at line 72 of file ffmpeg_swscontext.cc.

References m_ctx.

◆ get()

SwsContext * FFmpeg_SwsContext::get ( ) const

Get the owned FFmpeg scaler context pointer.

Returns
SwsContext pointer, or nullptr if empty.

Definition at line 45 of file ffmpeg_swscontext.cc.

References m_ctx.

◆ operator bool()

FFmpeg_SwsContext::operator bool ( ) const
explicit

Check whether the wrapper owns a valid context.

Definition at line 77 of file ffmpeg_swscontext.cc.

◆ operator SwsContext *()

FFmpeg_SwsContext::operator SwsContext * ( ) const

Convert to the underlying scaler context pointer.

Definition at line 82 of file ffmpeg_swscontext.cc.

◆ operator->()

SwsContext * FFmpeg_SwsContext::operator-> ( ) const

Access members of the underlying scaler context.

Returns
SwsContext pointer.

Definition at line 87 of file ffmpeg_swscontext.cc.

References m_ctx.

◆ operator=()

FFmpeg_SwsContext & FFmpeg_SwsContext::operator= ( FFmpeg_SwsContext &&  ctx)
noexcept

Move-assign a scaler-context wrapper.

Parameters
[in,out]ctxSource wrapper whose context ownership is transferred.
Returns
Reference to this wrapper.

Definition at line 36 of file ffmpeg_swscontext.cc.

◆ release()

SwsContext * FFmpeg_SwsContext::release ( )

Release ownership without freeing the scaler context.

Returns
Previously owned SwsContext pointer, or nullptr if empty.

Definition at line 50 of file ffmpeg_swscontext.cc.

References m_ctx.

◆ reset()

bool FFmpeg_SwsContext::reset ( SwsContext *  ctx = nullptr)

Replace the owned context.

Parameters
[in]ctxNew context pointer to own, or nullptr to only reset.
Returns
true if a previous context was freed, false otherwise.

Definition at line 57 of file ffmpeg_swscontext.cc.

References m_ctx.

Referenced by FFmpeg_Transcoder::close_output_file(), FFmpeg_Transcoder::init_rescaler(), and ~FFmpeg_SwsContext().

Member Data Documentation

◆ m_ctx

SwsContext* FFmpeg_SwsContext::m_ctx
private

Pointer to underlying SwsContext.

Definition at line 105 of file ffmpeg_swscontext.h.

Referenced by empty(), get(), operator->(), release(), and reset().


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