diff --git a/audio/out/ao_wasapi.h b/audio/out/ao_wasapi.h index 17b8f7a6d7c2f..24a9aa2cb37eb 100644 --- a/audio/out/ao_wasapi.h +++ b/audio/out/ao_wasapi.h @@ -31,7 +31,7 @@ #include #include "common/msg.h" -#include "osdep/windows_utils.h" +#include #include "internal.h" #include "ao.h" diff --git a/input/input.c b/input/input.c index 9d50abb50d8fa..21230b10d99b0 100644 --- a/input/input.c +++ b/input/input.c @@ -51,7 +51,7 @@ #include "common/common.h" #if HAVE_COCOA -#include "osdep/macosx_events.h" +#include #endif #define input_lock(ictx) pthread_mutex_lock(&ictx->mutex) diff --git a/input/ipc-win.c b/input/ipc-win.c index aec754a281f9e..eccbd01c3cded 100644 --- a/input/ipc-win.c +++ b/input/ipc-win.c @@ -20,7 +20,7 @@ #include "osdep/io.h" #include "osdep/threads.h" -#include "osdep/windows_utils.h" +#include #include "common/common.h" #include "common/global.h" diff --git a/meson.build b/meson.build index 2e4acb78eaf16..77cad19704123 100644 --- a/meson.build +++ b/meson.build @@ -246,7 +246,7 @@ sources = files( ## osdep 'osdep/io.c', - 'osdep/semaphore_osx.c', + 'osdep/darwin/semaphore.c', 'osdep/subprocess.c', 'osdep/threads.c', 'osdep/timer.c', @@ -395,13 +395,13 @@ cocoa = dependency('appleframeworks', modules: ['Cocoa', 'IOKit', 'QuartzCore'], features += {'cocoa': cocoa.found()} if features['cocoa'] dependencies += cocoa - sources += files('osdep/apple_utils.c', - 'osdep/language-apple.c', - 'osdep/macosx_application.m', - 'osdep/macosx_events.m', - 'osdep/macosx_menubar.m', - 'osdep/main-fn-cocoa.c', - 'osdep/path-macosx.m', + sources += files('osdep/darwin/utils.c', + 'osdep/darwin/language.c', + 'osdep/darwin/application.m', + 'osdep/darwin/events.m', + 'osdep/darwin/menubar.m', + 'osdep/darwin/main-fn.c', + 'osdep/darwin/path.m', 'video/out/cocoa_common.m', 'video/out/cocoa/events_view.m', 'video/out/cocoa/video_view.m', @@ -409,26 +409,26 @@ if features['cocoa'] endif if posix - path_source = files('osdep/path-unix.c') - subprocess_source = files('osdep/subprocess-posix.c') + path_source = files('osdep/unix/path.c') + subprocess_source = files('osdep/unix/subprocess.c') sources += files('input/ipc-unix.c', - 'osdep/poll_wrapper.c', - 'osdep/terminal-unix.c', + 'osdep/unix/poll_wrapper.c', + 'osdep/unix/terminal.c', 'sub/filter_regex.c') endif if posix and not features['cocoa'] - sources += files('osdep/main-fn-unix.c', - 'osdep/language-posix.c') + sources += files('osdep/unix/main-fn.c', + 'osdep/unix/language.c') endif if darwin - path_source = files('osdep/path-darwin.c') - timer_source = files('osdep/timer-darwin.c') + path_source = files('osdep/darwin/path.c') + timer_source = files('osdep/darwin/timer.c') endif if posix and not darwin - timer_source = files('osdep/timer-linux.c') + timer_source = files('osdep/unix/timer.c') endif features += {'ppoll': cc.has_function('ppoll', args: '-D_GNU_SOURCE', @@ -479,15 +479,15 @@ uwp = cc.find_library('windowsapp', required: uwp_opt) features += {'uwp': uwp.found()} if features['uwp'] dependencies += uwp - path_source = files('osdep/path-uwp.c') + path_source = files('osdep/uwp/path.c') subprocess_source = [] endif features += {'win32-executable': win32 and get_option('cplayer')} if win32 - timer_source = files('osdep/timer-win32.c') - sources += files('osdep/w32_keyboard.c', - 'osdep/windows_utils.c') + timer_source = files('osdep/win32/timer.c') + sources += files('osdep/win32/keyboard.c', + 'osdep/win32/utils.c') endif features += {'win32-desktop': win32 and not uwp.found()} @@ -501,12 +501,12 @@ if features['win32-desktop'] cc.find_library('version'), cc.find_library('winmm')] dependencies += win32_desktop_libs - path_source = files('osdep/path-win.c') - subprocess_source = files('osdep/subprocess-win.c') + path_source = files('osdep/win32/path.c') + subprocess_source = files('osdep/win32/subprocess.c') sources += files('input/ipc-win.c', - 'osdep/language-win.c', - 'osdep/main-fn-win.c', - 'osdep/terminal-win.c', + 'osdep/win32/language.c', + 'osdep/win32/main-fn.c', + 'osdep/win32/terminal.c', 'video/out/w32_common.c', 'video/out/win32/displayconfig.c', 'video/out/win32/droptarget.c') @@ -519,12 +519,12 @@ endif features += {'glob-posix': cc.has_function('glob', prefix: '#include ')} -features += {'glob-win32': win32 and not posix} +features += {'glob-win32': win32 and not features['glob-posix']} if features['glob-win32'] - sources += files('osdep/glob-win.c') + sources += files('osdep/win32/glob.c') endif -features += {'glob': features['glob-posix'] or features['glob-win32']} +features += {'glob': features['glob-posix']} features += {'vt.h': cc.has_header_symbol('sys/vt.h', 'VT_GETMODE')} @@ -589,6 +589,9 @@ if darwin subdir(join_paths('TOOLS', 'osxbundle')) endif +if win32 + subdir('osdep' / 'win32') +endif # misc dependencies features += {'av-channel-layout': libavutil.version().version_compare('>= 57.24.100')} @@ -1530,12 +1533,12 @@ features += {'swift': swift.allowed()} swift_sources = [] if features['cocoa'] and features['swift'] - swift_sources += files('osdep/macos/libmpv_helper.swift', - 'osdep/macos/log_helper.swift', - 'osdep/macos/mpv_helper.swift', - 'osdep/macos/precise_timer.swift', - 'osdep/macos/swift_compat.swift', - 'osdep/macos/swift_extensions.swift', + swift_sources += files('osdep/darwin/libmpv_helper.swift', + 'osdep/darwin/log_helper.swift', + 'osdep/darwin/mpv_helper.swift', + 'osdep/darwin/precise_timer.swift', + 'osdep/darwin/swift_compat.swift', + 'osdep/darwin/swift_extensions.swift', 'video/out/mac/common.swift', 'video/out/mac/title_bar.swift', 'video/out/mac/view.swift', @@ -1563,7 +1566,7 @@ macos_media_player = get_option('macos-media-player').require( ) features += {'macos-media-player': macos_media_player.allowed()} if features['macos-media-player'] - swift_sources += files('osdep/macos/remote_command_center.swift') + swift_sources += files('osdep/darwin/remote_command_center.swift') endif if features['swift'] and swift_sources.length() > 0 @@ -1576,7 +1579,7 @@ macos_touchbar = get_option('macos-touchbar').require( ) features += {'macos-touchbar': macos_touchbar.allowed()} if features['macos-touchbar'] - sources += files('osdep/macosx_touchbar.m') + sources += files('osdep/darwin/touchbar.m') endif @@ -1703,9 +1706,9 @@ if win32 'etc/mpv-icon-8bit-64x64.png', 'etc/mpv-icon-8bit-128x128.png', 'etc/mpv-icon.ico', - 'osdep/mpv.exe.manifest'] + 'osdep/win32/mpv.exe.manifest'] - sources += windows.compile_resources('osdep/mpv.rc', args: res_flags, depend_files: resources, + sources += windows.compile_resources('osdep/win32/mpv.rc', args: res_flags, depend_files: resources, depends: version_h, include_directories: res_includes) endif diff --git a/osdep/macosx_application.h b/osdep/darwin/application.h similarity index 97% rename from osdep/macosx_application.h rename to osdep/darwin/application.h index 753b9f033fdab..e45bb57ac480e 100644 --- a/osdep/macosx_application.h +++ b/osdep/darwin/application.h @@ -18,7 +18,7 @@ #ifndef MPV_MACOSX_APPLICATION #define MPV_MACOSX_APPLICATION -#include "osdep/macosx_menubar.h" +#include "menubar.h" #include "options/m_option.h" enum { diff --git a/osdep/macosx_application.m b/osdep/darwin/application.m similarity index 98% rename from osdep/macosx_application.m rename to osdep/darwin/application.m index bf60e05389679..e7dc678461e5c 100644 --- a/osdep/macosx_application.m +++ b/osdep/darwin/application.m @@ -26,17 +26,17 @@ #include "options/m_config.h" #include "options/options.h" -#import "osdep/macosx_application_objc.h" -#include "osdep/macosx_compat.h" -#import "osdep/macosx_events_objc.h" +#import "application_objc.h" +#include "compat.h" +#import "events_objc.h" #include "osdep/threads.h" #include "osdep/main-fn.h" #if HAVE_MACOS_TOUCHBAR -#import "osdep/macosx_touchbar.h" +#import "touchbar.h" #endif #if HAVE_MACOS_COCOA_CB -#include "osdep/macOS_swift.h" +#include "swift.h" #endif #define MPV_PROTOCOL @"mpv://" @@ -377,4 +377,3 @@ int cocoa_main(int argc, char *argv[]) return 1; } } - diff --git a/osdep/macosx_application_objc.h b/osdep/darwin/application_objc.h similarity index 94% rename from osdep/macosx_application_objc.h rename to osdep/darwin/application_objc.h index 11959a83eaf12..0e5b782dfa20b 100644 --- a/osdep/macosx_application_objc.h +++ b/osdep/darwin/application_objc.h @@ -16,8 +16,8 @@ */ #import -#include "osdep/macosx_application.h" -#import "osdep/macosx_menubar_objc.h" +#include "application.h" +#import "menubar_objc.h" @class CocoaCB; struct mpv_event; diff --git a/osdep/macosx_compat.h b/osdep/darwin/compat.h similarity index 98% rename from osdep/macosx_compat.h rename to osdep/darwin/compat.h index d5f8dab571b23..be1daea518888 100644 --- a/osdep/macosx_compat.h +++ b/osdep/darwin/compat.h @@ -22,7 +22,7 @@ #define MPV_MACOSX_COMPAT #import -#include "osdep/macosx_versions.h" +#include "versions.h" #if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12) diff --git a/osdep/macosx_events.h b/osdep/darwin/events.h similarity index 100% rename from osdep/macosx_events.h rename to osdep/darwin/events.h diff --git a/osdep/macosx_events.m b/osdep/darwin/events.m similarity index 98% rename from osdep/macosx_events.m rename to osdep/darwin/events.m index 2a82b3d034f5d..6c5345da81fcd 100644 --- a/osdep/macosx_events.m +++ b/osdep/darwin/events.m @@ -33,14 +33,14 @@ // doesn't make much sense, but needed to access keymap functionality #include "video/out/vo.h" -#include "osdep/macosx_compat.h" -#import "osdep/macosx_events_objc.h" -#import "osdep/macosx_application_objc.h" +#include "compat.h" +#import "events_objc.h" +#import "application_objc.h" #include "config.h" #if HAVE_MACOS_COCOA_CB -#include "osdep/macOS_swift.h" +#include "swift.h" #endif @interface EventsResponder () diff --git a/osdep/macosx_events_objc.h b/osdep/darwin/events_objc.h similarity index 97% rename from osdep/macosx_events_objc.h rename to osdep/darwin/events_objc.h index 9394fe7160b5e..7a0c49ed65583 100644 --- a/osdep/macosx_events_objc.h +++ b/osdep/darwin/events_objc.h @@ -18,7 +18,7 @@ */ #import -#include "osdep/macosx_events.h" +#include "events.h" @class RemoteCommandCenter; struct input_ctx; diff --git a/osdep/language-apple.c b/osdep/darwin/language.c similarity index 98% rename from osdep/language-apple.c rename to osdep/darwin/language.c index dc83fb545a264..85d08dea6c4bf 100644 --- a/osdep/language-apple.c +++ b/osdep/darwin/language.c @@ -19,7 +19,7 @@ #include "misc/language.h" -#include "apple_utils.h" +#include "utils.h" #include "mpv_talloc.h" char **mp_get_user_langs(void) diff --git a/osdep/macos/libmpv_helper.swift b/osdep/darwin/libmpv_helper.swift similarity index 100% rename from osdep/macos/libmpv_helper.swift rename to osdep/darwin/libmpv_helper.swift diff --git a/osdep/macos/log_helper.swift b/osdep/darwin/log_helper.swift similarity index 100% rename from osdep/macos/log_helper.swift rename to osdep/darwin/log_helper.swift diff --git a/osdep/main-fn-cocoa.c b/osdep/darwin/main-fn.c similarity index 89% rename from osdep/main-fn-cocoa.c rename to osdep/darwin/main-fn.c index eeed127ead8ef..286dea3f1559b 100644 --- a/osdep/main-fn-cocoa.c +++ b/osdep/darwin/main-fn.c @@ -1,4 +1,4 @@ -#include "osdep/macosx_application.h" +#include "application.h" // This is needed because Cocoa absolutely requires creating the NSApplication // singleton and running it in the "main" thread. It is apparently not diff --git a/osdep/macosx_menubar.h b/osdep/darwin/menubar.h similarity index 100% rename from osdep/macosx_menubar.h rename to osdep/darwin/menubar.h diff --git a/osdep/macosx_menubar.m b/osdep/darwin/menubar.m similarity index 99% rename from osdep/macosx_menubar.m rename to osdep/darwin/menubar.m index c8255dd037e25..d14e63263c633 100644 --- a/osdep/macosx_menubar.m +++ b/osdep/darwin/menubar.m @@ -18,9 +18,9 @@ #include "config.h" #include "common/common.h" -#import "macosx_menubar_objc.h" -#import "osdep/macosx_application_objc.h" -#include "osdep/macosx_compat.h" +#import "menubar_objc.h" +#import "application_objc.h" +#include "compat.h" @implementation MenuBar { diff --git a/osdep/macosx_menubar_objc.h b/osdep/darwin/menubar_objc.h similarity index 95% rename from osdep/macosx_menubar_objc.h rename to osdep/darwin/menubar_objc.h index 072fef85c7a8e..5d0f12466a0cc 100644 --- a/osdep/macosx_menubar_objc.h +++ b/osdep/darwin/menubar_objc.h @@ -16,7 +16,7 @@ */ #import -#include "osdep/macosx_menubar.h" +#include "menubar.h" @interface MenuBar : NSObject diff --git a/osdep/darwin/meson.build b/osdep/darwin/meson.build new file mode 100644 index 0000000000000..e7f8c843ca5a5 --- /dev/null +++ b/osdep/darwin/meson.build @@ -0,0 +1,59 @@ +# custom swift targets +bridge = join_paths(source_root, 'osdep/darwin/swift_bridge.h') +header = join_paths(build_root, 'osdep/darwin/swift.h') +module = join_paths(build_root, 'osdep/darwin/swift.swiftmodule') +target = join_paths(build_root, 'osdep/darwin/swift.o') + +swift_flags = ['-frontend', '-c', '-sdk', macos_sdk_path, + '-enable-objc-interop', '-emit-objc-header', '-parse-as-library'] + +if swift_ver.version_compare('>=6.0') + swift_flags += ['-swift-version', '5'] +endif + +if get_option('debug') + swift_flags += '-g' +endif + +if get_option('optimization') != '0' + swift_flags += '-O' +endif + +if macos_10_11_features.allowed() + swift_flags += ['-D', 'HAVE_MACOS_10_11_FEATURES'] +endif + +if macos_10_14_features.allowed() + swift_flags += ['-D', 'HAVE_MACOS_10_14_FEATURES'] +endif + +extra_flags = get_option('swift-flags').split() +swift_flags += extra_flags + +swift_compile = [swift_prog, swift_flags, '-module-name', 'swift', + '-emit-module-path', '@OUTPUT0@', '-import-objc-header', bridge, + '-emit-objc-header-path', '@OUTPUT1@', '-o', '@OUTPUT2@', + '@INPUT@', '-I.', '-I' + source_root, + '-I' + libplacebo.get_variable('includedir', + default_value: source_root / 'subprojects' / 'libplacebo' / 'src' / 'include')] + +swift_targets = custom_target('swift_targets', + input: swift_sources, + output: ['swift.swiftmodule', 'swift.h', 'swift.o'], + command: swift_compile, +) +sources += swift_targets + +swift_lib_dir_py = find_program(join_paths(tools_directory, 'macos-swift-lib-directory.py')) +swift_lib_dir = run_command(swift_lib_dir_py, swift_prog.full_path(), check: true).stdout() +message('Detected Swift library directory: ' + swift_lib_dir) + +# linker flags +swift_link_flags = ['-L' + swift_lib_dir, '-Xlinker', '-rpath', + '-Xlinker', swift_lib_dir, '-rdynamic', '-Xlinker', + '-add_ast_path', '-Xlinker', module] +if swift_ver.version_compare('>=5.0') + swift_link_flags += ['-Xlinker', '-rpath', '-Xlinker', + '/usr/lib/swift', '-L/usr/lib/swift'] +endif +add_project_link_arguments(swift_link_flags, language: ['c', 'objc']) diff --git a/osdep/macos/mpv_helper.swift b/osdep/darwin/mpv_helper.swift similarity index 100% rename from osdep/macos/mpv_helper.swift rename to osdep/darwin/mpv_helper.swift diff --git a/osdep/path-darwin.c b/osdep/darwin/path.c similarity index 99% rename from osdep/path-darwin.c rename to osdep/darwin/path.c index 0b55ea4c56c22..aad4293018607 100644 --- a/osdep/path-darwin.c +++ b/osdep/darwin/path.c @@ -19,7 +19,7 @@ #include #include "options/path.h" -#include "path.h" +#include #include "config.h" diff --git a/osdep/path-macosx.m b/osdep/darwin/path.m similarity index 100% rename from osdep/path-macosx.m rename to osdep/darwin/path.m diff --git a/osdep/macos/precise_timer.swift b/osdep/darwin/precise_timer.swift similarity index 100% rename from osdep/macos/precise_timer.swift rename to osdep/darwin/precise_timer.swift diff --git a/osdep/macos/remote_command_center.swift b/osdep/darwin/remote_command_center.swift similarity index 100% rename from osdep/macos/remote_command_center.swift rename to osdep/darwin/remote_command_center.swift diff --git a/osdep/semaphore_osx.c b/osdep/darwin/semaphore.c similarity index 99% rename from osdep/semaphore_osx.c rename to osdep/darwin/semaphore.c index 1e2015bddde2a..35dbc2c2af77f 100644 --- a/osdep/semaphore_osx.c +++ b/osdep/darwin/semaphore.c @@ -13,7 +13,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "osdep/semaphore.h" +#include "semaphore.h" #ifdef MP_SEMAPHORE_EMULATION diff --git a/osdep/semaphore.h b/osdep/darwin/semaphore.h similarity index 100% rename from osdep/semaphore.h rename to osdep/darwin/semaphore.h diff --git a/osdep/macOS_swift_bridge.h b/osdep/darwin/swift_bridge.h similarity index 96% rename from osdep/macOS_swift_bridge.h rename to osdep/darwin/swift_bridge.h index 9407b6fc9b26e..f313509cd7939 100644 --- a/osdep/macOS_swift_bridge.h +++ b/osdep/darwin/swift_bridge.h @@ -29,8 +29,8 @@ #include "input/input.h" #include "video/out/win_state.h" -#include "osdep/macosx_application_objc.h" -#include "osdep/macosx_events_objc.h" +#include "application_objc.h" +#include "events_objc.h" // complex macros won't get imported to Swift so we have to reassign them diff --git a/osdep/macos/swift_compat.swift b/osdep/darwin/swift_compat.swift similarity index 100% rename from osdep/macos/swift_compat.swift rename to osdep/darwin/swift_compat.swift diff --git a/osdep/macos/swift_extensions.swift b/osdep/darwin/swift_extensions.swift similarity index 100% rename from osdep/macos/swift_extensions.swift rename to osdep/darwin/swift_extensions.swift diff --git a/osdep/timer-darwin.c b/osdep/darwin/timer.c similarity index 98% rename from osdep/timer-darwin.c rename to osdep/darwin/timer.c index bb8a9b43248b8..6892af1a6bc8c 100644 --- a/osdep/timer-darwin.c +++ b/osdep/darwin/timer.c @@ -24,7 +24,7 @@ #include #include "common/msg.h" -#include "timer.h" +#include static double timebase_ratio_ns; diff --git a/osdep/macosx_touchbar.h b/osdep/darwin/touchbar.h similarity index 97% rename from osdep/macosx_touchbar.h rename to osdep/darwin/touchbar.h index a03b68c0e6570..95f98ee2c2883 100644 --- a/osdep/macosx_touchbar.h +++ b/osdep/darwin/touchbar.h @@ -16,7 +16,7 @@ */ #import -#import "osdep/macosx_application_objc.h" +#import "application_objc.h" #define BASE_ID @"io.mpv.touchbar" static NSTouchBarCustomizationIdentifier customID = BASE_ID; diff --git a/osdep/macosx_touchbar.m b/osdep/darwin/touchbar.m similarity index 100% rename from osdep/macosx_touchbar.m rename to osdep/darwin/touchbar.m diff --git a/osdep/apple_utils.c b/osdep/darwin/utils.c similarity index 97% rename from osdep/apple_utils.c rename to osdep/darwin/utils.c index 02cdfaa95abb9..e813bac4cf924 100644 --- a/osdep/apple_utils.c +++ b/osdep/darwin/utils.c @@ -17,7 +17,7 @@ * License along with mpv. If not, see . */ -#include "apple_utils.h" +#include "utils.h" #include "mpv_talloc.h" diff --git a/osdep/apple_utils.h b/osdep/darwin/utils.h similarity index 100% rename from osdep/apple_utils.h rename to osdep/darwin/utils.h diff --git a/osdep/macosx_versions.h b/osdep/darwin/versions.h similarity index 100% rename from osdep/macosx_versions.h rename to osdep/darwin/versions.h diff --git a/osdep/meson.build b/osdep/meson.build index 60fc2f6d574fa..ab6768264e15b 100644 --- a/osdep/meson.build +++ b/osdep/meson.build @@ -1,59 +1 @@ -# custom swift targets -bridge = join_paths(source_root, 'osdep/macOS_swift_bridge.h') -header = join_paths(build_root, 'osdep/macOS_swift.h') -module = join_paths(build_root, 'osdep/macOS_swift.swiftmodule') -target = join_paths(build_root, 'osdep/macOS_swift.o') - -swift_flags = ['-frontend', '-c', '-sdk', macos_sdk_path, - '-enable-objc-interop', '-emit-objc-header', '-parse-as-library'] - -if swift_ver.version_compare('>=6.0') - swift_flags += ['-swift-version', '5'] -endif - -if get_option('debug') - swift_flags += '-g' -endif - -if get_option('optimization') != '0' - swift_flags += '-O' -endif - -if macos_10_11_features.allowed() - swift_flags += ['-D', 'HAVE_MACOS_10_11_FEATURES'] -endif - -if macos_10_14_features.allowed() - swift_flags += ['-D', 'HAVE_MACOS_10_14_FEATURES'] -endif - -extra_flags = get_option('swift-flags').split() -swift_flags += extra_flags - -swift_compile = [swift_prog, swift_flags, '-module-name', 'macOS_swift', - '-emit-module-path', '@OUTPUT0@', '-import-objc-header', bridge, - '-emit-objc-header-path', '@OUTPUT1@', '-o', '@OUTPUT2@', - '@INPUT@', '-I.', '-I' + source_root, - '-I' + libplacebo.get_variable('includedir', - default_value: source_root / 'subprojects' / 'libplacebo' / 'src' / 'include')] - -swift_targets = custom_target('swift_targets', - input: swift_sources, - output: ['macOS_swift.swiftmodule', 'macOS_swift.h', 'macOS_swift.o'], - command: swift_compile, -) -sources += swift_targets - -swift_lib_dir_py = find_program(join_paths(tools_directory, 'macos-swift-lib-directory.py')) -swift_lib_dir = run_command(swift_lib_dir_py, swift_prog.full_path(), check: true).stdout() -message('Detected Swift library directory: ' + swift_lib_dir) - -# linker flags -swift_link_flags = ['-L' + swift_lib_dir, '-Xlinker', '-rpath', - '-Xlinker', swift_lib_dir, '-rdynamic', '-Xlinker', - '-add_ast_path', '-Xlinker', module] -if swift_ver.version_compare('>=5.0') - swift_link_flags += ['-Xlinker', '-rpath', '-Xlinker', - '/usr/lib/swift', '-L/usr/lib/swift'] -endif -add_project_link_arguments(swift_link_flags, language: ['c', 'objc']) +subdir('darwin') diff --git a/osdep/terminal-dummy.c b/osdep/terminal-dummy.c deleted file mode 100644 index 4b33d786a8fcf..0000000000000 --- a/osdep/terminal-dummy.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "terminal.h" - -void terminal_init(void) -{ -} - -void terminal_setup_getch(struct input_ctx *ictx) -{ -} - -void terminal_uninit(void) -{ -} - -bool terminal_in_background(void) -{ - return false; -} - -void terminal_get_size(int *w, int *h) -{ -} - -void terminal_get_size2(int *rows, int *cols, int *px_width, int *px_height) -{ -} - -void mp_write_console_ansi(void *wstream, char *buf) -{ -} - -bool terminal_try_attach(void) -{ - return false; -} diff --git a/osdep/threads.c b/osdep/threads.c index 0b96216cc75f6..c54576052b5a3 100644 --- a/osdep/threads.c +++ b/osdep/threads.c @@ -22,7 +22,7 @@ #include "common/common.h" #include "config.h" #include "threads.h" -#include "timer.h" +#include #if HAVE_BSD_THREAD_NAME #include diff --git a/osdep/timer.c b/osdep/timer.c index 0d5fade659b15..b2f0aa80d9fb9 100644 --- a/osdep/timer.c +++ b/osdep/timer.c @@ -26,7 +26,7 @@ #include "common/common.h" #include "common/msg.h" #include "misc/random.h" -#include "timer.h" +#include static uint64_t raw_time_offset; static pthread_once_t timer_init_once = PTHREAD_ONCE_INIT; diff --git a/osdep/language-posix.c b/osdep/unix/language.c similarity index 100% rename from osdep/language-posix.c rename to osdep/unix/language.c diff --git a/osdep/main-fn-unix.c b/osdep/unix/main-fn.c similarity index 72% rename from osdep/main-fn-unix.c rename to osdep/unix/main-fn.c index c30c4a91ecdbe..042fa2ada2ea7 100644 --- a/osdep/main-fn-unix.c +++ b/osdep/unix/main-fn.c @@ -1,4 +1,4 @@ -#include "main-fn.h" +#include int main(int argc, char *argv[]) { diff --git a/osdep/path-unix.c b/osdep/unix/path.c similarity index 99% rename from osdep/path-unix.c rename to osdep/unix/path.c index fed2695a871fe..ce7c386d93f54 100644 --- a/osdep/path-unix.c +++ b/osdep/unix/path.c @@ -19,7 +19,7 @@ #include #include "options/path.h" -#include "path.h" +#include #include "config.h" diff --git a/osdep/poll_wrapper.c b/osdep/unix/poll_wrapper.c similarity index 98% rename from osdep/poll_wrapper.c rename to osdep/unix/poll_wrapper.c index 44943929122bd..8c62e1097dec7 100644 --- a/osdep/poll_wrapper.c +++ b/osdep/unix/poll_wrapper.c @@ -22,7 +22,7 @@ #include "config.h" #include "poll_wrapper.h" -#include "timer.h" +#include int mp_poll(struct pollfd *fds, int nfds, int64_t timeout_ns) diff --git a/osdep/poll_wrapper.h b/osdep/unix/poll_wrapper.h similarity index 100% rename from osdep/poll_wrapper.h rename to osdep/unix/poll_wrapper.h diff --git a/osdep/subprocess-posix.c b/osdep/unix/subprocess.c similarity index 100% rename from osdep/subprocess-posix.c rename to osdep/unix/subprocess.c diff --git a/osdep/terminal-unix.c b/osdep/unix/terminal.c similarity index 99% rename from osdep/terminal-unix.c rename to osdep/unix/terminal.c index d31e1e753f3d7..12a5ea5295a51 100644 --- a/osdep/terminal-unix.c +++ b/osdep/unix/terminal.c @@ -31,14 +31,14 @@ #include "osdep/io.h" #include "osdep/threads.h" -#include "osdep/poll_wrapper.h" +#include "osdep/unix/poll_wrapper.h" +#include #include "common/common.h" #include "misc/bstr.h" #include "input/input.h" #include "input/keycodes.h" #include "misc/ctype.h" -#include "terminal.h" // Timeout in ms after which the (normally ambiguous) ESC key is detected. #define ESC_TIMEOUT 100 diff --git a/osdep/timer-linux.c b/osdep/unix/timer.c similarity index 98% rename from osdep/timer-linux.c rename to osdep/unix/timer.c index ff4b137cb227e..d80f25e6586b7 100644 --- a/osdep/timer-linux.c +++ b/osdep/unix/timer.c @@ -20,7 +20,8 @@ #include #include -#include "timer.h" + +#include void mp_sleep_ns(int64_t ns) { diff --git a/osdep/path-uwp.c b/osdep/uwp/path.c similarity index 100% rename from osdep/path-uwp.c rename to osdep/uwp/path.c diff --git a/osdep/win32-console-wrapper.c b/osdep/win32/console.c similarity index 100% rename from osdep/win32-console-wrapper.c rename to osdep/win32/console.c diff --git a/osdep/glob-win.c b/osdep/win32/glob.c similarity index 100% rename from osdep/glob-win.c rename to osdep/win32/glob.c diff --git a/osdep/w32_keyboard.c b/osdep/win32/keyboard.c similarity index 99% rename from osdep/w32_keyboard.c rename to osdep/win32/keyboard.c index 6eaa99c1208ee..2ef2cf0a996a5 100644 --- a/osdep/w32_keyboard.c +++ b/osdep/win32/keyboard.c @@ -16,7 +16,7 @@ */ #include -#include "osdep/w32_keyboard.h" +#include "keyboard.h" #include "input/keycodes.h" struct keymap { diff --git a/osdep/w32_keyboard.h b/osdep/win32/keyboard.h similarity index 100% rename from osdep/w32_keyboard.h rename to osdep/win32/keyboard.h diff --git a/osdep/language-win.c b/osdep/win32/language.c similarity index 100% rename from osdep/language-win.c rename to osdep/win32/language.c diff --git a/osdep/main-fn-win.c b/osdep/win32/main-fn.c similarity index 100% rename from osdep/main-fn-win.c rename to osdep/win32/main-fn.c diff --git a/osdep/win32/meson.build b/osdep/win32/meson.build new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/osdep/mpv.exe.manifest b/osdep/win32/mpv.exe.manifest similarity index 100% rename from osdep/mpv.exe.manifest rename to osdep/win32/mpv.exe.manifest diff --git a/osdep/mpv.rc b/osdep/win32/mpv.rc similarity index 100% rename from osdep/mpv.rc rename to osdep/win32/mpv.rc diff --git a/osdep/path-win.c b/osdep/win32/path.c similarity index 100% rename from osdep/path-win.c rename to osdep/win32/path.c diff --git a/osdep/subprocess-win.c b/osdep/win32/subprocess.c similarity index 99% rename from osdep/subprocess-win.c rename to osdep/win32/subprocess.c index bb3527eaa6426..923b79be41f93 100644 --- a/osdep/subprocess-win.c +++ b/osdep/win32/subprocess.c @@ -21,7 +21,7 @@ #include "osdep/subprocess.h" #include "osdep/io.h" -#include "osdep/windows_utils.h" +#include #include "mpv_talloc.h" #include "common/common.h" diff --git a/osdep/terminal-win.c b/osdep/win32/terminal.c similarity index 99% rename from osdep/terminal-win.c rename to osdep/win32/terminal.c index 4e88f29679ca8..e5cfcff0eb71f 100644 --- a/osdep/terminal-win.c +++ b/osdep/win32/terminal.c @@ -29,10 +29,10 @@ #include "common/common.h" #include "input/keycodes.h" #include "input/input.h" -#include "terminal.h" +#include "osdep/terminal.h" #include "osdep/io.h" #include "osdep/threads.h" -#include "osdep/w32_keyboard.h" +#include // https://docs.microsoft.com/en-us/windows/console/setconsolemode // These values are effective on Windows 10 build 16257 (August 2017) or later diff --git a/osdep/timer-win32.c b/osdep/win32/timer.c similarity index 99% rename from osdep/timer-win32.c rename to osdep/win32/timer.c index 7867b5a5251dd..7b60c8a0716dc 100644 --- a/osdep/timer-win32.c +++ b/osdep/win32/timer.c @@ -21,7 +21,7 @@ #include #include -#include "timer.h" +#include #include "config.h" diff --git a/osdep/windows_utils.c b/osdep/win32/utils.c similarity index 99% rename from osdep/windows_utils.c rename to osdep/win32/utils.c index 8cedf939e23d2..6e0076730651f 100644 --- a/osdep/windows_utils.c +++ b/osdep/win32/utils.c @@ -26,7 +26,7 @@ #include #include "common/common.h" -#include "windows_utils.h" +#include "utils.h" char *mp_GUID_to_str_buf(char *buf, size_t buf_size, const GUID *guid) { diff --git a/osdep/windows_utils.h b/osdep/win32/utils.h similarity index 100% rename from osdep/windows_utils.h rename to osdep/win32/utils.h diff --git a/player/main.c b/player/main.c index cd84026730ddf..fa47e25a6df84 100644 --- a/player/main.c +++ b/player/main.c @@ -71,7 +71,7 @@ static const char def_config[] = ; #if HAVE_COCOA -#include "osdep/macosx_events.h" +#include #endif #ifndef FULLCONFIG diff --git a/player/meson.build b/player/meson.build index dc334b8c963ee..12ab19a75743b 100644 --- a/player/meson.build +++ b/player/meson.build @@ -4,7 +4,7 @@ subdir('lua') # Meson doesn't allow having multiple build targets with the same name in the same file. # Just generate the com in here for windows builds. if win32 and get_option('cplayer') - wrapper_sources= '../osdep/win32-console-wrapper.c' + wrapper_sources= '../osdep/win32/console.c' executable('mpv', wrapper_sources, c_args: '-municode', link_args: '-municode', name_suffix: 'com', install: true) endif diff --git a/test/meson.build b/test/meson.build index a2b8ce496c893..30fe2ead56e1c 100644 --- a/test/meson.build +++ b/test/meson.build @@ -40,7 +40,7 @@ test_utils_deps = [libavutil, libm] if features['win32-internal-pthreads'] test_utils_args += '-DWIN32_TESTS' test_utils_files += ['osdep/win32/pthread.c', - 'osdep/windows_utils.c'] + 'osdep/win32/utils.c'] else test_utils_deps += pthreads endif diff --git a/video/d3d.c b/video/d3d.c index dfb999b8548ef..2702138408e7d 100644 --- a/video/d3d.c +++ b/video/d3d.c @@ -34,7 +34,7 @@ #include "video/hwdec.h" #include "video/mp_image.h" #include "video/mp_image_pool.h" -#include "osdep/windows_utils.h" +#include #include "d3d.h" diff --git a/video/filter/vf_d3d11vpp.c b/video/filter/vf_d3d11vpp.c index 3f00c5aa4dca9..f4f167cf13963 100644 --- a/video/filter/vf_d3d11vpp.c +++ b/video/filter/vf_d3d11vpp.c @@ -24,7 +24,7 @@ #include "common/common.h" #include "osdep/timer.h" -#include "osdep/windows_utils.h" +#include #include "filters/f_autoconvert.h" #include "filters/filter.h" #include "filters/filter_internal.h" diff --git a/video/out/cocoa/events_view.m b/video/out/cocoa/events_view.m index 2cfe3f2fda629..e26b926b7394b 100644 --- a/video/out/cocoa/events_view.m +++ b/video/out/cocoa/events_view.m @@ -18,7 +18,7 @@ #include "input/input.h" #include "input/keycodes.h" -#include "osdep/macosx_compat.h" +#include #include "video/out/cocoa_common.h" #include "events_view.h" diff --git a/video/out/cocoa/video_view.m b/video/out/cocoa/video_view.m index c0457d2a95ea9..6581bdbb9d870 100644 --- a/video/out/cocoa/video_view.m +++ b/video/out/cocoa/video_view.m @@ -15,7 +15,7 @@ * License along with mpv. If not, see . */ -#include "osdep/macosx_compat.h" +#include #include "video/out/cocoa_common.h" #include "video_view.h" diff --git a/video/out/cocoa/window.m b/video/out/cocoa/window.m index 011d8e422766d..08393aaed557f 100644 --- a/video/out/cocoa/window.m +++ b/video/out/cocoa/window.m @@ -19,8 +19,8 @@ #include "input/keycodes.h" -#include "osdep/macosx_events.h" -#include "osdep/macosx_compat.h" +#include +#include #include "video/out/cocoa_common.h" #include "window.h" diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index d670a7c1c3edf..7a25f6e7f669b 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -32,12 +32,12 @@ #import "video/out/cocoa/mpvadapter.h" #include "osdep/threads.h" -#include "osdep/macosx_compat.h" -#include "osdep/macosx_events_objc.h" +#include +#include #include "osdep/timer.h" -#include "osdep/macosx_application.h" -#include "osdep/macosx_application_objc.h" +#include "application.h" +#include "application_objc.h" #include "options/options.h" #include "video/out/vo.h" diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c index 05f04fdb6b082..ea6bbc7b5899e 100644 --- a/video/out/d3d11/context.c +++ b/video/out/d3d11/context.c @@ -18,7 +18,7 @@ #include "common/msg.h" #include "options/m_config.h" #include "osdep/timer.h" -#include "osdep/windows_utils.h" +#include #include "video/out/gpu/context.h" #include "video/out/gpu/d3d11_helpers.h" diff --git a/video/out/d3d11/hwdec_d3d11va.c b/video/out/d3d11/hwdec_d3d11va.c index 6aaa12bc66a5a..ba4ec7f1c33a2 100644 --- a/video/out/d3d11/hwdec_d3d11va.c +++ b/video/out/d3d11/hwdec_d3d11va.c @@ -21,7 +21,7 @@ #include "common/common.h" #include "options/m_config.h" -#include "osdep/windows_utils.h" +#include #include "video/hwdec.h" #include "video/d3d.h" #include "video/out/d3d11/ra_d3d11.h" diff --git a/video/out/d3d11/hwdec_dxva2dxgi.c b/video/out/d3d11/hwdec_dxva2dxgi.c index 62158d467b453..33dfceca267e3 100644 --- a/video/out/d3d11/hwdec_dxva2dxgi.c +++ b/video/out/d3d11/hwdec_dxva2dxgi.c @@ -21,7 +21,7 @@ #include #include "common/common.h" -#include "osdep/windows_utils.h" +#include #include "video/hwdec.h" #include "video/d3d.h" #include "video/out/d3d11/ra_d3d11.h" diff --git a/video/out/d3d11/ra_d3d11.c b/video/out/d3d11/ra_d3d11.c index e2a2b633b6c78..a5d0b29215d8a 100644 --- a/video/out/d3d11/ra_d3d11.c +++ b/video/out/d3d11/ra_d3d11.c @@ -10,7 +10,7 @@ #include "osdep/io.h" #include "osdep/subprocess.h" #include "osdep/timer.h" -#include "osdep/windows_utils.h" +#include #include "video/out/gpu/spirv.h" #include "video/out/gpu/utils.h" diff --git a/video/out/drm_common.c b/video/out/drm_common.c index d3cb58e8a60cb..2535012857dae 100644 --- a/video/out/drm_common.c +++ b/video/out/drm_common.c @@ -42,7 +42,7 @@ #include "common/msg.h" #include "options/m_config.h" #include "osdep/io.h" -#include "osdep/poll_wrapper.h" +#include "osdep/unix/poll_wrapper.h" #include "osdep/timer.h" #include "misc/ctype.h" #include "video/out/vo.h" @@ -431,7 +431,7 @@ void vo_drm_release_crtc(struct vo_drm_state *drm) if (request) drmModeAtomicFree(request); - + if (!success) MP_ERR(drm, "Failed to restore previous mode\n"); diff --git a/video/out/gpu/d3d11_helpers.c b/video/out/gpu/d3d11_helpers.c index b3e524056e516..2df310d71aa13 100644 --- a/video/out/gpu/d3d11_helpers.c +++ b/video/out/gpu/d3d11_helpers.c @@ -25,7 +25,7 @@ #include "common/msg.h" #include "misc/bstr.h" #include "osdep/io.h" -#include "osdep/windows_utils.h" +#include #include "d3d11_helpers.h" diff --git a/video/out/gpu_next/context.c b/video/out/gpu_next/context.c index 2887cff938f78..f7b2545078031 100644 --- a/video/out/gpu_next/context.c +++ b/video/out/gpu_next/context.c @@ -33,7 +33,7 @@ #include "video/out/gpu/video.h" #if HAVE_D3D11 -#include "osdep/windows_utils.h" +#include #include "video/out/d3d11/ra_d3d11.h" #include "video/out/d3d11/context.h" #endif diff --git a/video/out/opengl/context_angle.c b/video/out/opengl/context_angle.c index 553718af24fa3..37c22dcd44b97 100644 --- a/video/out/opengl/context_angle.c +++ b/video/out/opengl/context_angle.c @@ -30,7 +30,7 @@ #include "common/common.h" #include "options/m_config.h" #include "video/out/w32_common.h" -#include "osdep/windows_utils.h" +#include #include "context.h" #include "utils.h" diff --git a/video/out/opengl/context_cocoa.c b/video/out/opengl/context_cocoa.c index ec8ec27458def..9f5aa888e9b24 100644 --- a/video/out/opengl/context_cocoa.c +++ b/video/out/opengl/context_cocoa.c @@ -20,7 +20,7 @@ #include "options/m_config.h" #include "video/out/cocoa_common.h" #include "context.h" -#include "osdep/macosx_application.h" +#include "application.h" struct priv { GL gl; diff --git a/video/out/opengl/context_dxinterop.c b/video/out/opengl/context_dxinterop.c index cda696f71ba44..086848058a42c 100644 --- a/video/out/opengl/context_dxinterop.c +++ b/video/out/opengl/context_dxinterop.c @@ -19,7 +19,7 @@ #include #include #include -#include "osdep/windows_utils.h" +#include #include "video/out/w32_common.h" #include "context.h" #include "utils.h" diff --git a/video/out/opengl/hwdec_d3d11egl.c b/video/out/opengl/hwdec_d3d11egl.c index c3120914ea2c1..26c58341cf0c7 100644 --- a/video/out/opengl/hwdec_d3d11egl.c +++ b/video/out/opengl/hwdec_d3d11egl.c @@ -26,7 +26,7 @@ #include "common/common.h" #include "osdep/timer.h" -#include "osdep/windows_utils.h" +#include #include "video/out/gpu/hwdec.h" #include "ra_gl.h" #include "video/hwdec.h" diff --git a/video/out/opengl/hwdec_dxva2egl.c b/video/out/opengl/hwdec_dxva2egl.c index 979ef59745790..6e69b718dac5a 100644 --- a/video/out/opengl/hwdec_dxva2egl.c +++ b/video/out/opengl/hwdec_dxva2egl.c @@ -26,7 +26,7 @@ #include "common/common.h" #include "osdep/timer.h" -#include "osdep/windows_utils.h" +#include #include "video/out/gpu/hwdec.h" #include "ra_gl.h" #include "video/hwdec.h" diff --git a/video/out/opengl/hwdec_dxva2gldx.c b/video/out/opengl/hwdec_dxva2gldx.c index 01728130d7182..2bbfab1db895b 100644 --- a/video/out/opengl/hwdec_dxva2gldx.c +++ b/video/out/opengl/hwdec_dxva2gldx.c @@ -19,7 +19,7 @@ #include #include "common/common.h" -#include "osdep/windows_utils.h" +#include #include "video/out/gpu/hwdec.h" #include "ra_gl.h" #include "video/hwdec.h" diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index e2436f64f1919..354b1d65cad03 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -50,7 +50,7 @@ #if HAVE_D3D11 && defined(PL_HAVE_D3D11) #include #include "video/out/d3d11/ra_d3d11.h" -#include "osdep/windows_utils.h" +#include #endif #if PL_API_VER >= 309 diff --git a/video/out/w32_common.c b/video/out/w32_common.c index f58149e3c9f13..c969999e92727 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -43,7 +43,7 @@ #include "win32/droptarget.h" #include "osdep/io.h" #include "osdep/threads.h" -#include "osdep/w32_keyboard.h" +#include #include "misc/dispatch.h" #include "misc/rendezvous.h" #include "mpv_talloc.h" diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index d5ab2fe1c9500..4cc72c77fa9ec 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -29,7 +29,7 @@ #include "input/keycodes.h" #include "options/m_config.h" #include "osdep/io.h" -#include "osdep/poll_wrapper.h" +#include "osdep/unix/poll_wrapper.h" #include "osdep/timer.h" #include "present_sync.h" #include "wayland_common.h" diff --git a/video/out/win32/droptarget.c b/video/out/win32/droptarget.c index 8a33522df0384..b2d544dbc12cd 100644 --- a/video/out/win32/droptarget.c +++ b/video/out/win32/droptarget.c @@ -25,7 +25,7 @@ #include "input/input.h" #include "input/event.h" #include "osdep/io.h" -#include "osdep/windows_utils.h" +#include #include "mpv_talloc.h" #include "droptarget.h" diff --git a/video/out/x11_common.c b/video/out/x11_common.c index f77f4c86f874d..750753835278a 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -55,7 +55,7 @@ #include "vo.h" #include "win_state.h" #include "osdep/io.h" -#include "osdep/poll_wrapper.h" +#include "osdep/unix/poll_wrapper.h" #include "osdep/timer.h" #include "osdep/subprocess.h"