Re: AVCaptureInputPortFormatDescriptionDidChangeNotification confusion

2014-11-29 Thread Michael Babin
On Nov 29, 2014, at 2:31 AM, Ben  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:
>  {
>   mediaType:'soun' 
>   mediaSubType:'lpcm' 
>   mediaSpecific: {
>   ASBD: {
>   mSampleRate: 44100.00 
>   mFormatID: 'lpcm' 
>   mFormatFlags: 0xc 
>   mBytesPerPacket: 2 
>   mFramesPerPacket: 1 
>   mBytesPerFrame: 2 
>   mChannelsPerFrame: 1 
>   mBitsPerChannel: 16 } 
>   cookie: {(null)} 
>   ACL: {(null)} 
>   } 
>   extensions: {{type = immutable 
> dict, count = 1,
> entries =>
>   2 : {contents = 
> "VerbatimSampleDescription"} = {length = 52, 
> capacity = 52, bytes = 0x0034736f7774 ... 
> 00020002}
> }
> }
> }

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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

AVCaptureInputPortFormatDescriptionDidChangeNotification confusion

2014-11-29 Thread Ben
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:
 {
mediaType:'soun' 
mediaSubType:'lpcm' 
mediaSpecific: {
ASBD: {
mSampleRate: 44100.00 
mFormatID: 'lpcm' 
mFormatFlags: 0xc 
mBytesPerPacket: 2 
mFramesPerPacket: 1 
mBytesPerFrame: 2 
mChannelsPerFrame: 1 
mBitsPerChannel: 16 } 
cookie: {(null)} 
ACL: {(null)} 
} 
extensions: {{type = immutable 
dict, count = 1,
entries =>
2 : {contents = 
"VerbatimSampleDescription"} = {length = 52, 
capacity = 52, bytes = 0x0034736f7774 ... 00020002}
}
}
}
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com