• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to capture a video stream
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to capture a video stream


  • Subject: Re: How to capture a video stream
  • From: email@hidden
  • Date: Tue, 04 Dec 2012 17:50:02 -0700
  • Importance: Normal

>> On Dec 2, 2012, at 22:02 , email@hidden wrote:
>>
>>> Can anyone tell me what the next steps are?  Any snippets of code that
>>> I
>>> can look at?  I'm sure I'm not the first to try to do this.
>>
>> Have you looked here?
>>
>> 	https://developer.apple.com/library/mac/#documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/04_MediaCapture.html
>>
>> It seems pretty explicit about how to get video frames, and there are
>> code
>> fragments you can use.
>>
>>
>>
>
> Quincey,
>
> That's what I have been reading for the past few days and I'm waiting on
> the light to dawn.  I think I am missing some small bit as I am getting an
> error.
>
> I will keep digging. I'm sure I'll figure out this last 5% somehow.
>
> Thanks
>

Quincey,

I also found this example -->
https://developer.apple.com/library/ios/#qa/qa1702/_index.html

Of course there are some issues with it as it's from IOS, but I assume
this is the pattern that is supposed to be used.  Using this pattern, I
get a little further.  Below is a snippet of my code.  Ignore that fact
that I have a few things out of order:


- (void)setSelectedVideoDevice:(AVCaptureDevice *)selectedVideoDevice
{
	[[self session] beginConfiguration];

	if ([self videoDeviceInput]) {
		// Remove the old device input from the session
		[session removeInput:[self videoDeviceInput]];
		[self setVideoDeviceInput:nil];
	}

	if (selectedVideoDevice) {
		NSError *error = nil;

		// Create a device input for the device and add it to the session
		AVCaptureDeviceInput *newVideoDeviceInput = [AVCaptureDeviceInput
deviceInputWithDevice:selectedVideoDevice error:&error];
		if (newVideoDeviceInput == nil) {
			dispatch_async(dispatch_get_main_queue(), ^(void) {
				[self presentError:error];
			});
		} else {
			if (![selectedVideoDevice supportsAVCaptureSessionPreset:[session
sessionPreset]])
				[[self session] setSessionPreset:AVCaptureSessionPresetHigh];

			[[self session] addInput:newVideoDeviceInput];
			[self setVideoDeviceInput:newVideoDeviceInput];


            AVCaptureVideoDataOutput *output = [[AVCaptureVideoDataOutput
alloc] init];
            [session addOutput:output];

            // Configure your output.
            dispatch_queue_t queue = dispatch_queue_create("myQueue", NULL);
            [output setSampleBufferDelegate:self queue:queue];
            dispatch_release(queue);

		}

 	}

	[[self session] commitConfiguration];
}

The setSampleBufferDelegate:self queue:queue gives a warning in XCode that
says Sending '<my object name here>' to parameter of incompatible type
'id'<AVCaptureVideoDataOutputSampleBufferDelegate>'

I am not sure how to fix this.  Any thoughts would be helpful.  And yes I
am a newbie when it comes to Objective-C and Mac development.  So not
everything is totally clear to me on using this framework.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to capture a video stream
      • From: Quincey Morris <email@hidden>
References: 
 >How to capture a video stream (From: email@hidden)
 >Re: How to capture a video stream (From: Quincey Morris <email@hidden>)
 >Re: How to capture a video stream (From: email@hidden)

  • Prev by Date: Re: How to capture a video stream
  • Next by Date: Re: NSOperation Efficiency
  • Previous by thread: Re: How to capture a video stream
  • Next by thread: Re: How to capture a video stream
  • Index(es):
    • Date
    • Thread