pipewire/src/gst/gstpipewirepool.h
Arun Raghavan d7cb68bfc7 gst: pool: Some refinements to min/max handling
A number of changes for correctness.

  1) We expose the actualy min and max values we support in the
     allocation query.

  2) We don't support max_buffers as 0, as unlimited buffers is not an
     option

  3) In ParamBuffers, we request the max_buffers from bufferpool config,
     as we cannot dynamically allocate buffers
2025-03-26 12:08:35 -04:00

76 lines
1.7 KiB
C

/* GStreamer */
/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
/* SPDX-License-Identifier: MIT */
#ifndef __GST_PIPEWIRE_POOL_H__
#define __GST_PIPEWIRE_POOL_H__
#include "gstpipewirestream.h"
#include <gst/gst.h>
#include <gst/video/video.h>
#include <pipewire/pipewire.h>
G_BEGIN_DECLS
#define GST_TYPE_PIPEWIRE_POOL (gst_pipewire_pool_get_type())
G_DECLARE_FINAL_TYPE (GstPipeWirePool, gst_pipewire_pool, GST, PIPEWIRE_POOL, GstBufferPool)
#define PIPEWIRE_POOL_MIN_BUFFERS 2u
#define PIPEWIRE_POOL_MAX_BUFFERS 16u
typedef struct _GstPipeWirePoolData GstPipeWirePoolData;
struct _GstPipeWirePoolData {
GstPipeWirePool *pool;
void *owner;
struct spa_meta_header *header;
guint flags;
struct pw_buffer *b;
GstBuffer *buf;
gboolean queued;
struct spa_meta_region *crop;
struct spa_meta_videotransform *videotransform;
};
struct _GstPipeWirePool {
GstBufferPool parent;
GWeakRef stream;
guint n_buffers;
gboolean add_metavideo;
GstVideoInfo video_info;
GstAllocator *fd_allocator;
GstAllocator *dmabuf_allocator;
GCond cond;
gboolean paused;
};
enum GstPipeWirePoolMode {
USE_BUFFERPOOL_NO = 0,
USE_BUFFERPOOL_AUTO,
USE_BUFFERPOOL_YES
};
GstPipeWirePool * gst_pipewire_pool_new (GstPipeWireStream *stream);
void gst_pipewire_pool_wrap_buffer (GstPipeWirePool *pool, struct pw_buffer *buffer);
void gst_pipewire_pool_remove_buffer (GstPipeWirePool *pool, struct pw_buffer *buffer);
static inline gboolean
gst_pipewire_pool_has_buffers (GstPipeWirePool *pool)
{
return pool->n_buffers > 0;
}
GstPipeWirePoolData *gst_pipewire_pool_get_data (GstBuffer *buffer);
void gst_pipewire_pool_set_paused (GstPipeWirePool *pool, gboolean paused);
G_END_DECLS
#endif /* __GST_PIPEWIRE_POOL_H__ */