FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
avf_showcqt.c File Reference
#include "config.h"
#include "libavcodec/avfft.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "libavutil/xga_font_data.h"
#include "libavutil/qsort.h"
#include "libavutil/time.h"
#include "avfilter.h"
#include "internal.h"
#include <math.h>
#include <stdlib.h>

Go to the source code of this file.

Data Structures

struct  SparseCoeff
 
struct  ShowCQTContext
 

Macros

#define VIDEO_WIDTH   1920
 
#define VIDEO_HEIGHT   1080
 
#define FONT_HEIGHT   32
 
#define SPECTOGRAM_HEIGHT   ((VIDEO_HEIGHT-FONT_HEIGHT)/2)
 
#define SPECTOGRAM_START   (VIDEO_HEIGHT-SPECTOGRAM_HEIGHT)
 
#define BASE_FREQ   20.051392800492
 
#define COEFF_CLAMP   1.0e-4
 
#define OFFSET(x)   offsetof(ShowCQTContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (showcqt)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int qsort_sparsecoeff (const SparseCoeff *a, const SparseCoeff *b)
 
static int config_output (AVFilterLink *outlink)
 
static int plot_cqt (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *insamples)
 
static int request_frame (AVFilterLink *outlink)
 

Variables

static const AVOption showcqt_options []
 
static const AVFilterPad showcqt_inputs []
 
static const AVFilterPad showcqt_outputs []
 
AVFilter ff_avf_showcqt
 

Macro Definition Documentation

#define VIDEO_WIDTH   1920

Definition at line 45 of file avf_showcqt.c.

Referenced by config_output(), plot_cqt(), and uninit().

#define VIDEO_HEIGHT   1080

Definition at line 46 of file avf_showcqt.c.

Referenced by config_output().

#define FONT_HEIGHT   32

Definition at line 47 of file avf_showcqt.c.

Referenced by plot_cqt().

#define SPECTOGRAM_HEIGHT   ((VIDEO_HEIGHT-FONT_HEIGHT)/2)

Definition at line 48 of file avf_showcqt.c.

Referenced by config_output(), and plot_cqt().

#define SPECTOGRAM_START   (VIDEO_HEIGHT-SPECTOGRAM_HEIGHT)

Definition at line 49 of file avf_showcqt.c.

Referenced by plot_cqt().

#define BASE_FREQ   20.051392800492

Definition at line 50 of file avf_showcqt.c.

Referenced by config_output().

#define COEFF_CLAMP   1.0e-4

Definition at line 51 of file avf_showcqt.c.

Referenced by config_output().

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

Definition at line 87 of file avf_showcqt.c.

Definition at line 88 of file avf_showcqt.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( showcqt  )
static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 104 of file avf_showcqt.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 122 of file avf_showcqt.c.

static int qsort_sparsecoeff ( const SparseCoeff a,
const SparseCoeff b 
)
inlinestatic

Definition at line 249 of file avf_showcqt.c.

Referenced by config_output().

static int config_output ( AVFilterLink outlink)
static

Definition at line 257 of file avf_showcqt.c.

static int plot_cqt ( AVFilterLink inlink)
static

Definition at line 416 of file avf_showcqt.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFrame insamples 
)
static

Definition at line 592 of file avf_showcqt.c.

Referenced by request_frame().

static int request_frame ( AVFilterLink outlink)
static

Definition at line 652 of file avf_showcqt.c.

Variable Documentation

const AVOption showcqt_options[]
static
Initial value:
= {
{ "volume", "set volume", OFFSET(volume), AV_OPT_TYPE_DOUBLE, { .dbl = 16 }, 0.1, 100, FLAGS },
{ "timeclamp", "set timeclamp", OFFSET(timeclamp), AV_OPT_TYPE_DOUBLE, { .dbl = 0.17 }, 0.1, 1.0, FLAGS },
{ "coeffclamp", "set coeffclamp", OFFSET(coeffclamp), AV_OPT_TYPE_FLOAT, { .dbl = 1 }, 0.1, 10, FLAGS },
{ "gamma", "set gamma", OFFSET(gamma), AV_OPT_TYPE_FLOAT, { .dbl = 3 }, 1, 7, FLAGS },
{ "fullhd", "set full HD resolution", OFFSET(fullhd), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, FLAGS },
{ "fps", "set video fps", OFFSET(fps), AV_OPT_TYPE_INT, { .i64 = 25 }, 10, 100, FLAGS },
{ "count", "set number of transform per frame", OFFSET(count), AV_OPT_TYPE_INT, { .i64 = 6 }, 1, 30, FLAGS },
{ "fontfile", "set font file", OFFSET(fontfile), AV_OPT_TYPE_STRING, { .str = NULL }, CHAR_MIN, CHAR_MAX, FLAGS },
{ NULL }
}

Definition at line 90 of file avf_showcqt.c.

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

Definition at line 668 of file avf_showcqt.c.

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

Definition at line 677 of file avf_showcqt.c.

AVFilter ff_avf_showcqt
Initial value:
= {
.name = "showcqt",
.description = NULL_IF_CONFIG_SMALL("Convert input audio to a CQT (Constant Q Transform) spectrum video output."),
.uninit = uninit,
.query_formats = query_formats,
.priv_size = sizeof(ShowCQTContext),
.priv_class = &showcqt_class,
}

Definition at line 687 of file avf_showcqt.c.