FFmpeg
Data Structures | Macros | Functions | Variables
asrc_flite.c File Reference
#include <flite/flite.h>
#include "libavutil/audio_fifo.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/file.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/thread.h"
#include "avfilter.h"
#include "filters.h"
#include "audio.h"
#include "formats.h"

Go to the source code of this file.

Data Structures

struct  FliteContext
 
struct  voice_entry
 

Macros

#define OFFSET(x)   offsetof(FliteContext, x)
 
#define FLAGS   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define DECLARE_REGISTER_VOICE_FN(name)
 
#define MAKE_VOICE_STRUCTURE(voice_name)
 

Functions

 AVFILTER_DEFINE_CLASS (flite)
 
 DECLARE_REGISTER_VOICE_FN (awb)
 
 DECLARE_REGISTER_VOICE_FN (kal)
 
 DECLARE_REGISTER_VOICE_FN (kal16)
 
 DECLARE_REGISTER_VOICE_FN (rms)
 
 DECLARE_REGISTER_VOICE_FN (slt)
 
static void list_voices (void *log_ctx, const char *sep)
 
static int select_voice (struct voice_entry **entry_ret, const char *voice_name, void *log_ctx)
 
static int audio_stream_chunk_by_word (const cst_wave *wave, int start, int size, int last, cst_audio_streaming_info *asi)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
static int config_props (AVFilterLink *outlink)
 
static int activate (AVFilterContext *ctx)
 

Variables

static const AVOption flite_options []
 
static AVMutex flite_mutex = AV_MUTEX_INITIALIZER
 
static int flite_inited = 0
 
static struct voice_entry voice_entries []
 
static const AVFilterPad flite_outputs []
 
const AVFilter ff_asrc_flite
 

Detailed Description

flite voice synth source

Definition in file asrc_flite.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 57 of file asrc_flite.c.

◆ FLAGS

Definition at line 58 of file asrc_flite.c.

◆ DECLARE_REGISTER_VOICE_FN

#define DECLARE_REGISTER_VOICE_FN (   name)
Value:
cst_voice *register_cmu_us_## name(const char *); \
void unregister_cmu_us_## name(cst_voice *)

Definition at line 78 of file asrc_flite.c.

◆ MAKE_VOICE_STRUCTURE

#define MAKE_VOICE_STRUCTURE (   voice_name)
Value:
{ \
.name = #voice_name, \
.register_fn = register_cmu_us_ ## voice_name, \
.unregister_fn = unregister_cmu_us_ ## voice_name, \
}

Definition at line 95 of file asrc_flite.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( flite  )

◆ DECLARE_REGISTER_VOICE_FN() [1/5]

DECLARE_REGISTER_VOICE_FN ( awb  )

◆ DECLARE_REGISTER_VOICE_FN() [2/5]

DECLARE_REGISTER_VOICE_FN ( kal  )

◆ DECLARE_REGISTER_VOICE_FN() [3/5]

DECLARE_REGISTER_VOICE_FN ( kal16  )

◆ DECLARE_REGISTER_VOICE_FN() [4/5]

DECLARE_REGISTER_VOICE_FN ( rms  )

◆ DECLARE_REGISTER_VOICE_FN() [5/5]

DECLARE_REGISTER_VOICE_FN ( slt  )

◆ list_voices()

static void list_voices ( void *  log_ctx,
const char *  sep 
)
static

Definition at line 108 of file asrc_flite.c.

Referenced by init(), and select_voice().

◆ select_voice()

static int select_voice ( struct voice_entry **  entry_ret,
const char *  voice_name,
void *  log_ctx 
)
static

Definition at line 116 of file asrc_flite.c.

Referenced by init().

◆ audio_stream_chunk_by_word()

static int audio_stream_chunk_by_word ( const cst_wave *  wave,
int  start,
int  size,
int  last,
cst_audio_streaming_info *  asi 
)
static

Definition at line 148 of file asrc_flite.c.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 167 of file asrc_flite.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 243 of file asrc_flite.c.

◆ query_formats()

static int query_formats ( const AVFilterContext ctx,
AVFilterFormatsConfig **  cfg_in,
AVFilterFormatsConfig **  cfg_out 
)
static

Definition at line 258 of file asrc_flite.c.

◆ config_props()

static int config_props ( AVFilterLink outlink)
static

Definition at line 292 of file asrc_flite.c.

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 307 of file asrc_flite.c.

Variable Documentation

◆ flite_options

const AVOption flite_options[]
static
Initial value:
= {
{ "list_voices", "list voices and exit", OFFSET(list_voices), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ "nb_samples", "set number of samples per frame", OFFSET(frame_nb_samples), AV_OPT_TYPE_INT, {.i64=512}, 0, INT_MAX, FLAGS },
{ "n", "set number of samples per frame", OFFSET(frame_nb_samples), AV_OPT_TYPE_INT, {.i64=512}, 0, INT_MAX, FLAGS },
{ "text", "set text to speak", OFFSET(text), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "textfile", "set filename of the text to speak", OFFSET(textfile), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "v", "set voice", OFFSET(voice_str), AV_OPT_TYPE_STRING, {.str="kal"}, 0, 0, FLAGS },
{ "voice", "set voice", OFFSET(voice_str), AV_OPT_TYPE_STRING, {.str="kal"}, 0, 0, FLAGS },
{ NULL }
}

Definition at line 60 of file asrc_flite.c.

◆ flite_mutex

AVMutex flite_mutex = AV_MUTEX_INITIALIZER
static

Definition at line 73 of file asrc_flite.c.

Referenced by init(), select_voice(), and uninit().

◆ flite_inited

int flite_inited = 0
static

Definition at line 75 of file asrc_flite.c.

Referenced by init().

◆ voice_entries

struct voice_entry voice_entries[]
static
Initial value:

Definition at line 100 of file asrc_flite.c.

Referenced by list_voices(), and select_voice().

◆ flite_outputs

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

Definition at line 345 of file asrc_flite.c.

◆ ff_asrc_flite

const AVFilter ff_asrc_flite
Initial value:
= {
.name = "flite",
.description = NULL_IF_CONFIG_SMALL("Synthesize voice from text using libflite."),
.init = init,
.uninit = uninit,
.priv_size = sizeof(FliteContext),
.priv_class = &flite_class,
}

Definition at line 353 of file asrc_flite.c.

OFFSET
#define OFFSET(x)
Definition: asrc_flite.c:57
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
FliteContext
Definition: asrc_flite.c:39
MAKE_VOICE_STRUCTURE
#define MAKE_VOICE_STRUCTURE(voice_name)
Definition: asrc_flite.c:95
activate
static int activate(AVFilterContext *ctx)
Definition: asrc_flite.c:307
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
list_voices
static void list_voices(void *log_ctx, const char *sep)
Definition: asrc_flite.c:108
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
NULL
#define NULL
Definition: coverity.c:32
flite_outputs
static const AVFilterPad flite_outputs[]
Definition: asrc_flite.c:345
inputs
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: filter_design.txt:243
query_formats
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: asrc_flite.c:258
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:94
config_props
static int config_props(AVFilterLink *outlink)
Definition: asrc_flite.c:292
FILTER_QUERY_FUNC2
#define FILTER_QUERY_FUNC2(func)
Definition: filters.h:239
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: asrc_flite.c:243
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
init
static av_cold int init(AVFilterContext *ctx)
Definition: asrc_flite.c:167
FLAGS
#define FLAGS
Definition: asrc_flite.c:58
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276