upipe/ubuf_sound.h header reference

Upipe buffer handling for sound managers More

Header inclusion  

Members  

Functions  

Macro  

Description  

This file defines the sound-specific API to access buffers.

Members detail  

#define UBUF_ALLOC_SOUND  

This macro is declared in upipe/ubuf_sound.h source file, line 44.

This macro is a simple signature to make sure the ubuf_alloc internal API is used properly.

#define UBUF_SOUND_MAP_TEMPLATE(type, desc)  

This macro is declared in upipe/ubuf_sound.h source file, line 129.

#define _UPIPE_UBUF_SOUND_H_  

This macro is declared in upipe/ubuf_sound.h source file, line 32.

struct ubuf * ubuf_sound_alloc(struct ubuf_mgr *mgr, int size)  

This function is declared in upipe/ubuf_sound.h source file, line 54.

This function returns a new ubuf from a sound allocator.

Parameter list:

  • mgr: management structure for this ubuf type
  • size: size in samples

The return value is pointer to ubuf or NULL in case of failure

struct ubuf * ubuf_sound_copy(struct ubuf_mgr *mgr, struct ubuf *ubuf, int skip, int new_size)  

This function is declared in upipe/ubuf_sound.h source file, line 270.

This function copies a sound ubuf to a newly allocated ubuf, and doesn't deal with the old ubuf or a dictionary.

Parameter list:

  • mgr: management structure for this ubuf type
  • ubuf: pointer to ubuf to copy
  • skip: number of samples to skip at the beginning of each plane (if < 0, extend the sound upwards)
  • new_size: final size of the buffer, in samples (if set to -1, keep same end)

The return value is pointer to newly allocated ubuf or NULL in case of error

int ubuf_sound_interleave(struct ubuf *ubuf, uint8_t *buf, int offset, int samples, uint8_t sample_size, uint8_t planes)  

This function is declared in upipe/ubuf_sound.h source file, line 353.

This function interleaves planar formats to a user-allocated buffer.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: read offset in samples
  • samples: number of samples to interleave
  • sample_size: sample size
  • planes: number of planes to interleave

The return value is an error code

int ubuf_sound_plane_iterate(struct ubuf *ubuf, const char **channel_p)  

This function is declared in upipe/ubuf_sound.h source file, line 84.

This function iterates on sound planes channel types. Start by initializing *channel_p to NULL. If *channel_p is NULL after running this function, there are no more planes in this sound. Otherwise the string pointed to by *channel_p remains valid until the ubuf sound manager is deallocated.

Parameter list:

  • ubuf: pointer to ubuf
  • channel_p: reference written with channel type of the next plane

The return value is an error code

int ubuf_sound_plane_read_double(struct ubuf *ubuf, const char *channel, int offset, int size, const double **buffer_p)  

This function is declared in upipe/ubuf_sound.h source file, line 239.

This function returns a read-only pointer to the buffer space as double-precision floats. You must call ubuf_sound_plane_unmap when you're done with the pointer.

Parameter list:

  • ubuf: pointer to ubuf
  • channel: channel double (see channel reference)
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: reference written with a pointer to buffer space if not NULL

The return value is an error code

int ubuf_sound_plane_read_float(struct ubuf *ubuf, const char *channel, int offset, int size, const float **buffer_p)  

This function is declared in upipe/ubuf_sound.h source file, line 238.

This function returns a read-only pointer to the buffer space as floats. You must call ubuf_sound_plane_unmap when you're done with the pointer.

Parameter list:

  • ubuf: pointer to ubuf
  • channel: channel float (see channel reference)
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: reference written with a pointer to buffer space if not NULL

The return value is an error code

int ubuf_sound_plane_read_int16_t(struct ubuf *ubuf, const char *channel, int offset, int size, const int16_t **buffer_p)  

This function is declared in upipe/ubuf_sound.h source file, line 236.

This function returns a read-only pointer to the buffer space as 16-bit signed integers. You must call ubuf_sound_plane_unmap when you're done with the pointer.

Parameter list:

  • ubuf: pointer to ubuf
  • channel: channel int16_t (see channel reference)
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: reference written with a pointer to buffer space if not NULL

The return value is an error code

int ubuf_sound_plane_read_int32_t(struct ubuf *ubuf, const char *channel, int offset, int size, const int32_t **buffer_p)  

This function is declared in upipe/ubuf_sound.h source file, line 237.

This function returns a read-only pointer to the buffer space as 32-bit signed integers. You must call ubuf_sound_plane_unmap when you're done with the pointer.

Parameter list:

  • ubuf: pointer to ubuf
  • channel: channel int32_t (see channel reference)
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: reference written with a pointer to buffer space if not NULL

The return value is an error code

int ubuf_sound_plane_read_uint8_t(struct ubuf *ubuf, const char *channel, int offset, int size, const uint8_t **buffer_p)  

This function is declared in upipe/ubuf_sound.h source file, line 235.

This function returns a read-only pointer to the buffer space as 8-bit unsigned integers. You must call ubuf_sound_plane_unmap when you're done with the pointer.

Parameter list:

  • ubuf: pointer to ubuf
  • channel: channel uint8_t (see channel reference)
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: reference written with a pointer to buffer space if not NULL

The return value is an error code

int ubuf_sound_plane_read_void(struct ubuf *ubuf, const char *channel, int offset, int size, const void **buffer_p)  

This function is declared in upipe/ubuf_sound.h source file, line 234.

This function returns a read-only pointer to the buffer space as void objects. You must call ubuf_sound_plane_unmap when you're done with the pointer.

Parameter list:

  • ubuf: pointer to ubuf
  • channel: channel void (see channel reference)
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: reference written with a pointer to buffer space if not NULL

The return value is an error code

int ubuf_sound_plane_unmap(struct ubuf *ubuf, const char *channel, int offset, int size)  

This function is declared in upipe/ubuf_sound.h source file, line 100.

This function marks the buffer space as being currently unused, and the pointer will be invalid until the next time the ubuf is mapped.

Parameter list:

  • ubuf: pointer to ubuf
  • channel: channel type (see channel reference)
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end

The return value is an error code

int ubuf_sound_plane_write_double(struct ubuf *ubuf, const char *channel, int offset, int size, double **buffer_p)  

This function is declared in upipe/ubuf_sound.h source file, line 239.

This function returns a writable pointer to the buffer space, if the ubuf is not shared, as double-precision floats. You must call ubuf_sound_plane_unmap when you're done with the pointer.

Parameter list:

  • ubuf: pointer to ubuf
  • channel: channel double (see channel reference)
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: reference written with a pointer to buffer space if not NULL

The return value is an error code

int ubuf_sound_plane_write_float(struct ubuf *ubuf, const char *channel, int offset, int size, float **buffer_p)  

This function is declared in upipe/ubuf_sound.h source file, line 238.

This function returns a writable pointer to the buffer space, if the ubuf is not shared, as floats. You must call ubuf_sound_plane_unmap when you're done with the pointer.

Parameter list:

  • ubuf: pointer to ubuf
  • channel: channel float (see channel reference)
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: reference written with a pointer to buffer space if not NULL

The return value is an error code

int ubuf_sound_plane_write_int16_t(struct ubuf *ubuf, const char *channel, int offset, int size, int16_t **buffer_p)  

This function is declared in upipe/ubuf_sound.h source file, line 236.

This function returns a writable pointer to the buffer space, if the ubuf is not shared, as 16-bit signed integers. You must call ubuf_sound_plane_unmap when you're done with the pointer.

Parameter list:

  • ubuf: pointer to ubuf
  • channel: channel int16_t (see channel reference)
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: reference written with a pointer to buffer space if not NULL

The return value is an error code

int ubuf_sound_plane_write_int32_t(struct ubuf *ubuf, const char *channel, int offset, int size, int32_t **buffer_p)  

This function is declared in upipe/ubuf_sound.h source file, line 237.

This function returns a writable pointer to the buffer space, if the ubuf is not shared, as 32-bit signed integers. You must call ubuf_sound_plane_unmap when you're done with the pointer.

Parameter list:

  • ubuf: pointer to ubuf
  • channel: channel int32_t (see channel reference)
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: reference written with a pointer to buffer space if not NULL

The return value is an error code

int ubuf_sound_plane_write_uint8_t(struct ubuf *ubuf, const char *channel, int offset, int size, uint8_t **buffer_p)  

This function is declared in upipe/ubuf_sound.h source file, line 235.

This function returns a writable pointer to the buffer space, if the ubuf is not shared, as 8-bit unsigned integers. You must call ubuf_sound_plane_unmap when you're done with the pointer.

Parameter list:

  • ubuf: pointer to ubuf
  • channel: channel uint8_t (see channel reference)
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: reference written with a pointer to buffer space if not NULL

The return value is an error code

int ubuf_sound_plane_write_void(struct ubuf *ubuf, const char *channel, int offset, int size, void **buffer_p)  

This function is declared in upipe/ubuf_sound.h source file, line 234.

This function returns a writable pointer to the buffer space, if the ubuf is not shared, as void objects. You must call ubuf_sound_plane_unmap when you're done with the pointer.

Parameter list:

  • ubuf: pointer to ubuf
  • channel: channel void (see channel reference)
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: reference written with a pointer to buffer space if not NULL

The return value is an error code

int ubuf_sound_read_double(struct ubuf *ubuf, int offset, int size, const double *buffers_p[], uint8_t planes)  

This function is declared in upipe/ubuf_sound.h source file, line 239.

This function returns read-only pointers to the buffer spaces as double-precision floats. The planes are iterated in allocation order. You must call ubuf_sound_unmap when you're done with the pointers.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: array of references written with pointers to buffer space
  • planes: number of elements allocated in array buffers_p

The return value is an error code

int ubuf_sound_read_float(struct ubuf *ubuf, int offset, int size, const float *buffers_p[], uint8_t planes)  

This function is declared in upipe/ubuf_sound.h source file, line 238.

This function returns read-only pointers to the buffer spaces as floats. The planes are iterated in allocation order. You must call ubuf_sound_unmap when you're done with the pointers.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: array of references written with pointers to buffer space
  • planes: number of elements allocated in array buffers_p

The return value is an error code

int ubuf_sound_read_int16_t(struct ubuf *ubuf, int offset, int size, const int16_t *buffers_p[], uint8_t planes)  

This function is declared in upipe/ubuf_sound.h source file, line 236.

This function returns read-only pointers to the buffer spaces as 16-bit signed integers. The planes are iterated in allocation order. You must call ubuf_sound_unmap when you're done with the pointers.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: array of references written with pointers to buffer space
  • planes: number of elements allocated in array buffers_p

The return value is an error code

int ubuf_sound_read_int32_t(struct ubuf *ubuf, int offset, int size, const int32_t *buffers_p[], uint8_t planes)  

This function is declared in upipe/ubuf_sound.h source file, line 237.

This function returns read-only pointers to the buffer spaces as 32-bit signed integers. The planes are iterated in allocation order. You must call ubuf_sound_unmap when you're done with the pointers.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: array of references written with pointers to buffer space
  • planes: number of elements allocated in array buffers_p

The return value is an error code

int ubuf_sound_read_uint8_t(struct ubuf *ubuf, int offset, int size, const uint8_t *buffers_p[], uint8_t planes)  

This function is declared in upipe/ubuf_sound.h source file, line 235.

This function returns read-only pointers to the buffer spaces as 8-bit unsigned integers. The planes are iterated in allocation order. You must call ubuf_sound_unmap when you're done with the pointers.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: array of references written with pointers to buffer space
  • planes: number of elements allocated in array buffers_p

The return value is an error code

int ubuf_sound_read_void(struct ubuf *ubuf, int offset, int size, const void *buffers_p[], uint8_t planes)  

This function is declared in upipe/ubuf_sound.h source file, line 234.

This function returns read-only pointers to the buffer spaces as void objects. The planes are iterated in allocation order. You must call ubuf_sound_unmap when you're done with the pointers.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: array of references written with pointers to buffer space
  • planes: number of elements allocated in array buffers_p

The return value is an error code

int ubuf_sound_replace(struct ubuf_mgr *mgr, struct ubuf **ubuf_p, int skip, int new_size)  

This function is declared in upipe/ubuf_sound.h source file, line 385.

This function copies part of a ubuf to a newly allocated ubuf, and replaces the old ubuf with the new ubuf.

Parameter list:

  • mgr: management structure for this ubuf type
  • ubuf_p: reference to a pointer to ubuf to replace with a new sound ubuf
  • skip: number of samples to skip at the beginning of each plane (if < 0, extend the sound upwards)
  • new_size: final size of the buffer, in samples (if set to -1, keep same end)

The return value is an error code

int ubuf_sound_resize(struct ubuf *ubuf, int offset, int new_size)  

This function is declared in upipe/ubuf_sound.h source file, line 252.

This function shrinks a sound ubuf.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: offset of the buffer space wanted in the whole block, in samples, negative values start from the end
  • new_size: final size of the buffer, in samples (if set to -1, keep same end)

The return value is an error code

int ubuf_sound_size(struct ubuf *ubuf, size_t *size_p, uint8_t *sample_size_p)  

This function is declared in upipe/ubuf_sound.h source file, line 69.

This function returns the size of the sound ubuf.

Parameter list:

  • ubuf: pointer to ubuf
  • size_p: reference written with the number of samples of the sound if not NULL
  • sample_size_p: reference written with the number of octets in a sample of a plane if not NULL

The return value is an error code

int ubuf_sound_unmap(struct ubuf *ubuf, int offset, int size, uint8_t planes)  

This function is declared in upipe/ubuf_sound.h source file, line 116.

This function marks the buffer space as being currently unused, and pointers will be invalid until the next time the ubuf is mapped.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • planes: number of planes mapped

The return value is an error code

int ubuf_sound_write_double(struct ubuf *ubuf, int offset, int size, double *buffers_p[], uint8_t planes)  

This function is declared in upipe/ubuf_sound.h source file, line 239.

This function returns writable pointers to the buffer spaces as double-precision floats. The planes are iterated in allocation order. You must call ubuf_sound_unmap when you're done with the pointers.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: array of references written with pointers to buffer space
  • planes: number of elements allocated in array buffers_p

The return value is an error code

int ubuf_sound_write_float(struct ubuf *ubuf, int offset, int size, float *buffers_p[], uint8_t planes)  

This function is declared in upipe/ubuf_sound.h source file, line 238.

This function returns writable pointers to the buffer spaces as floats. The planes are iterated in allocation order. You must call ubuf_sound_unmap when you're done with the pointers.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: array of references written with pointers to buffer space
  • planes: number of elements allocated in array buffers_p

The return value is an error code

int ubuf_sound_write_int16_t(struct ubuf *ubuf, int offset, int size, int16_t *buffers_p[], uint8_t planes)  

This function is declared in upipe/ubuf_sound.h source file, line 236.

This function returns writable pointers to the buffer spaces as 16-bit signed integers. The planes are iterated in allocation order. You must call ubuf_sound_unmap when you're done with the pointers.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: array of references written with pointers to buffer space
  • planes: number of elements allocated in array buffers_p

The return value is an error code

int ubuf_sound_write_int32_t(struct ubuf *ubuf, int offset, int size, int32_t *buffers_p[], uint8_t planes)  

This function is declared in upipe/ubuf_sound.h source file, line 237.

This function returns writable pointers to the buffer spaces as 32-bit signed integers. The planes are iterated in allocation order. You must call ubuf_sound_unmap when you're done with the pointers.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: array of references written with pointers to buffer space
  • planes: number of elements allocated in array buffers_p

The return value is an error code

int ubuf_sound_write_uint8_t(struct ubuf *ubuf, int offset, int size, uint8_t *buffers_p[], uint8_t planes)  

This function is declared in upipe/ubuf_sound.h source file, line 235.

This function returns writable pointers to the buffer spaces as 8-bit unsigned integers. The planes are iterated in allocation order. You must call ubuf_sound_unmap when you're done with the pointers.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: array of references written with pointers to buffer space
  • planes: number of elements allocated in array buffers_p

The return value is an error code

int ubuf_sound_write_void(struct ubuf *ubuf, int offset, int size, void *buffers_p[], uint8_t planes)  

This function is declared in upipe/ubuf_sound.h source file, line 234.

This function returns writable pointers to the buffer spaces as void objects. The planes are iterated in allocation order. You must call ubuf_sound_unmap when you're done with the pointers.

Parameter list:

  • ubuf: pointer to ubuf
  • offset: offset of the sound area wanted in the whole sound, negative values start from the end, in samples
  • size: number of samples wanted, or -1 for until the end
  • buffer_p: array of references written with pointers to buffer space
  • planes: number of elements allocated in array buffers_p

The return value is an error code

Valid XHTML 1.0 StrictGenerated by cmassiot on Fri Feb 2 23:57:19 2018 using MkDoc