Data Structures | |
struct | rte_buffer |
Typedefs | |
typedef rte_bool (* | rte_buffer_callback )(rte_context *context, rte_codec *codec, rte_buffer *buffer) |
typedef rte_bool (* | rte_seek_callback )(rte_context *context, long long offset, int whence) |
Functions | |
rte_bool | rte_set_input_callback_master (rte_codec *codec, rte_buffer_callback read_cb, rte_buffer_callback unref_cb, unsigned int *queue_length) |
rte_bool | rte_set_input_callback_slave (rte_codec *codec, rte_buffer_callback read_cb) |
rte_bool | rte_set_input_push_master (rte_codec *codec, rte_buffer_callback unref_cb, unsigned int queue_request, unsigned int *queue_length) |
rte_bool | rte_set_input_push_slave (rte_codec *codec, unsigned int queue_request, unsigned int *queue_length) |
rte_bool | rte_push_buffer (rte_codec *codec, rte_buffer *buffer, rte_bool blocking) |
rte_bool | rte_set_output_callback_slave (rte_context *context, rte_buffer_callback write_cb, rte_seek_callback seek_cb) |
rte_bool | rte_set_output_stdio (rte_context *context, int fd) |
rte_bool | rte_set_output_file (rte_context *context, const char *filename) |
rte_bool | rte_set_output_discard (rte_context *context) |
|
When a function of this type is called to unreference data, it passes the same buffer contents (but not necessarily the same buffer pointer) exchanged at the respective read callback or rte_push_buffer() before.
When a function of this type is called to write data, codec is NULL and the buffer fields .data and .size are initialized. buffer will be Do not depend on the value of the buffer pointer, use buffer->user_data instead.
|
|
|
|
rte_bool my_read_cb (rte_context *context, rte_codec *codec, rte_buffer *buffer) { buffer->data = malloc (); read (buffer->data, &buffer->timestamp); return TRUE; } rte_bool my_unref_cb (rte_context *context, rte_codec *codec, rte_buffer *buffer) { free (buffer->data); }
|
|
Typical usage of rte_set_input_callback_slave(): rte_bool my_read_cb (rte_context *context, rte_codec *codec, rte_buffer *buffer) { read (buffer->data, &buffer->timestamp); return TRUE; }
|
|
rte_bool my_unref_cb (rte_context *context, rte_codec *codec, rte_buffer *buffer) { free (buffer->data); } while (have_data) { rte_buffer buffer; buffer.data = malloc (); read (buffer.data, &buffer.timestamp); if (!rte_push_buffer (codec, &buffer, FALSE)) { // The codec is not fast enough, we drop the frame. free (buffer.data); } }
|
|
NULL as buffer->data to start the cycle.
Typical usage of rte_set_input_push_slave(): rte_buffer buffer; buffer.data = NULL; rte_push_buffer (codec, &buffer, FALSE); // cannot fail while (have_data) { read (buffer.data, &buffer.timestamp); if (!rte_push_buffer(codec, &buffer, FALSE)) { // The codec is not fast enough, we drop the frame. } }
|
|
TRUE this function waits until space becomes available, when blocking is FALSE it immediately returns FALSE .
|
|
Typical usage of rte_set_output_callback_slave(): rte_bool my_write_cb (rte_context *context, rte_codec *codec, rte_buffer *buffer) { ssize_t actual; if (!buffer) // EOF return TRUE; do actual = write (STDOUT_FILENO, buffer->data, buffer->size); while (actual == -1 && errno == EINTR); return actual == buffer->size; // no error } rte_bool my_seek_cb (rte_context *context, long long offset, int whence) { return lseek64 (STDOUT_FILENO, offset, whence) != (off64_t) -1; }
|
|
|
|
|
|
|