Skip to content

Commit

Permalink
osdep: organize files per platform and remove suffixes/postfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 committed Oct 26, 2023
1 parent 2d36e9b commit 5dff147
Show file tree
Hide file tree
Showing 92 changed files with 179 additions and 218 deletions.
2 changes: 1 addition & 1 deletion audio/out/ao_coreaudio_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "audio/out/ao_coreaudio_utils.h"
#include "osdep/timer.h"
#include "osdep/endian.h"
#include "osdep/semaphore.h"
#include <osdep/darwin/semaphore.h>
#include "audio/format.h"

#if HAVE_COREAUDIO
Expand Down
2 changes: 1 addition & 1 deletion audio/out/ao_coreaudio_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "common/msg.h"
#include "audio/out/ao.h"
#include "internal.h"
#include "osdep/apple_utils.h"
#include <osdep/darwin/utils.h>

bool check_ca_st(struct ao *ao, int level, OSStatus code, const char *message);

Expand Down
2 changes: 1 addition & 1 deletion audio/out/ao_wasapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <endpointvolume.h>

#include "common/msg.h"
#include "osdep/windows_utils.h"
#include <osdep/win32/utils.h>
#include "internal.h"
#include "ao.h"

Expand Down
2 changes: 1 addition & 1 deletion input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#include "common/common.h"

#if HAVE_COCOA
#include "osdep/macosx_events.h"
#include <osdep/darwin/events.h>
#endif

#define input_lock(ictx) pthread_mutex_lock(&ictx->mutex)
Expand Down
2 changes: 1 addition & 1 deletion input/ipc-win.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "osdep/io.h"
#include "osdep/threads.h"
#include "osdep/windows_utils.h"
#include <osdep/win32/utils.h>

#include "common/common.h"
#include "common/global.h"
Expand Down
79 changes: 39 additions & 40 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -395,40 +395,40 @@ 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',
'video/out/cocoa/window.m')
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',
Expand Down Expand Up @@ -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()}
Expand All @@ -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')
Expand All @@ -519,12 +519,12 @@ endif

features += {'glob-posix': cc.has_function('glob', prefix: '#include <glob.h>')}

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')}

Expand Down Expand Up @@ -589,7 +589,6 @@ if darwin
subdir(join_paths('TOOLS', 'osxbundle'))
endif


# misc dependencies
features += {'av-channel-layout': libavutil.version().version_compare('>= 57.24.100')}
if features['av-channel-layout']
Expand Down Expand Up @@ -1530,12 +1529,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',
Expand Down Expand Up @@ -1563,7 +1562,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
Expand All @@ -1576,7 +1575,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


Expand Down Expand Up @@ -1703,9 +1702,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

Expand Down
2 changes: 1 addition & 1 deletion osdep/macosx_application.h → osdep/darwin/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 5 additions & 6 deletions osdep/macosx_application.m → osdep/darwin/application.m
Original file line number Diff line number Diff line change
Expand Up @@ -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://"
Expand Down Expand Up @@ -377,4 +377,3 @@ int cocoa_main(int argc, char *argv[])
return 1;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/

#import <Cocoa/Cocoa.h>
#include "osdep/macosx_application.h"
#import "osdep/macosx_menubar_objc.h"
#include "application.h"
#import "menubar_objc.h"

@class CocoaCB;
struct mpv_event;
Expand Down
2 changes: 1 addition & 1 deletion osdep/macosx_compat.h → osdep/darwin/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define MPV_MACOSX_COMPAT

#import <Cocoa/Cocoa.h>
#include "osdep/macosx_versions.h"
#include "versions.h"

#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12)

Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions osdep/macosx_events.m → osdep/darwin/events.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
2 changes: 1 addition & 1 deletion osdep/macosx_events_objc.h → osdep/darwin/events_objc.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

#import <Cocoa/Cocoa.h>
#include "osdep/macosx_events.h"
#include "events.h"

@class RemoteCommandCenter;
struct input_ctx;
Expand Down
2 changes: 1 addition & 1 deletion osdep/language-apple.c → osdep/darwin/language.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion osdep/main-fn-cocoa.c → osdep/darwin/main-fn.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions osdep/macosx_menubar.m → osdep/darwin/menubar.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

#import <Cocoa/Cocoa.h>
#include "osdep/macosx_menubar.h"
#include "menubar.h"

@interface MenuBar : NSObject

Expand Down
Loading

0 comments on commit 5dff147

Please sign in to comment.