/*****************************************************************************
* output.m: MacOS X Output Dialog
*****************************************************************************
- * Copyright (C) 2002-2003 VideoLAN
+ * Copyright (C) 2002-2003 the VideoLAN team
* $Id$
*
- * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
+ * 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>
*
* 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
- (id)init
{
self = [super init];
- o_mrl = [[NSString alloc] init];
+ o_mrl = [[NSArray alloc] init];
o_transcode = [[NSString alloc] init];
return self;
}
[super dealloc];
}
-- (void)setMRL:(NSString *)o_mrl_string
+- (void)setMRL:(NSArray *)o_mrl_array
{
[o_mrl autorelease];
- o_mrl = [o_mrl_string copy];
+ o_mrl = [o_mrl_array copy];
}
-- (NSString *)getMRL
+- (NSArray *)getMRL
{
return [o_mrl copy];
}
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
@"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", @"I263", @"WMV1", @"WMV2", @"MJPG", @"theo", nil];
+ @"DIV2", @"DIV3", @"h263", @"h264", @"WMV1", @"WMV2", @"MJPG", @"theo", nil];
[o_output_ckbox setTitle: _NS("Advanced output:")];
[o_output_settings setTitle: _NS("Settings...")];
[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_slp_chkbox setTitle: _NS("SLP announce")];
[o_rtsp_chkbox setTitle: _NS("RTSP announce")];
[o_http_chkbox setTitle:_NS("HTTP announce")];
+ [o_file_chkbox setTitle:_NS("Export SDP as file")];
[o_channel_name_lbl setStringValue: _NS("Channel Name")];
- [o_sdp_url_lbl setStringValue: _NS("SDP file address")];
+ [o_sdp_url_lbl setStringValue: _NS("SDP URL")];
}
- (IBAction)outputChanged:(id)sender;
[o_slp_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];
[o_slp_chkbox setEnabled: NO];
[o_rtsp_chkbox setEnabled: YES];
[o_http_chkbox setEnabled: YES];
+ [o_file_chkbox setEnabled: YES];
[o_channel_name setEnabled: YES];
}
}
- (void)outputInfoChanged:(NSNotification *)o_notification
{
- NSString *o_mode, *o_mux, *o_mux_string, *o_announce;
+ 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 )
{
if( [o_dump_chkbox state] == NSOnState )
{
- o_mrl_string = [NSMutableString stringWithFormat:
- @":demux=demuxdump :demuxdump-file=\"%@\"",
- [o_file_field stringValue]];
- [self setMRL:o_mrl_string];
+ NSMutableArray * o_sout_options;
+ o_sout_options = [NSArray arrayWithObjects:
+ [NSString stringWithString:
+ @":demux=dump"],
+ [NSString stringWithFormat:
+ @":demuxdump-file=%@",
+ [o_file_field stringValue]],
+ nil];
+ [self setMRL:o_sout_options];
return;
}
else
else if( [o_mode isEqualToString: _NS("Stream")] )
{
o_mode = [o_stream_type titleOfSelectedItem];
- o_announce = @"";
if ( [o_mode isEqualToString: @"HTTP"] )
o_mode = @"http";
if( [o_sap_chkbox state] == NSOnState )
{
if ( ![[o_channel_name stringValue] isEqualToString: @""] )
- o_announce = [NSString stringWithFormat:@",sap,name=%@",
- [o_channel_name stringValue]];
+ [o_announce appendFormat:
+ @",sap,name=%@", [o_channel_name stringValue]];
else
- o_announce = @",sap";
+ [o_announce appendFormat:@",sap"];
}
if( [o_slp_chkbox state] == NSOnState )
{
if ( ![[o_channel_name stringValue] isEqualToString: @""] )
- o_announce = [o_announce stringByAppendingFormat:@
+ [o_announce appendFormat:@
"slp,name=%@",[o_channel_name stringValue]];
else
- o_announce = [o_announce stringByAppendingString: @",slp"];
+ [o_announce appendString: @",slp"];
}
}
if ( ![o_mode isEqualToString: @"RTP"] )
else
{
NSString * o_stream_name;
+
if (![[o_channel_name stringValue] isEqualToString: @""] )
{
o_stream_name = [NSString stringWithFormat:@",name=%@",
if ( [o_sap_chkbox state] == NSOnState )
{
- o_announce = @",sdp=sap";
+ [o_announce appendString: @",sdp=sap"];
}
- else if ([o_rtsp_chkbox state] == NSOnState )
+ if ([o_rtsp_chkbox state] == NSOnState )
{
- o_announce = [NSString stringWithFormat:@",sdp=\"rtsp://%@\"",[o_sdp_url stringValue]];
+ [o_announce appendFormat:@",sdp=\"rtsp://%@\"",[o_sdp_url stringValue]];
}
- else if ([o_http_chkbox state] == NSOnState )
+ if ([o_http_chkbox state] == NSOnState )
+ {
+ [o_announce appendFormat:@",sdp=\"http://%@\"",[o_sdp_url stringValue]];
+ }
+ if ([o_file_chkbox state] == NSOnState )
{
- o_announce = [NSString stringWithFormat:@",sdp=\"http://%@\"",[o_sdp_url stringValue]];
+ [o_announce appendFormat:@",sdp=\"file://%@\"",[o_sdp_url stringValue]];
}
[o_mrl_string appendFormat:
@"rtp{dst=\"%@\",port=%@%@%@}",[o_stream_address stringValue],
{
[o_mrl_string appendString: @"}"];
}
- [self setMRL:o_mrl_string];
+ o_sout_options = [NSArray arrayWithObjects: o_mrl_string,nil];
+ [self setMRL:o_sout_options];
}
- (void)TTLChanged:(NSNotification *)o_notification
{
[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_string = [NSMutableString stringWithString:@"transcode{"];
if ( [o_transcode_video_chkbox state] == NSOnState )
{
- [o_transcode_string appendFormat: @"vcodec=\"%@\",vb=\"%@\"",
+ [o_transcode_string appendFormat: @"vcodec=\"%@\",vb=\"%@\""
+ ",scale=\"%@\"",
[o_transcode_video_selector titleOfSelectedItem],
- [o_transcode_video_bitrate stringValue]];
+ [o_transcode_video_bitrate stringValue],
+ [o_transcode_video_scale stringValue]];
if ( [o_transcode_audio_chkbox state] == NSOnState )
{
[o_transcode_string appendString: @","];
[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:@"}:"];
}
if ([o_mode isEqualToString: @"RTP"])
{
- if ([[sender title] isEqualToString: _NS("SAP announce")])
+/* if ([[sender title] isEqualToString: _NS("SAP announce")])
{
[o_rtsp_chkbox setState:NSOffState];
[o_http_chkbox setState:NSOffState];
- }
- else if ([[sender title] isEqualToString:_NS("RTSP announce")])
+ }*/
+ if ([[sender title] isEqualToString:_NS("RTSP announce")])
{
- [o_sap_chkbox setState:NSOffState];
+// [o_sap_chkbox setState:NSOffState];
[o_http_chkbox setState:NSOffState];
+ [o_file_chkbox setState:NSOffState];
}
else if ([[sender title] isEqualToString:_NS("HTTP announce")])
{
- [o_sap_chkbox setState:NSOffState];
+// [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_http_chkbox state] == NSOnState ||
+ [o_file_chkbox state] == NSOnState )
{
[o_sdp_url setEnabled: YES];
}