📄 wizard.m
字号:
/***************************************************************************** * wizard.m: MacOS X Streaming Wizard ***************************************************************************** * Copyright (C) 2005-2006 the VideoLAN team * $Id: wizard.m 18978 2007-02-23 20:07:18Z fkuehne $ * * Authors: Felix Kühne <fkuehne@users.sf.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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************//***************************************************************************** * Note: this code is partially based upon ../wxwidgets/wizard.cpp and * ../wxwidgets/streamdata.h; both written by Clément Stenac. *****************************************************************************//***************************************************************************** * Preamble *****************************************************************************/#import "wizard.h"#import "intf.h"#import "network.h"#import "playlist.h"#import <vlc/intf.h>/***************************************************************************** * VLCWizard implementation *****************************************************************************/@implementation VLCWizardstatic VLCWizard *_o_sharedInstance = nil;+ (VLCWizard *)sharedInstance{ return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];}- (id)init{ if (_o_sharedInstance) { [self dealloc]; } else { _o_sharedInstance = [super init]; } return _o_sharedInstance;}- (void)dealloc{ [o_userSelections release]; [o_videoCodecs release]; [o_audioCodecs release]; [o_encapFormats release]; [super dealloc];}- (void)awakeFromNib{ /* some minor cleanup */ [o_t2_tbl_plst setEnabled:NO]; o_userSelections = [[NSMutableDictionary alloc] init]; [o_btn_backward setEnabled:NO]; /* add audio-bitrates for transcoding */ NSArray * audioBitratesArray; audioBitratesArray = [NSArray arrayWithObjects: @"512", @"256", @"192", \ @"128", @"64", @"32", @"16", nil ]; [o_t4_pop_audioBitrate removeAllItems]; [o_t4_pop_audioBitrate addItemsWithTitles: audioBitratesArray]; [o_t4_pop_audioBitrate selectItemWithTitle: @"192"]; /* add video-bitrates for transcoding */ NSArray * videoBitratesArray; videoBitratesArray = [NSArray arrayWithObjects: @"3072", @"2048", @"1024", \ @"768", @"512", @"256", @"192", @"128", @"64", @"32", @"16", nil ]; [o_t4_pop_videoBitrate removeAllItems]; [o_t4_pop_videoBitrate addItemsWithTitles: videoBitratesArray]; [o_t4_pop_videoBitrate selectItemWithTitle: @"1024"]; /* fill 2 global arrays with arrays containing all codec-related information * - one array per codec named by its short name to define the encap-compability, * cmd-names, real names, more info in the order: realName, shortName, * moreInfo, encaps */ NSArray * o_mp1v; NSArray * o_mp2v; NSArray * o_mp4v; NSArray * o_div1; NSArray * o_div2; NSArray * o_div3; NSArray * o_h263; NSArray * o_h264; NSArray * o_wmv1; NSArray * o_wmv2; NSArray * o_mjpg; NSArray * o_theo; NSArray * o_dummyVid; o_mp1v = [NSArray arrayWithObjects: @"MPEG-1 Video", @"mp1v", \ _NS("MPEG-1 Video codec (usable with MPEG PS, MPEG TS, MPEG1, OGG " \ "and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_OGG", @"MUX_RAW", \ @"NO", @"NO", @"NO", @"NO", nil]; o_mp2v = [NSArray arrayWithObjects: @"MPEG-2 Video", @"mp2v", \ _NS("MPEG-2 Video codec (usable with MPEG PS, MPEG TS, MPEG1, OGG " \ "and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_OGG", @"MUX_RAW", \ @"NO", @"NO", @"NO", @"NO", nil]; o_mp4v = [NSArray arrayWithObjects: @"MPEG-4 Video", @"mp4v", \ _NS("MPEG-4 Video codec (useable with MPEG PS, MPEG TS, MPEG1, ASF, " \ "MP4, OGG and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", \ @"MUX_MP4", @"MUX_OGG", @"MUX_RAW", @"NO", @"NO", nil]; o_div1 = [NSArray arrayWithObjects: @"DIVX 1", @"DIV1", \ _NS("DivX first version (useable with MPEG TS, MPEG1, ASF and OGG)"), \ @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", \ @"NO", @"NO", nil]; o_div2 = [NSArray arrayWithObjects: @"DIVX 2", @"DIV2", \ _NS("DivX second version (useable with MPEG TS, MPEG1, ASF and OGG)"), \ @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", \ @"NO", @"NO", nil]; o_div3 = [NSArray arrayWithObjects: @"DIVX 3", @"DIV3", \ _NS("DivX third version (useable with MPEG TS, MPEG1, ASF and OGG)"), \ @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", \ @"NO", @"NO", nil]; o_h263 = [NSArray arrayWithObjects: @"H.263", @"h263", \ _NS("H263 is a video codec optimized for videoconference " \ "(low rates, useable with MPEG TS)"), @"MUX_TS", @"NO", @"NO", @"NO", \ @"NO", @"NO", @"NO", @"NO", @"NO", nil]; o_h264 = [NSArray arrayWithObjects: @"H.264", @"h264", \ _NS("H264 is a new video codec (useable with MPEG TS and MP4)"), \ @"MUX_TS", @"MUX_MP4", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", \ @"NO", nil]; o_wmv1 = [NSArray arrayWithObjects: @"WMV 1", @"WMV1", \ _NS("WMV (Windows Media Video) 1 (useable with MPEG TS, MPEG1, ASF and " \ "OGG)"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", \ @"NO", @"NO", @"NO", nil]; o_wmv2 = [NSArray arrayWithObjects: @"WMV 2", @"WMV2", \ _NS("WMV (Windows Media Video) 2 (useable with MPEG TS, MPEG1, ASF and " \ "OGG)"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", \ @"NO", @"NO", @"NO", nil]; o_mjpg = [NSArray arrayWithObjects: @"MJPEG", @"MJPG", \ _NS("MJPEG consists of a series of JPEG pictures (useable with MPEG TS," \ " MPEG1, ASF and OGG)"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", \ @"NO", @"NO", @"NO", @"NO", @"NO", nil]; o_theo = [NSArray arrayWithObjects: @"Theora", @"theo", \ _NS("Theora is a free general-purpose codec (useable with MPEG TS " \ "and OGG)"), @"MUX_TS", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO", \ @"NO", @"NO", nil]; o_dummyVid = [NSArray arrayWithObjects: @"Dummy", @"dummy", \ _NS("Dummy codec (do not transcode, useable with all encapsulation " \ "formats)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_MP4", \ @"MUX_OGG", @"MUX_WAV", @"MUX_RAW", @"MUX_MOV", nil]; o_videoCodecs = [[NSArray alloc] initWithObjects: o_mp1v, o_mp2v, o_mp4v, \ o_div1, o_div2, o_div3, o_h263, o_h264, o_wmv1, o_wmv2, o_mjpg, o_theo, \ o_dummyVid, nil]; NSArray * o_mpga; NSArray * o_mp3; NSArray * o_mp4a; NSArray * o_a52; NSArray * o_vorb; NSArray * o_flac; NSArray * o_spx; NSArray * o_s16l; NSArray * o_fl32; NSArray * o_dummyAud; o_mpga = [NSArray arrayWithObjects: @"MPEG Audio", @"mpga", \ _NS("The standard MPEG audio (1/2) format (useable with MPEG PS, MPEG TS, " \ "MPEG1, ASF, OGG and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", \ @"MUX_ASF", @"MUX_OGG", @"MUX_RAW", @"-1", @"-1", @"-1", nil]; o_mp3 = [NSArray arrayWithObjects: @"MP3", @"mp3", \ _NS("MPEG Audio Layer 3 (useable with MPEG PS, MPEG TS, MPEG1, ASF, OGG " \ "and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", \ @"MUX_RAW", @"-1", @"-1", @"-1", nil]; o_mp4a = [NSArray arrayWithObjects: @"MPEG 4 Audio", @"mp4a", \ _NS("Audio format for MPEG4 (useable with MPEG TS and MPEG4)"), @"MUX_TS", \ @"MUX_MP4", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil]; o_a52 = [NSArray arrayWithObjects: @"A/52", @"a52", _NS("DVD audio format (useable with MPEG PS, MPEG TS, MPEG1, ASF, OGG " \ "and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", \ @"MUX_RAW", @"-1", @"-1", @"-1", nil]; o_vorb = [NSArray arrayWithObjects: @"Vorbis", @"vorb", \ _NS("Vorbis is a free audio codec (useable with OGG)"), @"MUX_OGG", \ @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil]; o_flac = [NSArray arrayWithObjects: @"FLAC", @"flac", \ _NS("FLAC is a lossless audio codec (useable with OGG and RAW)"), \ @"MUX_OGG", @"MUX_RAW", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", \ @"-1", nil]; o_spx = [NSArray arrayWithObjects: @"Speex", @"spx", \ _NS("A free audio codec dedicated to compression of voice (useable " \ "with OGG)"), @"MUX_OGG", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", \ @"-1", @"-1", nil]; o_s16l = [NSArray arrayWithObjects: @"Uncompressed, integer", @"s16l", \ _NS("Uncompressed audio samples (useable with WAV)"), @"MUX_WAV", \ @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil]; o_fl32 = [NSArray arrayWithObjects: @"Uncompressed, floating point", @"fl32", \ _NS("Uncompressed audio samples (useable with WAV)"), @"MUX_WAV", \ @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil]; o_dummyAud = [NSArray arrayWithObjects: @"Dummy", @"dummy", \ _NS("Dummy codec (do not transcode, useable with all encapsulation " \ "formats)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_MP4", \ @"MUX_OGG", @"MUX_RAW", @"MUX_MOV", @"MUX_WAV", nil]; o_audioCodecs = [[NSArray alloc] initWithObjects: o_mpga, o_mp3, o_mp4a, \ o_a52, o_vorb, o_flac, o_spx, o_s16l, o_fl32, o_dummyAud, nil]; /* fill another global array with all information about the encap-formats * note that the order of the formats inside the g. array is the same as on * the encap-tab */ NSArray * o_ps; NSArray * o_ts; NSArray * o_mpeg; NSArray * o_ogg; NSArray * o_raw; NSArray * o_asf; NSArray * o_avi; NSArray * o_mp4; NSArray * o_mov; NSArray * o_wav; NSArray * o_asfh; o_ps = [NSArray arrayWithObjects: @"ps", @"MPEG PS", \ _NS("MPEG Program Stream"), @"mpg", nil]; o_ts = [NSArray arrayWithObjects: @"ts", @"MPEG TS", \ _NS("MPEG Transport Stream"), nil]; o_mpeg = [NSArray arrayWithObjects: @"ps", @"MPEG 1", \ _NS("MPEG 1 Format"), @"mpg", nil]; o_ogg = [NSArray arrayWithObjects: @"ogg", @"OGG", @"OGG", nil]; o_raw = [NSArray arrayWithObjects: @"raw", @"RAW", @"RAW", nil]; o_asf = [NSArray arrayWithObjects: @"asf", @"ASF", @"ASF", nil]; o_avi = [NSArray arrayWithObjects: @"avi", @"AVI", @"AVI", nil]; o_mp4 = [NSArray arrayWithObjects: @"mp4", @"MP4", @"MPEG4", nil]; o_mov = [NSArray arrayWithObjects: @"mov", @"MOV", @"MOV", nil]; o_wav = [NSArray arrayWithObjects: @"wav", @"WAV", @"WAV", nil]; o_asfh = [NSArray arrayWithObjects: @"asfh", @"ASFH", @"ASFH", nil]; o_encapFormats = [[NSArray alloc] initWithObjects: o_ps, o_ts, o_mpeg, \ o_ogg, o_raw, o_asf, o_avi, o_mp4, o_mov, o_wav, o_asfh, nil]; /* yet another array on streaming methods including help texts */ NSArray * o_http; NSArray * o_mms; NSArray * o_udp_uni; NSArray * o_udp_multi; NSArray * o_rtp_uni; NSArray * o_rtp_multi; o_http = [NSArray arrayWithObjects: @"http", @"HTTP", _NS("Enter the local " \ "addresses you want to listen requests on. Do not enter anything if " \ "you want to listen on all the network interfaces. This is generally " \ "the best thing to do. Other computers can then access the stream at " \ "http://yourip:8080 by default.") , _NS("Use this to stream to several " \ "computers. This method is not the most efficient, as the server needs "\ "to send the stream several times, but generally the most compatible"), nil]; o_mms = [NSArray arrayWithObjects: @"mmsh", @"MMS", _NS("Enter the local " \ "addresses you want to listen requests on. Do not enter anything if " \ "you want to listen on all the network interfaces. This is generally " \ "the best thing to do. Other computers can then access the stream at " \ "mms://yourip:8080 by default."), _NS("Use this to stream to several " \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -