mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
packet: Hide internals of pa_packet, introduce pa_packet_data()
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
This commit is contained in:
parent
9f97f08f40
commit
5a2c41e5bf
5 changed files with 50 additions and 24 deletions
|
|
@ -25,9 +25,17 @@
|
|||
|
||||
#include <pulse/xmalloc.h>
|
||||
#include <pulsecore/macro.h>
|
||||
#include <pulsecore/refcnt.h>
|
||||
|
||||
#include "packet.h"
|
||||
|
||||
typedef struct pa_packet {
|
||||
PA_REFCNT_DECLARE;
|
||||
enum { PA_PACKET_APPENDED, PA_PACKET_DYNAMIC } type;
|
||||
size_t length;
|
||||
uint8_t *data;
|
||||
} pa_packet;
|
||||
|
||||
pa_packet* pa_packet_new(size_t length) {
|
||||
pa_packet *p;
|
||||
|
||||
|
|
@ -57,6 +65,16 @@ pa_packet* pa_packet_new_dynamic(void* data, size_t length) {
|
|||
return p;
|
||||
}
|
||||
|
||||
const void* pa_packet_data(pa_packet *p, size_t *l) {
|
||||
pa_assert(PA_REFCNT_VALUE(p) >= 1);
|
||||
pa_assert(p->data);
|
||||
pa_assert(l);
|
||||
|
||||
*l = p->length;
|
||||
|
||||
return p->data;
|
||||
}
|
||||
|
||||
pa_packet* pa_packet_ref(pa_packet *p) {
|
||||
pa_assert(p);
|
||||
pa_assert(PA_REFCNT_VALUE(p) >= 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue