Commit 08f42608 authored by Jon Lech Johansen's avatar Jon Lech Johansen

* ./modules/gui/macosx/aout.m: cleaned up the code, removed intf dep.

  * ./src/misc/darwin_specific.m: fixed segfault (o_enumerator was being
                                  released twice) and memory leak.

    Bonne Ann�e!
parent 06fa8a6f
......@@ -12,8 +12,5 @@ SOURCES_macosx = \
modules/gui/macosx/playlist.m \
modules/gui/macosx/playlist.h \
modules/gui/macosx/controls.m \
modules/gui/macosx/asystm.m \
modules/gui/macosx/asystm.h \
modules/gui/macosx/adev_discovery.h \
$(NULL)
//
// main.h
// FindHW
//
// Created by Heiko Panther on Sun Sep 08 2002.
//
#import <Foundation/Foundation.h>
#import <CoreAudio/CoreAudio.h>
enum audiodeviceClasses
{
audiodevice_class_ac3 =1<<0, // compressed AC3
audiodevice_class_pcm2 =1<<1, // stereo PCM (uncompressed)
audiodevice_class_pcm6 =1<<2 // 6-channel PCM (uncompressed)
};
// specifies a rule for finding if a Device belongs to a class from above.
// if value==0, the value is ignored when matching. All other values must match.
struct classificationRule
{
UInt32 mFormatID;
UInt32 mChannelsPerFrame;
enum audiodeviceClasses characteristic;
char qualifierString[16];
};
This diff is collapsed.
//
// asystm.h
//
//
// Created by Heiko Panther on Tue Sep 10 2002.
// Copyright (c) 2002 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreAudio/CoreAudio.h>
#import "adev_discovery.h"
#import "intf.h"
/*****************************************************************************
* MacOSXSoundOption
* Each audio device can give several sound options: there might be several
* streams on one device, each can have different formats which might qualify
* as an option.
* We record format and channels, since these attributes are requirements
* from the user and the aout should deliver what the user wants. This
* selection is basically done when the user chooses the output option.
* We do not record sample rate and bit depth, since these attributes are
* tied to the media source, and the device format that matches these media
* formats best should be selected. This selection is done when the aout
* module is created with a certain stream, and asks the asystm for a device.
*****************************************************************************/
@interface MacOSXSoundOption:NSObject
{
NSString *name;
AudioDeviceID deviceID;
UInt32 streamIndex;
UInt32 mFormatID;
UInt32 mChannels;
}
- (id)initWithName:(NSString*)_name deviceID:(AudioDeviceID)devID streamIndex:(UInt32)strInd formatID:(UInt32)formID chans:(UInt32)chans;
- (AudioDeviceID)deviceID;
- (UInt32)streamIndex;
- (UInt32)mFormatID;
- (UInt32)mChannels;
- (void)dealloc;
- (NSString*)name;
@end
@interface MacOSXAudioSystem : NSObject {
VLCMain *main;
/* selected output device */
NSMenuItem *selectedOutput;
NSMenu *newMenu;
}
- (id)initWithGUI:(VLCMain*)main;
- (AudioStreamID) getStreamIDForIndex:(UInt32)streamIndex device:(AudioDeviceID)deviceID;
- (void)CheckDevice:(AudioDeviceID)deviceID isInput:(bool)isInput;
- (void)registerSoundOption:(MacOSXSoundOption*)option;
- (void)selectAction:(id)sender;
- (AudioStreamID)getSelectedDeviceSetToRate:(int)preferredSampleRate;
- (void)dealloc;
@end
This diff is collapsed.
......@@ -2,7 +2,7 @@
* intf.h: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: intf.h,v 1.6 2002/12/25 02:23:36 massiot Exp $
* $Id: intf.h,v 1.7 2003/01/01 11:14:50 jlj Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -154,8 +154,6 @@ struct intf_sys_t
IBOutlet id o_dmi_play;
IBOutlet id o_dmi_pause;
IBOutlet id o_dmi_stop;
id asystm; // MacOSXAudioSystem
}
- (void)terminate;
......
......@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: intf.m,v 1.13 2002/12/29 01:16:28 massiot Exp $
* $Id: intf.m,v 1.14 2003/01/01 11:14:50 jlj Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -35,7 +35,6 @@
#include "vout.h"
#include "prefs.h"
#include "playlist.h"
#include "asystm.h"
/*****************************************************************************
* Local prototypes.
......@@ -258,11 +257,6 @@ static void Run( intf_thread_t *p_intf )
[[NSRunLoop currentRunLoop]
addPort: p_intf->p_sys->o_sendport
forMode: NSDefaultRunLoopMode];
// Since we need the sound menu now, it's a good time to create the sound system class
asystm=[[MacOSXAudioSystem alloc] initWithGUI:self];
[asystm retain];
}
- (void)noopAction:(id)sender {
......@@ -493,8 +487,6 @@ static void Run( intf_thread_t *p_intf )
context: [NSGraphicsContext currentContext] eventNumber: 1
clickCount: 1 pressure: 0.0];
[NSApp postEvent: pEvent atStart: YES];
[asystm release];
}
- (void)manageMode
......
......@@ -2,7 +2,7 @@
* darwin_specific.m: Darwin specific features
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: darwin_specific.m,v 1.2 2002/12/31 01:54:36 massiot Exp $
* $Id: darwin_specific.m,v 1.3 2003/01/01 11:14:50 jlj Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -118,26 +118,31 @@ void system_Init( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] )
/* Check if $LANG is set. */
if ( (p_char = getenv("LANG")) == NULL )
{
vlc_bool_t b_found = 0;
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
/* Retrieve user's preferences. */
NSUserDefaults * p_defs =
[[NSUserDefaults standardUserDefaults] autorelease];
NSArray * p_languages =
[[p_defs objectForKey:@"AppleLanguages"] autorelease];
NSEnumerator * p_enumerator =
[[p_languages objectEnumerator] autorelease];
NSString * p_lang;
NSUserDefaults * o_defs = [NSUserDefaults standardUserDefaults];
NSArray * o_languages = [o_defs objectForKey:@"AppleLanguages"];
NSEnumerator * o_enumerator = [o_languages objectEnumerator];
NSString * o_lang;
while ( (p_lang = [[p_enumerator nextObject] autorelease]) )
while ( (o_lang = [o_enumerator nextObject]) )
{
if( !b_found )
{
const char * psz_string = [p_lang lossyCString];
const char * psz_string = [o_lang lossyCString];
if ( FindLanguage( psz_string ) )
{
break;
b_found = 1;
}
}
/* FIXME : why does it segfault ??? */
//[o_pool release];
[o_lang release];
}
[o_languages release];
[o_pool release];
}
}
......
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