avcpp 3.1.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
Loading...
Searching...
No Matches
av::BufferSinkFilterContext Class Reference

Exit point of a filter graph. More...

#include <buffersink.h>

Public Member Functions

 BufferSinkFilterContext (const FilterContext &ctx, OptionalErrorCode ec=throws())
 Wrap a sink context created by a graph.
void assign (const FilterContext &ctx, OptionalErrorCode ec=throws())
 Point the wrapper at another sink context.
BufferSinkFilterContext & operator= (const FilterContext &ctx)
 Assign from a filter context.
bool getVideoFrame (VideoFrame &frame, int flags, OptionalErrorCode ec=throws())
 Read one frame with explicit AV_BUFFERSINK_FLAG_* flags.
bool getVideoFrame (VideoFrame &frame, OptionalErrorCode ec=throws())
 Read one frame from the graph.
bool getAudioFrame (AudioSamples &samples, int flags, OptionalErrorCode ec=throws())
 Read one buffer of samples with explicit sink flags.
bool getAudioFrame (AudioSamples &samples, OptionalErrorCode ec=throws())
 Read one buffer of samples from the graph.
bool getAudioSamples (AudioSamples &samples, size_t samplesCount, OptionalErrorCode ec=throws())
 Read an exact number of samples.
void setFrameSize (unsigned size, OptionalErrorCode ec=throws())
 Ask the sink to deliver frames of a fixed size.
Rational frameRate (OptionalErrorCode ec=throws())
 Frame rate the sink reports.

Static Public Member Functions

static FilterMediaType checkFilter (const Filter &filter) noexcept
 Media type a filter would accept as a sink.

Detailed Description

Wraps the "buffersink" or "abuffersink" filter: frames or samples leave the graph here. A sink can produce zero, one or several outputs after a single push, so reading in a loop until it returns false is the normal pattern.

Examples
api2-decode-filter-encode.cpp, and api2-decode-overlay-encode.cpp.

Constructor & Destructor Documentation

◆ BufferSinkFilterContext()

av::BufferSinkFilterContext::BufferSinkFilterContext ( const FilterContext & ctx,
OptionalErrorCode ec = throws() )
explicit
Parameters
ctxthe filter context to wrap
echolder for the error code; a non-sink filter is reported

Member Function Documentation

◆ assign()

void av::BufferSinkFilterContext::assign ( const FilterContext & ctx,
OptionalErrorCode ec = throws() )
Parameters
ctxthe filter context to wrap
echolder for the error code

◆ checkFilter()

FilterMediaType av::BufferSinkFilterContext::checkFilter ( const Filter & filter)
staticnoexcept
Parameters
filterthe filter descriptor to inspect
Returns
Video, Audio or Unknown

◆ frameRate()

Rational av::BufferSinkFilterContext::frameRate ( OptionalErrorCode ec = throws())
Parameters
echolder for the error code
Returns
frames per second, or an empty value when the sink does not know it

◆ getAudioFrame() [1/2]

bool av::BufferSinkFilterContext::getAudioFrame ( AudioSamples & samples,
int flags,
OptionalErrorCode ec = throws() )
Parameters
samplesreceives the samples; left invalid when nothing is available
flagsthe sink flags
echolder for the error code
Returns
false when no samples are available right now

◆ getAudioFrame() [2/2]

bool av::BufferSinkFilterContext::getAudioFrame ( AudioSamples & samples,
OptionalErrorCode ec = throws() )
Parameters
samplesreceives the samples; left invalid when nothing is available
echolder for the error code
Returns
false when no samples are available right now

◆ getAudioSamples()

bool av::BufferSinkFilterContext::getAudioSamples ( AudioSamples & samples,
size_t samplesCount,
OptionalErrorCode ec = throws() )
Parameters
samplesreceives the samples
samplesCountnumber of samples per channel to read
echolder for the error code
Returns
false when the graph cannot provide that many samples right now

◆ getVideoFrame() [1/2]

bool av::BufferSinkFilterContext::getVideoFrame ( VideoFrame & frame,
int flags,
OptionalErrorCode ec = throws() )
Parameters
framereceives the frame; left invalid when nothing is available
flagsthe sink flags
echolder for the error code
Returns
false when no frame is available right now
Examples
api2-decode-filter-encode.cpp, and api2-decode-overlay-encode.cpp.

◆ getVideoFrame() [2/2]

bool av::BufferSinkFilterContext::getVideoFrame ( VideoFrame & frame,
OptionalErrorCode ec = throws() )
Parameters
framereceives the frame; left invalid when nothing is available
echolder for the error code
Returns
false when no frame is available right now

◆ operator=()

BufferSinkFilterContext & av::BufferSinkFilterContext::operator= ( const FilterContext & ctx)
Parameters
ctxthe filter context to wrap
Returns
this wrapper

◆ setFrameSize()

void av::BufferSinkFilterContext::setFrameSize ( unsigned size,
OptionalErrorCode ec = throws() )
Parameters
sizesamples per channel per output buffer
echolder for the error code

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