wayvnc/include/buffer.h

41 lines
1006 B
C

#pragma once
#include "sys/queue.h"
#include <unistd.h>
#include <stdbool.h>
#include <stdint.h>
struct wl_buffer;
struct wv_buffer {
TAILQ_ENTRY(wv_buffer) link;
struct wl_buffer* wl_buffer;
void* pixels;
size_t size;
int width, height, stride;
uint32_t format;
bool y_inverted;
};
TAILQ_HEAD(wv_buffer_queue, wv_buffer);
struct wv_buffer_pool {
struct wv_buffer_queue queue;
int width, height, stride;
uint32_t format;
};
struct wv_buffer* wv_buffer_create(int width, int height, int stride,
uint32_t fourcc);
void wv_buffer_destroy(struct wv_buffer* self);
struct wv_buffer_pool* wv_buffer_pool_create(int width, int height, int stride,
uint32_t format);
void wv_buffer_pool_destroy(struct wv_buffer_pool* pool);
void wv_buffer_pool_resize(struct wv_buffer_pool* pool,
int width, int height, int stride, uint32_t format);
struct wv_buffer* wv_buffer_pool_acquire(struct wv_buffer_pool* pool);
void wv_buffer_pool_release(struct wv_buffer_pool* pool,
struct wv_buffer* buffer);