• 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: AVCaptureInputPortFormatDescriptionDidChangeNotification confusion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AVCaptureInputPortFormatDescriptionDidChangeNotification confusion


  • Subject: Re: AVCaptureInputPortFormatDescriptionDidChangeNotification confusion
  • From: Michael Babin <email@hidden>
  • Date: Sat, 29 Nov 2014 09:38:54 -0600

On Nov 29, 2014, at 2:31 AM, Ben <email@hidden> wrote:

> I'm trying to get the video dimensions by using AVCaptureInputPortFormatDescriptionDidChangeNotification however the width & height returns a number way higher than I am expecting.
> Expecting 320/480 or similar but getting width = 1088784512, height = 1819304813.
>
> Any ideas what I am doing wrong?
>
>
> - (void)avCaptureInputPortFormatDescriptionDidChangeNotification:(NSNotification *)notification {
>
>    AVCaptureInputPort * captureInputPort = notification.object;
>
>
>    CMFormatDescriptionRef formatDescription = captureInputPort.formatDescription;
>    if (formatDescription) {
>        CMVideoDimensions dimensions = CMVideoFormatDescriptionGetDimensions(formatDescription);
>
>
> }
>
>
> Printing description of dimensions:
> (CMVideoDimensions) dimensions = (width = 1088784512, height = 1819304813)
>
>
>
> Printing description of formatDescription:
> <CMAudioFormatDescription 0x19acd1f0 [0x3aa74460]> {
> 	mediaType:'soun'
> 	mediaSubType:'lpcm'
> 	mediaSpecific: {
> 		ASBD: {
> 			mSampleRate: 44100.000000
> 			mFormatID: 'lpcm'
> 			mFormatFlags: 0xc
> 			mBytesPerPacket: 2
> 			mFramesPerPacket: 1
> 			mBytesPerFrame: 2
> 			mChannelsPerFrame: 1
> 			mBitsPerChannel: 16 	}
> 		cookie: {(null)}
> 		ACL: {(null)}
> 	}
> 	extensions: {<CFBasicHash 0x19acd250 [0x3aa74460]>{type = immutable dict, count = 1,
> entries =>
> 	2 : <CFString 0x3ab282e0 [0x3aa74460]>{contents = "VerbatimSampleDescription"} = <CFData 0x19acdca0 [0x3aa74460]>{length = 52, capacity = 52, bytes = 0x00000034736f7774000000000000ffff ... 0000000200000002}
> }
> }
> }

Looks like you’re assuming that the formatDescription is a CMVideoFormatDescriptionRef, when printing it shows that it is a CMAudioFormatDescriptionRef. I don’t have direct experience with the API, but would guess that CMVideoFormatDescriptionGetDimensions doesn’t return any useful value when passed a CMAudioFormatDescriptionRef.

As to why you’re receiving a notification for an audio format or input port instead of the video format/port you’re expecting, that’s left to you to determine.


_______________________________________________

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


References: 
 >AVCaptureInputPortFormatDescriptionDidChangeNotification confusion (From: Ben <email@hidden>)

  • Prev by Date: AVCaptureInputPortFormatDescriptionDidChangeNotification confusion
  • Next by Date: App fails on Yosemite - "Cannot remove an observer"
  • Previous by thread: AVCaptureInputPortFormatDescriptionDidChangeNotification confusion
  • Next by thread: App fails on Yosemite - "Cannot remove an observer"
  • Index(es):
    • Date
    • Thread