mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
Various improvements
context: fix memory free subscribe: implement dummy methods introspect: implement more stream: keep track of dequeued buffers ourselves because we need to be able to cancel and keep track of writable size.
This commit is contained in:
parent
68643fd25a
commit
fe932db2c6
10 changed files with 804 additions and 57 deletions
118
src/thread-mainloop.c
Normal file
118
src/thread-mainloop.c
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/* PipeWire
|
||||
* Copyright (C) 2018 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <pipewire/log.h>
|
||||
#include <pipewire/thread-loop.h>
|
||||
|
||||
#include <pulse/mainloop.h>
|
||||
#include <pulse/thread-mainloop.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
struct pa_threaded_mainloop
|
||||
{
|
||||
pa_mainloop *loop;
|
||||
struct pw_thread_loop *tloop;
|
||||
};
|
||||
|
||||
pa_threaded_mainloop *pa_threaded_mainloop_new(void)
|
||||
{
|
||||
pa_threaded_mainloop *m;
|
||||
|
||||
m = calloc(1, sizeof(pa_threaded_mainloop));
|
||||
if (m == NULL)
|
||||
return NULL;
|
||||
|
||||
m->loop = pa_mainloop_new();
|
||||
if (m->loop == NULL)
|
||||
goto no_mem;
|
||||
|
||||
m->tloop = pw_thread_loop_new(m->loop->loop, NULL);
|
||||
if (m->tloop == NULL)
|
||||
goto no_mem;
|
||||
|
||||
return m;
|
||||
|
||||
no_mem:
|
||||
if (m->loop)
|
||||
pa_mainloop_free(m->loop);
|
||||
free(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void pa_threaded_mainloop_free(pa_threaded_mainloop* m)
|
||||
{
|
||||
pw_thread_loop_destroy(m->tloop);
|
||||
pa_mainloop_free(m->loop);
|
||||
free(m);
|
||||
}
|
||||
|
||||
int pa_threaded_mainloop_start(pa_threaded_mainloop *m)
|
||||
{
|
||||
return pw_thread_loop_start(m->tloop);
|
||||
}
|
||||
|
||||
void pa_threaded_mainloop_stop(pa_threaded_mainloop *m)
|
||||
{
|
||||
pw_thread_loop_stop(m->tloop);
|
||||
}
|
||||
|
||||
void pa_threaded_mainloop_lock(pa_threaded_mainloop *m)
|
||||
{
|
||||
pw_thread_loop_lock(m->tloop);
|
||||
}
|
||||
|
||||
void pa_threaded_mainloop_unlock(pa_threaded_mainloop *m)
|
||||
{
|
||||
pw_thread_loop_unlock(m->tloop);
|
||||
}
|
||||
|
||||
void pa_threaded_mainloop_wait(pa_threaded_mainloop *m)
|
||||
{
|
||||
pw_thread_loop_wait(m->tloop);
|
||||
}
|
||||
|
||||
void pa_threaded_mainloop_signal(pa_threaded_mainloop *m, int wait_for_accept)
|
||||
{
|
||||
pw_thread_loop_signal(m->tloop, wait_for_accept);
|
||||
}
|
||||
|
||||
void pa_threaded_mainloop_accept(pa_threaded_mainloop *m)
|
||||
{
|
||||
pw_thread_loop_accept(m->tloop);
|
||||
}
|
||||
|
||||
int pa_threaded_mainloop_get_retval(pa_threaded_mainloop *m)
|
||||
{
|
||||
return pa_mainloop_get_retval(m->loop);
|
||||
}
|
||||
|
||||
pa_mainloop_api* pa_threaded_mainloop_get_api(pa_threaded_mainloop*m)
|
||||
{
|
||||
return pa_mainloop_get_api(m->loop);
|
||||
}
|
||||
|
||||
int pa_threaded_mainloop_in_thread(pa_threaded_mainloop *m)
|
||||
{
|
||||
return pw_thread_loop_in_thread(m->tloop);
|
||||
}
|
||||
|
||||
void pa_threaded_mainloop_set_name(pa_threaded_mainloop *m, const char *name)
|
||||
{
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue