Skip to content

Commit

Permalink
win32: add Media Control support
Browse files Browse the repository at this point in the history
Add support for SystemMediaTransportControls interface. This allows to
control mpv from Windows media control ui.
  • Loading branch information
kasper93 committed Jun 11, 2024
1 parent 9b0e3b3 commit 4f96afb
Show file tree
Hide file tree
Showing 6 changed files with 444 additions and 1 deletion.
8 changes: 7 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ project('mpv',
'buildtype=debugoptimized',
'b_lundef=false',
'c_std=c11',
'cpp_std=c++20',
'cpp_eh=default',
'warning_level=2',
]
)
Expand Down Expand Up @@ -383,7 +385,7 @@ if get_option('fuzzers')
link_flags += ['-fsanitize=address,undefined,fuzzer', '-fno-omit-frame-pointer']
endif

add_project_arguments(flags, language: 'c')
add_project_arguments(flags, language: ['c', 'cpp', 'objc'])
add_project_arguments(['-Wno-unused-parameter'], language: 'objc')
add_project_link_arguments(link_flags, language: ['c', 'cpp', 'objc'])

Expand Down Expand Up @@ -524,6 +526,10 @@ if not posix and not features['win32-desktop']
'osdep/terminal-dummy.c')
endif

if win32
subdir('osdep/win32')
endif

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

features += {'glob-win32': win32 and not features['glob-posix']}
Expand Down
3 changes: 3 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ option('macos-touchbar', type: 'feature', value: 'auto', description: 'macOS Tou
option('swift-build', type: 'feature', value: 'auto', description: 'macOS Swift build tools')
option('swift-flags', type: 'string', description: 'Optional Swift compiler flags')

# Windows features
option('win32-smtc', type: 'feature', value: 'auto', description: 'Enable Media Control support')

# manpages
option('html-build', type: 'feature', value: 'disabled', description: 'HTML manual generation')
option('manpage-build', type: 'feature', value: 'auto', description: 'manpage generation')
Expand Down
9 changes: 9 additions & 0 deletions osdep/win32/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
add_languages('cpp')
cpp = meson.get_compiler('cpp')

smtc = cpp.has_header('winrt/base.h', required: get_option('win32-smtc'))
features += {'smtc': smtc}
if features['smtc']
dependencies += cpp.find_library('runtimeobject')
sources += meson.current_source_dir() / 'smtc.cc'
endif
Loading

0 comments on commit 4f96afb

Please sign in to comment.