mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
remove hardcoded port allocation params
This commit is contained in:
parent
ca7d08c406
commit
3fee60597e
6 changed files with 27 additions and 48 deletions
|
|
@ -76,9 +76,6 @@ struct _PinosStreamPrivate
|
||||||
GPtrArray *possible_formats;
|
GPtrArray *possible_formats;
|
||||||
SpaFormat *format;
|
SpaFormat *format;
|
||||||
SpaPortInfo port_info;
|
SpaPortInfo port_info;
|
||||||
SpaAllocParam *port_params[2];
|
|
||||||
SpaAllocParamMetaEnable param_meta_enable;
|
|
||||||
SpaAllocParamBuffers param_buffers;
|
|
||||||
|
|
||||||
PinosStreamFlags flags;
|
PinosStreamFlags flags;
|
||||||
|
|
||||||
|
|
@ -1204,7 +1201,8 @@ pinos_stream_connect (PinosStream *stream,
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
pinos_stream_start_allocation (PinosStream *stream,
|
pinos_stream_start_allocation (PinosStream *stream,
|
||||||
PinosProperties *props)
|
SpaAllocParam **params,
|
||||||
|
unsigned int n_params)
|
||||||
{
|
{
|
||||||
PinosStreamPrivate *priv;
|
PinosStreamPrivate *priv;
|
||||||
PinosContext *context;
|
PinosContext *context;
|
||||||
|
|
@ -1219,17 +1217,8 @@ pinos_stream_start_allocation (PinosStream *stream,
|
||||||
|
|
||||||
control_builder_init (stream, &builder);
|
control_builder_init (stream, &builder);
|
||||||
|
|
||||||
priv->port_info.params = priv->port_params;
|
priv->port_info.params = params;
|
||||||
priv->port_info.n_params = 1;
|
priv->port_info.n_params = n_params;
|
||||||
|
|
||||||
priv->port_params[0] = &priv->param_buffers.param;
|
|
||||||
priv->param_buffers.param.type = SPA_ALLOC_PARAM_TYPE_BUFFERS;
|
|
||||||
priv->param_buffers.param.size = sizeof (SpaAllocParamBuffers);
|
|
||||||
priv->param_buffers.minsize = 115200;
|
|
||||||
priv->param_buffers.stride = 640;
|
|
||||||
priv->param_buffers.min_buffers = 0;
|
|
||||||
priv->param_buffers.max_buffers = 0;
|
|
||||||
priv->param_buffers.align = 16;
|
|
||||||
|
|
||||||
/* send update port status */
|
/* send update port status */
|
||||||
add_port_update (stream, &builder, SPA_CONTROL_CMD_PORT_UPDATE_INFO);
|
add_port_update (stream, &builder, SPA_CONTROL_CMD_PORT_UPDATE_INFO);
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,8 @@ gboolean pinos_stream_connect (PinosStream *stream,
|
||||||
gboolean pinos_stream_disconnect (PinosStream *stream);
|
gboolean pinos_stream_disconnect (PinosStream *stream);
|
||||||
|
|
||||||
gboolean pinos_stream_start_allocation (PinosStream *stream,
|
gboolean pinos_stream_start_allocation (PinosStream *stream,
|
||||||
PinosProperties *props);
|
SpaAllocParam **params,
|
||||||
|
unsigned int n_params);
|
||||||
|
|
||||||
gboolean pinos_stream_start (PinosStream *stream);
|
gboolean pinos_stream_start (PinosStream *stream);
|
||||||
gboolean pinos_stream_stop (PinosStream *stream);
|
gboolean pinos_stream_stop (PinosStream *stream);
|
||||||
|
|
|
||||||
|
|
@ -99,18 +99,32 @@ static gboolean
|
||||||
do_start (GstBufferPool * pool)
|
do_start (GstBufferPool * pool)
|
||||||
{
|
{
|
||||||
GstPinosPool *p = GST_PINOS_POOL (pool);
|
GstPinosPool *p = GST_PINOS_POOL (pool);
|
||||||
PinosProperties *props = NULL;
|
|
||||||
GstStructure *config;
|
GstStructure *config;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
guint size;
|
guint size;
|
||||||
guint min_buffers;
|
guint min_buffers;
|
||||||
guint max_buffers;
|
guint max_buffers;
|
||||||
|
SpaAllocParam *port_params[2];
|
||||||
|
SpaAllocParamMetaEnable param_meta_enable;
|
||||||
|
SpaAllocParamBuffers param_buffers;
|
||||||
|
|
||||||
config = gst_buffer_pool_get_config (pool);
|
config = gst_buffer_pool_get_config (pool);
|
||||||
gst_buffer_pool_config_get_params (config, &caps, &size, &min_buffers, &max_buffers);
|
gst_buffer_pool_config_get_params (config, &caps, &size, &min_buffers, &max_buffers);
|
||||||
|
|
||||||
|
port_params[0] = ¶m_buffers.param;
|
||||||
|
param_buffers.param.type = SPA_ALLOC_PARAM_TYPE_BUFFERS;
|
||||||
|
param_buffers.param.size = sizeof (SpaAllocParamBuffers);
|
||||||
|
param_buffers.minsize = size;
|
||||||
|
param_buffers.stride = 0;
|
||||||
|
param_buffers.min_buffers = min_buffers;
|
||||||
|
param_buffers.max_buffers = max_buffers;
|
||||||
|
param_buffers.align = 16;
|
||||||
|
port_params[1] = ¶m_meta_enable.param;
|
||||||
|
param_meta_enable.param.type = SPA_ALLOC_PARAM_TYPE_META_ENABLE;
|
||||||
|
param_meta_enable.param.size = sizeof (SpaAllocParamMetaEnable);
|
||||||
|
param_meta_enable.type = SPA_META_TYPE_HEADER;
|
||||||
|
|
||||||
pinos_stream_start_allocation (p->stream, props);
|
pinos_stream_start_allocation (p->stream, port_params, 2);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -220,8 +220,6 @@ gst_pinos_sink_init (GstPinosSink * sink)
|
||||||
sink->pool = gst_pinos_pool_new ();
|
sink->pool = gst_pinos_pool_new ();
|
||||||
sink->client_name = pinos_client_name();
|
sink->client_name = pinos_client_name();
|
||||||
sink->mode = DEFAULT_PROP_MODE;
|
sink->mode = DEFAULT_PROP_MODE;
|
||||||
g_queue_init (&sink->empty);
|
|
||||||
g_queue_init (&sink->filled);
|
|
||||||
|
|
||||||
sink->buf_ids = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
|
sink->buf_ids = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
|
||||||
(GDestroyNotify) gst_buffer_unref);
|
(GDestroyNotify) gst_buffer_unref);
|
||||||
|
|
@ -409,10 +407,9 @@ on_add_buffer (GObject *gobject,
|
||||||
g_slice_dup (ProcessMemData, &data),
|
g_slice_dup (ProcessMemData, &data),
|
||||||
process_mem_data_destroy);
|
process_mem_data_destroy);
|
||||||
|
|
||||||
gst_pinos_pool_add_buffer (GST_PINOS_POOL (pinossink->pool), buf);
|
gst_pinos_pool_add_buffer (pinossink->pool, buf);
|
||||||
g_hash_table_insert (pinossink->buf_ids, GINT_TO_POINTER (id), buf);
|
g_hash_table_insert (pinossink->buf_ids, GINT_TO_POINTER (id), buf);
|
||||||
|
|
||||||
g_queue_push_tail (&pinossink->empty, buf);
|
|
||||||
pinos_main_loop_signal (pinossink->loop, FALSE);
|
pinos_main_loop_signal (pinossink->loop, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -428,9 +425,7 @@ on_remove_buffer (GObject *gobject,
|
||||||
buf = g_hash_table_lookup (pinossink->buf_ids, GINT_TO_POINTER (id));
|
buf = g_hash_table_lookup (pinossink->buf_ids, GINT_TO_POINTER (id));
|
||||||
GST_MINI_OBJECT_CAST (buf)->dispose = NULL;
|
GST_MINI_OBJECT_CAST (buf)->dispose = NULL;
|
||||||
|
|
||||||
gst_pinos_pool_remove_buffer (GST_PINOS_POOL (pinossink->pool), buf);
|
gst_pinos_pool_remove_buffer (pinossink->pool, buf);
|
||||||
g_queue_remove (&pinossink->empty, buf);
|
|
||||||
g_queue_remove (&pinossink->filled, buf);
|
|
||||||
g_hash_table_remove (pinossink->buf_ids, GINT_TO_POINTER (id));
|
g_hash_table_remove (pinossink->buf_ids, GINT_TO_POINTER (id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -451,8 +446,6 @@ on_new_buffer (GObject *gobject,
|
||||||
|
|
||||||
g_debug ("recycle buffer %d %p", id, buf);
|
g_debug ("recycle buffer %d %p", id, buf);
|
||||||
if (buf) {
|
if (buf) {
|
||||||
g_queue_remove (&pinossink->filled, buf);
|
|
||||||
g_queue_push_tail (&pinossink->empty, buf);
|
|
||||||
pinos_main_loop_signal (pinossink->loop, FALSE);
|
pinos_main_loop_signal (pinossink->loop, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -490,12 +483,6 @@ on_format_notify (GObject *gobject,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GstPinosSink *pinossink = user_data;
|
|
||||||
SpaFormat *format;
|
|
||||||
PinosProperties *props = NULL;
|
|
||||||
|
|
||||||
g_object_get (gobject, "format", &format, NULL);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
@ -594,15 +581,9 @@ gst_pinos_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
|
||||||
if (buffer->pool != GST_BUFFER_POOL_CAST (pinossink->pool)) {
|
if (buffer->pool != GST_BUFFER_POOL_CAST (pinossink->pool)) {
|
||||||
GstBuffer *b = NULL;
|
GstBuffer *b = NULL;
|
||||||
|
|
||||||
while (TRUE) {
|
gst_buffer_pool_acquire_buffer (GST_BUFFER_POOL_CAST (pinossink->pool), &b, NULL);
|
||||||
b = g_queue_peek_head (&pinossink->empty);
|
|
||||||
if (b)
|
|
||||||
break;
|
|
||||||
|
|
||||||
pinos_main_loop_wait (pinossink->loop);
|
|
||||||
}
|
|
||||||
g_queue_push_tail (&pinossink->filled, b);
|
|
||||||
|
|
||||||
|
/* FIXME, copy */
|
||||||
buffer = b;
|
buffer = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,6 @@ struct _GstPinosSink {
|
||||||
|
|
||||||
GstPinosPool *pool;
|
GstPinosPool *pool;
|
||||||
GHashTable *buf_ids;
|
GHashTable *buf_ids;
|
||||||
|
|
||||||
GQueue empty;
|
|
||||||
GQueue filled;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstPinosSinkClass {
|
struct _GstPinosSinkClass {
|
||||||
|
|
|
||||||
|
|
@ -723,10 +723,7 @@ on_format_notify (GObject *gobject,
|
||||||
gst_base_src_set_caps (GST_BASE_SRC (pinossrc), caps);
|
gst_base_src_set_caps (GST_BASE_SRC (pinossrc), caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
pinos_stream_start_allocation (pinossrc->stream, NULL, 0);
|
||||||
|
|
||||||
|
|
||||||
pinos_stream_start_allocation (pinossrc->stream, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue