]> git.sesse.net Git - vlc/commitdiff
* ./plugins/macosx: rewrote the net panel for OS X
authorChristophe Massiot <massiot@videolan.org>
Sun, 2 Jun 2002 22:32:46 +0000 (22:32 +0000)
committerChristophe Massiot <massiot@videolan.org>
Sun, 2 Jun 2002 22:32:46 +0000 (22:32 +0000)
ChangeLog
extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
plugins/macosx/intf_controller.m
plugins/macosx/intf_open.h
plugins/macosx/intf_open.m
plugins/macosx/intf_vlc_wrapper.h
plugins/macosx/intf_vlc_wrapper.m

index 279ff240e0d5b2b9835c19c67283ebd159f23450..b992968dfc27c28b1f3cf5a9866347edc0df5b5d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -36,6 +36,7 @@ HEAD
 0.4.1
 Not released yet
 
+  * ./plugins/macosx: rewrote the net panel for OS X
   * ./plugins/spudec/spu_decoder.c: fixed a margin bug in the SPU renderer
     which caused subtitles to appear slanted in odd width windows.
   * ./plugins/gtk/gtk_display.c, ./plugins/win32/mainframe.cpp: we deactivate
index eed22e710560f963d16ee513b0d70f14ecb9f435..f51f4abbb4b18d1f8399f32c3bd7960e78883c96 100644 (file)
@@ -41,8 +41,7 @@
                 openDiscTypeChanged = id; 
                 openFile = id; 
                 openNet = id; 
-                openNetBroadcast = id; 
-                openNetChannel = id; 
+                openNetProtocol = id; 
                 panelCancel = id; 
                 panelOk = id; 
             }; 
                 o_disc_panel = id; 
                 o_disc_title = id; 
                 o_disc_type = id; 
-                o_net_channel_addr = id; 
-                o_net_channel_checkbox = id; 
-                o_net_channel_port = id; 
-                o_net_channel_port_label = id; 
-                o_net_channel_pstepper = id; 
                 o_net_panel = id; 
                 o_net_protocol = id; 
                 o_net_server_addr = id; 
                 o_net_server_addr_label = id; 
-                o_net_server_baddr = id; 
-                o_net_server_bcheckbox = id; 
                 o_net_server_port = id; 
                 o_net_server_port_label = id; 
                 o_net_server_pstepper = id; 
index e7f4b2e2acf3dd3a22ca72c689e998e601364694..3d26d1a69346ab091cbfe704164175afd7e08a3b 100644 (file)
@@ -2,7 +2,7 @@
  * intf_controller.c: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_controller.m,v 1.7 2002/06/02 12:16:31 massiot Exp $
+ * $Id: intf_controller.m,v 1.8 2002/06/02 22:31:52 massiot Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
 - (BOOL)validateMenuItem:(id)sender
 {
     NSMenuItem * o_item = (NSMenuItem *)sender;
+    int tag = [o_item tag];
 
-    if ( [o_item tag] == 12 || [o_item tag] == 13 )
+    if ( tag == 12 || tag == 13 )
     {
         if( !config_GetIntVariable( "network-channel" ) )
         {
             return NO;
         }
+        if ( tag == 12 && !p_main->p_intf->p_sys->i_channel )
+        {
+            return NO;
+        }
     }
         
     return YES;
index 330a075f8cb4e3fcfd5cc85438b7103c805f10f4..a9f1f57db0376bf8642be3403efd8331aff5e1fc 100644 (file)
@@ -2,7 +2,7 @@
  * intf_open.h: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_open.h,v 1.2 2002/05/06 22:59:46 massiot Exp $
+ * $Id: intf_open.h,v 1.3 2002/06/02 22:31:52 massiot Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> 
  *
@@ -41,15 +41,8 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
     
     IBOutlet id o_net_panel;
     IBOutlet id o_net_protocol;
-    IBOutlet id o_net_channel_addr;
-    IBOutlet id o_net_channel_checkbox;
-    IBOutlet id o_net_channel_port;
-    IBOutlet id o_net_channel_port_label;
-    IBOutlet id o_net_channel_pstepper;
     IBOutlet id o_net_server_addr;
     IBOutlet id o_net_server_addr_label;
-    IBOutlet id o_net_server_baddr;
-    IBOutlet id o_net_server_bcheckbox;
     IBOutlet id o_net_server_port;
     IBOutlet id o_net_server_port_label;
     IBOutlet id o_net_server_pstepper;
@@ -65,8 +58,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
 - (IBAction)openFile:(id)sender;
 
 - (IBAction)openNet:(id)sender;
-- (IBAction)openNetBroadcast:(id)sender;
-- (IBAction)openNetChannel:(id)sender;
+- (IBAction)openNetProtocol:(id)sender;
 
 - (IBAction)panelCancel:(id)sender;
 - (IBAction)panelOk:(id)sender;
index 22db12a06214527faa603466a3e66c4e770e4622..efba6afd5675f65c54835ddefba4dd57f001a04c 100644 (file)
@@ -2,7 +2,7 @@
  * intf_open.c: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_open.m,v 1.3 2002/05/23 22:18:55 jlj Exp $
+ * $Id: intf_open.m,v 1.4 2002/06/02 22:31:52 massiot Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> 
  *
@@ -139,18 +139,12 @@ static Intf_Open *o_open = nil;
 
 - (void)awakeFromNib
 {
-    [o_net_channel_pstepper setEnabled: FALSE];
-    
-    [o_net_server_addr addItemWithObjectValue: @"vls"];
-    [o_net_server_addr selectItemAtIndex: 0];
-    
-    [o_net_server_baddr setStringValue: @"138.195.159.255"];
+    [o_net_server_addr setEnabled: NSOffState];
+    [o_net_server_addr_label setStringValue: @"Address"];
+    [o_net_server_port setEnabled: NSOnState];
     [o_net_server_port setIntValue: 1234];
+    [o_net_server_pstepper setEnabled: NSOnState];
     [o_net_server_pstepper setIntValue: [o_net_server_port intValue]];
-
-    [o_net_channel_addr setStringValue: @"vlcs"];
-    [o_net_channel_port setIntValue: 6010];
-    [o_net_channel_pstepper setIntValue: [o_net_channel_port intValue]];
 }
 
 - (IBAction)openDisc:(id)sender
@@ -242,89 +236,70 @@ static Intf_Open *o_open = nil;
 
     if( i_result )
     {
-        BOOL b_channel;
-        BOOL b_broadcast;
         NSString *o_protocol;
+        int i_port = [o_net_server_port intValue];
+        NSString *o_addr = [o_net_server_addr stringValue];
 
         o_protocol = [[o_net_protocol selectedCell] title];
-        b_channel = [o_net_channel_checkbox state] == NSOnState;
-        b_broadcast = [o_net_server_bcheckbox state] == NSOnState;
 
-        if( [o_protocol isEqualToString: @"TS"] )
+        if( [o_protocol isEqualToString: @"UDP"] )
         {
-            o_protocol = @"udpstream";
+            [[Intf_VLCWrapper instance] openNet: @"" port: i_port]; 
         }
-        else if( [o_protocol isEqualToString: @"RTP"] ) 
+        else if( [o_protocol isEqualToString: @"UDP - multicast"] ) 
         {
-            o_protocol = @"rtp";
+            [[Intf_VLCWrapper instance] openNet: o_addr port: i_port]; 
         }
-
-        if( b_channel )
+        else if( [o_protocol isEqualToString: @"Channel server"] ) 
         {
-            NSString *o_channel_addr = [o_net_channel_addr stringValue];
-            int i_channel_port = [o_net_channel_port intValue];
-
-            [[Intf_VLCWrapper instance]
-                openNetChannel: o_channel_addr port: i_channel_port];
+            [[Intf_VLCWrapper instance] openNetChannel: o_addr port: i_port]; 
         }
-        else
+        else if( [o_protocol isEqualToString: @"HTTP"] ) 
         {
-            NSString *o_addr = [o_net_server_addr stringValue];
-            int i_port = [o_net_server_port intValue];
-
-            if( b_broadcast )
-            {
-                NSString *o_baddr = [o_net_server_baddr stringValue];
-
-                [[Intf_VLCWrapper instance]
-                    openNet: o_protocol addr: o_addr
-                        port: i_port baddr: o_baddr]; 
-            }
-            else
-            {
-                [[Intf_VLCWrapper instance]
-                    openNet: o_protocol addr: o_addr
-                        port: i_port baddr: nil];
-            } 
-        } 
+            [[Intf_VLCWrapper instance] openNetHTTP: o_addr]; 
+        }
     }
 }
 
-- (IBAction)openNetBroadcast:(id)sender
-{
-    BOOL b_broadcast;
-    
-    b_broadcast = [o_net_server_bcheckbox state] == NSOnState;
-    [o_net_server_baddr setEnabled: b_broadcast];
-}
-
-- (IBAction)openNetChannel:(id)sender
+- (IBAction)openNetProtocol:(id)sender
 {
-    BOOL b_channel;
-    BOOL b_broadcast;
-    NSColor *o_color;
-    
-    b_channel = [o_net_channel_checkbox state] == NSOnState;
-    b_broadcast = [o_net_server_bcheckbox state] == NSOnState;
-    
-    o_color = b_channel ? [NSColor controlTextColor] : 
-        [NSColor disabledControlTextColor];
+    NSString *o_protocol;
 
-    [o_net_channel_addr setEnabled: b_channel];
-    [o_net_channel_port setEnabled: b_channel];
-    [o_net_channel_port_label setTextColor: o_color];
-    [o_net_channel_pstepper setEnabled: b_channel];
+    o_protocol = [[o_net_protocol selectedCell] title];
     
-    o_color = !b_channel ? [NSColor controlTextColor] : 
-        [NSColor disabledControlTextColor];    
-        
-    [o_net_server_addr setEnabled: !b_channel];
-    [o_net_server_addr_label setTextColor: o_color];
-    [o_net_server_port setEnabled: !b_channel];
-    [o_net_server_port_label setTextColor: o_color];
-    [o_net_server_pstepper setEnabled: !b_channel];
-    [o_net_server_bcheckbox setEnabled: !b_channel];
-    [o_net_server_baddr setEnabled: b_broadcast && !b_channel];
+    if( [o_protocol isEqualToString: @"UDP"] )
+    {
+        [o_net_server_addr setEnabled: NSOffState];
+        [o_net_server_port setEnabled: NSOnState];
+        [o_net_server_port setIntValue: 1234];
+        [o_net_server_pstepper setEnabled: NSOnState];
+    }
+    else if( [o_protocol isEqualToString: @"UDP - multicast"] ) 
+    {
+        [o_net_server_addr setEnabled: NSOnState];
+        [o_net_server_addr_label setStringValue: @"Mult. addr."];
+        [o_net_server_port setEnabled: NSOnState];
+        [o_net_server_port setIntValue: 1234];
+        [o_net_server_pstepper setEnabled: NSOnState];
+    }
+    else if( [o_protocol isEqualToString: @"Channel server"] ) 
+    {
+        [o_net_server_addr setEnabled: NSOnState];
+        [o_net_server_addr_label setStringValue: @"Server"];
+        [o_net_server_addr setStringValue: @"vlcs"];
+        [o_net_server_port setEnabled: NSOnState];
+        [o_net_server_port setIntValue: 6010];
+        [o_net_server_pstepper setEnabled: NSOnState];
+    }
+    else if( [o_protocol isEqualToString: @"HTTP"] ) 
+    {
+        [o_net_server_addr setEnabled: NSOnState];
+        [o_net_server_addr_label setStringValue: @"URL"];
+        [o_net_server_addr setStringValue: @"http://"];
+        [o_net_server_port setEnabled: NSOffState];
+        [o_net_server_pstepper setEnabled: NSOffState];
+    }
+    [o_net_server_pstepper setIntValue: [o_net_server_port intValue]];
 }
 
 - (IBAction)panelCancel:(id)sender
index 534e191eff09e9103439b27697e3a42a72b44abd..f5b7525d23dcd34ce9af0a5a6b67d61bd9ce5bf0 100644 (file)
@@ -2,7 +2,7 @@
  * intf_vlc_wrapper.h: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_vlc_wrapper.h,v 1.10 2002/06/02 12:16:31 massiot Exp $
+ * $Id: intf_vlc_wrapper.h,v 1.11 2002/06/02 22:31:52 massiot Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -72,8 +72,9 @@
 /* open file/disc/network */
 - (void)openFiles:(NSArray*)o_files;
 - (void)openDisc:(NSString*)o_type device:(NSString*)o_device title:(int)i_title chapter:(int)i_chapter;
-- (void)openNet:(NSString*)o_protocol addr:(NSString*)o_addr port:(int)i_port baddr:(NSString*)o_baddr;
+- (void)openNet:(NSString*)o_addr port:(int)i_port;
 - (void)openNetChannel:(NSString*)o_addr port:(int)i_port;
+- (void)openNetHTTP:(NSString*)o_addr;
 
 /* menus management */
 - (void)toggleProgram:(id)sender;
index 4a1cd8f4a26901cd0178aff06317d67152e099ce..5e72c0f75dbe88ffc15f70507a26bbcc0c97178c 100644 (file)
@@ -2,7 +2,7 @@
  * intf_vlc_wrapper.c: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_vlc_wrapper.m,v 1.11 2002/06/02 12:16:31 massiot Exp $
+ * $Id: intf_vlc_wrapper.m,v 1.12 2002/06/02 22:31:52 massiot Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -578,7 +578,7 @@ static Intf_VLCWrapper *o_intf = nil;
     }
 }
 
-- (void)openNet:(NSString*)o_protocol addr:(NSString*)o_addr port:(int)i_port baddr:(NSString*)o_baddr
+- (void)openNet:(NSString*)o_addr port:(int)i_port
 {
     NSString *o_source;
     int i_end = p_main->p_playlist->i_size;
@@ -589,18 +589,10 @@ static Intf_VLCWrapper *o_intf = nil;
         p_input_bank->pp_input[0]->b_eof = 1;
     }
 
-    config_PutIntVariable( "network_channel", 0 );
+    config_PutIntVariable( "network-channel", 0 );
 
-    if( o_baddr != nil )
-    {
-        o_source = [NSString stringWithFormat: @"%@://%@@:%i/%@",
-                        o_protocol, o_addr, i_port, o_baddr];
-    }
-    else
-    {
-        o_source = [NSString stringWithFormat: @"%@://%@@:%i",
-                        o_protocol, o_addr, i_port];
-    }
+    o_source = [NSString stringWithFormat: @"udpstream:@%@:%i",
+                o_addr, i_port];
 
     if ( p_intf->p_sys->b_loop )
     {
@@ -627,15 +619,46 @@ static Intf_VLCWrapper *o_intf = nil;
         p_input_bank->pp_input[0]->b_eof = 1;
     }
 
-    config_PutIntVariable( "network_channel", 1 );
+    config_PutIntVariable( "network-channel", 1 );
 
     if( p_main->p_channel == NULL )
     {
         network_ChannelCreate();
     }
 
-    config_PutPszVariable( "channel_server", (char*)[o_addr lossyCString] );
-    config_PutIntVariable( "channel_port", i_port ); 
+    config_PutPszVariable( "channel-server", (char*)[o_addr lossyCString] );
+    config_PutIntVariable( "channel-port", i_port ); 
+}
+
+- (void)openNetHTTP:(NSString*)o_addr
+{
+    NSString *o_source;
+    int i_end = p_main->p_playlist->i_size;
+    intf_thread_t * p_intf = p_main->p_intf;
+
+    if( p_input_bank->pp_input[0] != NULL )
+    {
+        p_input_bank->pp_input[0]->b_eof = 1;
+    }
+
+    config_PutIntVariable( "network-channel", 0 );
+
+    if ( p_intf->p_sys->b_loop )
+    {
+        intf_PlaylistDelete( p_main->p_playlist,
+                             p_main->p_playlist->i_size - 1 );
+    }
+
+    intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END,
+                      [o_addr fileSystemRepresentation] );
+
+    intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
+
+    if ( p_intf->p_sys->b_loop )
+    {
+        intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, 
+                          "vlc:loop" );
+    }
 }
 
 - (void)toggleProgram:(id)sender