Commit 0a7d84f4 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* src/misc/cpu.c: New altivec detection for Darwin. Using the correct

  official method.
* modules/gui/macosx/playlist.m: Fix Add with options and no enqueue.
* modules/gui/macosx/applescript.m: PLAYLIST_GO fix
parent fd9250af
......@@ -2,7 +2,7 @@
* applescript.m: MacOS X AppleScript support
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: applescript.m,v 1.5 2004/01/05 13:07:03 zorglub Exp $
* $Id: applescript.m,v 1.6 2004/01/20 15:34:43 hartman Exp $
*
* Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
*
......@@ -53,10 +53,10 @@
{
NSURL * o_url;
int i_mode = PLAYLIST_INSERT | PLAYLIST_GO;
int i_mode = PLAYLIST_INSERT;
playlist_Add( p_playlist, [o_urlString fileSystemRepresentation],
[o_urlString fileSystemRepresentation],
[[o_urlString fileSystemRepresentation] lastPathComponent],
i_mode, PLAYLIST_END );
o_url = [NSURL fileURLWithPath: o_urlString];
......
......@@ -2,7 +2,7 @@
* playlist.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2004 VideoLAN
* $Id: playlist.m,v 1.53 2004/01/14 18:45:45 bigben Exp $
* $Id: playlist.m,v 1.54 2004/01/20 15:34:43 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <hartman at videolan dot org>
......@@ -423,7 +423,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
{
/* One item */
NSDictionary *o_one_item;
int j, i_new_position = -1;
int j, i_new_id = -1;
int i_mode = PLAYLIST_INSERT;
BOOL b_rem = FALSE, b_dir = FALSE;
NSString *o_uri, *o_name;
......@@ -455,12 +455,9 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
psz_dev[temp - psz_dev] = '\0';
o_uri = [NSString stringWithCString: psz_dev ];
}
if (i_item == 0 && !b_enqueue)
i_mode |= PLAYLIST_GO;
/* Add the item */
i_new_position = playlist_Add( p_playlist, [o_uri fileSystemRepresentation],
i_new_id = playlist_Add( p_playlist, [o_uri fileSystemRepresentation],
[o_name UTF8String], i_mode,
i_position == -1 ? PLAYLIST_END : i_position + i_item);
......@@ -469,10 +466,16 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
{
for( j = 0; j < [o_options count]; j++ )
{
playlist_AddOption( p_playlist, i_new_position,
playlist_AddOption( p_playlist, i_new_id,
strdup( [[o_options objectAtIndex:j] UTF8String] ) );
}
}
if( i_item == 0 && !b_enqueue )
{
playlist_Goto( p_playlist, playlist_GetPositionById( p_playlist, i_new_id ) );
playlist_Play( p_playlist );
}
/* Recent documents menu */
o_true_file = [NSURL fileURLWithPath: o_uri];
......
......@@ -2,7 +2,7 @@
* cpu.c: CPU detection code
*****************************************************************************
* Copyright (C) 1998-2004 VideoLAN
* $Id: cpu.c,v 1.12 2004/01/06 12:02:06 zorglub Exp $
* $Id: cpu.c,v 1.13 2004/01/20 15:34:44 hartman Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -34,10 +34,7 @@
#endif
#ifdef SYS_DARWIN
# include <mach/mach.h> /* AltiVec detection */
# include <mach/mach_error.h> /* some day the header files||compiler *
will define it for us */
# include <mach/bootstrap.h>
#include <sys/sysctl.h>
#endif
#include "vlc_cpu.h"
......@@ -70,34 +67,15 @@ uint32_t CPUCapabilities( void )
volatile uint32_t i_capabilities = CPU_CAPABILITY_NONE;
#if defined( SYS_DARWIN )
struct host_basic_info hi;
kern_return_t ret;
host_name_port_t host;
int i_size;
char *psz_name, *psz_subname;
int selectors[2] = { CTL_HW, HW_VECTORUNIT };
int i_has_altivec = 0;
size_t i_length = sizeof( i_has_altivec );
int i_error = sysctl( selectors, 2, &i_has_altivec, &i_length, NULL, 0);
i_capabilities |= CPU_CAPABILITY_FPU;
/* Should 'never' fail? */
host = mach_host_self();
i_size = sizeof( hi ) / sizeof( int );
ret = host_info( host, HOST_BASIC_INFO, ( host_info_t )&hi, &i_size );
if( ret != KERN_SUCCESS )
{
fprintf( stderr, "error: couldn't get CPU information\n" );
return i_capabilities;
}
slot_name( hi.cpu_type, hi.cpu_subtype, &psz_name, &psz_subname );
/* FIXME: need better way to detect newer proccessors.
* could do strncmp(a,b,5), but that's real ugly */
if( !strcmp(psz_name, "ppc7400") || !strcmp(psz_name, "ppc7450") )
{
if( i_error == 0 && i_has_altivec != 0 )
i_capabilities |= CPU_CAPABILITY_ALTIVEC;
}
return i_capabilities;
......
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