summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-10-21 04:55:41 +0200
committerDudemanguy <random342@airmail.cc>2023-11-05 17:36:17 +0000
commit174df99ffa53f1091589eaa4fa0c16cdd55a9326 (patch)
tree3a60d45615f18beed98a9b08267c28ed7e05dd5f /stream
parent3a8b107f6216b38a151d5ca1e9d4f2727e3418f5 (diff)
downloadmpv-174df99ffa53f1091589eaa4fa0c16cdd55a9326.tar.bz2
mpv-174df99ffa53f1091589eaa4fa0c16cdd55a9326.tar.xz
ALL: use new mp_thread abstraction
Diffstat (limited to 'stream')
-rw-r--r--stream/stream_dvb.c22
-rw-r--r--stream/stream_lavf.c3
2 files changed, 11 insertions, 14 deletions
diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c
index d776e7b18b..215e82ce0b 100644
--- a/stream/stream_dvb.c
+++ b/stream/stream_dvb.c
@@ -41,7 +41,6 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
-#include <pthread.h>
#include "osdep/io.h"
#include "misc/ctype.h"
@@ -53,6 +52,7 @@
#include "options/m_option.h"
#include "options/options.h"
#include "options/path.h"
+#include "osdep/threads.h"
#include "dvbin.h"
#include "dvb_tune.h"
@@ -66,7 +66,7 @@
#define OPT_BASE_STRUCT dvb_opts_t
static dvb_state_t *global_dvb_state = NULL;
-static pthread_mutex_t global_dvb_state_lock = PTHREAD_MUTEX_INITIALIZER;
+static mp_static_mutex global_dvb_state_lock = MP_STATIC_MUTEX_INITIALIZER;
const struct m_sub_options stream_dvb_conf = {
.opts = (const m_option_t[]) {
@@ -821,9 +821,9 @@ void dvbin_close(stream_t *stream)
if (state->switching_channel && state->is_on) {
// Prevent state destruction, reset channel-switch.
state->switching_channel = false;
- pthread_mutex_lock(&global_dvb_state_lock);
+ mp_mutex_lock(&global_dvb_state_lock);
global_dvb_state->stream_used = false;
- pthread_mutex_unlock(&global_dvb_state_lock);
+ mp_mutex_unlock(&global_dvb_state_lock);
return;
}
@@ -839,9 +839,9 @@ void dvbin_close(stream_t *stream)
state->cur_adapter = -1;
state->cur_frontend = -1;
- pthread_mutex_lock(&global_dvb_state_lock);
+ mp_mutex_lock(&global_dvb_state_lock);
TA_FREEP(&global_dvb_state);
- pthread_mutex_unlock(&global_dvb_state_lock);
+ mp_mutex_unlock(&global_dvb_state_lock);
}
static int dvb_streaming_start(stream_t *stream, char *progname)
@@ -918,10 +918,10 @@ static int dvb_open(stream_t *stream)
{
dvb_priv_t *priv = NULL;
- pthread_mutex_lock(&global_dvb_state_lock);
+ mp_mutex_lock(&global_dvb_state_lock);
if (global_dvb_state && global_dvb_state->stream_used) {
MP_ERR(stream, "DVB stream already in use, only one DVB stream can exist at a time!\n");
- pthread_mutex_unlock(&global_dvb_state_lock);
+ mp_mutex_unlock(&global_dvb_state_lock);
goto err_out;
}
@@ -937,17 +937,17 @@ static int dvb_open(stream_t *stream)
priv->log = stream->log;
if (!state) {
MP_ERR(stream, "DVB configuration is empty\n");
- pthread_mutex_unlock(&global_dvb_state_lock);
+ mp_mutex_unlock(&global_dvb_state_lock);
goto err_out;
}
if (!dvb_parse_path(stream)) {
- pthread_mutex_unlock(&global_dvb_state_lock);
+ mp_mutex_unlock(&global_dvb_state_lock);
goto err_out;
}
state->stream_used = true;
- pthread_mutex_unlock(&global_dvb_state_lock);
+ mp_mutex_unlock(&global_dvb_state_lock);
if (!state->is_on) {
// State could be already initialized, for example, we just did a channel switch.
diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c
index 08b61ab445..c153ddd4a2 100644
--- a/stream/stream_lavf.c
+++ b/stream/stream_lavf.c
@@ -15,8 +15,6 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <pthread.h>
-
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
#include <libavutil/opt.h>
@@ -457,4 +455,3 @@ const stream_info_t stream_info_ffmpeg_unsafe = {
.stream_origin = STREAM_ORIGIN_UNSAFE,
.can_write = true,
};
-