Commit 4ebec617 authored by Eugenio Jarosiewicz's avatar Eugenio Jarosiewicz

Updated & cleaned up intf_macosx.c and vout_macosx.c - added Open menu

function support and a no-frills About box

Created macosx_common.h in plugins/macosx/ to hold , well, common stuff
(the way I see it, there is inherently a difficult separation of intf and
vout on Mac OS, if anyone has suggestions I'm open)

Cleaned up debug spew I left in modules.c and video_text.c

Hacked main.c to disregard argv[1] when compiled for OSX & run as a full
app (ie., double clicked and not launched from command line)... read the
file for more details.  UGLY.

Updated Makefile.in to make vlc.app by default on Mac OS X & Darwin, added
clean code for it as well
parent b69b9d33
......@@ -484,6 +484,7 @@ clean:
rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
rm -f src/*/*.o extras/*/*.o
rm -f lib/*.so vlc gnome-vlc gvlc kvlc qvlc
rm -rf vlc.app
distclean: clean
rm -f **/*.o **/*~ *.log
......@@ -491,6 +492,7 @@ distclean: clean
rm -f config.status config.cache config.log
rm -f gmon.out core build-stamp
rm -Rf .dep
rm -f .gdb_history
install:
mkdir -p $(DESTDIR)$(bindir)
......@@ -682,8 +684,6 @@ ifeq ($(SYS),beos)
rm -f ./plugins/_APP_
ln -s ../vlc ./plugins/_APP_
endif
vlc.app: all
ifneq (,$(findstring darwin,$(SYS)))
mkdir -p vlc.app/Contents/MacOS
mkdir -p vlc.app/Contents/MacOS/lib
......
This diff is collapsed.
/*****************************************************************************
* macosx.c : MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $$
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Constants & more
*****************************************************************************/
#ifndef __CARBONPREFIX__
#define __CARBONPREFIX__
// 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>
#define PLAYING 0
#define PAUSED 1
#define STOPPED 2
/*****************************************************************************
* Type declarations that unfortunately need to be known to both
* ...
* Kind of a hack due to the fact that on Mac OS, there is little difference
* between the interface and the video output, and hence little separation
* between those elements.
*****************************************************************************/
/*****************************************************************************
* 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
{
Rect wrect;
WindowRef p_window;
short gwLocOffscreen;
GWorldPtr p_gw[ 2 ];
Boolean gNewNewGWorld; /* can we allocate in VRAm or AGP memory ? */
GDHandle theGDList;
Ptr theBase;
int theRow;
int theDepth;
int playback_status; // remember playback state
int vol_val; // remember the current volume
} vout_sys_t;
......@@ -3,7 +3,7 @@
*****************************************************************************
* 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
......@@ -38,26 +38,20 @@
#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
......@@ -74,32 +68,6 @@ 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
......@@ -174,8 +142,6 @@ static int vout_Create( vout_thread_t *p_vout )
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 ) )
{
......@@ -189,22 +155,6 @@ static int vout_Create( vout_thread_t *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 );
......@@ -237,9 +187,7 @@ void FindBestMemoryLocation( vout_thread_t *p_vout )
#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 ) )
......@@ -322,6 +270,7 @@ static int MakeWindow( vout_thread_t *p_vout )
int top = 0;
int bottom = p_vout->i_height;
int right = p_vout->i_width;
ProcessSerialNumber PSN;
WindowAttributes windowAttr = kWindowStandardDocumentAttributes |
kWindowStandardHandlerAttribute |
......@@ -339,16 +288,18 @@ static int MakeWindow( vout_thread_t *p_vout )
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 ;
......@@ -369,6 +320,7 @@ static int MakeWindow( vout_thread_t *p_vout )
default:
break;
}
}
#if 0
p_vout->i_red_lshift = 0x10;
......@@ -383,7 +335,6 @@ static int MakeWindow( vout_thread_t *p_vout )
p_vout->i_gray_pixel = 0x808080;
p_vout->i_blue_pixel = 0x32;
#endif
}
return( 0 );
}
......@@ -459,18 +410,13 @@ static void vout_Destroy( vout_thread_t *p_vout )
{
//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] );
......@@ -483,8 +429,7 @@ static void vout_Destroy( vout_thread_t *p_vout )
{
DisposeWindow( p_vout->p_sys->p_window );
}
#endif
free( p_vout->p_sys->p_video );
free( p_vout->p_sys );
}
......@@ -510,7 +455,8 @@ static void vout_Display( vout_thread_t *p_vout )
{
// intf_ErrMsg( "vout_Display()" );
BlitToWindow ( p_vout, p_vout->i_buffer_index );
if ( p_vout->p_sys->playback_status != PAUSED && p_vout->p_sys->playback_status != STOPPED )
BlitToWindow ( p_vout, p_vout->i_buffer_index );
}
......@@ -562,9 +508,17 @@ 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 );
// }
......
......@@ -2,7 +2,7 @@
* modules.c : Built-in and dynamic modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.20 2001/04/06 18:18:10 massiot Exp $
* $Id: modules.c,v 1.21 2001/04/11 13:30:30 ej Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
......@@ -122,10 +122,8 @@ void module_InitBank( module_bank_t * p_bank )
{
once = 1;
strncpy( app_path, p_main->ppsz_argv[ 0 ], i_pathlen );
intf_ErrMsg( "%s", p_main->ppsz_argv[ 0 ] );
strcat( app_path, "lib" );
path[ 3 ] = app_path ;
intf_ErrMsg( "%s", path[ 3 ] );
}
#endif
......
......@@ -2,7 +2,7 @@
* video_text.c : text manipulation functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_text.c,v 1.21 2001/04/06 18:18:10 massiot Exp $
* $Id: video_text.c,v 1.22 2001/04/11 13:30:30 ej Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -43,7 +43,6 @@
#include "video_text.h"
#ifdef SYS_DARWIN1_3
// #include <CFBundle.h>
#include <sys/param.h> /* for MAXPATHLEN */
#include "main.h"
extern main_t *p_main;
......@@ -229,7 +228,6 @@ vout_font_t *vout_LoadFont( const char *psz_name )
static char app_path[ MAXPATHLEN ];
/* HACK TO CUT OUT trailing 'vlc' */
int i_pathlen = strlen( p_main->ppsz_argv[ 0 ] ) - 3;
// CFBundleRef mainBundle;
#endif
int i_char, i_line; /* character and line indexes */
int i_file = -1; /* source file */
......@@ -237,17 +235,12 @@ vout_font_t *vout_LoadFont( const char *psz_name )
vout_font_t * p_font; /* the font itself */
#ifdef SYS_DARWIN1_3
// Get the main bundle for the app
// mainBundle = CFBundleGetMainBundle();
if( !once )
{
once = 1;
once = 1;
strncpy( app_path, p_main->ppsz_argv[ 0 ], i_pathlen );
intf_ErrMsg( "%s", p_main->ppsz_argv[ 0 ] );
strcat( app_path, "share" );
path[ 2 ] = app_path ;
intf_ErrMsg( "%s", path[ 2 ] );
}
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment