Re: cocoa/DVDPlayback example code?
Re: cocoa/DVDPlayback example code?
- Subject: Re: cocoa/DVDPlayback example code?
- From: Bob Kuehne <email@hidden>
- Date: Mon, 7 Feb 2005 12:15:08 -0500
On Monday, February 07, 2005, at 11:28AM, Ricky Sharp <email@hidden> wrote:
>On Monday, February 07, 2005, at 08:51AM, Bob Kuehne <email@hidden> wrote:
>> OSStatus result = DVDInitialize();
>> if ( noErr == result )
>> {
>> void* pwin = [ [ self window ] windowRef ];
>
>Do you have a Carbon window here? It sounds like you have a Cocoa window, so you shouldn't be doing this.
>
>> result = DVDSetVideoWindowID( GetWindowPort( pwin ) );
ok, good tip. code excised.
>From the header, it mentions "Set the playback grafport with DVDSetVideoPort(Carbon) or the window with DVDSetVideoWindowID(Cocoa)"
>
>If you actually had a Carbon window, you'd use DVDSetVideoPort with the window ref's grafPort. But since it sounds like you have a Cocoa window, you'd use DVDSetVideoWindowID, but with a different parameter. I'm not sure what exactly the UInt32 parameter to API is, but it may be the same thing as returned by NSWindow's windowNumber API.
>
>So instead of the two lines above, try this:
>
> result = DVDSetVideoWindowID ([[self window] windowNumber]);
well, that seems to work too. both your code & my code above yield the same result.
neither gives an error on the DVDSetVideoWindowID call, but later yielding an error in the
DVDSetVideoDisplay call, specifically returning a:
kDVDErrorNotSupportedConfiguration = -70013, // The current system configuration is not supported.
aha! bob thinks aloud, progress! so, i add some more code to check the display
status (see below), and it claims the display is valid! but then a subsequent
DVDSetVideoDisplay fails. drat.
>This code looks OK. Perhaps the reason for failure is the mixing of Carbon/Cocoa calls outlined above.
it's a good idea. maybe there's something else going on.
>If the above suggestions do not work, your best bet is to contact email@hidden. It will probably cost you an incident, but perhaps they can get you some sample code or at least answer your questions.
i'm hoping so - i sent them a note already. thanks for the help so far! oh, and the code
example, in it's current form:
-- code --
OSStatus result = DVDInitialize();
if ( noErr == result )
{
result = DVDSetVideoWindowID( [ [self window ] windowNumber ] );
NSLog( @"DVDSetVideoWindowID: %d\n", result );
NSScreen *mainscreen = [ [ NSScreen screens ] objectAtIndex:0 ];
NSDictionary *mainscreendict = [ mainscreen deviceDescription ];
NSLog( @"%@\n", mainscreendict );
NSNumber *dispnum = [ mainscreendict objectForKey:@"NSScreenNumber" ];
Boolean issd;
DVDIsSupportedDisplay( (CGDirectDisplayID)[ dispnum intValue ], &issd );
NSLog( @"DVDIsSupportedDisplay: %d\n", issd );
result = DVDSetVideoDisplay( (CGDirectDisplayID)[ dispnum intValue ] );
NSLog( @"DVDSetVideoDisplay: %d\n", result );
result = DVDDispose();
NSLog( @"DVDDispose: %d\n", result );
}
-- output --
2005-02-07 12:11:54.540 dvdannotate[10539] DVDSetVideoWindowID: 0
2005-02-07 12:11:54.546 dvdannotate[10539] {
NSDeviceBitsPerSample = 8;
NSDeviceColorSpaceName = NSCalibratedRGBColorSpace;
NSDeviceIsScreen = YES;
NSDeviceResolution = <42900000 42900000 >;
NSDeviceSize = <44a00000 44558000 >;
NSScreenNumber = 69666816;
}
2005-02-07 12:11:54.550 dvdannotate[10539] DVDIsSupportedDisplay: 1
2005-02-07 12:11:54.551 dvdannotate[10539] DVDSetVideoDisplay: -70013
2005-02-07 12:11:54.558 dvdannotate[10539] DVDDispose: 0
--
thanks!
bob
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden