Go to the documentation of this file.
26 #include <flite/flite.h>
51 #define OFFSET(x) offsetof(FliteContext, x)
52 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
72 #define DECLARE_REGISTER_VOICE_FN(name) \
73 cst_voice *register_cmu_us_## name(const char *); \
74 void unregister_cmu_us_## name(cst_voice *)
83 cst_voice * (*register_fn)(
const char *);
89 #define MAKE_VOICE_STRUCTURE(voice_name) { \
90 .name = #voice_name, \
91 .register_fn = register_cmu_us_ ## voice_name, \
92 .unregister_fn = unregister_cmu_us_ ## voice_name, \
105 for (
i = 0;
i < n;
i++)
116 if (!strcmp(entry->
name, voice_name)) {
127 "Could not register voice '%s'\n", voice_name);
154 if ((
ret = flite_init()) >= 0)
169 "Both text and textfile options set: only one must be specified\n");
179 "The text file '%s' could not be read: %s\n",
188 memcpy(flite->
text, textbuf, textbuf_size);
189 flite->
text[textbuf_size] = 0;
195 "No speech text specified, specify the 'text' or 'textfile' option\n");
218 delete_wave(flite->
wave);
273 nb_samples * flite->
wave->num_channels * 2);
274 samplesref->
pts = flite->
pts;
277 flite->
pts += nb_samples;
302 .priv_class = &flite_class,
const AVFilter ff_asrc_flite
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).
#define FILTER_QUERY_FUNC(func)
#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)
static AVMutex flite_mutex
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 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).
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
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
#define pthread_mutex_unlock(a)
void(* unregister_fn)(cst_voice *)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
An AVChannelLayout holds information about the channel layout of audio data.
#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
#define AV_MUTEX_INITIALIZER
AVFilterContext * src
source filter
#define AVERROR_EXTERNAL
Generic error in an external library.
static int config_props(AVFilterLink *outlink)
#define AV_LOG_INFO
Standard information.
int sample_rate
samples per second
#define i(width, name, range_min, range_max)
@ 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)
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)
#define FILTER_OUTPUTS(array)
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)
#define pthread_mutex_lock(a)