mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 08:01:20 +02:00
There's no user facing changes in this PR This PR updates `MpvPlayer` to use a threading model more similar to [ExoPlayer's model](https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#threading-model). There's now a dedicated thread looper message queue between the UI interactions on the main thread and calls to `libmpv`. This is necessary because previously, the main thread would make the calls into `libmpv`. `libmpv` uses internal mutex locking for some operations which meant that the main thread would be blocked momentarily. Now, the UI issues a command (eg seek to X position) and the command is added to the thread looper queue and processed on that separate thread. This uses the standard Android Handler/Looper mechanisms. Related to #235
20 lines
471 B
C
20 lines
471 B
C
#pragma once
|
|
|
|
#include <android/log.h>
|
|
|
|
#define DEBUG 0
|
|
|
|
#define LOG_TAG "mpv"
|
|
#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
|
|
#if DEBUG
|
|
#define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)
|
|
#else
|
|
#define ALOGV(...) (void)0
|
|
#endif
|
|
|
|
__attribute__((noreturn)) void die(const char *msg);
|
|
|
|
#define CHECK_MPV_INIT() do { \
|
|
if (__builtin_expect(!g_mpv, 0)) \
|
|
die("libmpv is not initialized"); \
|
|
} while (0)
|