mirror of
https://github.com/mpv-player/mpv
synced 2024-12-31 19:52:16 +00:00
mp_ring: remove unused function
This was needed for ao_jack.c., but not anymore.
This commit is contained in:
parent
7f7e9a9fff
commit
a9d98082aa
@ -87,31 +87,6 @@ int mp_ring_read(struct mp_ring *buffer, unsigned char *dest, int len)
|
||||
return read_len;
|
||||
}
|
||||
|
||||
int mp_ring_read_cb(struct mp_ring *buffer, void *ctx, int len,
|
||||
void (*func)(void*, void*, int))
|
||||
{
|
||||
// The point of this function is defining custom read behaviour, assume
|
||||
// it's a programmers error if func is null.
|
||||
assert(func);
|
||||
|
||||
int size = mp_ring_size(buffer);
|
||||
int buffered = mp_ring_buffered(buffer);
|
||||
int read_len = FFMIN(len, buffered);
|
||||
int read_ptr = mp_ring_get_rpos(buffer) % size;
|
||||
|
||||
int len1 = FFMIN(size - read_ptr, read_len);
|
||||
int len2 = read_len - len1;
|
||||
|
||||
func(ctx, buffer->buffer + read_ptr, len1);
|
||||
if (len2 > 0)
|
||||
func(ctx, buffer->buffer, len2);
|
||||
|
||||
mp_atomic_add_and_fetch(&buffer->rpos, read_len);
|
||||
mp_memory_barrier();
|
||||
|
||||
return read_len;
|
||||
}
|
||||
|
||||
int mp_ring_write(struct mp_ring *buffer, unsigned char *src, int len)
|
||||
{
|
||||
int size = mp_ring_size(buffer);
|
||||
|
@ -46,28 +46,6 @@ struct mp_ring *mp_ring_new(void *talloc_ctx, int size);
|
||||
*/
|
||||
int mp_ring_read(struct mp_ring *buffer, unsigned char *dest, int len);
|
||||
|
||||
/**
|
||||
* Read data from the ringbuffer
|
||||
*
|
||||
* This function behaves similarly to `av_fifo_generic_read` and was actually
|
||||
* added for compatibility with code that was written for it.
|
||||
* This function will drain the returned amount of bytes from the ringbuffer
|
||||
* so you don't have to handle that in inside `func`.
|
||||
*
|
||||
* buffer: target ringbuffer instance
|
||||
* ctx: context for the callback function
|
||||
* len: maximum number of bytes to read
|
||||
* func: callback function to customize reading behaviour. It will be called
|
||||
* by `mp_ring_read_cb` with the following parameters:
|
||||
* ctx: context data provided to `mp_ring_read_cb`
|
||||
* src: source buffer to read from
|
||||
* len: the *exact* amount of bytes to read. These will be drained
|
||||
* by the ring after this callback is called.
|
||||
* return: number of bytes read
|
||||
*/
|
||||
int mp_ring_read_cb(struct mp_ring *buffer, void *ctx, int len,
|
||||
void (*func)(void *ctx, void *src, int len));
|
||||
|
||||
/**
|
||||
* Write data to the ringbuffer
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user