mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-06-30 08:33:32 +00:00
mac-capture: Replace pragmas with availability markers
Also changes clang-format SeparateDefinitionBlocks to Leave on ObjC files, which avoid having an empty new line after API_AVAIABLE and the declaration.
This commit is contained in:
parent
c3c6c6c934
commit
7824e164b1
|
@ -181,7 +181,7 @@ ReferenceAlignment: Right
|
||||||
RemoveSemicolon: false
|
RemoveSemicolon: false
|
||||||
RequiresClausePosition: WithPreceding
|
RequiresClausePosition: WithPreceding
|
||||||
RequiresExpressionIndentation: OuterScope
|
RequiresExpressionIndentation: OuterScope
|
||||||
SeparateDefinitionBlocks: Always
|
SeparateDefinitionBlocks: Leave
|
||||||
ShortNamespaceLines: 1
|
ShortNamespaceLines: 1
|
||||||
SortIncludes: false
|
SortIncludes: false
|
||||||
#SortUsingDeclarations: LexicographicNumeric
|
#SortUsingDeclarations: LexicographicNumeric
|
||||||
|
|
|
@ -5,7 +5,7 @@ const char *sck_audio_capture_getname(void *unused __unused)
|
||||||
return obs_module_text("SCK.Audio.Name");
|
return obs_module_text("SCK.Audio.Name");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroy_audio_screen_stream(struct screen_capture *sc)
|
API_AVAILABLE(macos(13.0)) static void destroy_audio_screen_stream(struct screen_capture *sc)
|
||||||
{
|
{
|
||||||
if (sc->disp && !sc->capture_failed) {
|
if (sc->disp && !sc->capture_failed) {
|
||||||
[sc->disp stopCaptureWithCompletionHandler:^(NSError *_Nullable error) {
|
[sc->disp stopCaptureWithCompletionHandler:^(NSError *_Nullable error) {
|
||||||
|
@ -32,7 +32,7 @@ static void destroy_audio_screen_stream(struct screen_capture *sc)
|
||||||
os_event_destroy(sc->stream_start_completed);
|
os_event_destroy(sc->stream_start_completed);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sck_audio_capture_destroy(void *data)
|
API_AVAILABLE(macos(13.0)) static void sck_audio_capture_destroy(void *data)
|
||||||
{
|
{
|
||||||
struct screen_capture *sc = data;
|
struct screen_capture *sc = data;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ static void sck_audio_capture_destroy(void *data)
|
||||||
bfree(sc);
|
bfree(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool init_audio_screen_stream(struct screen_capture *sc)
|
API_AVAILABLE(macos(13.0)) static bool init_audio_screen_stream(struct screen_capture *sc)
|
||||||
{
|
{
|
||||||
SCContentFilter *content_filter;
|
SCContentFilter *content_filter;
|
||||||
if (sc->capture_failed) {
|
if (sc->capture_failed) {
|
||||||
|
@ -178,7 +178,7 @@ static void sck_audio_capture_defaults(obs_data_t *settings)
|
||||||
obs_data_set_default_int(settings, "type", ScreenCaptureAudioDesktopStream);
|
obs_data_set_default_int(settings, "type", ScreenCaptureAudioDesktopStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *sck_audio_capture_create(obs_data_t *settings, obs_source_t *source)
|
API_AVAILABLE(macos(13.0)) static void *sck_audio_capture_create(obs_data_t *settings, obs_source_t *source)
|
||||||
{
|
{
|
||||||
struct screen_capture *sc = bzalloc(sizeof(struct screen_capture));
|
struct screen_capture *sc = bzalloc(sizeof(struct screen_capture));
|
||||||
|
|
||||||
|
@ -209,6 +209,7 @@ fail:
|
||||||
|
|
||||||
#pragma mark - obs_properties
|
#pragma mark - obs_properties
|
||||||
|
|
||||||
|
API_AVAILABLE(macos(13.0))
|
||||||
static bool audio_capture_method_changed(void *data, obs_properties_t *props, obs_property_t *list __unused,
|
static bool audio_capture_method_changed(void *data, obs_properties_t *props, obs_property_t *list __unused,
|
||||||
obs_data_t *settings)
|
obs_data_t *settings)
|
||||||
{
|
{
|
||||||
|
@ -233,6 +234,7 @@ static bool audio_capture_method_changed(void *data, obs_properties_t *props, ob
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
API_AVAILABLE(macos(13.0))
|
||||||
static bool reactivate_capture(obs_properties_t *props __unused, obs_property_t *property, void *data)
|
static bool reactivate_capture(obs_properties_t *props __unused, obs_property_t *property, void *data)
|
||||||
{
|
{
|
||||||
struct screen_capture *sc = data;
|
struct screen_capture *sc = data;
|
||||||
|
@ -248,7 +250,7 @@ static bool reactivate_capture(obs_properties_t *props __unused, obs_property_t
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static obs_properties_t *sck_audio_capture_properties(void *data)
|
API_AVAILABLE(macos(13.0)) static obs_properties_t *sck_audio_capture_properties(void *data)
|
||||||
{
|
{
|
||||||
struct screen_capture *sc = data;
|
struct screen_capture *sc = data;
|
||||||
|
|
||||||
|
@ -284,7 +286,7 @@ static obs_properties_t *sck_audio_capture_properties(void *data)
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sck_audio_capture_update(void *data, obs_data_t *settings)
|
API_AVAILABLE(macos(13.0)) static void sck_audio_capture_update(void *data, obs_data_t *settings)
|
||||||
{
|
{
|
||||||
struct screen_capture *sc = data;
|
struct screen_capture *sc = data;
|
||||||
|
|
||||||
|
@ -300,6 +302,7 @@ static void sck_audio_capture_update(void *data, obs_data_t *settings)
|
||||||
|
|
||||||
#pragma mark - obs_source_info
|
#pragma mark - obs_source_info
|
||||||
|
|
||||||
|
API_AVAILABLE(macos(13.0))
|
||||||
struct obs_source_info sck_audio_capture_info = {
|
struct obs_source_info sck_audio_capture_info = {
|
||||||
.id = "sck_audio_capture",
|
.id = "sck_audio_capture",
|
||||||
.type = OBS_SOURCE_TYPE_INPUT,
|
.type = OBS_SOURCE_TYPE_INPUT,
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
#include <AvailabilityMacros.h>
|
#include <AvailabilityMacros.h>
|
||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <obs-module.h>
|
#include <obs-module.h>
|
||||||
#include <util/threading.h>
|
#include <util/threading.h>
|
||||||
|
@ -28,15 +25,16 @@ typedef enum {
|
||||||
ScreenCaptureAudioApplicationStream = 1,
|
ScreenCaptureAudioApplicationStream = 1,
|
||||||
} ScreenCaptureAudioStreamType;
|
} ScreenCaptureAudioStreamType;
|
||||||
|
|
||||||
typedef SCDisplay *SCDisplayRef;
|
API_AVAILABLE(macos(12.5)) typedef SCDisplay *SCDisplayRef;
|
||||||
|
|
||||||
|
API_AVAILABLE(macos(12.5))
|
||||||
@interface ScreenCaptureDelegate : NSObject <SCStreamOutput, SCStreamDelegate>
|
@interface ScreenCaptureDelegate : NSObject <SCStreamOutput, SCStreamDelegate>
|
||||||
|
|
||||||
@property struct screen_capture *sc;
|
@property struct screen_capture *sc;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
struct screen_capture {
|
struct API_AVAILABLE(macos(12.5)) screen_capture {
|
||||||
obs_source_t *source;
|
obs_source_t *source;
|
||||||
|
|
||||||
gs_effect_t *effect;
|
gs_effect_t *effect;
|
||||||
|
@ -71,18 +69,16 @@ struct screen_capture {
|
||||||
|
|
||||||
bool is_screen_capture_available(void);
|
bool is_screen_capture_available(void);
|
||||||
|
|
||||||
void screen_capture_build_content_list(struct screen_capture *sc, bool display_capture);
|
API_AVAILABLE(macos(12.5)) void screen_capture_build_content_list(struct screen_capture *sc, bool display_capture);
|
||||||
|
|
||||||
bool build_display_list(struct screen_capture *sc, obs_properties_t *props);
|
API_AVAILABLE(macos(12.5)) bool build_display_list(struct screen_capture *sc, obs_properties_t *props);
|
||||||
|
|
||||||
bool build_window_list(struct screen_capture *sc, obs_properties_t *props);
|
API_AVAILABLE(macos(12.5)) bool build_window_list(struct screen_capture *sc, obs_properties_t *props);
|
||||||
|
|
||||||
bool build_application_list(struct screen_capture *sc, obs_properties_t *props);
|
API_AVAILABLE(macos(12.5)) bool build_application_list(struct screen_capture *sc, obs_properties_t *props);
|
||||||
|
|
||||||
static const char *screen_capture_getname(void *unused __unused);
|
static const char *screen_capture_getname(void *unused __unused);
|
||||||
|
|
||||||
void screen_stream_video_update(struct screen_capture *sc, CMSampleBufferRef sample_buffer);
|
API_AVAILABLE(macos(12.5)) void screen_stream_video_update(struct screen_capture *sc, CMSampleBufferRef sample_buffer);
|
||||||
|
|
||||||
void screen_stream_audio_update(struct screen_capture *sc, CMSampleBufferRef sample_buffer);
|
API_AVAILABLE(macos(12.5)) void screen_stream_audio_update(struct screen_capture *sc, CMSampleBufferRef sample_buffer);
|
||||||
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ bool build_application_list(struct screen_capture *sc, obs_properties_t *props)
|
||||||
|
|
||||||
#pragma mark - audio/video
|
#pragma mark - audio/video
|
||||||
|
|
||||||
void screen_stream_video_update(struct screen_capture *sc, CMSampleBufferRef sample_buffer)
|
API_AVAILABLE(macos(12.5)) void screen_stream_video_update(struct screen_capture *sc, CMSampleBufferRef sample_buffer)
|
||||||
{
|
{
|
||||||
bool frame_detail_errored = false;
|
bool frame_detail_errored = false;
|
||||||
float scale_factor = 1.0f;
|
float scale_factor = 1.0f;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "mac-sck-common.h"
|
#include "mac-sck-common.h"
|
||||||
#include "window-utils.h"
|
#include "window-utils.h"
|
||||||
|
|
||||||
static void destroy_screen_stream(struct screen_capture *sc)
|
API_AVAILABLE(macos(12.5)) static void destroy_screen_stream(struct screen_capture *sc)
|
||||||
{
|
{
|
||||||
if (sc->disp && !sc->capture_failed) {
|
if (sc->disp && !sc->capture_failed) {
|
||||||
[sc->disp stopCaptureWithCompletionHandler:^(NSError *_Nullable error) {
|
[sc->disp stopCaptureWithCompletionHandler:^(NSError *_Nullable error) {
|
||||||
|
@ -45,7 +45,7 @@ static void destroy_screen_stream(struct screen_capture *sc)
|
||||||
os_event_destroy(sc->stream_start_completed);
|
os_event_destroy(sc->stream_start_completed);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sck_video_capture_destroy(void *data)
|
API_AVAILABLE(macos(12.5)) static void sck_video_capture_destroy(void *data)
|
||||||
{
|
{
|
||||||
struct screen_capture *sc = data;
|
struct screen_capture *sc = data;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ static void sck_video_capture_destroy(void *data)
|
||||||
bfree(sc);
|
bfree(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool init_screen_stream(struct screen_capture *sc)
|
API_AVAILABLE(macos(12.5)) static bool init_screen_stream(struct screen_capture *sc)
|
||||||
{
|
{
|
||||||
SCContentFilter *content_filter;
|
SCContentFilter *content_filter;
|
||||||
if (sc->capture_failed) {
|
if (sc->capture_failed) {
|
||||||
|
@ -270,7 +270,7 @@ static bool init_screen_stream(struct screen_capture *sc)
|
||||||
return did_stream_start;
|
return did_stream_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *sck_video_capture_create(obs_data_t *settings, obs_source_t *source)
|
API_AVAILABLE(macos(12.5)) static void *sck_video_capture_create(obs_data_t *settings, obs_source_t *source)
|
||||||
{
|
{
|
||||||
struct screen_capture *sc = bzalloc(sizeof(struct screen_capture));
|
struct screen_capture *sc = bzalloc(sizeof(struct screen_capture));
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ fail:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sck_video_capture_tick(void *data, float seconds __unused)
|
API_AVAILABLE(macos(12.5)) static void sck_video_capture_tick(void *data, float seconds __unused)
|
||||||
{
|
{
|
||||||
struct screen_capture *sc = data;
|
struct screen_capture *sc = data;
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ static void sck_video_capture_tick(void *data, float seconds __unused)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sck_video_capture_render(void *data, gs_effect_t *effect __unused)
|
API_AVAILABLE(macos(12.5)) static void sck_video_capture_render(void *data, gs_effect_t *effect __unused)
|
||||||
{
|
{
|
||||||
struct screen_capture *sc = data;
|
struct screen_capture *sc = data;
|
||||||
|
|
||||||
|
@ -368,14 +368,14 @@ static const char *sck_video_capture_getname(void *unused __unused)
|
||||||
return obs_module_text("SCK.Name.Beta");
|
return obs_module_text("SCK.Name.Beta");
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t sck_video_capture_getwidth(void *data)
|
API_AVAILABLE(macos(12.5)) static uint32_t sck_video_capture_getwidth(void *data)
|
||||||
{
|
{
|
||||||
struct screen_capture *sc = data;
|
struct screen_capture *sc = data;
|
||||||
|
|
||||||
return (uint32_t) sc->frame.size.width;
|
return (uint32_t) sc->frame.size.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t sck_video_capture_getheight(void *data)
|
API_AVAILABLE(macos(12.5)) static uint32_t sck_video_capture_getheight(void *data)
|
||||||
{
|
{
|
||||||
struct screen_capture *sc = data;
|
struct screen_capture *sc = data;
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ static void sck_video_capture_defaults(obs_data_t *settings)
|
||||||
obs_data_set_default_bool(settings, "show_hidden_windows", false);
|
obs_data_set_default_bool(settings, "show_hidden_windows", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sck_video_capture_update(void *data, obs_data_t *settings)
|
API_AVAILABLE(macos(12.5)) static void sck_video_capture_update(void *data, obs_data_t *settings)
|
||||||
{
|
{
|
||||||
struct screen_capture *sc = data;
|
struct screen_capture *sc = data;
|
||||||
|
|
||||||
|
@ -472,6 +472,7 @@ static void sck_video_capture_update(void *data, obs_data_t *settings)
|
||||||
|
|
||||||
#pragma mark - obs_properties
|
#pragma mark - obs_properties
|
||||||
|
|
||||||
|
API_AVAILABLE(macos(12.5))
|
||||||
static bool content_settings_changed(void *data, obs_properties_t *props, obs_property_t *list __unused,
|
static bool content_settings_changed(void *data, obs_properties_t *props, obs_property_t *list __unused,
|
||||||
obs_data_t *settings)
|
obs_data_t *settings)
|
||||||
{
|
{
|
||||||
|
@ -543,6 +544,7 @@ static bool content_settings_changed(void *data, obs_properties_t *props, obs_pr
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
API_AVAILABLE(macos(12.5))
|
||||||
static bool reactivate_capture(obs_properties_t *props __unused, obs_property_t *property, void *data)
|
static bool reactivate_capture(obs_properties_t *props __unused, obs_property_t *property, void *data)
|
||||||
{
|
{
|
||||||
struct screen_capture *sc = data;
|
struct screen_capture *sc = data;
|
||||||
|
@ -560,7 +562,7 @@ static bool reactivate_capture(obs_properties_t *props __unused, obs_property_t
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static obs_properties_t *sck_video_capture_properties(void *data)
|
API_AVAILABLE(macos(12.5)) static obs_properties_t *sck_video_capture_properties(void *data)
|
||||||
{
|
{
|
||||||
struct screen_capture *sc = data;
|
struct screen_capture *sc = data;
|
||||||
|
|
||||||
|
@ -693,6 +695,7 @@ enum gs_color_space sck_video_capture_get_color_space(void *data, size_t count,
|
||||||
|
|
||||||
#pragma mark - obs_source_info
|
#pragma mark - obs_source_info
|
||||||
|
|
||||||
|
API_AVAILABLE(macos(12.5))
|
||||||
struct obs_source_info sck_video_capture_info = {
|
struct obs_source_info sck_video_capture_info = {
|
||||||
.id = "screen_capture",
|
.id = "screen_capture",
|
||||||
.type = OBS_SOURCE_TYPE_INPUT,
|
.type = OBS_SOURCE_TYPE_INPUT,
|
||||||
|
|
Loading…
Reference in a new issue