Re: cocoa/DVDPlayback example code?
Re: cocoa/DVDPlayback example code?
- Subject: Re: cocoa/DVDPlayback example code?
- From: Ricky Sharp <email@hidden>
- Date: Mon, 07 Feb 2005 10:28:27 -0600
On Monday, February 07, 2005, at 08:51AM, Bob Kuehne <email@hidden> wrote:
>i've done some research over the weekend into how
>DVDPlayback.framework operates, and i've made some
>progress, but information is pretty sparse on the
>apple web sites, google, the ADC docs, etc. the
>closest thing i can find to a complete example is
>described in a comment in the DVDPlayback.h header.
>but it's not quite enough. i'm looking for sample
>code to show me how to do the following operations
>with either a Cocoa View or Window. this recommended
>cookbook is copied from the header and converted
>into code below. the parts outside of the #if function
>fine, but the parts inside, i can't quite get to go.
>
>--
> 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 ) );
>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]);
> NSLog( @"DVDSetVideoWindowID: %d\n", result );
>
>#if HOW_SHOULD_THIS_WORK
> NSScreen *mainscreen = [ [ NSScreen screens ] objectAtIndex:0 ];
> NSDictionary *mainscreendict = [ mainscreen deviceDescription ];
> NSNumber *dispnum = [ mainscreendict
>objectForKey:@"NSScreenNumber" ];
> result = DVDSetVideoDisplay( (CGDirectDisplayID)[ dispnum
>intValue ] );
> NSLog( @"DVDSetVideoDisplay: %d\n", result );
> NSLog( @"noErr: %d\n", noErr );
>
> result = DVDSetVideoBounds( (CGRect){ NSMinX(pwinFrame),
>NSMinY(pwinFrame),
> NSWidth(pwinFrame), NSHeight(pwinFrame) } );
> NSLog( @"DVDSetVideoBounds: %d\n", result );
>#endif
This code looks OK. Perhaps the reason for failure is the mixing of Carbon/Cocoa calls outlined above.
>
> // cleanup
> result = DVDDispose();
> NSLog( @"DVDDispose: %d\n", result );
> }
>--
>
>a few questions:
> - can anyone provide a complete example (ideally
> including a nib) of how this works?
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.
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
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