+ * VLCApplication interface
+ *****************************************************************************/
+@interface VLCApplication : NSApplication
+{
+}
+
+@end
+
+/*****************************************************************************
+ * VLCApplication implementation
+ *****************************************************************************/
+@implementation VLCApplication
+
+- (void)stop: (id)sender
+{
+ NSEvent *o_event;
+ [super stop:sender];
+
+ /* send a dummy event to break out of the event loop */
+ o_event = [NSEvent mouseEventWithType: NSLeftMouseDown
+ location: NSMakePoint( 1, 1 ) modifierFlags: 0
+ timestamp: 1 windowNumber: [[NSApp mainWindow] windowNumber]
+ context: [NSGraphicsContext currentContext] eventNumber: 1
+ clickCount: 1 pressure: 0.0];
+ [NSApp postEvent: o_event atStart: YES];
+}
+
+- (void)terminate: (id)sender
+{
+ if( [NSApp isRunning] )
+ [NSApp stop:sender];
+ [super terminate: sender];
+}
+
+@end
+
+#endif /* SYS_DARWIN */
+
+/*****************************************************************************
+ * main: parse command line, start interface and spawn threads.