00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <stdlib.h>
00031 #include <string.h>
00032
00033 #include "intf.h"
00034 #include "output.h"
00035
00036
00037
00038
00039 @implementation VLCOutput
00040
00041 - (id)init
00042 {
00043 self = [super init];
00044 o_mrl = [[NSArray alloc] init];
00045 o_transcode = [[NSString alloc] init];
00046 return self;
00047 }
00048
00049 - (void)dealloc
00050 {
00051 [o_mrl release];
00052 [o_transcode release];
00053 [super dealloc];
00054 }
00055
00056 - (void)setMRL:(NSArray *)o_mrl_array
00057 {
00058 [o_mrl autorelease];
00059 o_mrl = [o_mrl_array copy];
00060 }
00061
00062 - (NSArray *)getMRL
00063 {
00064 return [o_mrl copy];
00065 }
00066
00067 - (void)setTranscode:(NSString *)o_transcode_string
00068 {
00069 [o_transcode autorelease];
00070 o_transcode = [o_transcode_string copy];
00071 }
00072
00073 - (void)awakeFromNib
00074 {
00075 [self initStrings];
00076
00077 [[NSNotificationCenter defaultCenter] addObserver: self
00078 selector: @selector(outputInfoChanged:)
00079 name: NSControlTextDidChangeNotification
00080 object: o_file_field];
00081 [[NSNotificationCenter defaultCenter] addObserver: self
00082 selector: @selector(outputInfoChanged:)
00083 name: NSControlTextDidChangeNotification
00084 object: o_stream_address];
00085 [[NSNotificationCenter defaultCenter] addObserver: self
00086 selector: @selector(outputInfoChanged:)
00087 name: NSControlTextDidChangeNotification
00088 object: o_stream_port];
00089 [[NSNotificationCenter defaultCenter] addObserver: self
00090 selector: @selector(TTLChanged:)
00091 name: NSControlTextDidChangeNotification
00092 object: o_stream_ttl];
00093 [[NSNotificationCenter defaultCenter] addObserver: self
00094 selector: @selector(transcodeInfoChanged:)
00095 name: NSControlTextDidChangeNotification
00096 object: o_transcode_video_bitrate];
00097 [[NSNotificationCenter defaultCenter] addObserver: self
00098 selector: @selector(transcodeInfoChanged:)
00099 name: NSControlTextDidChangeNotification
00100 object: o_transcode_video_scale];
00101 [[NSNotificationCenter defaultCenter] addObserver: self
00102 selector: @selector(transcodeInfoChanged:)
00103 name: NSControlTextDidChangeNotification
00104 object: o_transcode_audio_bitrate];
00105 [[NSNotificationCenter defaultCenter] addObserver: self
00106 selector: @selector(transcodeInfoChanged:)
00107 name: NSControlTextDidChangeNotification
00108 object: o_transcode_audio_channels];
00109 [[NSNotificationCenter defaultCenter] addObserver: self
00110 selector: @selector(transcodeInfoChanged:)
00111 name: NSControlTextDidChangeNotification
00112 object: o_channel_name];
00113 [[NSNotificationCenter defaultCenter] addObserver: self
00114 selector: @selector(transcodeInfoChanged:)
00115 name: NSControlTextDidChangeNotification
00116 object: o_sdp_url];
00117
00118 [o_mux_selector setAutoenablesItems: NO];
00119 [self transcodeChanged:nil];
00120 }
00121
00122 - (void)initStrings
00123 {
00124 NSArray *o_muxers = [NSArray arrayWithObjects: @"MPEG TS", @"MPEG PS", @"MPEG 1",
00125 @"Ogg", @"AVI", @"ASF", @"MPEG 4", @"Quicktime", @"Raw", nil];
00126 NSArray *o_a_channels = [NSArray arrayWithObjects: @"1", @"2", @"4", @"6", nil];
00127 NSArray *o_a_bitrates = [NSArray arrayWithObjects: @"16", @"32", @"64", @"96",
00128 @"128", @"192", @"256", @"512", nil];
00129 NSArray *o_v_bitrates = [NSArray arrayWithObjects: @"16", @"32", @"64", @"96",
00130 @"128", @"192", @"256", @"384", @"512", @"768", @"1024", @"2048", @"3072", nil];
00131 NSArray *o_v_scales = [NSArray arrayWithObjects: @"0.25",@"0.5",@"0.75",@"1",@"1.25",@"1.5",@"1.75",@"2",nil];
00132 NSArray *o_a_codecs = [NSArray arrayWithObjects: @"mpga", @"mp3 ", @"mp4a", @"a52 ", @"vorb", @"flac", @"spx ", nil];
00133 NSArray *o_v_codecs = [NSArray arrayWithObjects: @"mp1v", @"mp2v", @"mp4v", @"DIV1",
00134 @"DIV2", @"DIV3", @"h263", @"h264", @"WMV1", @"WMV2", @"MJPG", @"theo", nil];
00135
00136 [o_output_ckbox setTitle: _NS("Advanced output:")];
00137 [o_output_settings setTitle: _NS("Settings...")];
00138 [o_btn_ok setTitle: _NS("OK")];
00139
00140 [o_options_lbl setTitle: _NS("Output Options")];
00141 [o_display setTitle: _NS("Play locally")];
00142 [[o_method cellAtRow:0 column:0] setTitle: _NS("File")];
00143 [[o_method cellAtRow:1 column:0] setTitle: _NS("Stream")];
00144 [o_dump_chkbox setTitle: _NS("Dump raw input")];
00145 [o_btn_browse setTitle: _NS("Browse...")];
00146 [o_stream_address_lbl setStringValue: _NS("Address")];
00147 [o_stream_port_lbl setStringValue: _NS("Port")];
00148 [o_stream_ttl_lbl setStringValue: @"TTL"];
00149 [[o_stream_type itemAtIndex: 0] setTitle: @"HTTP"];
00150 [[o_stream_type itemAtIndex: 1] setTitle: @"MMSH"];
00151 [[o_stream_type itemAtIndex: 2] setTitle: @"UDP"];
00152 [[o_stream_type itemAtIndex: 3] setTitle: @"RTP"];
00153 [o_stream_type_lbl setStringValue: _NS("Type")];
00154
00155 [o_mux_lbl setStringValue: _NS("Encapsulation Method")];
00156 [o_mux_selector removeAllItems];
00157 [o_mux_selector addItemsWithTitles: o_muxers];
00158
00159 [o_transcode_lbl setTitle: _NS("Transcode options")];
00160 [o_transcode_video_chkbox setTitle: _NS("Video")];
00161 [o_transcode_video_selector removeAllItems];
00162 [o_transcode_video_selector addItemsWithTitles: o_v_codecs];
00163 [o_transcode_video_bitrate_lbl setStringValue: _NS("Bitrate (kb/s)")];
00164 [o_transcode_video_bitrate removeAllItems];
00165 [o_transcode_video_bitrate addItemsWithObjectValues: o_v_bitrates];
00166 [o_transcode_video_scale_lbl setStringValue: _NS("Scale")];
00167 [o_transcode_video_scale removeAllItems];
00168 [o_transcode_video_scale addItemsWithObjectValues: o_v_scales];
00169 [o_transcode_video_scale selectItemWithObjectValue: @"1"];
00170 [o_transcode_audio_chkbox setTitle: _NS("Audio")];
00171 [o_transcode_audio_selector removeAllItems];
00172 [o_transcode_audio_selector addItemsWithTitles: o_a_codecs];
00173 [o_transcode_audio_bitrate_lbl setStringValue: _NS("Bitrate (kb/s)")];
00174 [o_transcode_audio_bitrate removeAllItems];
00175 [o_transcode_audio_bitrate addItemsWithObjectValues: o_a_bitrates];
00176 [o_transcode_audio_channels_lbl setStringValue: _NS("Channels")];
00177 [o_transcode_audio_channels removeAllItems];
00178 [o_transcode_audio_channels addItemsWithObjectValues: o_a_channels];
00179
00180 [o_misc_lbl setTitle: _NS("Stream Announcing")];
00181 [o_sap_chkbox setTitle: _NS("SAP announce")];
00182 [o_slp_chkbox setTitle: _NS("SLP announce")];
00183 [o_rtsp_chkbox setTitle: _NS("RTSP announce")];
00184 [o_http_chkbox setTitle:_NS("HTTP announce")];
00185 [o_file_chkbox setTitle:_NS("Export SDP as file")];
00186
00187 [o_channel_name_lbl setStringValue: _NS("Channel Name")];
00188 [o_sdp_url_lbl setStringValue: _NS("SDP URL")];
00189 }
00190
00191 - (IBAction)outputChanged:(id)sender;
00192 {
00193 if ([o_output_ckbox state] == NSOnState)
00194 {
00195 [o_output_settings setEnabled:YES];
00196 }
00197 else
00198 {
00199 [o_output_settings setEnabled:NO];
00200 }
00201 }
00202
00203 - (IBAction)outputSettings:(id)sender
00204 {
00205 [NSApp beginSheet: o_output_sheet
00206 modalForWindow: o_open_panel
00207 modalDelegate: self
00208 didEndSelector: NULL
00209 contextInfo: nil];
00210 }
00211
00212 - (IBAction)outputCloseSheet:(id)sender
00213 {
00214 [o_output_sheet orderOut:sender];
00215 [NSApp endSheet: o_output_sheet];
00216 }
00217
00218 - (void)outputMethodChanged:(NSNotification *)o_notification
00219 {
00220 NSString *o_mode;
00221 o_mode = [[o_method selectedCell] title];
00222
00223 [o_sap_chkbox setEnabled: NO];
00224 [o_slp_chkbox setEnabled: NO];
00225 [o_http_chkbox setEnabled: NO];
00226 [o_rtsp_chkbox setEnabled: NO];
00227 [o_file_chkbox setEnabled: NO];
00228 [o_channel_name setEnabled: NO];
00229 [o_sdp_url setEnabled: NO];
00230 [[o_mux_selector itemAtIndex: 0] setEnabled: YES];
00231
00232 if( [o_mode isEqualToString: _NS("File")] )
00233 {
00234 [o_file_field setEnabled: YES];
00235 [o_btn_browse setEnabled: YES];
00236 [o_dump_chkbox setEnabled: YES];
00237 [o_stream_address setEnabled: NO];
00238 [o_stream_port setEnabled: NO];
00239 [o_stream_ttl setEnabled: NO];
00240 [o_stream_port_stp setEnabled: NO];
00241 [o_stream_ttl_stp setEnabled: NO];
00242 [o_stream_type setEnabled: NO];
00243 [o_mux_selector setEnabled: YES];
00244 [[o_mux_selector itemAtIndex: 1] setEnabled: YES];
00245 [[o_mux_selector itemAtIndex: 2] setEnabled: YES];
00246 [[o_mux_selector itemAtIndex: 3] setEnabled: YES];
00247 [[o_mux_selector itemAtIndex: 4] setEnabled: YES];
00248 [[o_mux_selector itemAtIndex: 5] setEnabled: YES];
00249 [[o_mux_selector itemAtIndex: 6] setEnabled: YES];
00250 [[o_mux_selector itemAtIndex: 7] setEnabled: YES];
00251 [[o_mux_selector itemAtIndex: 8] setEnabled: YES];
00252 }
00253 else if( [o_mode isEqualToString: _NS("Stream")] )
00254 {
00255 [o_file_field setEnabled: NO];
00256 [o_dump_chkbox setEnabled: NO];
00257 [o_btn_browse setEnabled: NO];
00258 [o_stream_port setEnabled: YES];
00259 [o_stream_port_stp setEnabled: YES];
00260 [o_stream_type setEnabled: YES];
00261 [o_mux_selector setEnabled: YES];
00262
00263 o_mode = [o_stream_type titleOfSelectedItem];
00264
00265 if( [o_mode isEqualToString: @"HTTP"] )
00266 {
00267 [o_stream_address setEnabled: YES];
00268 [o_stream_ttl setEnabled: NO];
00269 [o_stream_ttl_stp setEnabled: NO];
00270 [[o_mux_selector itemAtIndex: 1] setEnabled: YES];
00271 [[o_mux_selector itemAtIndex: 2] setEnabled: YES];
00272 [[o_mux_selector itemAtIndex: 3] setEnabled: YES];
00273 [[o_mux_selector itemAtIndex: 4] setEnabled: NO];
00274 [[o_mux_selector itemAtIndex: 5] setEnabled: YES];
00275 [[o_mux_selector itemAtIndex: 6] setEnabled: NO];
00276 [[o_mux_selector itemAtIndex: 7] setEnabled: NO];
00277 [[o_mux_selector itemAtIndex: 8] setEnabled: YES];
00278 }
00279 else if( [o_mode isEqualToString: @"MMSH"] )
00280 {
00281 [o_stream_address setEnabled: YES];
00282 [o_stream_ttl setEnabled: NO];
00283 [o_stream_ttl_stp setEnabled: NO];
00284 [[o_mux_selector itemAtIndex: 0] setEnabled: NO];
00285 [[o_mux_selector itemAtIndex: 1] setEnabled: NO];
00286 [[o_mux_selector itemAtIndex: 2] setEnabled: NO];
00287 [[o_mux_selector itemAtIndex: 3] setEnabled: NO];
00288 [[o_mux_selector itemAtIndex: 4] setEnabled: NO];
00289 [[o_mux_selector itemAtIndex: 5] setEnabled: YES];
00290 [[o_mux_selector itemAtIndex: 6] setEnabled: NO];
00291 [[o_mux_selector itemAtIndex: 7] setEnabled: NO];
00292 [[o_mux_selector itemAtIndex: 8] setEnabled: NO];
00293 [o_mux_selector selectItemAtIndex: 5];
00294 }
00295 else if( [o_mode isEqualToString: @"UDP"] )
00296 {
00297 [o_stream_address setEnabled: YES];
00298 [o_stream_ttl setEnabled: YES];
00299 [o_stream_ttl_stp setEnabled: YES];
00300 [[o_mux_selector itemAtIndex: 1] setEnabled: NO];
00301 [[o_mux_selector itemAtIndex: 2] setEnabled: NO];
00302 [[o_mux_selector itemAtIndex: 3] setEnabled: NO];
00303 [[o_mux_selector itemAtIndex: 4] setEnabled: NO];
00304 [[o_mux_selector itemAtIndex: 5] setEnabled: NO];
00305 [[o_mux_selector itemAtIndex: 6] setEnabled: NO];
00306 [[o_mux_selector itemAtIndex: 7] setEnabled: NO];
00307 [[o_mux_selector itemAtIndex: 8] setEnabled: YES];
00308 [o_sap_chkbox setEnabled: YES];
00309 [o_slp_chkbox setEnabled: YES];
00310 [o_channel_name setEnabled: YES];
00311 }
00312 else if( [o_mode isEqualToString: @"RTP"] )
00313 {
00314 [o_stream_address setEnabled: YES];
00315 [o_stream_ttl setEnabled: YES];
00316 [o_stream_ttl_stp setEnabled: YES];
00317 [[o_mux_selector itemAtIndex: 0] setEnabled: NO];
00318 [[o_mux_selector itemAtIndex: 1] setEnabled: NO];
00319 [[o_mux_selector itemAtIndex: 2] setEnabled: NO];
00320 [[o_mux_selector itemAtIndex: 3] setEnabled: NO];
00321 [[o_mux_selector itemAtIndex: 4] setEnabled: NO];
00322 [[o_mux_selector itemAtIndex: 5] setEnabled: NO];
00323 [[o_mux_selector itemAtIndex: 6] setEnabled: NO];
00324 [[o_mux_selector itemAtIndex: 7] setEnabled: NO];
00325 [[o_mux_selector itemAtIndex: 8] setEnabled: YES];
00326 [o_mux_selector selectItemAtIndex: 8];
00327 [o_sap_chkbox setEnabled: YES];
00328 [o_slp_chkbox setEnabled: NO];
00329 [o_rtsp_chkbox setEnabled: YES];
00330 [o_http_chkbox setEnabled: YES];
00331 [o_file_chkbox setEnabled: YES];
00332 [o_channel_name setEnabled: YES];
00333 }
00334 }
00335
00336 if( ![[o_mux_selector selectedItem] isEnabled] && ![o_mode isEqualToString: @"RTP"] )
00337 {
00338 [o_mux_selector selectItemAtIndex: 0];
00339 }
00340 else if (![[o_mux_selector selectedItem] isEnabled] && [o_mode isEqualToString: @"RTP"] )
00341 {
00342 [o_mux_selector selectItemAtIndex: 8];
00343 }
00344 [self outputInfoChanged: nil];
00345 }
00346
00347 - (void)outputInfoChanged:(NSNotification *)o_notification
00348 {
00349 NSString *o_mode, *o_mux, *o_mux_string;
00350 NSMutableString *o_announce = [NSMutableString stringWithString:@""];
00351 NSMutableString *o_mrl_string = [NSMutableString stringWithString:@":sout=#"];
00352 NSArray *o_sout_options;
00353
00354 [o_mrl_string appendString: o_transcode];
00355 if( [o_display state] == NSOnState )
00356 {
00357 [o_mrl_string appendString: @"duplicate{dst=display,dst="];
00358 }
00359
00360 o_mode = [[o_method selectedCell] title];
00361 o_mux = [o_mux_selector titleOfSelectedItem];
00362
00363 if ( [o_mux isEqualToString: @"AVI"] ) o_mux_string = @"avi";
00364 else if ( [o_mux isEqualToString: @"Ogg"] ) o_mux_string = @"ogg";
00365 else if ( [o_mux isEqualToString: @"MPEG PS"] ) o_mux_string = @"ps";
00366 else if ( [o_mux isEqualToString: @"MPEG 4"] ) o_mux_string = @"mp4";
00367 else if ( [o_mux isEqualToString: @"MPEG 1"] ) o_mux_string = @"mpeg1";
00368 else if ( [o_mux isEqualToString: @"Quicktime"] ) o_mux_string = @"mov";
00369 else if ( [o_mux isEqualToString: @"ASF"] ) o_mux_string = @"asf";
00370 else if ( [o_mux isEqualToString: @"Raw"] ) o_mux_string = @"raw";
00371 else o_mux_string = @"ts";
00372
00373 if( [o_mode isEqualToString: _NS("File")] )
00374 {
00375 if( [o_dump_chkbox state] == NSOnState )
00376 {
00377 NSMutableArray * o_sout_options;
00378 o_sout_options = [NSArray arrayWithObjects:
00379 [NSString stringWithString:
00380 @":demux=dump"],
00381 [NSString stringWithFormat:
00382 @":demuxdump-file=%@",
00383 [o_file_field stringValue]],
00384 nil];
00385 [self setMRL:o_sout_options];
00386 return;
00387 }
00388 else
00389 {
00390 [o_mrl_string appendFormat:
00391 @"std{access=file,mux=%@,url=\"%@\"}",
00392 o_mux_string, [o_file_field stringValue]];
00393 }
00394 }
00395 else if( [o_mode isEqualToString: _NS("Stream")] )
00396 {
00397 o_mode = [o_stream_type titleOfSelectedItem];
00398
00399 if ( [o_mode isEqualToString: @"HTTP"] )
00400 o_mode = @"http";
00401 else if ( [o_mode isEqualToString: @"MMSH"] )
00402 {
00403 if ( [o_mux isEqualToString: @"ASF"] ) o_mux_string = @"asfh";
00404 o_mode = @"mmsh";
00405 }
00406 else if ( [o_mode isEqualToString: @"UDP"] )
00407 {
00408 o_mode = @"udp";
00409 if( [o_sap_chkbox state] == NSOnState )
00410 {
00411 if ( ![[o_channel_name stringValue] isEqualToString: @""] )
00412 [o_announce appendFormat:
00413 @",sap,name=%@", [o_channel_name stringValue]];
00414 else
00415 [o_announce appendFormat:@",sap"];
00416 }
00417 if( [o_slp_chkbox state] == NSOnState )
00418 {
00419 if ( ![[o_channel_name stringValue] isEqualToString: @""] )
00420 [o_announce appendFormat:@
00421 "slp,name=%@",[o_channel_name stringValue]];
00422 else
00423 [o_announce appendString: @",slp"];
00424 }
00425 }
00426 if ( ![o_mode isEqualToString: @"RTP"] )
00427 {
00428
00429
00430
00431 NSArray * o_urlItems = [[o_stream_address stringValue] \
00432 componentsSeparatedByString: @"/"];
00433 NSMutableString * o_finalStreamAddress;
00434 o_finalStreamAddress = [[NSMutableString alloc] init];
00435
00436 if ([o_urlItems count] == 1)
00437 {
00438 [o_finalStreamAddress appendFormat: @"\"%@:%@\"", \
00439 [o_stream_address stringValue],[o_stream_port stringValue]];
00440 }
00441 else
00442 {
00443 [o_finalStreamAddress appendFormat: @"\"%@:%@", [o_urlItems \
00444 objectAtIndex: 0], [o_stream_port stringValue]];
00445 unsigned int x;
00446 x = 1;
00447 while (x != [o_urlItems count])
00448 {
00449 [o_finalStreamAddress appendFormat: @"/%@", [o_urlItems \
00450 objectAtIndex: x]];
00451 x = (x + 1);
00452 }
00453 [o_finalStreamAddress appendString: @"\""];
00454 }
00455
00456 [o_mrl_string appendFormat:
00457 @"std{access=%@,mux=%@,url=%@%@}",
00458 o_mode, o_mux_string, o_finalStreamAddress, o_announce];
00459 }
00460 else
00461 {
00462 NSString * o_stream_name;
00463
00464 if (![[o_channel_name stringValue] isEqualToString: @""] )
00465 {
00466 o_stream_name = [NSString stringWithFormat:@",name=%@",
00467 [o_channel_name stringValue]];
00468 }
00469 else
00470 {
00471 o_stream_name = @"";
00472 }
00473
00474 if ( [o_sap_chkbox state] == NSOnState )
00475 {
00476 [o_announce appendString: @",sdp=sap"];
00477 }
00478 if ([o_rtsp_chkbox state] == NSOnState )
00479 {
00480 [o_announce appendFormat:@",sdp=\"rtsp://%@\"",[o_sdp_url stringValue]];
00481
00482 }
00483 if ([o_http_chkbox state] == NSOnState )
00484 {
00485 [o_announce appendFormat:@",sdp=\"http://%@\"",[o_sdp_url stringValue]];
00486 }
00487 if ([o_file_chkbox state] == NSOnState )
00488 {
00489 [o_announce appendFormat:@",sdp=\"file://%@\"",[o_sdp_url stringValue]];
00490 }
00491 [o_mrl_string appendFormat:
00492 @"rtp{dst=\"%@\",port=%@%@%@}",[o_stream_address stringValue],
00493 [o_stream_port stringValue], o_stream_name, o_announce];
00494 }
00495
00496 }
00497 if( [o_display state] == NSOnState )
00498 {
00499 [o_mrl_string appendString: @"}"];
00500 }
00501 o_sout_options = [NSArray arrayWithObjects: o_mrl_string,nil];
00502 [self setMRL:o_sout_options];
00503 }
00504
00505 - (void)TTLChanged:(NSNotification *)o_notification
00506 {
00507 intf_thread_t * p_intf = VLCIntf;
00508 config_PutInt( p_intf, "ttl", [o_stream_ttl intValue] );
00509 }
00510
00511 - (IBAction)outputFileBrowse:(id)sender
00512 {
00513 NSSavePanel *o_save_panel = [NSSavePanel savePanel];
00514 NSString *o_mux_string;
00515 if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"MPEG PS"] )
00516 o_mux_string = @"vob";
00517 else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"MPEG 1"] )
00518 o_mux_string = @"mpg";
00519 else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"AVI"] )
00520 o_mux_string = @"avi";
00521 else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"ASF"] )
00522 o_mux_string = @"asf";
00523 else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"Ogg"] )
00524 o_mux_string = @"ogm";
00525 else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"MPEG 4"] )
00526 o_mux_string = @"mp4";
00527 else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"Quicktime"] )
00528 o_mux_string = @"mov";
00529 else if ( [[o_mux_selector titleOfSelectedItem] isEqualToString: @"Raw"] )
00530 o_mux_string = @"raw";
00531 else
00532 o_mux_string = @"ts";
00533
00534 NSString * o_name = [NSString stringWithFormat: @"vlc-output.%@",
00535 o_mux_string];
00536
00537 [o_save_panel setTitle: _NS("Save File")];
00538 [o_save_panel setPrompt: _NS("Save")];
00539
00540 if( [o_save_panel runModalForDirectory: nil
00541 file: o_name] == NSOKButton )
00542 {
00543 NSString *o_filename = [o_save_panel filename];
00544 [o_file_field setStringValue: o_filename];
00545 [self outputInfoChanged: nil];
00546 }
00547 }
00548
00549 - (IBAction)streamPortStepperChanged:(id)sender
00550 {
00551 [o_stream_port setIntValue: [o_stream_port_stp intValue]];
00552 [self outputInfoChanged: nil];
00553 }
00554
00555 - (IBAction)streamTTLStepperChanged:(id)sender
00556 {
00557 [o_stream_ttl setIntValue: [o_stream_ttl_stp intValue]];
00558 [self TTLChanged:nil];
00559 }
00560
00561 - (void)transcodeChanged:(NSNotification *)o_notification
00562 {
00563 if( [o_transcode_video_chkbox state] == NSOnState )
00564 {
00565 [o_transcode_video_selector setEnabled: YES];
00566 [o_transcode_video_bitrate setEnabled: YES];
00567 [o_transcode_video_scale setEnabled: YES];
00568 }
00569 else
00570 {
00571 [o_transcode_video_selector setEnabled: NO];
00572 [o_transcode_video_bitrate setEnabled: NO];
00573 [o_transcode_video_scale setEnabled: NO];
00574 }
00575 if( [o_transcode_audio_chkbox state] == NSOnState )
00576 {
00577 [o_transcode_audio_selector setEnabled: YES];
00578 [o_transcode_audio_bitrate setEnabled: YES];
00579 [o_transcode_audio_channels setEnabled: YES];
00580 }
00581 else
00582 {
00583 [o_transcode_audio_selector setEnabled: NO];
00584 [o_transcode_audio_bitrate setEnabled: NO];
00585 [o_transcode_audio_channels setEnabled: NO];
00586 }
00587
00588 [self transcodeInfoChanged:nil];
00589 }
00590
00591 - (void)transcodeInfoChanged:(NSNotification *)o_notification
00592 {
00593 NSMutableString *o_transcode_string;
00594
00595 if( [o_transcode_video_chkbox state] == NSOnState ||
00596 [o_transcode_audio_chkbox state] == NSOnState )
00597 {
00598 o_transcode_string = [NSMutableString stringWithString:@"transcode{"];
00599 if ( [o_transcode_video_chkbox state] == NSOnState )
00600 {
00601 [o_transcode_string appendFormat: @"vcodec=\"%@\",vb=\"%@\",scale=\"%@\"",
00602 [o_transcode_video_selector titleOfSelectedItem],
00603 [o_transcode_video_bitrate stringValue],
00604 [o_transcode_video_scale stringValue]];
00605 if ( [o_transcode_audio_chkbox state] == NSOnState )
00606 {
00607 [o_transcode_string appendString: @","];
00608 }
00609 }
00610 if ( [o_transcode_audio_chkbox state] == NSOnState )
00611 {
00612 [o_transcode_string appendFormat: @"acodec=\"%@\",ab=\"%@\"",
00613 [o_transcode_audio_selector titleOfSelectedItem],
00614 [o_transcode_audio_bitrate stringValue]];
00615 if ( ![[o_transcode_audio_channels stringValue]
00616 isEqualToString: @""])
00617 {
00618 [o_transcode_string appendFormat: @",channels=\"%@\"",
00619 [o_transcode_audio_channels stringValue]];
00620 }
00621 }
00622 [o_transcode_string appendString:@"}:"];
00623 }
00624 else
00625 {
00626 o_transcode_string = [NSString stringWithString:@""];
00627 }
00628 [self setTranscode: o_transcode_string];
00629 [self outputInfoChanged:nil];
00630 }
00631
00632 - (IBAction)announceChanged:(id)sender
00633 {
00634 NSString *o_mode;
00635 o_mode = [[o_stream_type selectedCell] title];
00636 [o_channel_name setEnabled: [o_sap_chkbox state] || [o_slp_chkbox state]
00637 || [o_mode isEqualToString: @"RTP"]];
00638
00639 if ([o_mode isEqualToString: @"RTP"])
00640 {
00641
00642
00643
00644
00645
00646 if ([[sender title] isEqualToString:_NS("RTSP announce")])
00647 {
00648
00649 [o_http_chkbox setState:NSOffState];
00650 [o_file_chkbox setState:NSOffState];
00651 }
00652 else if ([[sender title] isEqualToString:_NS("HTTP announce")])
00653 {
00654
00655 [o_rtsp_chkbox setState:NSOffState];
00656 [o_file_chkbox setState:NSOffState];
00657 }
00658 else if ([[sender title] isEqualToString:_NS("Export SDP as file")])
00659 {
00660 [o_rtsp_chkbox setState:NSOffState];
00661 [o_http_chkbox setState:NSOffState];
00662 }
00663
00664 if ( [o_rtsp_chkbox state] == NSOnState ||
00665 [o_http_chkbox state] == NSOnState ||
00666 [o_file_chkbox state] == NSOnState )
00667 {
00668 [o_sdp_url setEnabled: YES];
00669 }
00670 else
00671 {
00672 [o_sdp_url setEnabled: NO];
00673 }
00674 }
00675 [self outputInfoChanged: nil];
00676 }
00677
00678 @end