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"
Include dependency graph for af_silencedetect.c:

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 char * get_metadata_val (AVFrame *insamples, const char *key)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *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

Definition at line 46 of file af_silencedetect.c.

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

Definition at line 45 of file af_silencedetect.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( silencedetect  )
static int filter_frame ( AVFilterLink inlink,
AVFrame insamples 
)
static

Definition at line 63 of file af_silencedetect.c.

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

Definition at line 57 of file af_silencedetect.c.

Referenced by filter_frame().

static int query_formats ( AVFilterContext ctx)
static

Definition at line 114 of file af_silencedetect.c.

Variable Documentation

AVFilter avfilter_af_silencedetect
Initial value:
= {
.name = "silencedetect",
.description = NULL_IF_CONFIG_SMALL("Detect silence."),
.priv_size = sizeof(SilenceDetectContext),
.priv_class = &silencedetect_class,
}
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
static const AVFilterPad silencedetect_inputs[]
static const AVFilterPad silencedetect_outputs[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int query_formats(AVFilterContext *ctx)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs

Definition at line 159 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 }
}
static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
AVFrame * ff_null_get_audio_buffer(AVFilterLink *link, int nb_samples)
get_audio_buffer() handler for filters which simply pass audio along
Definition: audio.c:36
NULL
Definition: eval.c:55

Definition at line 141 of file af_silencedetect.c.

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 },
}
#define OFFSET(x)
static int64_t duration
Definition: ffplay.c:294
#define FLAGS
NULL
Definition: eval.c:55
static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe)
Definition: noise_bsf.c:28

Definition at line 47 of file af_silencedetect.c.

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

Definition at line 151 of file af_silencedetect.c.