output.m
上传用户:kjfoods
上传日期:2020-07-06
资源大小:29949k
文件大小:25k
源码类别:

midi

开发平台:

Unix_Linux

  1. /*****************************************************************************
  2.  * output.m: MacOS X Output Dialog
  3.  *****************************************************************************
  4.  * Copyright (C) 2002-2007 the VideoLAN team
  5.  * $Id: 74c04324607f954db8667eb84701b99b852c3b3f $
  6.  *
  7.  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  8.  *          Christophe Massiot <massiot@via.ecp.fr>
  9.  *          Derk-Jan Hartman <thedj@users.sourceforge.net>
  10.  *          Benjamin Pracht <bigben AT videolan DOT org>
  11.  *
  12.  * This program is free software; you can redistribute it and/or modify
  13.  * it under the terms of the GNU General Public License as published by
  14.  * the Free Software Foundation; either version 2 of the License, or
  15.  * (at your option) any later version.
  16.  *
  17.  * This program is distributed in the hope that it will be useful,
  18.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20.  * GNU General Public License for more details.
  21.  *
  22.  * You should have received a copy of the GNU General Public License
  23.  * along with this program; if not, write to the Free Software
  24.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  25.  *****************************************************************************/
  26. /*****************************************************************************
  27.  * Preamble
  28.  *****************************************************************************/
  29. #include <stdlib.h>                                      /* malloc(), free() */
  30. #include <string.h>
  31. #include "intf.h"
  32. #include "output.h"
  33. /*****************************************************************************
  34.  * VLCOutput implementation
  35.  *****************************************************************************/
  36. @implementation VLCOutput
  37. - (id)init
  38. {
  39.     self = [super init];
  40.     o_mrl = [[NSArray alloc] init];
  41.     o_transcode = [[NSString alloc] init];
  42.     return self;
  43. }
  44. - (void)dealloc
  45. {
  46.     [o_mrl release];
  47.     [o_transcode release];
  48.     [super dealloc];
  49. }
  50. - (void)setMRL:(NSArray *)o_mrl_array
  51. {
  52.     [o_mrl autorelease];
  53.     o_mrl = [o_mrl_array copy];
  54. }
  55. - (NSArray *)mrl
  56. {
  57.     return [o_mrl copy];
  58. }
  59. - (void)setTranscode:(NSString *)o_transcode_string
  60. {
  61.     [o_transcode autorelease];
  62.     o_transcode = [o_transcode_string copy];
  63. }
  64. - (void)awakeFromNib
  65. {
  66.     [self initStrings];
  67.     [[NSNotificationCenter defaultCenter] addObserver: self
  68.         selector: @selector(outputInfoChanged:)
  69.         name: NSControlTextDidChangeNotification
  70.         object: o_file_field];
  71.     [[NSNotificationCenter defaultCenter] addObserver: self
  72.         selector: @selector(outputInfoChanged:)
  73.         name: NSControlTextDidChangeNotification
  74.         object: o_stream_address];
  75.     [[NSNotificationCenter defaultCenter] addObserver: self
  76.         selector: @selector(outputInfoChanged:)
  77.         name: NSControlTextDidChangeNotification
  78.         object: o_stream_port];
  79.     [[NSNotificationCenter defaultCenter] addObserver: self
  80.         selector: @selector(TTLChanged:)
  81.         name: NSControlTextDidChangeNotification
  82.         object: o_stream_ttl];
  83.     [[NSNotificationCenter defaultCenter] addObserver: self
  84.         selector: @selector(transcodeInfoChanged:)
  85.         name: NSControlTextDidChangeNotification
  86.         object: o_transcode_video_bitrate];
  87.     [[NSNotificationCenter defaultCenter] addObserver: self
  88.         selector: @selector(transcodeInfoChanged:)
  89.         name: NSControlTextDidChangeNotification
  90.         object: o_transcode_video_scale];
  91.     [[NSNotificationCenter defaultCenter] addObserver: self
  92.         selector: @selector(transcodeInfoChanged:)
  93.         name: NSControlTextDidChangeNotification
  94.         object: o_transcode_audio_bitrate];
  95.     [[NSNotificationCenter defaultCenter] addObserver: self
  96.         selector: @selector(transcodeInfoChanged:)
  97.         name: NSControlTextDidChangeNotification
  98.         object: o_transcode_audio_channels];
  99.     [[NSNotificationCenter defaultCenter] addObserver: self
  100.         selector: @selector(transcodeInfoChanged:)
  101.         name: NSControlTextDidChangeNotification
  102.         object: o_channel_name];
  103.     [[NSNotificationCenter defaultCenter] addObserver: self
  104.         selector: @selector(transcodeInfoChanged:)
  105.         name: NSControlTextDidChangeNotification
  106.         object: o_sdp_url];
  107.     [o_mux_selector setAutoenablesItems: NO];
  108.     [self transcodeChanged:nil];
  109. }
  110. - (void)initStrings
  111. {
  112.     NSArray *o_muxers = [NSArray arrayWithObjects: @"MPEG TS", @"MPEG PS", @"MPEG 1",
  113.         @"Ogg", @"AVI", @"ASF", @"MPEG 4", @"Quicktime", @"Raw", nil];
  114.     NSArray *o_a_channels = [NSArray arrayWithObjects: @"1", @"2", @"4", @"6", nil];
  115.     NSArray *o_a_bitrates = [NSArray arrayWithObjects: @"16", @"32", @"64", @"96",
  116.         @"128", @"192", @"256", @"512", nil];
  117.     NSArray *o_v_bitrates = [NSArray arrayWithObjects: @"16", @"32", @"64", @"96",
  118.         @"128", @"192", @"256", @"384", @"512", @"768", @"1024", @"2048", @"3072", nil];
  119.     NSArray *o_v_scales = [NSArray arrayWithObjects: @"0.25",@"0.5",@"0.75",@"1",@"1.25",@"1.5",@"1.75",@"2",nil];
  120.     NSArray *o_a_codecs = [NSArray arrayWithObjects: @"mpga", @"mp3 ", @"a52 ", @"vorb", @"flac", @"spx ", nil]; //@"mp4a"
  121.     NSArray *o_v_codecs = [NSArray arrayWithObjects: @"mp1v", @"mp2v", @"mp4v", @"DIV1",
  122.         @"DIV2", @"DIV3", @"h263", @"h264", @"WMV1", @"WMV2", @"MJPG", @"theo", nil];
  123.     [o_output_ckbox setTitle: _NS("Streaming/Saving:")];
  124.     [o_output_settings setTitle: _NS("Settings...")];
  125.     [o_btn_ok setTitle: _NS("OK")];
  126.     [o_options_lbl setTitle: _NS("Streaming and Transcoding Options")];
  127.     [o_display setTitle: _NS("Display the stream locally")];
  128.     [[o_method cellAtRow:0 column:0] setTitle: _NS("File")];
  129.     [[o_method cellAtRow:1 column:0] setTitle: _NS("Stream")];
  130.     [o_dump_chkbox setTitle: _NS("Dump raw input")];
  131.     [o_btn_browse setTitle: _NS("Browse...")];
  132.     [o_stream_address_lbl setStringValue: _NS("Address")];
  133.     [o_stream_port_lbl setStringValue: _NS("Port")];
  134.     [o_stream_ttl_lbl setStringValue: @"TTL"];
  135.     [[o_stream_type itemAtIndex: 0] setTitle: @"HTTP"];
  136.     [[o_stream_type itemAtIndex: 1] setTitle: @"MMSH"];
  137.     [[o_stream_type itemAtIndex: 2] setTitle: @"UDP"];
  138.     [[o_stream_type itemAtIndex: 3] setTitle: @"RTP"];
  139.     [o_stream_type_lbl setStringValue: _NS("Type")];
  140.     [o_mux_lbl setStringValue: _NS("Encapsulation Method")];
  141.     [o_mux_selector removeAllItems];
  142.     [o_mux_selector addItemsWithTitles: o_muxers];
  143.     [o_transcode_lbl setTitle: _NS("Transcoding options")];
  144.     [o_transcode_video_chkbox setTitle: _NS("Video")];
  145.     [o_transcode_video_selector removeAllItems];
  146.     [o_transcode_video_selector addItemsWithTitles: o_v_codecs];
  147.     [o_transcode_video_bitrate_lbl setStringValue: _NS("Bitrate (kb/s)")];
  148.     [o_transcode_video_bitrate removeAllItems];
  149.     [o_transcode_video_bitrate addItemsWithObjectValues: o_v_bitrates];
  150.     [o_transcode_video_scale_lbl setStringValue: _NS("Scale")];
  151.     [o_transcode_video_scale removeAllItems];
  152.     [o_transcode_video_scale addItemsWithObjectValues: o_v_scales];
  153.     [o_transcode_video_scale selectItemWithObjectValue: @"1"];
  154.     [o_transcode_audio_chkbox setTitle: _NS("Audio")];
  155.     [o_transcode_audio_selector removeAllItems];
  156.     [o_transcode_audio_selector addItemsWithTitles: o_a_codecs];
  157.     [o_transcode_audio_bitrate_lbl setStringValue: _NS("Bitrate (kb/s)")];
  158.     [o_transcode_audio_bitrate removeAllItems];
  159.     [o_transcode_audio_bitrate addItemsWithObjectValues: o_a_bitrates];
  160.     [o_transcode_audio_channels_lbl setStringValue: _NS("Channels")];
  161.     [o_transcode_audio_channels removeAllItems];
  162.     [o_transcode_audio_channels addItemsWithObjectValues: o_a_channels];
  163.     [o_misc_lbl setTitle: _NS("Stream Announcing")];
  164.     [o_sap_chkbox setTitle: _NS("SAP announce")];
  165.     [o_rtsp_chkbox setTitle: _NS("RTSP announce")];
  166.     [o_http_chkbox setTitle:_NS("HTTP announce")];
  167.     [o_file_chkbox setTitle:_NS("Export SDP as file")];
  168.     [o_channel_name_lbl setStringValue: _NS("Channel Name")];
  169.     [o_sdp_url_lbl setStringValue: _NS("SDP URL")];
  170. }
  171. - (IBAction)outputChanged:(id)sender;
  172. {
  173.     if ([o_output_ckbox state] == NSOnState)
  174.     {
  175.         [o_output_settings setEnabled:YES];
  176.     }
  177.     else
  178.     {
  179.         [o_output_settings setEnabled:NO];
  180.     }
  181. }
  182. - (IBAction)outputSettings:(id)sender
  183. {
  184.     [NSApp beginSheet: o_output_sheet
  185.         modalForWindow: o_open_panel
  186.         modalDelegate: self
  187.         didEndSelector: NULL
  188.         contextInfo: nil];
  189. }
  190. - (IBAction)outputCloseSheet:(id)sender
  191. {
  192.     [o_output_sheet orderOut:sender];
  193.     [NSApp endSheet: o_output_sheet];
  194. }
  195. - (void)outputMethodChanged:(NSNotification *)o_notification
  196. {
  197.     NSString *o_mode;
  198.     o_mode = [[o_method selectedCell] title];
  199.     [o_sap_chkbox setEnabled: NO];
  200.     [o_http_chkbox setEnabled: NO];
  201.     [o_rtsp_chkbox setEnabled: NO];
  202.     [o_file_chkbox setEnabled: NO];
  203.     [o_channel_name setEnabled: NO];
  204.     [o_sdp_url setEnabled: NO];
  205.     [[o_mux_selector itemAtIndex: 0] setEnabled: YES];
  206.     if( [o_mode isEqualToString: _NS("File")] )
  207.     {
  208.         [o_file_field setEnabled: YES];
  209.         [o_btn_browse setEnabled: YES];
  210.         [o_dump_chkbox setEnabled: YES];
  211.         [o_stream_address setEnabled: NO];
  212.         [o_stream_port setEnabled: NO];
  213.         [o_stream_ttl setEnabled: NO];
  214.         [o_stream_port_stp setEnabled: NO];
  215.         [o_stream_ttl_stp setEnabled: NO];
  216.         [o_stream_type setEnabled: NO];
  217.         [o_mux_selector setEnabled: YES];
  218.         [[o_mux_selector itemAtIndex: 1] setEnabled: YES]; // MPEG PS
  219.         [[o_mux_selector itemAtIndex: 2] setEnabled: YES]; // MPEG 1
  220.         [[o_mux_selector itemAtIndex: 3] setEnabled: YES]; // Ogg
  221.         [[o_mux_selector itemAtIndex: 4] setEnabled: YES]; // AVI
  222.         [[o_mux_selector itemAtIndex: 5] setEnabled: YES]; // ASF
  223.         [[o_mux_selector itemAtIndex: 6] setEnabled: YES]; // MPEG 4
  224.         [[o_mux_selector itemAtIndex: 7] setEnabled: YES]; // QuickTime
  225.         [[o_mux_selector itemAtIndex: 8] setEnabled: YES]; // Raw
  226.     }
  227.     else if( [o_mode isEqualToString: _NS("Stream")] )
  228.     {
  229.         [o_file_field setEnabled: NO];
  230.         [o_dump_chkbox setEnabled: NO];
  231.         [o_btn_browse setEnabled: NO];
  232.         [o_stream_port setEnabled: YES];
  233.         [o_stream_port_stp setEnabled: YES];
  234.         [o_stream_type setEnabled: YES];
  235.         [o_mux_selector setEnabled: YES];
  236.         o_mode = [o_stream_type titleOfSelectedItem];
  237.         if( [o_mode isEqualToString: @"HTTP"] )
  238.         {
  239.             [o_stream_address setEnabled: YES];
  240.             [o_stream_ttl setEnabled: NO];
  241.             [o_stream_ttl_stp setEnabled: NO];
  242.             [[o_mux_selector itemAtIndex: 1] setEnabled: YES];
  243.             [[o_mux_selector itemAtIndex: 2] setEnabled: YES];
  244.             [[o_mux_selector itemAtIndex: 3] setEnabled: YES];
  245.             [[o_mux_selector itemAtIndex: 4] setEnabled: NO];
  246.             [[o_mux_selector itemAtIndex: 5] setEnabled: YES];
  247.             [[o_mux_selector itemAtIndex: 6] setEnabled: NO];
  248.             [[o_mux_selector itemAtIndex: 7] setEnabled: NO];
  249.             [[o_mux_selector itemAtIndex: 8] setEnabled: YES];
  250.         }
  251.         else if( [o_mode isEqualToString: @"MMSH"] )
  252.         {
  253.             [o_stream_address setEnabled: YES];
  254.             [o_stream_ttl setEnabled: NO];
  255.             [o_stream_ttl_stp setEnabled: NO];
  256.             [[o_mux_selector itemAtIndex: 0] setEnabled: NO];
  257.             [[o_mux_selector itemAtIndex: 1] setEnabled: NO];
  258.             [[o_mux_selector itemAtIndex: 2] setEnabled: NO];
  259.             [[o_mux_selector itemAtIndex: 3] setEnabled: NO];
  260.             [[o_mux_selector itemAtIndex: 4] setEnabled: NO];
  261.             [[o_mux_selector itemAtIndex: 5] setEnabled: YES];
  262.             [[o_mux_selector itemAtIndex: 6] setEnabled: NO];
  263.             [[o_mux_selector itemAtIndex: 7] setEnabled: NO];
  264.             [[o_mux_selector itemAtIndex: 8] setEnabled: NO];
  265.             [o_mux_selector selectItemAtIndex: 5];
  266.         }
  267.         else if( [o_mode isEqualToString: @"UDP"] )
  268.         {
  269.             [o_stream_address setEnabled: YES];
  270.             [o_stream_ttl setEnabled: YES];
  271.             [o_stream_ttl_stp setEnabled: YES];
  272.             [[o_mux_selector itemAtIndex: 1] setEnabled: NO];
  273.             [[o_mux_selector itemAtIndex: 2] setEnabled: NO];
  274.             [[o_mux_selector itemAtIndex: 3] setEnabled: NO];
  275.             [[o_mux_selector itemAtIndex: 4] setEnabled: NO];
  276.             [[o_mux_selector itemAtIndex: 5] setEnabled: NO];
  277.             [[o_mux_selector itemAtIndex: 6] setEnabled: NO];
  278.             [[o_mux_selector itemAtIndex: 7] setEnabled: NO];
  279.             [[o_mux_selector itemAtIndex: 8] setEnabled: YES];
  280.             [o_sap_chkbox setEnabled: YES];
  281.             [o_channel_name setEnabled: YES];
  282.         }
  283.         else if( [o_mode isEqualToString: @"RTP"] )
  284.         {
  285.             [o_stream_address setEnabled: YES];
  286.             [o_stream_ttl setEnabled: YES];
  287.             [o_stream_ttl_stp setEnabled: YES];
  288.             [[o_mux_selector itemAtIndex: 0] setEnabled: NO];
  289.             [[o_mux_selector itemAtIndex: 1] setEnabled: NO];
  290.             [[o_mux_selector itemAtIndex: 2] setEnabled: NO];
  291.             [[o_mux_selector itemAtIndex: 3] setEnabled: NO];
  292.             [[o_mux_selector itemAtIndex: 4] setEnabled: NO];
  293.             [[o_mux_selector itemAtIndex: 5] setEnabled: NO];
  294.             [[o_mux_selector itemAtIndex: 6] setEnabled: NO];
  295.             [[o_mux_selector itemAtIndex: 7] setEnabled: NO];
  296.             [[o_mux_selector itemAtIndex: 8] setEnabled: YES];
  297.             [o_mux_selector selectItemAtIndex: 8];
  298.             [o_sap_chkbox setEnabled: YES];
  299.             [o_rtsp_chkbox setEnabled: YES];
  300.             [o_http_chkbox setEnabled: YES];
  301.             [o_file_chkbox setEnabled: YES];
  302.             [o_channel_name setEnabled: YES];
  303.         }
  304.     }
  305.     if( ![[o_mux_selector selectedItem] isEnabled] && ![o_mode isEqualToString: @"RTP"] )
  306.     {
  307.         [o_mux_selector selectItemAtIndex: 0];
  308.     }
  309.     else if (![[o_mux_selector selectedItem] isEnabled] && [o_mode isEqualToString: @"RTP"] )
  310.     {
  311.         [o_mux_selector selectItemAtIndex: 8];
  312.     }
  313.     [self outputInfoChanged: nil];
  314. }
  315. - (void)outputInfoChanged:(NSNotification *)o_notification
  316. {
  317.     NSString *o_mode, *o_mux, *o_mux_string;
  318.     NSMutableString *o_announce = [NSMutableString stringWithString:@""];
  319.     NSMutableString *o_mrl_string = [NSMutableString stringWithString:@":sout=#"];
  320.     NSArray *o_sout_options;
  321.     [o_mrl_string appendString: o_transcode];
  322.     if( [o_display state] == NSOnState )
  323.     {
  324.         [o_mrl_string appendString: @"duplicate{dst=display,dst="];
  325.     }
  326.     o_mode = [[o_method selectedCell] title];
  327.     o_mux = [o_mux_selector titleOfSelectedItem];
  328.     if ( [o_mux isEqualToString: @"AVI"] ) o_mux_string = @"avi";
  329.     else if ( [o_mux isEqualToString: @"Ogg"] ) o_mux_string = @"ogg";
  330.     else if ( [o_mux isEqualToString: @"MPEG PS"] ) o_mux_string = @"ps";
  331.     else if ( [o_mux isEqualToString: @"MPEG 4"] ) o_mux_string = @"mp4";
  332.     else if ( [o_mux isEqualToString: @"MPEG 1"] ) o_mux_string = @"mpeg1";
  333.     else if ( [o_mux isEqualToString: @"Quicktime"] ) o_mux_string = @"mov";
  334.     else if ( [o_mux isEqualToString: @"ASF"] ) o_mux_string = @"asf";
  335.     else if ( [o_mux isEqualToString: @"Raw"] ) o_mux_string = @"raw";
  336.     else o_mux_string = @"ts";
  337.     if( [o_mode isEqualToString: _NS("File")] )
  338.     {
  339.         if( [o_dump_chkbox state] == NSOnState )
  340.         {
  341.             NSMutableArray * o_sout_options;
  342.             o_sout_options = [NSArray arrayWithObjects:
  343.                                     [NSString stringWithString:
  344.                                     @":demux=dump"],
  345.                                     [NSString stringWithFormat:
  346.                                     @":demuxdump-file=%@",
  347.                                     [o_file_field stringValue]],
  348.                                     nil];
  349.             [self setMRL:o_sout_options];
  350.             return;
  351.         }
  352.         else
  353.         {
  354.                 [o_mrl_string appendFormat:
  355.                         @"std{access=file,mux=%@,dst="%@"}",
  356.                         o_mux_string, [o_file_field stringValue]];
  357.         }
  358.     }
  359.     else if( [o_mode isEqualToString: _NS("Stream")] )
  360.     {
  361.         o_mode = [o_stream_type titleOfSelectedItem];
  362.         if ( [o_mode isEqualToString: @"HTTP"] )
  363.             o_mode = @"http";
  364.         else if ( [o_mode isEqualToString: @"MMSH"] )
  365.         {
  366.             if ( [o_mux isEqualToString: @"ASF"] ) o_mux_string = @"asfh";
  367.             o_mode = @"mmsh";
  368.         }
  369.         else if ( [o_mode isEqualToString: @"UDP"] )
  370.         {
  371.             o_mode = @"udp";
  372.             if( [o_sap_chkbox state] == NSOnState )
  373.             {
  374.                 if ( ![[o_channel_name stringValue] isEqualToString: @""] )
  375.                     [o_announce appendFormat:
  376.                         @",sap,name=%@", [o_channel_name stringValue]];
  377.                 else
  378.                     [o_announce appendFormat:@",sap"];
  379.             }
  380.         }
  381.         if ( ![o_mode isEqualToString: @"RTP"] )
  382.         {
  383.             /* split up the hostname and the following path to paste the
  384.              * port correctly. Not need, if there isn't any path following the
  385.              * hostname. */
  386.             NSArray * o_urlItems = [[o_stream_address stringValue] 
  387.                 componentsSeparatedByString: @"/"];
  388.             NSMutableString * o_finalStreamAddress;
  389.             o_finalStreamAddress = [[NSMutableString alloc] init];
  390.  
  391.             if ([o_urlItems count] == 1)
  392.             {
  393.                 [o_finalStreamAddress appendFormat: @""%@:%@"", 
  394.                     [o_stream_address stringValue],[o_stream_port stringValue]];
  395.             }
  396.             else
  397.             {
  398.                 [o_finalStreamAddress appendFormat: @""%@:%@", [o_urlItems 
  399.                     objectAtIndex: 0], [o_stream_port stringValue]];
  400.                 unsigned int x;
  401.                 x = 1;
  402.                 while (x != [o_urlItems count])
  403.                 {
  404.                     [o_finalStreamAddress appendFormat: @"/%@", [o_urlItems 
  405.                         objectAtIndex: x]];
  406.                     x = (x + 1);
  407.                 }
  408.                 [o_finalStreamAddress appendString: @"""];
  409.             }
  410.  
  411.             [o_mrl_string appendFormat:
  412.                         @"std{access=%@,mux=%@,dst=%@%@}",
  413.                         o_mode, o_mux_string, o_finalStreamAddress, o_announce];
  414.         }
  415.         else
  416.         {
  417.             NSString * o_stream_name;
  418.             if (![[o_channel_name stringValue] isEqualToString: @""] )
  419.             {
  420.                 o_stream_name = [NSString stringWithFormat:@",name=%@",
  421.                                 [o_channel_name stringValue]];
  422.             }
  423.             else
  424.             {
  425.                 o_stream_name = @"";
  426.             }
  427.             if ( [o_sap_chkbox state] == NSOnState )
  428.             {
  429.                 [o_announce appendString: @",sdp=sap"];
  430.             }
  431.             if ([o_rtsp_chkbox state] == NSOnState )
  432.             {
  433.                 [o_announce appendFormat:@",sdp="rtsp://%@"",[o_sdp_url stringValue]];
  434.             }
  435.             if ([o_http_chkbox state] == NSOnState )
  436.             {
  437.                 [o_announce appendFormat:@",sdp="http://%@"",[o_sdp_url stringValue]];
  438.             }
  439.             if ([o_file_chkbox state] == NSOnState )
  440.             {
  441.                 [o_announce appendFormat:@",sdp="file://%@"",[o_sdp_url stringValue]];
  442.             }
  443.             [o_mrl_string appendFormat:
  444.                         @"rtp{dst="%@",port=%@%@%@}",[o_stream_address stringValue],
  445.                         [o_stream_port stringValue], o_stream_name, o_announce];
  446.         }
  447.     }
  448.     if( [o_display state] == NSOnState )
  449.     {
  450.         [o_mrl_string appendString: @"}"];
  451.     }
  452.     o_sout_options = [NSArray arrayWithObjects: o_mrl_string,nil];
  453.     [self setMRL:o_sout_options];
  454. }
  455. - (void)TTLChanged:(NSNotification *)o_notification
  456. {
  457.     intf_thread_t * p_intf = VLCIntf;
  458.     config_PutInt( p_intf, "ttl", [o_stream_ttl intValue] );
  459. }
  460. - (IBAction)outputFileBrowse:(id)sender
  461. {
  462.     NSSavePanel *o_save_panel = [NSSavePanel savePanel];
  463.     NSString *o_mux_string;
  464.     if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"MPEG PS"] )
  465.         o_mux_string = @"vob";
  466.     else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"MPEG 1"] )
  467.         o_mux_string = @"mpg";
  468.     else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"AVI"] )
  469.         o_mux_string = @"avi";
  470.     else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"ASF"] )
  471.         o_mux_string = @"asf";
  472.     else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"Ogg"] )
  473.         o_mux_string = @"ogm";
  474.     else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"MPEG 4"] )
  475.         o_mux_string = @"mp4";
  476.     else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"Quicktime"] )
  477.         o_mux_string = @"mov";
  478.     else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"Raw"] )
  479.         o_mux_string = @"raw";
  480.     else
  481.         o_mux_string = @"ts";
  482.     NSString * o_name = [NSString stringWithFormat: @"vlc-output.%@",
  483.                          o_mux_string];
  484.     [o_save_panel setTitle: _NS("Save File")];
  485.     [o_save_panel setPrompt: _NS("Save")];
  486.     if( [o_save_panel runModalForDirectory: nil
  487.             file: o_name] == NSOKButton )
  488.     {
  489.         NSString *o_filename = [o_save_panel filename];
  490.         [o_file_field setStringValue: o_filename];
  491.         [self outputInfoChanged: nil];
  492.     }
  493. }
  494. - (IBAction)streamPortStepperChanged:(id)sender
  495. {
  496.     [o_stream_port setIntValue: [o_stream_port_stp intValue]];
  497.     [self outputInfoChanged: nil];
  498. }
  499. - (IBAction)streamTTLStepperChanged:(id)sender
  500. {
  501.     [o_stream_ttl setIntValue: [o_stream_ttl_stp intValue]];
  502.     [self TTLChanged:nil];
  503. }
  504. - (void)transcodeChanged:(NSNotification *)o_notification
  505. {
  506.     if( [o_transcode_video_chkbox state] == NSOnState )
  507.     {
  508.         [o_transcode_video_selector setEnabled: YES];
  509.         [o_transcode_video_bitrate setEnabled: YES];
  510.         [o_transcode_video_scale setEnabled: YES];
  511.     }
  512.     else
  513.     {
  514.         [o_transcode_video_selector setEnabled: NO];
  515.         [o_transcode_video_bitrate setEnabled: NO];
  516.         [o_transcode_video_scale setEnabled: NO];
  517.     }
  518.     if( [o_transcode_audio_chkbox state] == NSOnState )
  519.     {
  520.         [o_transcode_audio_selector setEnabled: YES];
  521.         [o_transcode_audio_bitrate setEnabled: YES];
  522.         [o_transcode_audio_channels setEnabled: YES];
  523.     }
  524.     else
  525.     {
  526.         [o_transcode_audio_selector setEnabled: NO];
  527.         [o_transcode_audio_bitrate setEnabled: NO];
  528.         [o_transcode_audio_channels setEnabled: NO];
  529.     }
  530.     [self transcodeInfoChanged:nil];
  531. }
  532. - (void)transcodeInfoChanged:(NSNotification *)o_notification
  533. {
  534.     NSMutableString *o_transcode_string;
  535.     if( [o_transcode_video_chkbox state] == NSOnState ||
  536.         [o_transcode_audio_chkbox state] == NSOnState )
  537.     {
  538.         o_transcode_string = [NSMutableString stringWithString:@"transcode{"];
  539.         if ( [o_transcode_video_chkbox state] == NSOnState )
  540.         {
  541.             [o_transcode_string appendFormat: @"vcodec="%@",vb="%@"" 
  542.                                                             ",scale="%@"",
  543.                 [o_transcode_video_selector titleOfSelectedItem],
  544.                 [o_transcode_video_bitrate stringValue],
  545.                 [o_transcode_video_scale stringValue]];
  546.             if ( [o_transcode_audio_chkbox state] == NSOnState )
  547.             {
  548.                 [o_transcode_string appendString: @","];
  549.             }
  550.         }
  551.         if ( [o_transcode_audio_chkbox state] == NSOnState )
  552.         {
  553.             [o_transcode_string appendFormat: @"acodec="%@",ab="%@"",
  554.                 [o_transcode_audio_selector titleOfSelectedItem],
  555.                 [o_transcode_audio_bitrate stringValue]];
  556.             if ( ![[o_transcode_audio_channels stringValue]
  557.                                             isEqualToString: @""])
  558.             {
  559.                 [o_transcode_string appendFormat: @",channels="%@"",
  560.                                    [o_transcode_audio_channels stringValue]];
  561.             }
  562.         }
  563.         [o_transcode_string appendString:@"}:"];
  564.     }
  565.     else
  566.     {
  567.         o_transcode_string = [NSString stringWithString:@""];
  568.     }
  569.     [self setTranscode: o_transcode_string];
  570.     [self outputInfoChanged:nil];
  571. }
  572. - (IBAction)announceChanged:(id)sender
  573. {
  574.     NSString *o_mode;
  575.     o_mode = [[o_stream_type selectedCell] title];
  576.     [o_channel_name setEnabled: [o_sap_chkbox state] ||
  577.                 [o_mode isEqualToString: @"RTP"]];
  578.     if ([o_mode isEqualToString: @"RTP"])
  579.     {
  580. /*        if ([[sender title] isEqualToString: _NS("SAP announce")])
  581.         {
  582.             [o_rtsp_chkbox setState:NSOffState];
  583.             [o_http_chkbox setState:NSOffState];
  584.         }*/
  585.         if ([[sender title] isEqualToString:_NS("RTSP announce")])
  586.         {
  587. //            [o_sap_chkbox setState:NSOffState];
  588.             [o_http_chkbox setState:NSOffState];
  589.             [o_file_chkbox setState:NSOffState];
  590.         }
  591.         else if ([[sender title] isEqualToString:_NS("HTTP announce")])
  592.         {
  593. //            [o_sap_chkbox setState:NSOffState];
  594.             [o_rtsp_chkbox setState:NSOffState];
  595.             [o_file_chkbox setState:NSOffState];
  596.         }
  597.         else if ([[sender title] isEqualToString:_NS("Export SDP as file")])
  598.         {
  599.             [o_rtsp_chkbox setState:NSOffState];
  600.             [o_http_chkbox setState:NSOffState];
  601.         }
  602.         if ( [o_rtsp_chkbox state] == NSOnState ||
  603.                             [o_http_chkbox state] == NSOnState ||
  604.                             [o_file_chkbox state] == NSOnState )
  605.         {
  606.             [o_sdp_url setEnabled: YES];
  607.         }
  608.         else
  609.         {
  610.             [o_sdp_url setEnabled: NO];
  611.         }
  612.     }
  613.     [self outputInfoChanged: nil];
  614. }
  615. @end