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

Entry point of a filter graph. More...

#include <buffersrc.h>

Public Member Functions

 BufferSrcFilterContext (const FilterContext &ctx, OptionalErrorCode ec=throws())
 Wrap a source context created by a graph.
void assign (const FilterContext &ctx, OptionalErrorCode ec=throws())
 Point the wrapper at another source context.
BufferSrcFilterContext & operator= (const FilterContext &ctx)
 Assign from a filter context.
void writeVideoFrame (const VideoFrame &frame, OptionalErrorCode ec=throws())
 Write a video frame into the graph.
void addVideoFrame (VideoFrame &frame, int flags, OptionalErrorCode ec=throws())
 Push a video frame with explicit AV_BUFFERSRC_FLAG_* flags.
void addVideoFrame (VideoFrame &frame, OptionalErrorCode ec=throws())
 Push a video frame into the graph.
void writeAudioSamples (const AudioSamples &samples, OptionalErrorCode ec=throws())
 Write audio samples into the graph.
void addAudioSamples (AudioSamples &samples, int flags, OptionalErrorCode ec=throws())
 Push audio samples with explicit flags.
void addAudioSamples (AudioSamples &samples, OptionalErrorCode ec=throws())
 Push audio samples into the graph.
size_t failedRequestsCount ()
 How many pushes the graph refused.

Static Public Member Functions

static FilterMediaType checkFilter (const Filter &filter)
 Media type a filter would produce as a source.

Detailed Description

Wraps the "buffer" or "abuffersrc" filter: frames or samples written here enter the graph. The source is typed by the filter it wraps, and the typed write functions refuse data of the other kind.

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

Constructor & Destructor Documentation

◆ BufferSrcFilterContext()

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

Member Function Documentation

◆ addAudioSamples() [1/2]

void av::BufferSrcFilterContext::addAudioSamples ( AudioSamples & samples,
int flags,
OptionalErrorCode ec = throws() )
Parameters
samplesthe samples to push
flagsAV_BUFFERSRC_FLAG_* bits
echolder for the error code

◆ addAudioSamples() [2/2]

void av::BufferSrcFilterContext::addAudioSamples ( AudioSamples & samples,
OptionalErrorCode ec = throws() )
Parameters
samplesthe samples to push
echolder for the error code

◆ addVideoFrame() [1/2]

void av::BufferSrcFilterContext::addVideoFrame ( VideoFrame & frame,
int flags,
OptionalErrorCode ec = throws() )
Parameters
framethe frame to push
flagsfor example AV_BUFFERSRC_FLAG_KEEP_REF to keep the frame usable after the call
echolder for the error code
Examples
api2-decode-filter-encode.cpp, and api2-decode-overlay-encode.cpp.

◆ addVideoFrame() [2/2]

void av::BufferSrcFilterContext::addVideoFrame ( VideoFrame & frame,
OptionalErrorCode ec = throws() )
Parameters
framethe frame to push
echolder for the error code

◆ assign()

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

◆ checkFilter()

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

◆ failedRequestsCount()

size_t av::BufferSrcFilterContext::failedRequestsCount ( )

A refused push is EAGAIN: the graph wants its output drained first, which is not an error but usually means the pull loop is missing.

Returns
the number of refused pushes since the context was created

◆ operator=()

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

◆ writeAudioSamples()

void av::BufferSrcFilterContext::writeAudioSamples ( const AudioSamples & samples,
OptionalErrorCode ec = throws() )
Parameters
samplesthe samples to push
echolder for the error code

◆ writeVideoFrame()

void av::BufferSrcFilterContext::writeVideoFrame ( const VideoFrame & frame,
OptionalErrorCode ec = throws() )

The frame is referenced, not copied, and must stay valid until the graph consumed it, which happens during the call.

Parameters
framethe frame to push
echolder for the error code
Examples
api2-decode-overlay-encode.cpp.

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