Lines Matching defs:output

2  * \file output.c
3 * \brief Generic stdio-like output interface
7 * Generic stdio-like output interface
38 int (*close)(snd_output_t *output);
39 int (*print)(snd_output_t *output, const char *format, va_list args);
40 int (*puts)(snd_output_t *output, const char *str);
41 int (*putch)(snd_output_t *output, int c);
42 int (*flush)(snd_output_t *output);
53 * \brief Closes an output handle.
54 * \param output The output handle to be closed.
57 int snd_output_close(snd_output_t *output)
59 int err = output->ops->close(output);
60 free(output);
65 * \brief Writes formatted output (like \c fprintf(3)) to an output handle.
66 * \param output The output handle.
71 int snd_output_printf(snd_output_t *output, const char *format, ...)
76 result = output->ops->print(output, format, args);
82 * \brief Writes formatted output (like \c fprintf(3)) to an output handle.
83 * \param output The output handle.
88 int snd_output_vprintf(snd_output_t *output, const char *format, va_list args)
90 return output->ops->print(output, format, args);
94 * \brief Writes a string to an output handle (like \c fputs(3)).
95 * \param output The output handle.
99 int snd_output_puts(snd_output_t *output, const char *str)
101 return output->ops->puts(output, str);
105 * \brief Writes a character to an output handle (like \c putc(3)).
106 * \param output The output handle.
110 int snd_output_putc(snd_output_t *output, int c)
112 return output->ops->putch(output, c);
116 * \brief Flushes an output handle (like fflush(3)).
117 * \param output The output handle.
124 int snd_output_flush(snd_output_t *output)
126 return output->ops->flush(output);
135 static int snd_output_stdio_close(snd_output_t *output)
137 snd_output_stdio_t *stdio = output->private_data;
144 static int snd_output_stdio_print(snd_output_t *output, const char *format, va_list args)
146 snd_output_stdio_t *stdio = output->private_data;
150 static int snd_output_stdio_puts(snd_output_t *output, const char *str)
152 snd_output_stdio_t *stdio = output->private_data;
156 static int snd_output_stdio_putc(snd_output_t *output, int c)
158 snd_output_stdio_t *stdio = output->private_data;
162 static int snd_output_stdio_flush(snd_output_t *output)
164 snd_output_stdio_t *stdio = output->private_data;
179 * \brief Creates a new output object using an existing stdio \c FILE pointer.
180 * \param outputp The function puts the pointer to the new output object
190 snd_output_t *output;
196 output = calloc(1, sizeof(*output));
197 if (!output) {
203 output->type = SND_OUTPUT_STDIO;
204 output->ops = &snd_output_stdio_ops;
205 output->private_data = stdio;
206 *outputp = output;
211 * \brief Creates a new output object writing to a file.
212 * \param outputp The function puts the pointer to the new output object
240 static int snd_output_buffer_close(snd_output_t *output)
242 snd_output_buffer_t *buffer = output->private_data;
248 static int snd_output_buffer_need(snd_output_t *output, size_t size)
250 snd_output_buffer_t *buffer = output->private_data;
274 static int snd_output_buffer_print(snd_output_t *output, const char *format, va_list args)
276 snd_output_buffer_t *buffer = output->private_data;
279 result = snd_output_buffer_need(output, size);
289 result = snd_output_buffer_need(output, size);
298 static int snd_output_buffer_puts(snd_output_t *output, const char *str)
300 snd_output_buffer_t *buffer = output->private_data;
303 err = snd_output_buffer_need(output, size);
311 static int snd_output_buffer_putc(snd_output_t *output, int c)
313 snd_output_buffer_t *buffer = output->private_data;
315 err = snd_output_buffer_need(output, 1);
322 static int snd_output_buffer_flush(snd_output_t *output ATTRIBUTE_UNUSED)
324 snd_output_buffer_t *buffer = output->private_data;
339 * \brief Returns the address of the buffer of a #SND_OUTPUT_BUFFER output handle.
340 * \param output The output handle.
345 * The address of the buffer may become invalid when output functions or
348 size_t snd_output_buffer_string(snd_output_t *output, char **buf)
350 snd_output_buffer_t *buffer = output->private_data;
356 * \brief Returns the address of the buffer of a #SND_OUTPUT_BUFFER output handle.
357 * \param output The output handle.
365 size_t snd_output_buffer_steal(snd_output_t *output, char **buf)
367 snd_output_buffer_t *buffer = output->private_data;
378 * \brief Creates a new output object with an auto-extending memory buffer.
379 * \param outputp The function puts the pointer to the new output object
385 snd_output_t *output;
391 output = calloc(1, sizeof(*output));
392 if (!output) {
399 output->type = SND_OUTPUT_BUFFER;
400 output->ops = &snd_output_buffer_ops;
401 output->private_data = buffer;
402 *outputp = output;