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