26 #include <flite/flite.h>
50 #define OFFSET(x) offsetof(FliteContext, x)
51 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
69 #define DECLARE_REGISTER_VOICE_FN(name) \
70 cst_voice *register_cmu_us_## name(const char *); \
71 void unregister_cmu_us_## name(cst_voice *);
80 cst_voice * (*register_fn)(
const char *);
86 #define MAKE_VOICE_STRUCTURE(voice_name) { \
87 .name = #voice_name, \
88 .register_fn = register_cmu_us_ ## voice_name, \
89 .unregister_fn = unregister_cmu_us_ ## voice_name, \
102 for (
i = 0;
i < n;
i++)
113 if (!strcmp(entry->
name, voice_name)) {
118 "Could not register voice '%s'\n", voice_name);
145 if (flite_init() < 0) {
158 "Both text and textfile options set: only one must be specified\n");
168 "The text file '%s' could not be read: %s\n",
177 memcpy(flite->
text, textbuf, textbuf_size);
178 flite->
text[textbuf_size] = 0;
184 "No speech text specified, specify the 'text' or 'textfile' option\n");
205 delete_wave(flite->
wave);
258 nb_samples * flite->
wave->num_channels * 2);
259 samplesref->
pts = flite->
pts;
262 flite->
pts += nb_samples;
288 .priv_class = &flite_class,
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
struct voice_entry voice_entry
static int config_props(AVFilterLink *outlink)
static void list_voices(void *log_ctx, const char *sep)
#define DECLARE_REGISTER_VOICE_FN(name)
static int query_formats(AVFilterContext *ctx)
static struct voice_entry voice_entries[]
static int request_frame(AVFilterLink *outlink)
static volatile int flite_inited
#define MAKE_VOICE_STRUCTURE(voice_name)
AVFILTER_DEFINE_CLASS(flite)
static const AVOption flite_options[]
static int select_voice(struct voice_entry **entry_ret, const char *voice_name, void *log_ctx)
static av_cold int init(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
static const AVFilterPad flite_outputs[]
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
audio channel layout utility functions
int64_t av_get_default_channel_layout(int nb_channels)
Return default channel layout for a given number of channels.
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
#define AVERROR_EOF
End of file.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
@ AV_SAMPLE_FMT_S16
signed 16 bits
void av_file_unmap(uint8_t *bufptr, size_t size)
Unmap or free the buffer bufptr created by av_file_map().
int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, int log_offset, void *log_ctx)
Read the file with name filename, and put its content in a newly allocated buffer or map it with mmap...
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
typedef void(RENAME(mix_any_func_type))
#define FF_ARRAY_ELEMS(a)
Describe the class of an AVClass context structure.
A list of supported channel layouts.
void * priv
private data for use by the filter
A link between two filters.
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
int sample_rate
samples per second
int format
agreed upon media format
A filter pad used for either input or output.
const char * name
Pad name.
const char * name
Filter name.
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int64_t pkt_pos
reordered pos from the last AVPacket that has been input into the decoder
int sample_rate
Sample rate of the audio data.
Rational number (pair of numerator and denominator).
struct voice_entry * voice_entry
int frame_nb_samples
number of samples per frame
cst_voice *(* register_fn)(const char *)
void(* unregister_fn)(cst_voice *)