26 #include "libavutil/channel_layout.h"
27 #include "libavutil/opt.h"
28 #include "libavutil/parseutils.h"
53 #define OFFSET(x) offsetof(ShowWavesContext, x)
54 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
121 outlink->
w = showwaves->
w;
122 outlink->
h = showwaves->
h;
161 #define MAX_INT16 ((1<<15) -1)
170 int linesize = outpicref ? outpicref->
linesize[0] : 0;
171 int16_t *p = (int16_t *)insamples->
data[0];
173 int i, j, k, h,
ret = 0;
174 const int n = showwaves->
n;
178 for (i = 0; i < nb_samples; i++) {
184 outpicref->
width = outlink->
w;
185 outpicref->
height = outlink->
h;
186 outpicref->
pts = insamples->
pts +
191 for (j = 0; j < outlink->
h; j++)
192 memset(outpicref->
data[0] + j * linesize, 0, outlink->
w);
196 switch (showwaves->
mode) {
198 if (h >= 0 && h < outlink->h)
199 *(outpicref->
data[0] + showwaves->
buf_idx + h * linesize) += x;
204 int start = showwaves->
h/2,
end = av_clip(h, 0, outlink->
h-1);
206 for (k = start; k <
end; k++)
207 *(outpicref->
data[0] + showwaves->
buf_idx + k * linesize) += x;
218 if (showwaves->
buf_idx == showwaves->
w)
253 .
inputs = showwaves_inputs,
255 .priv_class = &showwaves_class,
This structure describes decoded (raw) audio or video data.
const char * name
Filter name.
void * priv
private data for use by the filter
static const AVFilterPad outputs[]
int h
agreed upon image height
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
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.
AVFilter avfilter_avf_showwaves
const char * name
Pad name.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static av_cold int end(AVCodecContext *avctx)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static av_cold void uninit(AVFilterContext *ctx)
static double av_q2d(AVRational a)
Convert rational to double.
#define AV_LOG_VERBOSE
Detailed information.
#define FFSWAP(type, a, b)
A filter pad used for either input or output.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
int width
width and height of the video frame
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 int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
AVRational av_div_q(AVRational b, AVRational c) av_const
Divide one rational by another.
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
AVFilterContext * src
source filter
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVPixelFormat
Pixel format.
int w
agreed upon image width
int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const
Rescale a 64-bit integer with rounding to nearest.
A list of supported channel layouts.
AVFilterFormats * out_samplerates
Main libavfilter public API header.
AVFilterLink ** outputs
array of pointers to output links
AVSampleFormat
Audio Sample Formats.
static const AVFilterPad showwaves_outputs[]
static int config_output(AVFilterLink *outlink)
static int push_frame(AVFilterLink *outlink)
static int request_frame(AVFilterLink *outlink)
AVFilterFormats * out_formats
Describe the class of an AVClass context structure.
static const AVFilterPad inputs[]
AVFilterLink ** inputs
array of pointers to input links
rational number numerator/denominator
static int query_formats(AVFilterContext *ctx)
offset must point to AVRational
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterContext * dst
dest filter
offset must point to two consecutive integers
enum MovChannelLayoutTag * layouts
static const AVFilterPad showwaves_inputs[]
int channels
Number of channels.
#define AVFILTER_DEFINE_CLASS(fname)
static enum AVSampleFormat sample_fmts[]
struct AVFilterChannelLayouts * out_channel_layouts
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
static const AVOption showwaves_options[]
int nb_samples
number of audio samples (per channel) described by this frame
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.