FFmpeg
Data Structures | Macros | Functions | Variables
avf_aphasemeter.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/timestamp.h"
#include "avfilter.h"
#include "formats.h"
#include "audio.h"
#include "video.h"
#include "internal.h"
#include "float.h"

Go to the source code of this file.

Data Structures

struct  AudioPhaseMeterContext
 

Macros

#define MAX_DURATION   (24*60*60*1000000LL)
 
#define OFFSET(x)   offsetof(AudioPhaseMeterContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define get_duration(index)   (index[1] - index[0])
 

Functions

 AVFILTER_DEFINE_CLASS (aphasemeter)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int config_video_output (AVFilterLink *outlink)
 
static int get_x (float phase, int w)
 
static void add_metadata (AVFrame *insamples, const char *key, char *value)
 
static void update_mono_detection (AudioPhaseMeterContext *s, AVFrame *insamples, int mono_measurement)
 
static void update_out_phase_detection (AudioPhaseMeterContext *s, AVFrame *insamples, int out_phase_measurement)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static av_cold int init (AVFilterContext *ctx)
 

Variables

static const AVOption aphasemeter_options []
 
static const AVFilterPad inputs []
 
const AVFilter ff_avf_aphasemeter
 

Detailed Description

audio to video multimedia aphasemeter filter

Definition in file avf_aphasemeter.c.

Macro Definition Documentation

◆ MAX_DURATION

#define MAX_DURATION   (24*60*60*1000000LL)

Definition at line 64 of file avf_aphasemeter.c.

◆ OFFSET

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

Definition at line 65 of file avf_aphasemeter.c.

◆ FLAGS

Definition at line 66 of file avf_aphasemeter.c.

◆ get_duration

#define get_duration (   index)    (index[1] - index[0])

Definition at line 67 of file avf_aphasemeter.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( aphasemeter  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 91 of file avf_aphasemeter.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 126 of file avf_aphasemeter.c.

◆ config_video_output()

static int config_video_output ( AVFilterLink outlink)
static

Definition at line 143 of file avf_aphasemeter.c.

Referenced by init().

◆ get_x()

static int get_x ( float  phase,
int  w 
)
inlinestatic

Definition at line 163 of file avf_aphasemeter.c.

Referenced by filter_frame().

◆ add_metadata()

static void add_metadata ( AVFrame insamples,
const char *  key,
char *  value 
)
inlinestatic

◆ update_mono_detection()

static void update_mono_detection ( AudioPhaseMeterContext s,
AVFrame insamples,
int  mono_measurement 
)
inlinestatic

Definition at line 176 of file avf_aphasemeter.c.

Referenced by filter_frame(), and uninit().

◆ update_out_phase_detection()

static void update_out_phase_detection ( AudioPhaseMeterContext s,
AVFrame insamples,
int  out_phase_measurement 
)
inlinestatic

Definition at line 207 of file avf_aphasemeter.c.

Referenced by filter_frame(), and uninit().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 238 of file avf_aphasemeter.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 339 of file avf_aphasemeter.c.

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 350 of file avf_aphasemeter.c.

Variable Documentation

◆ aphasemeter_options

const AVOption aphasemeter_options[]
static
Initial value:
= {
{ "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
{ "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
{ "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="800x400"}, 0, 0, FLAGS },
{ "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="800x400"}, 0, 0, FLAGS },
{ "rc", "set red contrast", OFFSET(contrast[0]), AV_OPT_TYPE_INT, {.i64=2}, 0, 255, FLAGS },
{ "gc", "set green contrast", OFFSET(contrast[1]), AV_OPT_TYPE_INT, {.i64=7}, 0, 255, FLAGS },
{ "bc", "set blue contrast", OFFSET(contrast[2]), AV_OPT_TYPE_INT, {.i64=1}, 0, 255, FLAGS },
{ "mpc", "set median phase color", OFFSET(mpc_str), AV_OPT_TYPE_STRING, {.str = "none"}, 0, 0, FLAGS },
{ "video", "set video output", OFFSET(do_video), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, FLAGS },
{ "phasing", "set mono and out-of-phase detection output", OFFSET(do_phasing_detection), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS },
{ "tolerance", "set phase tolerance for mono detection", OFFSET(tolerance), AV_OPT_TYPE_FLOAT, {.dbl = 0.}, 0, 1, FLAGS },
{ "t", "set phase tolerance for mono detection", OFFSET(tolerance), AV_OPT_TYPE_FLOAT, {.dbl = 0.}, 0, 1, FLAGS },
{ "angle", "set angle threshold for out-of-phase detection", OFFSET(angle), AV_OPT_TYPE_FLOAT, {.dbl = 170.}, 90, 180, FLAGS },
{ "a", "set angle threshold for out-of-phase detection", OFFSET(angle), AV_OPT_TYPE_FLOAT, {.dbl = 170.}, 90, 180, FLAGS },
{ "duration", "set minimum mono or out-of-phase duration in seconds", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=2000000}, 0, MAX_DURATION, FLAGS },
{ "d", "set minimum mono or out-of-phase duration in seconds", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=2000000}, 0, MAX_DURATION, FLAGS },
{ NULL }
}

Definition at line 69 of file avf_aphasemeter.c.

◆ inputs

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

Definition at line 378 of file avf_aphasemeter.c.

◆ ff_avf_aphasemeter

const AVFilter ff_avf_aphasemeter
Initial value:
= {
.name = "aphasemeter",
.description = NULL_IF_CONFIG_SMALL("Convert input audio to phase meter video output."),
.init = init,
.uninit = uninit,
.query_formats = query_formats,
.priv_size = sizeof(AudioPhaseMeterContext),
.priv_class = &aphasemeter_class,
}

Definition at line 388 of file avf_aphasemeter.c.

inputs
static const AVFilterPad inputs[]
Definition: avf_aphasemeter.c:378
init
static av_cold int init(AVFilterContext *ctx)
Definition: avf_aphasemeter.c:350
AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:238
config_input
static int config_input(AVFilterLink *inlink)
Definition: avf_aphasemeter.c:126
w
uint8_t w
Definition: llviddspenc.c:39
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Definition: opt.h:239
FLAGS
#define FLAGS
Definition: avf_aphasemeter.c:66
duration
int64_t duration
Definition: movenc.c:64
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: avf_aphasemeter.c:238
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: avf_aphasemeter.c:91
NULL
#define NULL
Definition: coverity.c:32
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:235
AudioPhaseMeterContext
Definition: avf_aphasemeter.c:39
AVFILTER_FLAG_DYNAMIC_OUTPUTS
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
Definition: avfilter.h:112
MAX_DURATION
#define MAX_DURATION
Definition: avf_aphasemeter.c:64
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
OFFSET
#define OFFSET(x)
Definition: avf_aphasemeter.c:65
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: avf_aphasemeter.c:339
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:242
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229