*****************************************************************************
* Copyright (C) 2001 VideoLAN
*
- * Authors:
+ * Authors: Colin Delacroix <colin@zoy.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "mtime.h"
#include "tests.h"
-#include "video.h"
-#include "video_output.h"
-
#include "intf_msg.h"
-#include "main.h"
+#include "video.h"
+#include "video_output.h"
#include "modules.h"
+#include "main.h"
-#ifndef __CARBONPREFIX__
- #define __CARBONPREFIX__
+#include "macosx_common.h"
- // Needed for carbonization
- #define TARGET_API_MAC_CARBON 1
- // For the pascal to C or C to pascal string conversions in carbon
- #define OLDP2C 1
-#endif
-
-#include <Carbon/Carbon.h>
+/*****************************************************************************
+ * Constants & more
+ *****************************************************************************/
// Initial Window Constants
enum
kInSystem
};
-/*****************************************************************************
- * vout_sys_t: MacOS X video output method descriptor
- *****************************************************************************
- * This structure is part of the video output thread descriptor.
- * It describes the MacOS X specific properties of an output thread.
- *****************************************************************************/
-typedef struct vout_sys_s
-{
- /* MacOS X video memory */
- byte_t * p_video; /* base adress */
- size_t i_page_size; /* page size */
-
- Rect wrect;
- WindowRef p_window;
- short gwLocOffscreen;
- GWorldPtr p_gw[ 2 ];
- Boolean gNewNewGWorld; /* can we allocate in VRAm or AGP memory ? */
-
- // Boolean gDone;
- // SInt32 gSleepTime;
-
- GDHandle theGDList;
- Ptr theBase;
- int theRow;
- int theDepth;
-} vout_sys_t;
/*****************************************************************************
* Local prototypes
p_vout->p_sys->p_window = NULL;
p_vout->p_sys->p_gw[ 0 ] = NULL;
p_vout->p_sys->p_gw[ 1 ] = NULL;
- p_vout->p_sys->i_page_size = p_vout->i_width * p_vout->i_height
- * p_vout->i_bytes_per_pixel;
if ( CreateDisplay( p_vout ) )
{
intf_ErrMsg( "vout p_vout->i_height %d" , p_vout->i_height);
intf_ErrMsg( "vout p_vout->i_bytes_per_pixel %d" , p_vout->i_bytes_per_pixel);
intf_ErrMsg( "vout p_vout->i_screen_depth %d" , p_vout->i_screen_depth);
- intf_ErrMsg( "vout p_vout->p_sys->i_page_size %d" , p_vout->p_sys->i_page_size);
-#endif
-
-#if 0
- /* Map two framebuffers a the very beginning of the fb */
- p_vout->p_sys->p_video = malloc( 2 * p_vout->p_sys->i_page_size );
- if( p_vout->p_sys->p_video == NULL )
- {
- intf_ErrMsg( "vout error: can't map video memory (%s)",
- strerror(errno) );
- free( p_vout->p_sys );
- return( 1 );
- }
- /* Set and initialize buffers */
- vout_SetBuffers( p_vout, p_vout->p_sys->p_video,
- p_vout->p_sys->p_video + p_vout->p_sys->i_page_size );
#endif
return( 0 );
#if 0
p_vout->i_screen_depth = wPixDepth;
p_vout->i_bytes_per_pixel = wPixDepth;
- p_vout->i_bytes_per_line = p_vout->i_width * p_vout->i_bytes_per_pixel;
- p_vout->p_sys->i_page_size = p_vout->i_width * p_vout->i_height * p_vout->i_bytes_per_pixel;
-//p_vout->i_bytes_per_line = (**(**hgdWindow).gdPMap).rowBytes & 0x3FFF ;
+ p_vout->i_bytes_per_line = (**(**hgdWindow).gdPMap).rowBytes & 0x3FFF ;
#endif
if( ( noErr == NewGWorld( &pgwTest, wPixDepth, &rectTest, NULL, hgdWindow,
noNewDevice | useDistantHdwrMem ) )
//FIXME - if I ever dispose of the Gworlds and recreate them, i'll have a new address
//and I'll need to tell vout about them... dunno what problems vout might have if we just updateGworld
- vout_SetBuffers( p_vout, hPixmapBaseAddr0, hPixmapBaseAddr1 );
+ p_vout->pf_setbuffers( p_vout, hPixmapBaseAddr0, hPixmapBaseAddr1 );
return 0;
}
int top = 0;
int bottom = p_vout->i_height;
int right = p_vout->i_width;
+ ProcessSerialNumber PSN;
WindowAttributes windowAttr = kWindowStandardDocumentAttributes |
kWindowStandardHandlerAttribute |
InstallStandardEventHandler(GetWindowEventTarget(p_vout->p_sys->p_window));
SetPort( GetWindowPort( p_vout->p_sys->p_window ) );
SetWindowTitleWithCFString( p_vout->p_sys->p_window, CFSTR("VLC") );
-// ShowWindow( p_vout->p_sys->p_window );
- TransitionWindow( p_vout->p_sys->p_window, kWindowZoomTransitionEffect, kWindowShowTransitionAction, NULL);
- BringToFront( p_vout->p_sys->p_window );
+ ShowWindow( p_vout->p_sys->p_window );
+ SelectWindow( p_vout->p_sys->p_window );
+
+ //in case we are run from the command line, bring us to front instead of Terminal
+ GetCurrentProcess(&PSN);
+ SetFrontProcess(&PSN);
{
short wPixDepth = (**(GetPortPixMap( GetWindowPort( p_vout->p_sys->p_window ) ))).pixelSize;
p_vout->i_screen_depth = wPixDepth;
p_vout->i_bytes_per_pixel = p_vout->i_screen_depth / 8;
p_vout->i_bytes_per_line = p_vout->i_width * p_vout->i_bytes_per_pixel;
- p_vout->p_sys->i_page_size = p_vout->i_width * p_vout->i_height * p_vout->i_bytes_per_pixel;
p_vout->i_bytes_per_line = (**(**GetWindowDevice( p_vout )).gdPMap).rowBytes & 0x3FFF ;
default:
break;
}
+}
#if 0
p_vout->i_red_lshift = 0x10;
p_vout->i_gray_pixel = 0x808080;
p_vout->i_blue_pixel = 0x32;
#endif
-}
return( 0 );
}
/*****************************************************************************
- * AllocBuffer: forces offscreen allocation (if different than current) in memory type specified
+ * AllocBuffer: forces offscreen allocation (if different than current) in
+ * memory type specified
*****************************************************************************/
static int AllocBuffer ( vout_thread_t *p_vout, short index )
{
{
//intf_ErrMsg( "vout_Destroy()" );
-//FIXME KLUDGE to lock pixels
-#if 1
-{
+//FIXME Big Lock around Gworlds
PixMapHandle hPixmap0, hPixmap1;
hPixmap0 = GetGWorldPixMap( p_vout->p_sys->p_gw[0] );
hPixmap1 = GetGWorldPixMap( p_vout->p_sys->p_gw[1] );
UnlockPixels(hPixmap0);
UnlockPixels(hPixmap1);
-}
-#endif
-#if 1
if ( p_vout->p_sys->p_gw[0] )
{
DisposeGWorld( p_vout->p_sys->p_gw[0] );
{
DisposeWindow( p_vout->p_sys->p_window );
}
-#endif
- free( p_vout->p_sys->p_video );
+
free( p_vout->p_sys );
}
{
// intf_ErrMsg( "vout_Display()" );
- BlitToWindow ( p_vout, p_vout->i_buffer_index );
+//we should not be called if we set the status to paused or stopped via the interface
+// if ( p_vout->p_sys->playback_status != PAUSED && p_vout->p_sys->playback_status != STOPPED )
+ BlitToWindow ( p_vout, p_vout->i_buffer_index );
}
/*****************************************************************************
* flushQD: flushes buffered window area
- *****************************************************************************/
+ *****************************************************************************/
void flushQD( vout_thread_t *p_vout )
{
CGrafPtr thePort;
/*****************************************************************************
* BlitToWindow: checks offscreen and blits it to the front
- *****************************************************************************/
+ *****************************************************************************/
void BlitToWindow( vout_thread_t *p_vout, short index )
{
//FIXME have global lock - kinda bad but oh well
// if ( LockPixels( GetGWorldPixMap( p_vout->p_sys->p_gw[index] ) ) )
// {
+
+//LockPortBits(GetWindowPort( p_vout->p_sys->p_window ));
+//NoPurgePixels( GetGWorldPixMap( p_vout->p_sys->p_gw[index] ) );
+
CopyBits( GetPortBitMapForCopyBits( p_vout->p_sys->p_gw[index] ),
GetPortBitMapForCopyBits( GetWindowPort( p_vout->p_sys->p_window ) ),
&rectSource, &rectDest, srcCopy, NULL);
+
+//UnlockPortBits(GetWindowPort( p_vout->p_sys->p_window ));
+//AllowPurgePixels( GetGWorldPixMap( p_vout->p_sys->p_gw[index] ) );
+
// UnlockPixels( GetGWorldPixMap( p_vout->p_sys->p_gw[index] ) );
//flushQD( p_vout );
// }