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 *);
81 void (*unregister_fn)(cst_voice *);
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++)
104 voice_entries[i].
name, i < (n-1) ? sep :
"\n");
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");
203 delete_wave(flite->
wave);
256 nb_samples * flite->
wave->num_channels * 2);
257 samplesref->
pts = flite->
pts;
260 flite->
pts += nb_samples;
286 .priv_class = &flite_class,
static const AVOption flite_options[]
This structure describes decoded (raw) audio or video data.
int64_t pkt_pos
reordered pos from the last AVPacket that has been input into the decoder
Main libavfilter public API header.
static av_cold void uninit(AVFilterContext *ctx)
AVFILTER_DEFINE_CLASS(flite)
static int request_frame(AVFilterLink *outlink)
const char * name
Pad name.
struct voice_entry * voice_entry
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static int query_formats(AVFilterContext *ctx)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
#define AVERROR_EOF
End of file.
#define AV_LOG_VERBOSE
Detailed information.
int frame_nb_samples
number of samples per frame
A filter pad used for either input or output.
A link between two filters.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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...
int sample_rate
samples per second
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
static struct voice_entry voice_entries[]
#define MAKE_VOICE_STRUCTURE(voice_name)
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.
static int config_props(AVFilterLink *outlink)
void(* unregister_fn)(cst_voice *)
audio channel layout utility functions
static volatile int flite_inited
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
static int select_voice(struct voice_entry **entry_ret, const char *voice_name, void *log_ctx)
AVFilterContext * src
source filter
static const AVFilterPad inputs[]
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
static const AVFilterPad outputs[]
int format
agreed upon media format
#define FF_ARRAY_ELEMS(a)
A list of supported channel layouts.
#define AV_LOG_INFO
Standard information.
typedef void(RENAME(mix_any_func_type))
Describe the class of an AVClass context structure.
int sample_rate
Sample rate of the audio data.
Rational number (pair of numerator and denominator).
const char * name
Filter name.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static av_cold int init(AVFilterContext *ctx)
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
int64_t av_get_default_channel_layout(int nb_channels)
Return default channel layout for a given number of channels.
#define DECLARE_REGISTER_VOICE_FN(name)
static const AVFilterPad flite_outputs[]
cst_voice *(* register_fn)(const char *)