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

Audio silence detector. More...

#include <float.h>
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "libavutil/timestamp.h"
#include "audio.h"
#include "formats.h"
#include "avfilter.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  SilenceDetectContext
 

Macros

#define OFFSET(x)   offsetof(SilenceDetectContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (silencedetect)
 
static av_cold int init (AVFilterContext *ctx, const char *args)
 
static char * get_metadata_val (AVFilterBufferRef *insamples, const char *key)
 
static int filter_frame (AVFilterLink *inlink, AVFilterBufferRef *insamples)
 
static int query_formats (AVFilterContext *ctx)
 

Variables

static const AVOption silencedetect_options []
 
static const AVFilterPad silencedetect_inputs []
 
static const AVFilterPad silencedetect_outputs []
 
AVFilter avfilter_af_silencedetect
 

Detailed Description

Audio silence detector.

Definition in file af_silencedetect.c.

Macro Definition Documentation

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

Definition at line 45 of file af_silencedetect.c.

Definition at line 46 of file af_silencedetect.c.

Function Documentation

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

Definition at line 57 of file af_silencedetect.c.

static char* get_metadata_val ( AVFilterBufferRef insamples,
const char *  key 
)
static

Definition at line 73 of file af_silencedetect.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFilterBufferRef insamples 
)
static

Definition at line 79 of file af_silencedetect.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 130 of file af_silencedetect.c.

Variable Documentation

const AVOption silencedetect_options[]
static
Initial value:
= {
{ "n", "set noise tolerance", OFFSET(noise), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0, DBL_MAX, FLAGS },
{ "noise", "set noise tolerance", OFFSET(noise), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0, DBL_MAX, FLAGS },
{ "d", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DOUBLE, {.dbl=2.}, 0, 24*60*60, FLAGS },
{ "duration", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DOUBLE, {.dbl=2.}, 0, 24*60*60, FLAGS },
{ NULL },
}

Definition at line 47 of file af_silencedetect.c.

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

Definition at line 157 of file af_silencedetect.c.

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

Definition at line 167 of file af_silencedetect.c.

AVFilter avfilter_af_silencedetect
Initial value:
= {
.name = "silencedetect",
.description = NULL_IF_CONFIG_SMALL("Detect silence."),
.priv_size = sizeof(SilenceDetectContext),
.init = init,
.priv_class = &silencedetect_class,
}

Definition at line 175 of file af_silencedetect.c.