45 #define OFFSET(x) offsetof(ShowVolumeContext, x)
46 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
55 {
"c",
"set volume color expression",
OFFSET(
color),
AV_OPT_TYPE_STRING, {.str=
"if(gte(VOLUME,-2), if(gte(VOLUME,-1),0xff0000ff, 0xff00ffff),0xff00ff00)"}, 0, 0,
FLAGS },
147 for (i = 0; txt[i]; i++) {
151 for (char_y = 0; char_y < font_height; char_y++) {
152 for (mask = 0x80;
mask; mask >>= 1) {
153 if (font[txt[i] * font_height + char_y] & mask)
179 for (i = 0; i < outlink->
h; i++)
184 for (j = 0; j < outlink->
h; j++) {
186 for (k = 0; k < s->
w; k++) {
187 dst[k * 4 + 0] =
FFMAX(dst[k * 4 + 0] - s->
f, 0);
188 dst[k * 4 + 1] =
FFMAX(dst[k * 4 + 1] - s->
f, 0);
189 dst[k * 4 + 2] =
FFMAX(dst[k * 4 + 2] - s->
f, 0);
190 dst[k * 4 + 3] =
FFMAX(dst[k * 4 + 3] - s->
f, 0);
194 for (c = 0; c < inlink->
channels; c++) {
200 max =
FFMAX(max, src[i]);
202 max = av_clipf(max, 0, 1);
207 for (j = 0; j < s->
h; j++) {
210 for (k = 0; k < s->
w * max; k++)
252 .
name =
"showvolume",
258 .
inputs = showvolume_inputs,
260 .priv_class = &showvolume_class,
This structure describes decoded (raw) audio or video data.
AVFilter ff_avf_showvolume
static const AVFilterPad outputs[]
Main libavfilter public API header.
int max_samples
Maximum number of samples to filter at once.
int h
agreed upon image height
static int draw_text(AVFilterContext *ctx, AVFrame *frame, int width, int height)
static enum AVSampleFormat formats[]
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
static const AVOption showvolume_options[]
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.
static const AVFilterPad showvolume_outputs[]
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static double av_q2d(AVRational a)
Convert rational to double.
A filter pad used for either input or output.
A link between two filters.
int width
width and height of the video frame
const uint8_t avpriv_cga_font[2048]
int min_samples
Minimum number of samples to filter at once.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown; if left to 0/0, will be automatically be cop...
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 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
struct AVFilterChannelLayouts * out_channel_layouts
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
uint64_t channel_layout
Channel layout of the audio data.
int w
agreed upon image width
audio channel layout utility functions
static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
AVFilterContext * src
source filter
int partial_buf_size
Size of the partial buffer to allocate.
static const AVFilterPad showvolume_inputs[]
static int config_output(AVFilterLink *outlink)
AVFilterFormats * out_samplerates
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
A list of supported channel layouts.
AVSampleFormat
Audio sample formats.
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
static int query_formats(AVFilterContext *ctx)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Describe the class of an AVClass context structure.
static const AVFilterPad inputs[]
rational number numerator/denominator
offset must point to AVRational
static av_cold int init(AVFilterContext *ctx)
const char * name
Filter name.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterLink ** outputs
array of pointers to output links
enum MovChannelLayoutTag * layouts
static enum AVPixelFormat pix_fmts[]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
Get the channel with the given index in channel_layout.
static int config_input(AVFilterLink *inlink)
int channels
Number of channels.
static av_cold void uninit(AVFilterContext *ctx)
static const char *const var_names[]
const char * av_get_channel_name(uint64_t channel)
Get the name of a given channel.
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
AVFilterContext * dst
dest filter
static enum AVSampleFormat sample_fmts[]
uint8_t ** extended_data
pointers to the data planes/channels.
static void drawtext(AVFrame *pic, int x, int y, const char *txt)
AVPixelFormat
Pixel format.
int nb_samples
number of audio samples (per channel) described by this frame
AVFILTER_DEFINE_CLASS(showvolume)
CGA/EGA/VGA ROM font data.
AVFilterFormats * out_formats
simple arithmetic expression evaluator