Go to the documentation of this file.
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,
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
A list of supported channel layouts.
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
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static const AVOption flite_options[]
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
#define AVERROR_EOF
End of file.
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).
static volatile int flite_inited
#define AV_LOG_VERBOSE
Detailed information.
const char * name
Filter name.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
struct voice_entry * voice_entry
A link between two filters.
AVFILTER_DEFINE_CLASS(flite)
cst_voice *(* register_fn)(const char *)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define MAKE_VOICE_STRUCTURE(voice_name)
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...
void * priv
private data for use by the filter
A filter pad used for either input or output.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
int64_t pkt_pos
reordered pos from the last AVPacket that has been input into the decoder
static const AVFilterPad outputs[]
static void list_voices(void *log_ctx, const char *sep)
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.
void av_file_unmap(uint8_t *bufptr, size_t size)
Unmap or free the buffer bufptr created by av_file_map().
Describe the class of an AVClass context structure.
static const AVFilterPad flite_outputs[]
static struct voice_entry voice_entries[]
static int query_formats(AVFilterContext *ctx)
Rational number (pair of numerator and denominator).
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
void(* unregister_fn)(cst_voice *)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
int sample_rate
Sample rate of the audio data.
int format
agreed upon media format
AVFilterContext * src
source filter
static int config_props(AVFilterLink *outlink)
#define AV_LOG_INFO
Standard information.
int sample_rate
samples per second
@ AV_SAMPLE_FMT_S16
signed 16 bits
const char * name
Pad name.
static av_cold void uninit(AVFilterContext *ctx)
static av_cold int init(AVFilterContext *ctx)
struct voice_entry voice_entry
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
#define DECLARE_REGISTER_VOICE_FN(name)
int64_t av_get_default_channel_layout(int nb_channels)
Return default channel layout for a given number of channels.
static int select_voice(struct voice_entry **entry_ret, const char *voice_name, void *log_ctx)
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
int frame_nb_samples
number of samples per frame
static int request_frame(AVFilterLink *outlink)