83 if (mainlink->
w != alphalink->
w || mainlink->
h != alphalink->
h) {
85 "Input frame sizes do not match (%dx%d vs %dx%d).\n",
86 mainlink->
w, mainlink->
h,
87 alphalink->
w, alphalink->
h);
91 outlink->
w = mainlink->
w;
92 outlink->
h = mainlink->
h;
109 for (y = 0; y <
h; y++) {
112 for (x = 0; x < main_buf->
width; x++) {
119 const int main_linesize = main_buf->
linesize[
A];
120 const int alpha_linesize = alpha_buf->
linesize[
Y];
122 alpha_buf->
data[
Y], alpha_linesize,
123 FFMIN(main_linesize, alpha_linesize), alpha_buf->
height);
205 .
name =
"alphamerge",
207 "input into the alpha channel of the first input."),
209 .priv_class = &alphamerge_class,
211 .
inputs = alphamerge_inputs,
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
This structure describes decoded (raw) audio or video data.
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
Main libavfilter public API header.
static const AVFilterPad alphamerge_inputs[]
int h
agreed upon image height
#define FFERROR_NOT_READY
Filters implementation helper functions.
static int activate(AVFilterContext *ctx)
int is_disabled
the enabled state from the last expression evaluation
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
static int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
const char * name
Pad name.
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)
AVFILTER_DEFINE_CLASS(alphamerge)
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.
static void draw_frame(AVFilterContext *ctx, AVFrame *main_buf, AVFrame *alpha_buf)
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.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#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)
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int w
agreed upon image width
static const AVFilterPad alphamerge_outputs[]
AVFilterContext * src
source filter
static const AVFilterPad inputs[]
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)
Describe the class of an AVClass context structure.
int ff_outlink_get_status(AVFilterLink *link)
Get the status on an output link.
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 FF_FILTER_FORWARD_STATUS(inlink, outlink)
Acknowledge the status on an input link and forward it to an output link.
#define flags(name, subs,...)
static int config_output(AVFilterLink *outlink)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
planar GBRA 4:4:4:4 32bpp
AVFilter ff_vf_alphamerge
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.
AVPixelFormat
Pixel format.
AVFilterFormats * out_formats