ALL: New output dialog that uses the new --sout syntax.
authorDerk-Jan Hartman <hartman@videolan.org>
Wed, 30 Apr 2003 23:58:56 +0000 (23:58 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Wed, 30 Apr 2003 23:58:56 +0000 (23:58 +0000)
  - it is not so powerful as --sout (does not allow for multiple unicasts ie)
  - there is a bug in the transcode settings. not sure what is causing it.

extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib
extras/MacOSX/vlc.pbproj/project.pbxproj
modules/gui/macosx/Modules.am
modules/gui/macosx/open.h
modules/gui/macosx/open.m
modules/gui/macosx/output.h [new file with mode: 0644]
modules/gui/macosx/output.m [new file with mode: 0644]

index 8e3794c..8ab51cb 100644 (file)
                 openVTSBrowse = id; 
                 panelCancel = id; 
                 panelOk = id; 
-                soutChanged = id; 
-                soutCloseSheet = id; 
-                soutFileBrowse = id; 
-                soutModeChanged = id; 
-                soutSettings = id; 
-                soutStepperChanged = id; 
                 subCloseSheet = id; 
                 subDelayStepperChanged = id; 
                 subFileBrowse = id; 
                 "o_net_udpm_port_stp" = id; 
                 "o_panel" = id; 
                 "o_playlist" = id; 
-                "o_sout_access" = id; 
-                "o_sout_access_lbl" = id; 
-                "o_sout_btn_ok" = id; 
-                "o_sout_cbox" = id; 
-                "o_sout_file_btn_browse" = id; 
-                "o_sout_file_path" = id; 
-                "o_sout_mrl" = id; 
-                "o_sout_mrl_lbl" = id; 
-                "o_sout_mux" = id; 
-                "o_sout_mux_lbl" = id; 
-                "o_sout_settings" = id; 
-                "o_sout_sheet" = id; 
-                "o_sout_udp_addr" = id; 
-                "o_sout_udp_addr_lbl" = id; 
-                "o_sout_udp_port" = id; 
-                "o_sout_udp_port_lbl" = id; 
-                "o_sout_udp_port_stp" = id; 
                 "o_tabview" = id; 
             }; 
             SUPERCLASS = NSObject; 
         }, 
+        {
+            ACTIONS = {
+                outputChanged = id; 
+                outputCloseSheet = id; 
+                outputFileBrowse = id; 
+                outputInfoChanged = id; 
+                outputMethodChanged = id; 
+                outputSettings = id; 
+                streamPortStepperChanged = id; 
+                streamTTLStepperChanged = id; 
+                transcodeChanged = id; 
+                transcodeInfoChanged = id; 
+            }; 
+            CLASS = VLCOutput; 
+            LANGUAGE = ObjC; 
+            OUTLETS = {
+                "o_btn_browse" = id; 
+                "o_btn_ok" = id; 
+                "o_display" = id; 
+                "o_file_field" = id; 
+                "o_method" = id; 
+                "o_mux_lbl" = id; 
+                "o_mux_selector" = id; 
+                "o_open_panel" = id; 
+                "o_options_lbl" = id; 
+                "o_output_ckbox" = id; 
+                "o_output_settings" = id; 
+                "o_output_sheet" = id; 
+                "o_stream_address" = id; 
+                "o_stream_address_lbl" = id; 
+                "o_stream_port" = id; 
+                "o_stream_port_lbl" = id; 
+                "o_stream_port_stp" = id; 
+                "o_stream_ttl" = id; 
+                "o_stream_ttl_lbl" = id; 
+                "o_stream_ttl_stp" = id; 
+                "o_stream_type" = id; 
+                "o_stream_type_lbl" = id; 
+                "o_transcode_audio_bitrate" = id; 
+                "o_transcode_audio_bitrate_lbl" = id; 
+                "o_transcode_audio_chkbox" = id; 
+                "o_transcode_audio_selector" = id; 
+                "o_transcode_lbl" = id; 
+                "o_transcode_video_bitrate" = id; 
+                "o_transcode_video_bitrate_lbl" = id; 
+                "o_transcode_video_chkbox" = id; 
+                "o_transcode_video_selector" = id; 
+            }; 
+            SUPERCLASS = NSObject; 
+        }, 
         {
             ACTIONS = {deleteItems = id; playItem = id; selectAll = id; }; 
             CLASS = VLCPlaylist; 
index af17fe2..d0bc185 100644 (file)
@@ -3,7 +3,7 @@
 <plist version="1.0">
 <dict>
        <key>IBDocumentLocation</key>
-       <string>38 65 365 441 0 0 1280 1002 </string>
+       <string>36 88 365 441 0 0 1280 1002 </string>
        <key>IBEditorPositions</key>
        <dict>
                <key>29</key>
        </array>
        <key>IBOpenObjects</key>
        <array>
-               <integer>1345</integer>
+               <integer>1411</integer>
                <integer>29</integer>
        </array>
        <key>IBSystem Version</key>
-       <string>6I32</string>
+       <string>6L29</string>
 </dict>
 </plist>
index 33509d5..498649c 100644 (file)
Binary files a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib and b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib differ
index b9687c8..c7296e9 100644 (file)
                                8ED6C28403E2EB1C0059A3A7,
                                8ED6C28503E2EB1C0059A3A7,
                                8ED6C28603E2EB1C0059A3A7,
+                               8E55FB7F0459B0FD00FB3317,
+                               8E55FB800459B0FD00FB3317,
                                8ED6C28703E2EB1C0059A3A7,
                                8ED6C28803E2EB1C0059A3A7,
                        );
 //8E2
 //8E3
 //8E4
+               8E55FB7F0459B0FD00FB3317 = {
+                       fileEncoding = 30;
+                       isa = PBXFileReference;
+                       name = output.h;
+                       path = /Volumes/Users/pjotr/Development/vlc/modules/gui/macosx/output.h;
+                       refType = 0;
+               };
+               8E55FB800459B0FD00FB3317 = {
+                       fileEncoding = 30;
+                       isa = PBXFileReference;
+                       name = output.m;
+                       path = /Volumes/Users/pjotr/Development/vlc/modules/gui/macosx/output.m;
+                       refType = 0;
+               };
                8E6BC6F6041643860059A3A7 = {
                        fileEncoding = 4;
                        isa = PBXFileReference;
index 2b6cfaf..44a0828 100644 (file)
@@ -18,6 +18,8 @@ SOURCES_macosx = \
        modules/gui/macosx/playlist.h \
        modules/gui/macosx/prefs.m \
        modules/gui/macosx/prefs.h \
+       modules/gui/macosx/output.h \
+       modules/gui/macosx/output.m \
        modules/gui/macosx/vout.m \
        modules/gui/macosx/vout.h \
        $(NULL)
index 0c36aa5..02a8baa 100644 (file)
@@ -2,7 +2,7 @@
  * open.h: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: open.h,v 1.13 2003/03/26 03:13:30 hartman Exp $
+ * $Id: open.h,v 1.14 2003/04/30 23:58:56 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -71,24 +71,6 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
     IBOutlet id o_net_http_url;
     IBOutlet id o_net_http_url_lbl;
 
-    IBOutlet id o_sout_cbox;
-    IBOutlet id o_sout_settings;
-    IBOutlet id o_sout_sheet;
-    IBOutlet id o_sout_mrl_lbl;
-    IBOutlet id o_sout_mrl;
-    IBOutlet id o_sout_access;
-    IBOutlet id o_sout_access_lbl;
-    IBOutlet id o_sout_file_path;
-    IBOutlet id o_sout_file_btn_browse;
-    IBOutlet id o_sout_udp_addr;
-    IBOutlet id o_sout_udp_addr_lbl;
-    IBOutlet id o_sout_udp_port;
-    IBOutlet id o_sout_udp_port_lbl;
-    IBOutlet id o_sout_udp_port_stp;
-    IBOutlet id o_sout_mux;
-    IBOutlet id o_sout_mux_lbl;
-    IBOutlet id o_sout_btn_ok;
-    
     IBOutlet id o_file_sub_ckbox;
     IBOutlet id o_file_sub_btn_settings;
     IBOutlet id o_file_sub_sheet;
@@ -125,14 +107,6 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
 - (IBAction)openNetStepperChanged:(id)sender;
 - (void)openNetInfoChanged:(NSNotification *)o_notification;
 
-- (IBAction)soutChanged:(id)sender;
-- (IBAction)soutSettings:(id)sender;
-- (IBAction)soutFileBrowse:(id)sender;
-- (void)soutModeChanged:(NSNotification *)o_notification;
-- (void)soutInfoChanged:(NSNotification *)o_notification;
-- (IBAction)soutStepperChanged:(id)sender;
-- (IBAction)soutCloseSheet:(id)sender;
-
 - (IBAction)subsChanged:(id)sender;
 - (IBAction)subSettings:(id)sender;
 - (IBAction)subFileBrowse:(id)sender;
index 0ffbe66..d4252c1 100644 (file)
@@ -2,7 +2,7 @@
  * open.m: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: open.m,v 1.29 2003/04/15 14:05:13 hartman Exp $
+ * $Id: open.m,v 1.30 2003/04/30 23:58:56 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> 
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -132,17 +132,6 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
 - (void)awakeFromNib
 {
     intf_thread_t * p_intf = [NSApp getIntf];
-    char * psz_sout = config_GetPsz( p_intf, "sout" );
-
-    if ( psz_sout != NULL && *psz_sout )
-    {
-        [o_sout_cbox setState: YES];
-    }
-    else
-    {
-        [o_sout_cbox setState: NO];
-    }
-    free(psz_sout);
 
     [o_panel setTitle: _NS("Open Source")];
     [o_mrl_lbl setTitle: _NS("Media Resource Locator (MRL)")];
@@ -180,27 +169,6 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
     [o_net_udp_port setIntValue: config_GetInt( p_intf, "server-port" )];
     [o_net_udp_port_stp setIntValue: config_GetInt( p_intf, "server-port" )];
 
-    [o_sout_cbox setTitle: _NS("Stream output:")];
-    [o_sout_btn_ok setTitle: _NS("OK")];
-    [o_sout_settings setTitle: _NS("Settings...")];
-    [o_sout_mrl_lbl setTitle: _NS("Stream output MRL")];
-    
-    [o_sout_access_lbl setTitle: _NS("Output Method")];
-    [[o_sout_access cellAtRow:0 column:0] setTitle: _NS("File")];
-    [[o_sout_access cellAtRow:1 column:0] setTitle: _NS("HTTP")];
-    [[o_sout_access cellAtRow:2 column:0] setTitle: _NS("UDP")];
-    [[o_sout_access cellAtRow:3 column:0] setTitle: _NS("RTP")];
-
-    [o_sout_file_btn_browse setTitle: _NS("Browse...")];
-    [o_sout_udp_addr_lbl setStringValue: _NS("Address")];
-    [o_sout_udp_port_lbl setStringValue: _NS("Port")];
-
-    [o_sout_mux_lbl setTitle: _NS("Encapsulation Method")];
-    [[o_sout_mux cellAtRow:0 column:0] setTitle: _NS("MPEG TS")];
-    [[o_sout_mux cellAtRow:0 column:1] setTitle: _NS("MPEG PS")];
-    [[o_sout_mux cellAtRow:0 column:2] setTitle: _NS("AVI")];
-    [[o_sout_mux cellAtRow:0 column:3] setTitle: _NS("Ogg")];
-    
     [o_file_sub_ckbox setTitle: _NS("Load subtitles file:")];
     [o_file_sub_btn_settings setTitle: _NS("Settings...")];
     [o_file_sub_btn_browse setTitle: _NS("Browse...")];
@@ -249,19 +217,6 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
         selector: @selector(openNetInfoChanged:)
         name: NSControlTextDidChangeNotification
         object: o_net_http_url];
-
-    [[NSNotificationCenter defaultCenter] addObserver: self
-        selector: @selector(soutInfoChanged:)
-        name: NSControlTextDidChangeNotification
-        object: o_sout_file_path];
-    [[NSNotificationCenter defaultCenter] addObserver: self
-        selector: @selector(soutInfoChanged:)
-        name: NSControlTextDidChangeNotification
-        object: o_sout_udp_addr];
-    [[NSNotificationCenter defaultCenter] addObserver: self
-        selector: @selector(soutInfoChanged:)
-        name: NSControlTextDidChangeNotification
-        object: o_sout_udp_port];
 }
 
 - (void)openTarget:(int)i_type
@@ -276,17 +231,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
 
     if( i_result )
     {
-        NSString *o_sout = [o_sout_mrl stringValue];
         intf_thread_t * p_intf = [NSApp getIntf];
-        
-        if ( [o_sout_cbox state] )
-        {
-            config_PutPsz( p_intf, "sout", [o_sout lossyCString] );
-        }
-        else
-        {
-            config_PutPsz( p_intf, "sout", "" );
-        }
 
         NSString *o_source = [o_mrl stringValue];
         BOOL b_enq = [o_ckbox_enqueue state] == NSOnState ? YES : NO;
@@ -311,7 +256,6 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
             config_PutFloat( p_intf, "sub-fps", 0.0 );
         }
     }
-    [self soutModeChanged: nil];
 }
 
 - (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi
@@ -663,140 +607,6 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
     [o_mrl setStringValue: o_mrl_string];
 }
 
-- (IBAction)soutChanged:(id)sender;
-{
-    if ([o_sout_cbox state] == NSOnState)
-    {
-        [o_sout_settings setEnabled:YES];
-    }
-    else
-    {
-        [o_sout_settings setEnabled:NO];
-    }
-}
-
-- (IBAction)soutSettings:(id)sender
-{
-    [self soutModeChanged: nil];
-    [NSApp beginSheet: o_sout_sheet
-        modalForWindow: [sender window]
-        modalDelegate: self
-        didEndSelector: NULL
-        contextInfo: nil];
-}
-
-- (IBAction)soutFileBrowse:(id)sender
-{
-    NSSavePanel *o_save_panel = [NSSavePanel savePanel];
-    NSString *o_mux_string;
-    if ( [[[o_sout_mux selectedCell] title] isEqualToString: _NS("MPEG PS")] )
-        o_mux_string = @"vob";
-    else if ( [[[o_sout_mux selectedCell] title] isEqualToString: _NS("AVI")] )
-        o_mux_string = @"avi";
-    else if ( [[[o_sout_mux selectedCell] title] isEqualToString: _NS("Ogg")] )
-        o_mux_string = @"ogm";
-    else
-        o_mux_string = @"ts";
-
-    NSString * o_name = [NSString stringWithFormat: @"vlc-output.%@",
-                         o_mux_string];
-
-    [o_save_panel setTitle: _NS("Save File")];
-    [o_save_panel setPrompt: _NS("Save")];
-
-    if( [o_save_panel runModalForDirectory: nil
-            file: o_name] == NSOKButton )
-    {
-        NSString *o_filename = [o_save_panel filename];
-        [o_sout_file_path setStringValue: o_filename];
-        [self soutInfoChanged: nil];
-    }
-}
-
-- (void)soutModeChanged:(NSNotification *)o_notification
-{
-    NSString *o_mode;
-    BOOL b_file = FALSE;
-    BOOL b_net = FALSE;
-
-    o_mode = [[o_sout_access selectedCell] title];
-
-    if( [o_mode isEqualToString: _NS("File")] ) b_file = TRUE;   
-    else if( [o_mode isEqualToString: _NS("UDP")] ) b_net = TRUE;
-    else if( [o_mode isEqualToString: _NS("RTP")] ) b_net = TRUE;
-
-    [o_sout_file_path setEnabled: b_file];
-    [o_sout_file_btn_browse setEnabled: b_file];
-    [o_sout_udp_addr setEnabled: !b_file];
-    [o_sout_udp_port setEnabled: !b_file];
-    [o_sout_udp_port_stp setEnabled: !b_file ];
-    
-    [[o_sout_mux cellAtRow:0 column: 1] setEnabled: !b_net];
-    [[o_sout_mux cellAtRow:0 column: 2] setEnabled: !b_net];
-    [[o_sout_mux cellAtRow:0 column: 3] setEnabled: !b_net];
-    if ( b_net )
-    {
-        [o_sout_mux selectCellAtRow:0 column: 0];
-    }
-
-    [self soutInfoChanged: nil];
-}
-
-- (void)soutInfoChanged:(NSNotification *)o_notification
-{
-    NSString *o_mode;
-    NSString *o_mux;
-    NSString *o_mrl_string;
-    NSString *o_mux_string;
-
-    o_mode = [[o_sout_access selectedCell] title];
-    o_mux = [[o_sout_mux selectedCell] title];
-
-    if ( [o_mux isEqualToString: _NS("AVI")] ) o_mux_string = @"avi";
-    else if ( [o_mux isEqualToString: _NS("Ogg")] ) o_mux_string = @"ogg";
-    else if ( [o_mux isEqualToString: _NS("MPEG PS")] ) o_mux_string = @"ps";
-    else o_mux_string = @"ts";
-
-    if ( [o_mode isEqualToString: _NS("File")] )
-    {
-        o_mrl_string = [NSString stringWithFormat: @"file/%@://%@",
-                        o_mux_string, [o_sout_file_path stringValue]];
-    }
-    else if ( [o_mode isEqualToString: _NS("HTTP")] )
-    {
-        o_mrl_string = [NSString stringWithFormat: @"http/%@://%@:%i",
-                        o_mux_string, [o_sout_udp_addr stringValue],
-                        [o_sout_udp_port intValue]];
-    }
-    else if ( [o_mode isEqualToString: _NS("UDP")] )
-    {
-        o_mrl_string = [NSString stringWithFormat: @"udp/%@://%@:%i",
-                        o_mux_string, [o_sout_udp_addr stringValue],
-                        [o_sout_udp_port intValue]];
-    }
-    else
-    {
-        o_mrl_string = [NSString stringWithFormat: @"rtp/%@://%@:%i",
-                        o_mux_string, [o_sout_udp_addr stringValue],
-                        [o_sout_udp_port intValue]];
-    }
-
-
-    [o_sout_mrl setStringValue: o_mrl_string];
-}
-
-- (IBAction)soutStepperChanged:(id)sender
-{
-    [o_sout_udp_port setIntValue: [o_sout_udp_port_stp intValue]];
-    [self soutInfoChanged: nil];
-}
-
-- (IBAction)soutCloseSheet:(id)sender
-{
-    [o_sout_sheet orderOut:sender];
-    [NSApp endSheet: o_sout_sheet];
-}
-
 - (IBAction)openFile:(id)sender
 {
     NSOpenPanel *o_open_panel = [NSOpenPanel openPanel];
diff --git a/modules/gui/macosx/output.h b/modules/gui/macosx/output.h
new file mode 100644 (file)
index 0000000..86fe974
--- /dev/null
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * output.h: MacOS X Output Dialog
+ *****************************************************************************
+ * Copyright (C) 2002-2003 VideoLAN
+ * $Id: output.h,v 1.1 2003/04/30 23:58:56 hartman Exp $
+ *
+ * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
+ *          Christophe Massiot <massiot@via.ecp.fr>
+ *          Derk-Jan Hartman <thedj@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * VLCOutput interface
+ *****************************************************************************/
+@interface VLCOutput : NSObject
+{
+    IBOutlet id o_open_panel;
+    IBOutlet id o_output_ckbox;
+    IBOutlet id o_output_settings;
+    IBOutlet id o_output_sheet;
+    IBOutlet id o_btn_ok;
+        
+    IBOutlet id o_options_lbl;
+    IBOutlet id o_display;
+    IBOutlet id o_method;
+    IBOutlet id o_file_field;
+    IBOutlet id o_btn_browse;
+    IBOutlet id o_stream_address;
+    IBOutlet id o_stream_address_lbl;
+    IBOutlet id o_stream_port;
+    IBOutlet id o_stream_port_stp;
+    IBOutlet id o_stream_port_lbl;
+    IBOutlet id o_stream_ttl;
+    IBOutlet id o_stream_ttl_stp;
+    IBOutlet id o_stream_ttl_lbl;
+    IBOutlet id o_stream_type;
+    IBOutlet id o_stream_type_lbl;
+    
+    IBOutlet id o_mux_lbl;
+    IBOutlet id o_mux_selector;
+    
+    IBOutlet id o_transcode_audio_bitrate;
+    IBOutlet id o_transcode_audio_bitrate_lbl;
+    IBOutlet id o_transcode_audio_chkbox;
+    IBOutlet id o_transcode_audio_selector;
+    IBOutlet id o_transcode_lbl;
+    IBOutlet id o_transcode_video_bitrate;
+    IBOutlet id o_transcode_video_bitrate_lbl;
+    IBOutlet id o_transcode_video_chkbox;
+    IBOutlet id o_transcode_video_selector;
+    
+    NSString *o_mrl;
+    NSString *o_transcode;
+}
+
+- (void)setMRL:(NSString *)o_mrl_string;
+- (void)setTranscode:(NSString *)o_transcode_string;
+
+- (void)initStrings;
+
+- (IBAction)outputChanged:(id)sender;
+- (IBAction)outputSettings:(id)sender;
+- (IBAction)outputCloseSheet:(id)sender;
+- (void)outputMethodChanged:(NSNotification *)o_notification;
+- (void)outputInfoChanged:(NSNotification *)o_notification;
+- (void)TTLChanged:(NSNotification *)o_notification;
+- (IBAction)outputFileBrowse:(id)sender;
+- (void)transcodeChanged:(NSNotification *)o_notification;
+- (void)transcodeInfoChanged:(NSNotification *)o_notification;
+
+@end
diff --git a/modules/gui/macosx/output.m b/modules/gui/macosx/output.m
new file mode 100644 (file)
index 0000000..c404c5a
--- /dev/null
@@ -0,0 +1,408 @@
+/*****************************************************************************
+ * output.m: MacOS X Output Dialog
+ *****************************************************************************
+ * Copyright (C) 2002-2003 VideoLAN
+ * $Id: output.m,v 1.1 2003/04/30 23:58:56 hartman Exp $
+ *
+ * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> 
+ *          Christophe Massiot <massiot@via.ecp.fr>
+ *          Derk-Jan Hartman <thedj@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include <stdlib.h>                                      /* malloc(), free() */
+#include <string.h>
+
+#include "intf.h"
+#include "output.h"
+
+/*****************************************************************************
+ * VLCOutput implementation 
+ *****************************************************************************/
+@implementation VLCOutput
+
+- (id)init
+{
+    self = [super init];
+    o_mrl = [[NSString alloc] init];
+    o_transcode = [[NSString alloc] init];
+    return self;
+}
+
+- (void)dealloc
+{
+    [o_mrl release];
+    [o_transcode release];
+    [super dealloc];
+}
+
+- (void)setMRL:(NSString *)o_mrl_string
+{
+    [o_mrl autorelease];
+    o_mrl = [o_mrl_string copy];
+}
+
+- (void)setTranscode:(NSString *)o_transcode_string
+{
+    [o_transcode autorelease];
+    o_transcode = [o_transcode_string copy];
+}
+
+- (void)awakeFromNib
+{
+    intf_thread_t * p_intf = [NSApp getIntf];
+    char * psz_sout = config_GetPsz( p_intf, "sout" );
+
+    if ( psz_sout != NULL && *psz_sout )
+    {
+        [o_output_ckbox setState: YES];
+    }
+    else
+    {
+        [o_output_ckbox setState: NO];
+    }
+    free(psz_sout);
+
+    [self initStrings];
+    
+    [[NSNotificationCenter defaultCenter] addObserver: self
+        selector: @selector(outputInfoChanged:)
+        name: NSControlTextDidChangeNotification
+        object: o_file_field];
+    [[NSNotificationCenter defaultCenter] addObserver: self
+        selector: @selector(outputInfoChanged:)
+        name: NSControlTextDidChangeNotification
+        object: o_stream_address];
+    [[NSNotificationCenter defaultCenter] addObserver: self
+        selector: @selector(outputInfoChanged:)
+        name: NSControlTextDidChangeNotification
+        object: o_stream_port];
+    [[NSNotificationCenter defaultCenter] addObserver: self
+        selector: @selector(TTLChanged:)
+        name: NSControlTextDidChangeNotification
+        object: o_stream_ttl];
+    [[NSNotificationCenter defaultCenter] addObserver: self
+        selector: @selector(transcodeInfoChanged:)
+        name: NSControlTextDidChangeNotification
+        object: o_transcode_video_bitrate];
+    [[NSNotificationCenter defaultCenter] addObserver: self
+        selector: @selector(transcodeInfoChanged:)
+        name: NSControlTextDidChangeNotification
+        object: o_transcode_audio_bitrate];
+
+    [o_mux_selector setAutoenablesItems: NO];
+    [self transcodeChanged:nil];
+}
+
+- (void)initStrings
+{
+    [o_output_ckbox setTitle: _NS("Advanced output:")];
+    [o_output_settings setTitle: _NS("Settings...")];
+    [o_btn_ok setTitle: _NS("OK")];
+    
+    [o_options_lbl setTitle: _NS("Output Options")];
+    [o_display setTitle: _NS("Screen")];
+    [[o_method cellAtRow:0 column:0] setTitle: _NS("File")];
+    [[o_method cellAtRow:1 column:0] setTitle: _NS("Stream")];
+    [o_btn_browse setTitle: _NS("Browse...")]; 
+    [o_stream_address_lbl setStringValue: _NS("Address")];
+    [o_stream_port_lbl setStringValue: _NS("Port")];
+    [o_stream_ttl_lbl setStringValue: _NS("TTL")];
+    [[o_stream_type itemAtIndex: 0] setTitle: _NS("HTTP")];
+    [[o_stream_type itemAtIndex: 1] setTitle: _NS("UDP")];
+    [[o_stream_type itemAtIndex: 2] setTitle: _NS("RTP")];
+    [o_stream_type_lbl setStringValue: _NS("Type")];
+    
+    [o_mux_lbl setStringValue: _NS("Encapsulation Method")];
+    [[o_mux_selector itemAtIndex: 0] setTitle: _NS("MPEG TS")];
+    [[o_mux_selector itemAtIndex: 1] setTitle: _NS("MPEG PS")];
+    [[o_mux_selector itemAtIndex: 2] setTitle: _NS("AVI")];
+    [[o_mux_selector itemAtIndex: 3] setTitle: _NS("Ogg")];
+    [[o_mux_selector itemAtIndex: 4] setTitle: _NS("mp4")];
+    
+    [o_transcode_lbl setTitle: _NS("Transcode options")];
+    [o_transcode_video_chkbox setTitle: _NS("Video")];
+    [[o_transcode_video_selector itemAtIndex: 0] setTitle: @"mpgv"];
+    [[o_transcode_video_selector itemAtIndex: 1] setTitle: @"mp4v"];
+    [[o_transcode_video_selector itemAtIndex: 2] setTitle: @"DIV1"];
+    [[o_transcode_video_selector itemAtIndex: 3] setTitle: @"DIV2"];
+    [[o_transcode_video_selector itemAtIndex: 4] setTitle: @"DIV3"];
+    [[o_transcode_video_selector itemAtIndex: 5] setTitle: @"H263"];
+    [[o_transcode_video_selector itemAtIndex: 6] setTitle: @"I263"];
+    [[o_transcode_video_selector itemAtIndex: 7] setTitle: @"WMV1"];
+    [o_transcode_video_bitrate_lbl setStringValue: _NS("Bitrate (bps)")];
+    [o_transcode_audio_chkbox setTitle: _NS("Audio")];
+    [[o_transcode_audio_selector itemAtIndex: 0] setTitle: _NS("mpga")];
+    [[o_transcode_audio_selector itemAtIndex: 1] setTitle: _NS("a52 ")];
+    [o_transcode_audio_bitrate_lbl setStringValue: _NS("Bitrate (bps)")];
+}
+
+- (IBAction)outputChanged:(id)sender;
+{
+    if ([o_output_ckbox state] == NSOnState)
+    {
+        [o_output_settings setEnabled:YES];
+    }
+    else
+    {
+        intf_thread_t * p_intf = [NSApp getIntf];
+        config_PutPsz( p_intf, "sout", NULL );
+        [o_output_settings setEnabled:NO];
+    }
+}
+
+- (IBAction)outputSettings:(id)sender
+{
+    [NSApp beginSheet: o_output_sheet
+        modalForWindow: o_open_panel
+        modalDelegate: self
+        didEndSelector: NULL
+        contextInfo: nil];
+}
+
+- (IBAction)outputCloseSheet:(id)sender
+{
+    intf_thread_t * p_intf = [NSApp getIntf];
+    NSLog( o_mrl );
+    config_PutPsz( p_intf, "sout", [o_mrl lossyCString] );
+    
+    [o_output_sheet orderOut:sender];
+    [NSApp endSheet: o_output_sheet];
+}
+
+- (void)outputMethodChanged:(NSNotification *)o_notification
+{
+    NSString *o_mode;
+
+    o_mode = [[o_method selectedCell] title];
+
+    if( [o_mode isEqualToString: _NS("File")] )
+    {
+        [o_file_field setEnabled: YES];
+        [o_btn_browse setEnabled: YES];
+        [o_stream_address setEnabled: NO];
+        [o_stream_port setEnabled: NO];
+        [o_stream_ttl setEnabled: NO];
+        [o_stream_port_stp setEnabled: NO];
+        [o_stream_ttl_stp setEnabled: NO];
+        [o_stream_type setEnabled: NO];
+        [o_mux_selector setEnabled: YES];
+        [[o_mux_selector itemAtIndex: 1] setEnabled: YES];
+        [[o_mux_selector itemAtIndex: 2] setEnabled: YES];
+        [[o_mux_selector itemAtIndex: 3] setEnabled: YES];
+        [[o_mux_selector itemAtIndex: 4] setEnabled: YES];
+    }
+    else if( [o_mode isEqualToString: _NS("Stream")] )
+    {
+        [o_file_field setEnabled: NO];
+        [o_btn_browse setEnabled: NO];
+        [o_stream_port setEnabled: YES];
+        [o_stream_port_stp setEnabled: YES];
+        [o_stream_type setEnabled: YES];
+        [o_mux_selector setEnabled: YES];
+        
+        o_mode = [o_stream_type titleOfSelectedItem];
+        
+        if( [o_mode isEqualToString: _NS("HTTP")] )
+        {
+            [o_stream_address setEnabled: YES];
+            [o_stream_ttl setEnabled: NO];
+            [o_stream_ttl_stp setEnabled: NO];
+            [[o_mux_selector itemAtIndex: 1] setEnabled: YES];
+            [[o_mux_selector itemAtIndex: 2] setEnabled: NO];
+            [[o_mux_selector itemAtIndex: 3] setEnabled: YES];
+            [[o_mux_selector itemAtIndex: 4] setEnabled: NO];
+        }
+        else if( [o_mode isEqualToString: _NS("UDP")] )
+        {
+            [o_stream_address setEnabled: YES];
+            [o_stream_ttl setEnabled: YES];
+            [o_stream_ttl_stp setEnabled: YES];
+            [[o_mux_selector itemAtIndex: 1] setEnabled: NO];
+            [[o_mux_selector itemAtIndex: 2] setEnabled: NO];
+            [[o_mux_selector itemAtIndex: 3] setEnabled: NO];
+            [[o_mux_selector itemAtIndex: 4] setEnabled: NO];
+        }
+        else if( [o_mode isEqualToString: _NS("RTP")] )
+        {
+            [o_stream_address setEnabled: YES];
+            [o_stream_ttl setEnabled: NO];
+            [o_stream_ttl_stp setEnabled: NO];
+            [[o_mux_selector itemAtIndex: 1] setEnabled: NO];
+            [[o_mux_selector itemAtIndex: 2] setEnabled: NO];
+            [[o_mux_selector itemAtIndex: 3] setEnabled: NO];
+            [[o_mux_selector itemAtIndex: 4] setEnabled: NO];
+        }
+    }
+    if( ![[o_mux_selector selectedItem] isEnabled] )
+    {
+        [o_mux_selector selectItemAtIndex: 0];
+    }
+    [self outputInfoChanged: nil];
+}
+
+- (void)outputInfoChanged:(NSNotification *)o_notification
+{
+    NSString *o_mode, *o_mux, *o_mux_string;
+    NSString *o_mrl_string = @"#";
+
+    if( [o_display state] == NSOnState )
+    {
+        o_mrl_string = [o_mrl_string stringByAppendingString: @"display:"];
+    }
+    o_mrl_string = [o_mrl_string stringByAppendingString: o_transcode];
+
+    o_mode = [[o_method selectedCell] title];
+    o_mux = [o_mux_selector titleOfSelectedItem];
+
+    if ( [o_mux isEqualToString: _NS("AVI")] ) o_mux_string = @"avi";
+    else if ( [o_mux isEqualToString: _NS("Ogg")] ) o_mux_string = @"ogg";
+    else if ( [o_mux isEqualToString: _NS("MPEG PS")] ) o_mux_string = @"ps";
+    else if ( [o_mux isEqualToString: _NS("mp4")] ) o_mux_string = @"mp4";
+    else o_mux_string = @"ts";
+
+    if( [o_mode isEqualToString: _NS("File")] )
+    {
+        o_mrl_string = [o_mrl_string stringByAppendingFormat:
+                        @"dst=std{access=file,mux=%@,url=\"%@\"},",
+                        o_mux_string, [o_file_field stringValue]];
+    }
+    else if( [o_mode isEqualToString: _NS("Stream")] )
+    {
+        o_mode = [o_stream_type titleOfSelectedItem];
+        
+        if ( [o_mode isEqualToString: _NS("HTTP")] ) o_mode = @"http";
+        else if ( [o_mode isEqualToString: _NS("UDP")] )
+            o_mode = @"udp";
+        else if ( [o_mode isEqualToString: _NS("RTP")] )
+            o_mode = @"rtp";
+            
+        o_mrl_string = [o_mrl_string stringByAppendingFormat:
+                        @"dst=std{access=%@,mux=%@,url=\"%@:%@\"},",
+                        o_mode, o_mux_string, [o_stream_address stringValue],
+                        [o_stream_port stringValue]];
+    }
+    o_mrl_string = [o_mrl_string stringByAppendingString: @"}:"];
+    [self setMRL:o_mrl_string];
+}
+
+- (void)TTLChanged:(NSNotification *)o_notification
+{
+    intf_thread_t * p_intf = [NSApp getIntf];
+    config_PutInt( p_intf, "ttl", [o_stream_ttl intValue] );
+}
+
+- (IBAction)outputFileBrowse:(id)sender
+{
+    NSSavePanel *o_save_panel = [NSSavePanel savePanel];
+    NSString *o_mux_string;
+    if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: _NS("MPEG PS")] )
+        o_mux_string = @"vob";
+    else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: _NS("AVI")] )
+        o_mux_string = @"avi";
+    else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: _NS("Ogg")] )
+        o_mux_string = @"ogm";
+    else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: _NS("mp4")] )
+        o_mux_string = @"mp4";
+    else
+        o_mux_string = @"ts";
+
+    NSString * o_name = [NSString stringWithFormat: @"vlc-output.%@",
+                         o_mux_string];
+
+    [o_save_panel setTitle: _NS("Save File")];
+    [o_save_panel setPrompt: _NS("Save")];
+
+    if( [o_save_panel runModalForDirectory: nil
+            file: o_name] == NSOKButton )
+    {
+        NSString *o_filename = [o_save_panel filename];
+        [o_file_field setStringValue: o_filename];
+        [self outputInfoChanged: nil];
+    }
+}
+
+- (IBAction)streamPortStepperChanged:(id)sender
+{
+    [o_stream_port setIntValue: [o_stream_port_stp intValue]];
+    [self outputInfoChanged: nil];
+}
+
+- (IBAction)streamTTLStepperChanged:(id)sender
+{
+    [o_stream_ttl setIntValue: [o_stream_ttl_stp intValue]];
+    [self TTLChanged:nil];
+}
+
+- (void)transcodeChanged:(NSNotification *)o_notification
+{
+    if( [o_transcode_video_chkbox state] == NSOnState )
+    {
+        [o_transcode_video_selector setEnabled: YES];
+        [o_transcode_video_bitrate setEnabled: YES];
+    }
+    else
+    {
+        [o_transcode_video_selector setEnabled: NO];
+        [o_transcode_video_bitrate setEnabled: NO];
+    }
+    if( [o_transcode_audio_chkbox state] == NSOnState )
+    {
+        [o_transcode_audio_selector setEnabled: YES];
+        [o_transcode_audio_bitrate setEnabled: YES];
+    }
+    else
+    {
+        [o_transcode_audio_selector setEnabled: NO];
+        [o_transcode_audio_bitrate setEnabled: NO];
+    }
+
+    [self transcodeInfoChanged:nil];
+}
+
+- (void)transcodeInfoChanged:(NSNotification *)o_notification
+{
+    NSString *o_transcode_string;
+    
+    if( [o_transcode_video_chkbox state] == NSOnState ||
+        [o_transcode_audio_chkbox state] == NSOnState )
+    {
+        o_transcode_string = @"transcode{";
+        if ( [o_transcode_video_chkbox state] == NSOnState )
+        {
+            o_transcode_string = [o_transcode stringByAppendingFormat: @"vcodec=\"%@\",vb=\"%@\",",
+                [o_transcode_video_selector titleOfSelectedItem],
+                [o_transcode_video_bitrate stringValue]];
+        }
+        if ( [o_transcode_audio_chkbox state] == NSOnState )
+        {
+            o_transcode_string = [o_transcode stringByAppendingFormat: @"acodec=\"%@\",ab=\"%@\",",
+                [o_transcode_audio_selector titleOfSelectedItem],
+                [o_transcode_audio_bitrate stringValue]];
+        }
+    }
+    else
+    {
+        o_transcode_string = @"duplicate{";
+    }
+    [self setTranscode: o_transcode_string];
+    [self outputInfoChanged:nil];
+}
+
+@end