52 #define OFFSET(x) offsetof(ShowVolumeContext, x)
53 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
62 {
"c",
"set volume color expression",
OFFSET(
color),
AV_OPT_TYPE_STRING, {.str=
"if(gte(VOLUME,-6), if(gte(VOLUME,-2), if(gte(VOLUME,-1), if(gt(VOLUME,0), 0xff0000ff, 0xff0066ff), 0xff00ffff),0xff00ff00),0xffff0000)"}, 0, 0,
FLAGS },
151 for (i = 0; txt[i]; i++) {
155 for (char_y = 0; char_y < font_height; char_y++) {
156 for (mask = 0x80;
mask; mask >>= 1) {
157 if (font[txt[i] * font_height + char_y] & mask)
183 for (i = 0; i < outlink->
h; i++)
188 for (j = 0; j < outlink->
h; j++) {
190 for (k = 0; k < s->
w; k++) {
191 dst[k * 4 + 0] =
FFMAX(dst[k * 4 + 0] * s->
f, 0);
192 dst[k * 4 + 1] =
FFMAX(dst[k * 4 + 1] * s->
f, 0);
193 dst[k * 4 + 2] =
FFMAX(dst[k * 4 + 2] * s->
f, 0);
194 dst[k * 4 + 3] =
FFMAX(dst[k * 4 + 3] * s->
f, 0);
198 for (c = 0; c < inlink->
channels; c++) {
204 max =
FFMAX(max, src[i]);
207 max = av_clipf(max, 0, 1);
211 for (j = 0; j < s->
h; j++) {
214 for (k = 0; k < s->
w * max; k++)
234 drawtext(out,
FFMAX(0, s->
w - 8 * (
int)strlen(buf)), c * (s->
h + s->
b) + (s->
h - 8) / 2, buf);
270 .
name =
"showvolume",
276 .
inputs = showvolume_inputs,
278 .priv_class = &showvolume_class,
This structure describes decoded (raw) audio or video data.
AVFilter ff_avf_showvolume
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 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 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 const AVFilterPad outputs[]
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.
static const AVFilterPad inputs[]
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.
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[]
void * av_calloc(size_t nmemb, size_t size)
Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vec...
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
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