47 #define REASONABLE_SIZE 1024
49 #define OFFSET(x) offsetof(TileContext, x)
50 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
54 {.str =
"6x5"}, 0, 0,
FLAGS },
55 {
"nb_frames",
"set maximum number of frame to render",
OFFSET(nb_frames),
57 {
"margin",
"set outer border margin in pixels",
OFFSET(margin),
59 {
"padding",
"set inner border thickness in pixels",
OFFSET(padding),
81 tile->
w, tile->
h, tile->
w * tile->
h);
98 const unsigned total_margin_w = (tile->
w - 1) * tile->
padding + 2*tile->
margin;
99 const unsigned total_margin_h = (tile->
h - 1) * tile->
padding + 2*tile->
margin;
101 if (inlink->
w > (INT_MAX - total_margin_w) / tile->
w) {
106 if (inlink->
h > (INT_MAX - total_margin_h) / tile->
h) {
111 outlink->
w = tile->
w * inlink->
w + total_margin_w;
112 outlink->
h = tile->
h * inlink->
h + total_margin_h;
126 const unsigned tx = tile->
current % tile->
w;
127 const unsigned ty = tile->
current / tile->
w;
142 x0, y0, inlink->
w, inlink->
h);
185 0, 0, outlink->
w, outlink->
h);
192 x0, y0, 0, 0, inlink->
w, inlink->
h);
241 .priv_class = &tile_class,
AVFilterFormats * ff_draw_supported_pixel_formats(unsigned flags)
Return the list of pixel formats supported by the draw functions.
This structure describes decoded (raw) audio or video data.
void ff_copy_rectangle2(FFDrawContext *draw, uint8_t *dst[], int dst_linesize[], uint8_t *src[], int src_linesize[], int dst_x, int dst_y, int src_x, int src_y, int w, int h)
Copy a rectangle from an image to another.
static int request_frame(AVFilterLink *outlink)
Main libavfilter public API header.
int h
agreed upon image height
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
static AVRational av_make_q(int num, int den)
Create a rational.
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
static int end_last_frame(AVFilterContext *ctx)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static int config_props(AVFilterLink *outlink)
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
#define AVERROR_EOF
End of file.
static void get_current_tile_pos(AVFilterContext *ctx, unsigned *x, unsigned *y)
static const AVFilterPad tile_inputs[]
A filter pad used for either input or output.
A link between two filters.
int width
width and height of the video frame
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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.
static void draw_blank_frame(AVFilterContext *ctx, AVFrame *out_buf)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFILTER_DEFINE_CLASS(tile)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4])
Prepare a color.
int w
agreed upon image width
static int query_formats(AVFilterContext *ctx)
AVFilterContext * src
source filter
static const AVFilterPad outputs[]
static const AVFilterPad tile_outputs[]
static av_cold int init(AVFilterContext *ctx)
int format
agreed upon media format
static const AVFilterPad inputs[]
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Describe the class of an AVClass context structure.
const char * name
Filter name.
int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
Init a draw context.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
offset must point to two consecutive integers
AVFilterLink ** outputs
array of pointers to output links
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVFilterContext * dst
dest filter
static const AVOption tile_options[]
void ff_fill_rectangle(FFDrawContext *draw, FFDrawColor *color, uint8_t *dst[], int dst_linesize[], int dst_x, int dst_y, int w, int h)
Fill a rectangle with an uniform color.
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.