54 #define OFFSET(x) offsetof(AudioVectorScopeContext, x)
55 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
84 if (y >= s->
h || x >= s->
w)
104 for (i = 0; i < s->
h; i++) {
105 for (j = 0; j < s->
w*4; j+=4) {
179 const int hw = s->
hw;
180 const int hh = s->
hh;
182 const double zoom = s->
zoom;
194 for (i = 0; i < outlink->
h; i++)
201 switch (insamples->
format) {
204 int16_t *
src = (int16_t *)insamples->
data[0] + i * 2;
207 x = ((src[1] - src[0]) * zoom / (
float)(UINT16_MAX) + 1) * hw;
208 y = (1.0 - (src[0] + src[1]) * zoom / (
float)UINT16_MAX) * hh;
210 x = (src[1] * zoom / (float)INT16_MAX + 1) * hw;
211 y = (src[0] * zoom / (float)INT16_MAX + 1) * hh;
219 float *
src = (
float *)insamples->
data[0] + i * 2;
222 x = ((src[1] - src[0]) * zoom / 2 + 1) * hw;
223 y = (1.0 - (src[0] + src[1]) * zoom / 2) * hh;
225 x = (src[1] * zoom + 1) * hw;
226 y = (src[0] * zoom + 1) * hh;
266 .
name =
"avectorscope",
271 .
inputs = audiovectorscope_inputs,
272 .
outputs = audiovectorscope_outputs,
273 .priv_class = &avectorscope_class,
This structure describes decoded (raw) audio or video data.
static const AVFilterPad outputs[]
Main libavfilter public API header.
int max_samples
Maximum number of samples to filter at once.
static av_cold void uninit(AVFilterContext *ctx)
int h
agreed upon image height
static enum AVSampleFormat formats[]
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
#define AV_CH_LAYOUT_STEREO
AVFilter ff_avf_avectorscope
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.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static const AVFilterPad audiovectorscope_outputs[]
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
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
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
static int config_input(AVFilterLink *inlink)
#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
simple assert() macros that are a bit more flexible than ISO C assert().
struct AVFilterChannelLayouts * out_channel_layouts
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
static const AVOption avectorscope_options[]
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int w
agreed upon image width
audio channel layout utility functions
static const AVFilterPad audiovectorscope_inputs[]
AVFilterContext * src
source filter
int partial_buf_size
Size of the partial buffer to allocate.
static void draw_dot(AudioVectorScopeContext *s, unsigned x, unsigned y)
AVFilterFormats * out_samplerates
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
AVFILTER_DEFINE_CLASS(avectorscope)
static int config_output(AVFilterLink *outlink)
A list of supported channel layouts.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
AVSampleFormat
Audio sample formats.
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
const char * name
Filter name.
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.
static int query_formats(AVFilterContext *ctx)
static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
AVFilterContext * dst
dest filter
static enum AVSampleFormat sample_fmts[]
static void fade(AudioVectorScopeContext *s)
AVPixelFormat
Pixel format.
int nb_samples
number of audio samples (per channel) described by this frame
AVFilterFormats * out_formats