64 #define OFFSET(x) offsetof(GraphMonitorContext, x)
65 #define VF AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
112 for (
int i = 0; i < out->
height; i++)
113 for (
int j = 0; j < out->
width; j++)
125 if (y + 8 >= pic->
height ||
126 x + strlen(txt) * 8 >= pic->
width)
129 for (i = 0; txt[i]; i++) {
133 for (char_y = 0; char_y < font_height; char_y++) {
134 for (mask = 0x80;
mask; mask >>= 1) {
135 if (font[txt[i] * font_height + char_y] & mask) {
149 for (
int j = 0; j < filter->
nb_inputs; j++) {
157 for (
int j = 0; j < filter->
nb_outputs; j++) {
174 char buffer[1024] = { 0 };
178 snprintf(buffer,
sizeof(buffer)-1,
" | format: %s",
181 snprintf(buffer,
sizeof(buffer)-1,
" | format: %s",
185 xpos += strlen(buffer) * 8;
189 snprintf(buffer,
sizeof(buffer)-1,
" | size: %dx%d", l->
w, l->
h);
194 xpos += strlen(buffer) * 8;
203 xpos += strlen(buffer) * 8;
208 xpos += strlen(buffer) * 8;
211 snprintf(buffer,
sizeof(buffer)-1,
" | queue: ");
213 xpos += strlen(buffer) * 8;
214 snprintf(buffer,
sizeof(buffer)-1,
"%"PRId64, frames);
216 xpos += strlen(buffer) * 8;
221 xpos += strlen(buffer) * 8;
226 xpos += strlen(buffer) * 8;
231 xpos += strlen(buffer) * 8;
236 xpos += strlen(buffer) * 8;
255 char buffer[1024] = { 0 };
262 xpos += strlen(filter->
name) * 8 + 10;
265 for (
int j = 0; j < filter->
nb_inputs; j++) {
269 if (s->
mode && !frames)
273 snprintf(buffer,
sizeof(buffer)-1,
"in%d: ", j);
275 xpos += strlen(buffer) * 8;
277 xpos += strlen(l->
src->
name) * 8 + 10;
283 for (
int j = 0; j < filter->
nb_outputs; j++) {
287 if (s->
mode && !frames)
291 snprintf(buffer,
sizeof(buffer)-1,
"out%d: ", j);
293 xpos += strlen(buffer) * 8;
295 xpos += strlen(l->
dst->
name) * 8 + 10;
359 #if CONFIG_GRAPHMONITOR_FILTER
371 static const AVFilterPad graphmonitor_outputs[] = {
381 .
name =
"graphmonitor",
384 .priv_class = &graphmonitor_class,
387 .
inputs = graphmonitor_inputs,
388 .
outputs = graphmonitor_outputs,
391 #endif // CONFIG_GRAPHMONITOR_FILTER
393 #if CONFIG_AGRAPHMONITOR_FILTER
395 #define agraphmonitor_options graphmonitor_options
398 static const AVFilterPad agraphmonitor_inputs[] = {
406 static const AVFilterPad agraphmonitor_outputs[] = {
416 .
name =
"agraphmonitor",
419 .priv_class = &agraphmonitor_class,
422 .
inputs = agraphmonitor_inputs,
423 .
outputs = agraphmonitor_outputs,
425 #endif // CONFIG_AGRAPHMONITOR_FILTER
AVFilterContext ** filters
int64_t frame_count_in
Number of past frames sent through the link.
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.
Main libavfilter public API header.
int h
agreed upon image height
#define FFERROR_NOT_READY
Filters implementation helper functions.
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
AVFilter ff_avf_agraphmonitor
static int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
struct AVFilterGraph * graph
filtergraph this filter belongs to
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
char * name
name of this filter instance
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, int clip)
timestamp utils, mostly useful for debugging/logging purposes
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
A filter pad used for either input or output.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
const uint8_t avpriv_cga_font[2048]
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.
int sample_rate
samples per second
static const uint16_t mask[17]
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
unsigned nb_outputs
number of output pads
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int64_t current_pts_us
Current timestamp of the link, as defined by the most recent frame(s), in AV_TIME_BASE units...
void * priv
private data for use by the filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
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.
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int w
agreed upon image width
#define FF_FILTER_FORWARD_WANTED(outlink, inlink)
Forward the frame_wanted_out flag from an output link to an input link.
unsigned nb_inputs
number of input pads
static int config_output(AVFilterLink *outlink)
AVFilterContext * src
source filter
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
int format
agreed upon media format
AVFilter ff_vf_graphmonitor
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static const AVOption graphmonitor_options[]
Describe the class of an AVClass context structure.
static int filter_have_queued(AVFilterContext *filter)
Rational number (pair of numerator and denominator).
offset must point to AVRational
const char * name
Filter name.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
size_t ff_inlink_queued_frames(AVFilterLink *link)
Get the number of frames available on the link.
offset must point to two consecutive integers
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.
static enum AVPixelFormat pix_fmts[]
#define flags(name, subs,...)
enum AVMediaType type
filter media type
static int activate(AVFilterContext *ctx)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
static void clear_image(GraphMonitorContext *s, AVFrame *out, AVFilterLink *outlink)
int channels
Number of channels.
static int query_formats(AVFilterContext *ctx)
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
AVFilterContext * dst
dest filter
#define AVFILTER_DEFINE_CLASS(fname)
static void drawtext(AVFrame *pic, int x, int y, const char *txt, uint8_t *color)
static void draw_items(AVFilterContext *ctx, AVFrame *out, int xpos, int ypos, AVFilterLink *l, size_t frames)
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.
static int create_frame(AVFilterContext *ctx, int64_t pts)
AVPixelFormat
Pixel format.
mode
Use these values in ebur128_init (or'ed).
const AVFilter * filter
the AVFilter of which this is an instance
#define AV_NOPTS_VALUE
Undefined timestamp value.
CGA/EGA/VGA ROM font data.
simple arithmetic expression evaluator