21#include "config_components.h"
95#define OFFSET(x) offsetof(GraphMonitorContext, x)
96#define VF AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
97#define VFR AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
142 8192 *
sizeof(*(
s->cache)));
168 const int h =
out->height;
169 const int w =
out->width;
170 uint8_t *
dst =
out->data[0];
173 for (
int j = 0; j <
w; j++)
176 for (
int i = 1;
i <
h;
i++) {
177 memcpy(
dst,
out->data[0],
w * 4);
191 if (y + 8 >= pic->
height ||
195 for (
i = 0; txt[
i];
i++) {
198 uint8_t *p = pic->
data[0] + y*pic->
linesize[0] + (x +
i*8)*4;
199 for (char_y = 0; char_y < font_height; char_y++) {
201 if (font[txt[
i] * font_height + char_y] &
mask) {
215 for (
int j = 0; j <
filter->nb_inputs; j++) {
222 for (
int j = 0; j <
filter->nb_outputs; j++) {
234 for (
int j = 0; j <
filter->nb_inputs; j++) {
242 for (
int j = 0; j <
filter->nb_outputs; j++) {
262 int64_t previous_pts_us =
s->cache[
s->cache_index].previous_pts_us;
264 const int flags =
s->flags;
265 const int mode =
s->mode;
266 char buffer[1024] = { 0 };
372 s->cache[
s->cache_index].previous_pts_us = current_pts_us;
374 if (
s->cache_index + 1 >=
s->cache_size /
sizeof(*(
s->cache))) {
390 int ret,
len, xpos, ypos = 0;
398 s->bg[3] = 255 *
s->opacity;
403 for (
int i = 0;
i <
ctx->graph->nb_filters;
i++) {
418 xpos +=
len * 8 + 10;
422 for (
int j = 0; j <
filter->nb_inputs; j++) {
438 xpos +=
len * 8 + 10;
446 for (
int j = 0; j <
filter->nb_outputs; j++) {
462 xpos +=
len * 8 + 10;
511 s->next_pts =
s->pts + 1;
514 if (
s->eof &&
s->eof_frames == 0) {
544 s->white[0] =
s->white[1] =
s->white[2] = 255;
545 s->yellow[0] =
s->yellow[1] = 255;
549 s->gray[0] =
s->gray[1] =
s->gray[2] = 128;
566 s->cache_size =
s->cache_index = 0;
579#if CONFIG_GRAPHMONITOR_FILTER
582 .p.name =
"graphmonitor",
584 .p.priv_class = &graphmonitor_class,
597#if CONFIG_AGRAPHMONITOR_FILTER
600 .p.name =
"agraphmonitor",
602 .p.priv_class = &graphmonitor_class,
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
const FFFilter ff_avf_agraphmonitor
const FFFilter ff_vf_graphmonitor
static AVFormatContext * ctx
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
int ff_outlink_get_status(AVFilterLink *link)
Get the status on an output link.
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
size_t ff_inlink_queued_frames(AVFilterLink *link)
Get the number of frames available on the link.
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Main libavfilter public API header.
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
int(* init)(AVBSFContext *ctx)
static const AVOption graphmonitor_options[]
static int create_frame(AVFilterContext *ctx, int64_t pts)
static void clear_image(GraphMonitorContext *s, AVFrame *out, AVFilterLink *outlink)
static int filter_have_eof(AVFilterContext *filter)
static void drawtext(AVFrame *pic, int x, int y, const char *txt, const int len, uint8_t *color)
static int filter_have_queued(AVFilterContext *filter)
static int draw_items(AVFilterContext *ctx, AVFilterContext *filter, AVFrame *out, int xpos, int ypos, AVFilterLink *l, size_t frames)
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static int activate(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
static const AVFilterPad graphmonitor_outputs[]
static int config_output(AVFilterLink *outlink)
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
@ AV_OPT_TYPE_VIDEO_RATE
Underlying C type is AVRational.
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
#define AVERROR_EOF
End of file.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FF_FILTER_FORWARD_WANTED(outlink, inlink)
Forward the frame_wanted_out flag from an output link to an input link.
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
#define AVFILTER_DEFINE_CLASS_EXT(name, desc, options)
static FilterLink * ff_filter_link(AVFilterLink *link)
#define FILTER_QUERY_FUNC2(func)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
static const uint16_t mask[17]
Memory handling functions.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
char * name
name of this filter instance
void * priv
private data for use by the filter
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
enum AVMediaType type
filter media type
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
int sample_rate
samples per second
AVChannelLayout ch_layout
channel layout of current buffer (see libavutil/channel_layout.h)
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Rational number (pair of numerator and denominator).
Link properties exposed to filter code, but not external callers.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
int64_t sample_count_in
Number of past samples sent through the link.
int64_t current_pts_us
Current timestamp of the link, as defined by the most recent frame(s), in AV_TIME_BASE units.
int64_t frame_count_in
Number of past frames sent through the link.
static void error(const char *err)
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
timestamp utils, mostly useful for debugging/logging purposes
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
const uint8_t * avpriv_cga_font_get(void)
CGA/EGA/VGA ROM font data.