diff --git a/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegCapture.m b/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegCapture.m index dd2efc28..baf0b194 100644 --- a/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegCapture.m +++ b/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegCapture.m @@ -271,15 +271,20 @@ -(void)itemStarted:(CSFFMpegInput *)item [CATransaction commit]; }]; } - self.durationString = [self timeToString:item.duration]; - self.currentMovieDuration = item.duration; - [self generateUniqueID]; - self.captureName = item.shortName; - if (self.pcmPlayer) + if (item) { - self.pcmPlayer.name = item.shortName; + self.durationString = [self timeToString:item.duration]; + self.currentMovieDuration = item.duration; + [self generateUniqueID]; + self.captureName = item.shortName; + if (self.pcmPlayer) + { + self.pcmPlayer.name = item.shortName; + } + [self changeAttachedAudioInputName:self.uuid withName:item.shortName]; + } else { + self.currentTimeString = [self timeToString:0.0f]; } - [self changeAttachedAudioInputName:self.uuid withName:item.shortName]; }); } diff --git a/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegCaptureViewController.m b/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegCaptureViewController.m index 92853ffc..89165180 100644 --- a/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegCaptureViewController.m +++ b/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegCaptureViewController.m @@ -20,6 +20,7 @@ - (void)viewDidLoad { // Do view setup here. if (self.captureObj && self.captureObj.player) { + [self pauseStateChanged]; self.captureObj.player.pauseStateChanged = ^{ [self pauseStateChanged]; }; @@ -220,7 +221,7 @@ - (IBAction)manualAddItem:(id)sender -(void)pauseStateChanged { dispatch_async(dispatch_get_main_queue(), ^{ - if (self.captureObj.player.paused) + if (self.captureObj.player.paused || !self.captureObj.player.playing) { NSImage *playImage = [[NSBundle bundleForClass:[self class]] imageForResource:@"play"]; diff --git a/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegCaptureViewController.xib b/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegCaptureViewController.xib index b06bec4d..31e86c3c 100644 --- a/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegCaptureViewController.xib +++ b/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegCaptureViewController.xib @@ -1,8 +1,8 @@ - + - + @@ -23,7 +23,7 @@ - + @@ -46,12 +46,12 @@ - + - + @@ -64,7 +64,7 @@ - + @@ -107,7 +107,7 @@ - + @@ -121,7 +121,7 @@ - + @@ -145,15 +145,9 @@ - - - - - - - - - + + + @@ -166,7 +160,7 @@ - + @@ -177,7 +171,7 @@ - + @@ -185,7 +179,7 @@ - + @@ -197,7 +191,7 @@ - + @@ -207,7 +201,7 @@ - + @@ -217,7 +211,7 @@ - + @@ -230,7 +224,7 @@ - + @@ -239,7 +233,7 @@ - + @@ -251,12 +245,15 @@ - + + + + @@ -268,7 +265,7 @@ - + diff --git a/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegInput.m b/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegInput.m index 63a85a67..7fc7a09a 100644 --- a/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegInput.m +++ b/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegInput.m @@ -705,7 +705,7 @@ -(void)closeMedia { @synchronized (self) { _stop_request = YES; - + _is_ready = NO; dispatch_semaphore_signal(_read_loop_semaphore); av_thread_message_queue_set_err_send(_video_message_queue, AVERROR_EOF); diff --git a/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegPlayer.h b/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegPlayer.h index 22ea1f25..331109d7 100644 --- a/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegPlayer.h +++ b/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegPlayer.h @@ -16,7 +16,8 @@ typedef enum ff_movie_repeat_t { kCSFFMovieRepeatNone = 0, kCSFFMovieRepeatOne = 1, - kCSFFMovieRepeatAll = 2 + kCSFFMovieRepeatAll = 2, + kCSFFMovieRepeatRandom = 3 } ff_movie_repeat; diff --git a/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegPlayer.m b/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegPlayer.m index 077cebec..dfbc83ba 100644 --- a/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegPlayer.m +++ b/CSFFMpegCapturePlugin/CSFFMpegCapturePlugin/CSFFMpegPlayer.m @@ -172,6 +172,8 @@ -(CSFFMpegInput *)nextItem if (self.repeat == kCSFFMovieRepeatNone || self.repeat == kCSFFMovieRepeatAll) { currentIdx++; + } else if (self.repeat == kCSFFMovieRepeatRandom) { + currentIdx = arc4random_uniform(_inputQueue.count); } } @@ -638,8 +640,17 @@ -(void)inputDone CSFFMpegInput *willPlay = nil; CSFFMpegInput *wasPlaying = self.currentlyPlaying; + + + if (_audio_done && _video_done) { + + + if (wasPlaying) + { + [wasPlaying seek:0.0f]; + } //[self.currentlyPlaying stop]; @@ -657,8 +668,17 @@ -(void)inputDone if (!willPlay && (willPlay != wasPlaying)) { + self.playing = NO; + if (self.pauseStateChanged) + { + dispatch_async(dispatch_get_main_queue(), ^{ + self.pauseStateChanged(); + }); + } + if (self.itemStarted) { + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ self.itemStarted(nil);}); } diff --git a/CocoaSplit/CAMultiAudio/CAMultiAudioDownmixer.m b/CocoaSplit/CAMultiAudio/CAMultiAudioDownmixer.m index a6250494..cfff070b 100644 --- a/CocoaSplit/CAMultiAudio/CAMultiAudioDownmixer.m +++ b/CocoaSplit/CAMultiAudio/CAMultiAudioDownmixer.m @@ -364,7 +364,7 @@ -(void)didInitializeNode NSLog(@"Failed to set output volume for channel %d on %@ with status %d", chan, self, err); } - if (_inputChannels < self.graph.audioFormat.channelCount) + if ((_inputChannels > 0) && _inputChannels < self.graph.audioFormat.channelCount) { UInt32 inChan = chan % _inputChannels; [self setVolume:1.0f forChannel:inChan outChannel:chan]; diff --git a/CocoaSplit/Compressor/CompressorBase.m b/CocoaSplit/Compressor/CompressorBase.m index 95e37407..91701bdc 100644 --- a/CocoaSplit/Compressor/CompressorBase.m +++ b/CocoaSplit/Compressor/CompressorBase.m @@ -227,6 +227,11 @@ -(bool)compressFrame:(CapturedFrameData *)frameData } +-(bool)needsSetup +{ + return NO; +} + -(void)reconfigureCompressor {