ui/cocoa: capture screencast with AVAssetWriter
PATCH 1/1 ui/cocoa: capture screencast with AVAssetWriter
To record screencast, AVAssetWriter APIs were called for each cocoa_update call.
Commands for start/stop recording were added to View menu.
AVFoundation, CoreMedia and CoreVideo were added as linking dependencies.
--- meson.build | 6 +++ ui/cocoa.m | 132 +++++++++++++++++++++++++++++++++++++++++++++++-- ui/meson.build | 1 + 3 files changed, 136 insertions(+), 3 deletions(-)
meson.build +6 -0
@@ -281,6 +281,9 @@ emulator_link_args = [] nvmm =not_found hvf = not_found host_dsosuf = '.so' +avfoundation = [] +coremedia = [] +corevideo = [] if targetos == 'windows' socket = cc.find_library('ws2_32') winmm = cc.find_library('winmm')
@@ -292,6 +295,9 @@ if targetos == 'windows' host_dsosuf = '.dll' elif targetos == 'darwin' coref = dependency('appleframeworks', modules: 'CoreFoundation') + avfoundation = dependency('appleframeworks', modules: 'AVFoundation') + coremedia = dependency('appleframeworks', modules: 'CoreMedia') + corevideo = dependency('appleframeworks', modules: 'CoreVideo') iokit = dependency('appleframeworks', modules: 'IOKit', required: false) host_dsosuf = '.dylib' elif targetos == 'sunos'
ui/cocoa.m +129 -3
213 lines not on this page · raw message
ui/meson.build +1 -0
@@ -25,6 +25,7 @@ softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files( 'udmabuf.c', )) softmmu_ss.add(when: cocoa, if_true: files('cocoa.m')) +softmmu_ss.add(when: avfoundation, if_true: [avfoundation, coremedia, corevideo]) vnc_ss = ss.source_set() vnc_ss.add(files(
Signature · 1 line
2.30.2
Quoted 5 lines · Zhang Chen
To record screencast, AVAssetWriter APIs were called for each
cocoa_updatecall.Commands for start/stop recording were added to View menu.
This seems a bit of an odd feature -- why doesn't the OS just permit screen recording of any application without the app having to have code for it specifically ?
-- PMM
Granted that this patch might not fit for main branch, I hope this snippet could help someone in need.
Screen cast feature shipped with macOS does support screen recording, but only for whole screen or selected rectangle, not for a selected window like photo capture feature.
And pixels are not sourced from qemu display frame buffer. This means the screencast would be scaled by contentsScale (for retina screen) and window titlebar would be included.
Best Regards
Quoted 14 lines
2022年1月11日 下午4:31,Peter Maydell <[email protected]> 写道:
Quoted 5 lines · Zhang Chen
To record screencast, AVAssetWriter APIs were called for each
cocoa_updatecall.Commands for start/stop recording were added to View menu.
This seems a bit of an odd feature -- why doesn't the OS just permit screen recording of any application without the app having to have code for it specifically ?
-- PMM