]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/intf.h
macosx: fixed another crash after the video stopped playing
[vlc] / modules / gui / macosx / intf.h
index 81c71aa16042b574e3f484e995f2582468ffcbc4..d6a7164241815e2499505419f7511a295719c362 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * intf.h: MacOS X interface module
  *****************************************************************************
- * Copyright (C) 2002-2009 the VideoLAN team
+ * Copyright (C) 2002-2011 the VideoLAN team
  * $Id$
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
 #include <vlc_input.h>
 
 #include <Cocoa/Cocoa.h>
+#import "SPMediaKeyTap.h"                   /* for the media key support */
 
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
 unsigned int CocoaKeyToVLC( unichar i_key );
 
-#define VLCIntf [[VLCMain sharedInstance] getIntf]
+#define VLCIntf [[VLCMain sharedInstance] intf]
 
 #define _NS(s) [[VLCMain sharedInstance] localizedString: _(s)]
 /* Get an alternate version of the string.
@@ -54,13 +55,17 @@ unsigned int CocoaKeyToVLC( unichar i_key );
             @"/System/Library/CoreServices/SystemVersion.plist"] \
             objectForKey: @"ProductVersion"] floatValue]
 
+
+// You need to release those objects after use
+input_thread_t *getInput(void);
+vout_thread_t *getVout(void);
+aout_instance_t *getAout(void);
+
 /*****************************************************************************
  * intf_sys_t: description and status of the interface
  *****************************************************************************/
 struct intf_sys_t
 {
-    NSAutoreleasePool * o_pool;
-
     /* special actions */
     bool b_mute;
     int i_play_status;
@@ -83,14 +88,12 @@ struct intf_sys_t
     msg_subscription_t * p_sub;
 };
 
-static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
-
 /*****************************************************************************
  * VLCMain interface
  *****************************************************************************/
 @class AppleRemote;
 @class VLCInformation;
-@class VLControllerWindow;
+@class VLCControllerWindow;
 @class VLCEmbeddedWindow;
 @class VLCControls;
 @class VLCPlaylist;
@@ -104,14 +107,12 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
     id o_wizard;                /* VLCWizard      */
     id o_extended;              /* VLCExtended    */
     id o_bookmarks;             /* VLCBookmarks   */
-    id o_vlm;                   /* VLCVLMController */
     id o_embedded_list;         /* VLCEmbeddedList*/
     id o_coredialogs;           /* VLCCoreDialogProvider */
-    VLCInformation * o_info;                  /* VLCInformation */
-#ifdef UPDATE_CHECK
-    id o_update;                /* VLCUpdate      */
-#endif
+    VLCInformation * o_info;    /* VLCInformation */
     id o_eyetv;                 /* VLCEyeTVController */
+    id o_audioeffects;          /* VLCAudioEffects */
+    id o_trackSynchronization;  /* VLCTrackSynchronization */
     BOOL nib_main_loaded;       /* main nibfile */
     BOOL nib_open_loaded;       /* open nibfile */
     BOOL nib_about_loaded;      /* about nibfile */
@@ -119,12 +120,12 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
     BOOL nib_extended_loaded;   /* extended nibfile */
     BOOL nib_bookmarks_loaded;  /* bookmarks nibfile */
     BOOL nib_prefs_loaded;      /* preferences nibfile */
-    BOOL nib_update_loaded;     /* update nibfile */
     BOOL nib_info_loaded;       /* information panel nibfile */
-    BOOL nib_vlm_loaded;        /* VLM Panel nibfile */
     BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
+    BOOL nib_audioeffects_loaded; /* audio effects panel */
+    BOOL nib_tracksynchro_loaded; /* track synchro panel */
 
-    IBOutlet VLControllerWindow * o_window;                     /* main window */
+    IBOutlet VLCControllerWindow * o_window;                     /* main window */
     IBOutlet NSView * o_playlist_view;                          /* playlist view  */
     IBOutlet id o_scrollfield;                                  /* info field */
     IBOutlet NSTextField * o_timefield;                         /* time field */
@@ -146,7 +147,7 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
     IBOutlet NSButton * o_btn_next;     /* btn next       */
     IBOutlet NSButton * o_btn_fullscreen;/* btn fullscreen (embedded vout window) */
     IBOutlet NSButton * o_btn_playlist; /* btn playlist   */
-    IBOutlet NSButton * o_btn_equalizer; /* eq btn */
+    IBOutlet NSButton * o_btn_audioEffects; /* AudioEffects btn */
 
     NSImage * o_img_play;       /* btn play img   */
     NSImage * o_img_pause;      /* btn pause img  */
@@ -163,7 +164,7 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
     BOOL b_msg_arr_changed;                     /* did the array change? */
     IBOutlet NSButton * o_msgs_crashlog_btn;    /* messages open crashlog */
     IBOutlet NSButton * o_msgs_save_btn;        /* save the log as rtf */
-    
+
     /* CrashReporter panel */
     IBOutlet NSButton * o_crashrep_dontSend_btn;
     IBOutlet NSButton * o_crashrep_send_btn;
@@ -197,7 +198,6 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
     IBOutlet NSMenuItem * o_mi_open_recent;
     IBOutlet NSMenuItem * o_mi_open_recent_cm;
     IBOutlet NSMenuItem * o_mi_open_wizard;
-    IBOutlet NSMenuItem * o_mi_open_vlm;
 
     IBOutlet NSMenu * o_mu_edit;
     IBOutlet NSMenuItem * o_mi_cut;
@@ -211,11 +211,14 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
     IBOutlet NSMenuItem * o_mi_stop;
     IBOutlet NSMenuItem * o_mi_faster;
     IBOutlet NSMenuItem * o_mi_slower;
+    IBOutlet NSMenuItem * o_mi_normalSpeed;
+    IBOutlet NSMenuItem * o_mi_trackSynchronization;
     IBOutlet NSMenuItem * o_mi_previous;
     IBOutlet NSMenuItem * o_mi_next;
     IBOutlet NSMenuItem * o_mi_random;
     IBOutlet NSMenuItem * o_mi_repeat;
     IBOutlet NSMenuItem * o_mi_loop;
+    IBOutlet NSMenuItem * o_mi_quitAfterPB;
     IBOutlet NSMenuItem * o_mi_fwd;
     IBOutlet NSMenuItem * o_mi_bwd;
     IBOutlet NSMenuItem * o_mi_fwd1m;
@@ -223,7 +226,7 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
     IBOutlet NSMenuItem * o_mi_fwd5m;
     IBOutlet NSMenuItem * o_mi_bwd5m;
     IBOutlet NSMenuItem * o_mi_program;
-    IBOutlet NSMenuItem * o_mu_program;
+    IBOutlet NSMenu * o_mu_program;
     IBOutlet NSMenuItem * o_mi_title;
     IBOutlet NSMenu * o_mu_title;
     IBOutlet NSMenuItem * o_mi_chapter;
@@ -263,8 +266,10 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
     IBOutlet NSMenuItem * o_mi_addSub;
     IBOutlet NSMenuItem * o_mi_deinterlace;
     IBOutlet NSMenu * o_mu_deinterlace;
+    IBOutlet NSMenuItem * o_mi_deinterlace_mode;
+    IBOutlet NSMenu * o_mu_deinterlace_mode;
     IBOutlet NSMenuItem * o_mi_ffmpeg_pp;
-    IBOutlet NSMenuItem * o_mu_ffmpeg_pp;
+    IBOutlet NSMenu * o_mu_ffmpeg_pp;
     IBOutlet NSMenuItem * o_mi_teletext;
     IBOutlet NSMenuItem * o_mi_teletext_transparent;
     IBOutlet NSMenuItem * o_mi_teletext_index;
@@ -276,8 +281,9 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
     IBOutlet NSMenu * o_mu_window;
     IBOutlet NSMenuItem * o_mi_minimize;
     IBOutlet NSMenuItem * o_mi_close_window;
+    IBOutlet NSMenuItem * o_mi_player;
     IBOutlet NSMenuItem * o_mi_controller;
-    IBOutlet NSMenuItem * o_mi_equalizer;
+    IBOutlet NSMenuItem * o_mi_audioeffects;
     IBOutlet NSMenuItem * o_mi_extended;
     IBOutlet NSMenuItem * o_mi_bookmarks;
     IBOutlet NSMenuItem * o_mi_playlist;
@@ -337,34 +343,43 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
 
     AppleRemote * o_remote;
     BOOL b_remote_button_hold; /* true as long as the user holds the left,right,plus or minus on the remote control */
+
+    /* media key support */
+    BOOL b_mediaKeySupport;
+    BOOL b_mediakeyJustJumped;
+    SPMediaKeyTap * o_mediaKeyController;
+
+    NSArray *o_usedHotkeys;
 }
 
 + (VLCMain *)sharedInstance;
 
-- (intf_thread_t *)getIntf;
+- (intf_thread_t *)intf;
 - (void)setIntf:(intf_thread_t *)p_mainintf;
 
-- (void)controlTintChanged;
-
-- (id)getControls;
-- (id)getSimplePreferences;
-- (id)getPreferences;
-- (id)getPlaylist;
+- (id)controls;
+- (id)simplePreferences;
+- (id)preferences;
+- (id)playlist;
 - (BOOL)isPlaylistCollapsed;
-- (id)getInfo;
-- (id)getWizard;
-- (id)getBookmarks;
-- (id)getEmbeddedList;
-- (id)getCoreDialogProvider;
-- (id)getMainIntfPgbar;
-- (id)getControllerWindow;
-- (id)getVoutMenu;
-- (id)getEyeTVController;
+- (id)info;
+- (id)wizard;
+- (id)bookmarks;
+- (id)embeddedList;
+- (id)coreDialogProvider;
+- (id)mainIntfPgbar;
+- (id)controllerWindow;
+- (id)voutMenu;
+- (id)eyeTVController;
+- (id)appleRemoteController;
 - (void)applicationWillTerminate:(NSNotification *)notification;
 - (NSString *)localizedString:(const char *)psz;
 - (char *)delocalizeString:(NSString *)psz;
 - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
 - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event;
+- (NSString *)VLCKeyToString:(NSString *)theString;
+- (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
+- (void)updateCurrentlyUsedHotkeys;
 
 - (void)initStrings;
 
@@ -392,14 +407,14 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
 - (IBAction)intfOpenCapture:(id)sender;
 
 - (IBAction)showWizard:(id)sender;
-- (IBAction)showVLM:(id)sender;
 - (IBAction)showExtended:(id)sender;
+- (IBAction)showAudioEffects:(id)sender;
+- (IBAction)showTrackSynchronization:(id)sender;
 - (IBAction)showBookmarks:(id)sender;
 
 - (IBAction)viewAbout:(id)sender;
 - (IBAction)showLicense:(id)sender;
 - (IBAction)viewPreferences:(id)sender;
-- (IBAction)checkForUpdate:(id)sender;
 - (IBAction)viewHelp:(id)sender;
 - (IBAction)openReadMe:(id)sender;
 - (IBAction)openDocumentation:(id)sender;
@@ -419,10 +434,13 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
 
 - (void)windowDidBecomeKey:(NSNotification *)o_notification;
 
+- (void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
 @end
 
 @interface VLCMain (Internal)
 - (void)handlePortMessage:(NSPortMessage *)o_msg;
+- (void)resetMediaKeyJump;
+- (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification;
 @end
 
 /*****************************************************************************
@@ -431,10 +449,5 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
 
 @interface VLCApplication : NSApplication
 {
-    BOOL b_justJumped;
 }
-
-- (void)sendEvent: (NSEvent*)event;
-- (void)resetJump;
-
 @end