FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
avf_showspectrum.c File Reference

audio to spectrum (video) transmedia filter, based on ffplay rdft showmode (by Michael Niedermayer) and lavfi/avf_showwaves (by Stefano Sabatini). More...

#include <math.h>
#include "libavcodec/avfft.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  ShowSpectrumContext
 

Macros

#define OFFSET(x)   offsetof(ShowSpectrumContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define RE(ch)   data[ch][2*y + 0]
 
#define IM(ch)   data[ch][2*y + 1]
 
#define MAGNITUDE(re, im)   sqrt((re)*(re) + (im)*(im))
 

Functions

 AVFILTER_DEFINE_CLASS (showspectrum)
 
static av_cold int init (AVFilterContext *ctx, const char *args)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_output (AVFilterLink *outlink)
 
static void push_frame (AVFilterLink *outlink)
 
static int request_frame (AVFilterLink *outlink)
 
static int plot_spectrum_column (AVFilterLink *inlink, AVFilterBufferRef *insamples, int nb_samples)
 
static int filter_frame (AVFilterLink *inlink, AVFilterBufferRef *insamples)
 

Variables

static const AVOption showspectrum_options []
 
static const AVFilterPad showspectrum_inputs []
 
static const AVFilterPad showspectrum_outputs []
 
AVFilter avfilter_avf_showspectrum
 

Detailed Description

audio to spectrum (video) transmedia filter, based on ffplay rdft showmode (by Michael Niedermayer) and lavfi/avf_showwaves (by Stefano Sabatini).

Definition in file avf_showspectrum.c.

Macro Definition Documentation

#define OFFSET (   x)    offsetof(ShowSpectrumContext, x)

Definition at line 50 of file avf_showspectrum.c.

Definition at line 51 of file avf_showspectrum.c.

#define RE (   ch)    data[ch][2*y + 0]

Referenced by plot_spectrum_column().

#define IM (   ch)    data[ch][2*y + 1]

Referenced by plot_spectrum_column().

#define MAGNITUDE (   re,
  im 
)    sqrt((re)*(re) + (im)*(im))

Referenced by plot_spectrum_column().

Function Documentation

AVFILTER_DEFINE_CLASS ( showspectrum  )
static av_cold int init ( AVFilterContext ctx,
const char *  args 
)
static

Definition at line 62 of file avf_showspectrum.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 76 of file avf_showspectrum.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 86 of file avf_showspectrum.c.

static int config_output ( AVFilterLink outlink)
static

Definition at line 120 of file avf_showspectrum.c.

static void push_frame ( AVFilterLink outlink)
inlinestatic

Definition at line 181 of file avf_showspectrum.c.

Referenced by plot_spectrum_column(), and request_frame().

static int request_frame ( AVFilterLink outlink)
static

Definition at line 194 of file avf_showspectrum.c.

static int plot_spectrum_column ( AVFilterLink inlink,
AVFilterBufferRef insamples,
int  nb_samples 
)
static

Definition at line 210 of file avf_showspectrum.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFilterBufferRef insamples 
)
static

Definition at line 282 of file avf_showspectrum.c.

Variable Documentation

const AVOption showspectrum_options[]
static
Initial value:
= {
{ "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "640x480"}, 0, 0, FLAGS },
{ "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "640x480"}, 0, 0, FLAGS },
{ "slide", "set sliding mode", OFFSET(sliding), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, FLAGS },
{ NULL },
}

Definition at line 53 of file avf_showspectrum.c.

const AVFilterPad showspectrum_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.min_perms = AV_PERM_READ,
},
{ NULL }
}

Definition at line 299 of file avf_showspectrum.c.

const AVFilterPad showspectrum_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
.request_frame = request_frame,
},
{ NULL }
}

Definition at line 309 of file avf_showspectrum.c.

AVFilter avfilter_avf_showspectrum
Initial value:
= {
.name = "showspectrum",
.description = NULL_IF_CONFIG_SMALL("Convert input audio to a spectrum video output."),
.init = init,
.uninit = uninit,
.query_formats = query_formats,
.priv_size = sizeof(ShowSpectrumContext),
.priv_class = &showspectrum_class,
}

Definition at line 319 of file avf_showspectrum.c.