From 01479aca32f8b35f8550aa28bfcea125aa8cb9f9 Mon Sep 17 00:00:00 2001 From: Zakk Date: Sun, 12 Apr 2020 15:33:41 -0400 Subject: [PATCH] Add Start/Stop recording scripting event. Don't call queue err_send function in ffmpeg closeMedia, let the consumer loop do that --- CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegInput.m | 4 ++-- CSNotifications.m | 3 ++- CocoaSplit/CaptureController.m | 4 ++++ CocoaSplit/PluginHeaders/CSNotifications.h | 2 ++ .../AppDelegate+AppDelegate_ScriptingAdditions.m | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegInput.m b/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegInput.m index 7fc7a09a..245aa57e 100644 --- a/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegInput.m +++ b/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegInput.m @@ -708,8 +708,8 @@ -(void)closeMedia _is_ready = NO; dispatch_semaphore_signal(_read_loop_semaphore); - av_thread_message_queue_set_err_send(_video_message_queue, AVERROR_EOF); - av_thread_message_queue_set_err_send(_audio_message_queue, AVERROR_EOF); + //av_thread_message_queue_set_err_send(_video_message_queue, AVERROR_EOF); + //mkav_thread_message_queue_set_err_send(_audio_message_queue, AVERROR_EOF); } } diff --git a/CSNotifications.m b/CSNotifications.m index ef86f148..fc24bb5b 100644 --- a/CSNotifications.m +++ b/CSNotifications.m @@ -21,7 +21,8 @@ NSString *const CSNotificationStreamStarted = @"CSNotificationStreamStarted"; NSString *const CSNotificationStreamStopped = @"CSNotificationStreamStopped"; - +NSString *const CSNotificationMainRecordingStarted = @"CSNotificationMainRecordingStarted"; +NSString *const CSNotificationMainRecordingStopped = @"CSNotificationMainRecordingStopped"; NSString *const CSNotificationOutputAdded = @"CSNotificationOutputAdded"; NSString *const CSNotificationOutputDeleted = @"CSNotificationOutputDeleted"; diff --git a/CocoaSplit/CaptureController.m b/CocoaSplit/CaptureController.m index c4ce10a5..0a00f588 100644 --- a/CocoaSplit/CaptureController.m +++ b/CocoaSplit/CaptureController.m @@ -3497,8 +3497,12 @@ -(void)setMainRecordingActive:(bool)mainRecordingActive if (mainRecordingActive) { tmpColor = CGColorCreateGenericRGB(1, 0, 0, 1); + [self postNotification:CSNotificationMainRecordingStarted forObject:self]; + } else { tmpColor = CGColorCreateGenericRGB(1, 0, 0, 0.5); + [self postNotification:CSNotificationMainRecordingStopped forObject:self]; + } self.recordButton.layer.backgroundColor = tmpColor; diff --git a/CocoaSplit/PluginHeaders/CSNotifications.h b/CocoaSplit/PluginHeaders/CSNotifications.h index c928c0d3..6bb2940b 100644 --- a/CocoaSplit/PluginHeaders/CSNotifications.h +++ b/CocoaSplit/PluginHeaders/CSNotifications.h @@ -21,6 +21,8 @@ extern NSString *const CSNotificationLayoutInStagingChanged; extern NSString *const CSNotificationStreamStarted; extern NSString *const CSNotificationStreamStopped; +extern NSString *const CSNotificationMainRecordingStarted; +extern NSString *const CSNotificationMainRecordingStopped; extern NSString *const CSNotificationOutputAdded; extern NSString *const CSNotificationOutputDeleted; diff --git a/CocoaSplit/ScriptingAddditions/AppDelegate+AppDelegate_ScriptingAdditions.m b/CocoaSplit/ScriptingAddditions/AppDelegate+AppDelegate_ScriptingAdditions.m index 8822ac0d..9dbc72d7 100644 --- a/CocoaSplit/ScriptingAddditions/AppDelegate+AppDelegate_ScriptingAdditions.m +++ b/CocoaSplit/ScriptingAddditions/AppDelegate+AppDelegate_ScriptingAdditions.m @@ -200,7 +200,7 @@ -(BOOL)application:(NSApplication *)sender delegateHandlesKey:(NSString *)key { - NSArray *keys = @[@"layouts", @"width", @"height", @"fps", @"activelayout", @"layoutscripts", @"audioInputs", @"captureDestinations", @"staginglayout", @"livelayout", @"useTransitions", @"previewAudio", @"streamAudio", @"transitions", @"streamRunning", @"stagingEnabled", @"audioTracks"]; + NSArray *keys = @[@"layouts", @"width", @"height", @"fps", @"activelayout", @"layoutscripts", @"audioInputs", @"captureDestinations", @"staginglayout", @"livelayout", @"useTransitions", @"previewAudio", @"streamAudio", @"transitions", @"streamRunning", @"stagingEnabled", @"audioTracks", @"recordingActive"]; return [keys containsObject:key]; }