66 for (y = 0; y < main_buf->
height; y++) {
69 for (x = 0; x < main_buf->
width; x++) {
76 const int main_linesize = main_buf->
linesize[
A];
77 const int alpha_linesize = alpha_buf->
linesize[
Y];
79 alpha_buf->
data[
Y], alpha_linesize,
80 FFMIN(main_linesize, alpha_linesize), alpha_buf->
height);
131 if (mainlink->
w != alphalink->
w || mainlink->
h != alphalink->
h) {
133 "Input frame sizes do not match (%dx%d vs %dx%d).\n",
134 mainlink->
w, mainlink->
h,
135 alphalink->
w, alphalink->
h);
142 outlink->
w = mainlink->
w;
143 outlink->
h = mainlink->
h;
192 .
name =
"alphamerge",
194 "input into the alpha channel of the first input."),
195 .preinit = alphamerge_framesync_preinit,
197 .priv_class = &alphamerge_class,
200 .
inputs = alphamerge_inputs,
This structure describes decoded (raw) audio or video data.
Main libavfilter public API header.
static const AVFilterPad alphamerge_inputs[]
int h
agreed upon image height
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
static int activate(AVFilterContext *ctx)
AVFilterFormatsConfig outcfg
Lists of supported formats / etc.
FRAMESYNC_DEFINE_CLASS(alphamerge, AlphaMergeContext, fs)
const char * name
Pad name.
AVFilterContext * parent
Parent filter context.
AVFilterLink ** inputs
array of pointers to input links
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
static int do_alphamerge(FFFrameSync *fs)
int ff_framesync_init_dualinput(FFFrameSync *fs, AVFilterContext *parent)
Initialize a frame sync structure for dualinput.
int ff_framesync_dualinput_get_writable(FFFrameSync *fs, AVFrame **f0, AVFrame **f1)
Same as ff_framesync_dualinput_get(), but make sure that f0 is writable.
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
A filter pad used for either input or output.
A link between two filters.
static int config_input_main(AVFilterLink *inlink)
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0, will be automatically copied from the first input of the source filter if it exists.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
void * priv
private data for use by the filter
static const AVOption alphamerge_options[]
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
static int query_formats(AVFilterContext *ctx)
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
int(* on_event)(struct FFFrameSync *fs)
Callback called when a frame event is ready.
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int w
agreed upon image width
static av_cold void uninit(AVFilterContext *ctx)
static const AVFilterPad alphamerge_outputs[]
AVFilterContext * src
source filter
static const AVFilterPad outputs[]
int format
agreed upon media format
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Describe the class of an AVClass context structure.
static av_cold int init(AVFilterContext *ctx)
const char * name
Filter name.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
AVFilterLink ** outputs
array of pointers to output links
#define flags(name, subs,...)
static int config_output(AVFilterLink *outlink)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
planar GBRA 4:4:4:4 32bpp
AVFilter ff_vf_alphamerge
AVFilterFormatsConfig incfg
Lists of supported formats / etc.
AVFilterContext * dst
dest filter
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
AVPixelFormat
Pixel format.