libavfilter/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/audioconvert.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  ShowSpectrumContext

Defines

#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_samples (AVFilterLink *inlink, AVFilterBufferRef *insamples)

Variables

static const AVOption showspectrum_options []
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.


Define Documentation

#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM

Definition at line 50 of file avf_showspectrum.c.

#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().

#define OFFSET (  )     offsetof(ShowSpectrumContext, x)

Definition at line 49 of file avf_showspectrum.c.

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

Referenced by plot_spectrum_column().


Function Documentation

AVFILTER_DEFINE_CLASS ( showspectrum   ) 

static int config_output ( AVFilterLink outlink  )  [static]

Definition at line 118 of file avf_showspectrum.c.

static int filter_samples ( AVFilterLink inlink,
AVFilterBufferRef insamples 
) [static]

Definition at line 271 of file avf_showspectrum.c.

static av_cold int init ( AVFilterContext ctx,
const char *  args 
) [static]

Definition at line 60 of file avf_showspectrum.c.

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

Definition at line 206 of file avf_showspectrum.c.

Referenced by filter_samples().

static void push_frame ( AVFilterLink outlink  )  [inline, static]

Definition at line 175 of file avf_showspectrum.c.

static int query_formats ( AVFilterContext ctx  )  [static]

Definition at line 84 of file avf_showspectrum.c.

static int request_frame ( AVFilterLink outlink  )  [static]

Definition at line 190 of file avf_showspectrum.c.

static av_cold void uninit ( AVFilterContext ctx  )  [static]

Definition at line 74 of file avf_showspectrum.c.


Variable Documentation

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),

    .inputs  = (const AVFilterPad[]) {
        {
            .name           = "default",
            .type           = AVMEDIA_TYPE_AUDIO,
            .filter_samples = filter_samples,
            .min_perms      = AV_PERM_READ,
        },
        { .name = NULL }
    },

    .outputs = (const AVFilterPad[]) {
        {
            .name           = "default",
            .type           = AVMEDIA_TYPE_VIDEO,
            .config_props   = config_output,
            .request_frame  = request_frame,
        },
        { .name = NULL }
    },

    .priv_class = &showspectrum_class,
}

Definition at line 288 of file avf_showspectrum.c.

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 },
    { NULL },
}

Definition at line 52 of file avf_showspectrum.c.


Generated on Fri Oct 26 02:50:09 2012 for FFmpeg by  doxygen 1.5.8