macosx: rename to VLCConvertAndSaveWindowController
authorDavid Fuhrmann <dfuhrmann@videolan.org>
Mon, 8 Aug 2016 16:22:01 +0000 (18:22 +0200)
committerDavid Fuhrmann <dfuhrmann@videolan.org>
Mon, 8 Aug 2016 16:47:29 +0000 (18:47 +0200)
extras/package/macosx/Resources/English.lproj/ConvertAndSave.xib
extras/package/macosx/vlc.xcodeproj/project.pbxproj
modules/gui/macosx/ConvertAndSave.h [deleted file]
modules/gui/macosx/ConvertAndSave.m [deleted file]
modules/gui/macosx/Makefile.am
modules/gui/macosx/VLCConvertAndSaveWindowController.h [new file with mode: 0644]
modules/gui/macosx/VLCConvertAndSaveWindowController.m [new file with mode: 0644]
modules/gui/macosx/VLCMainMenu.m
modules/gui/macosx/intf.h
modules/gui/macosx/intf.m

index 1567066..d22a76a 100644 (file)
@@ -1,13 +1,12 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
-        <deployment identifier="macosx"/>
         <development version="7000" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
         <capability name="box content view" minToolsVersion="7.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="VLCConvertAndSave">
+        <customObject id="-2" userLabel="File's Owner" customClass="VLCConvertAndSaveWindowController">
             <connections>
                 <outlet property="customizeAudBitrateField" destination="214" id="596"/>
                 <outlet property="customizeAudBitrateLabel" destination="212" id="592"/>
index dfa7764..f7848e8 100644 (file)
                1CCB5F5D1A62A724004C3E90 /* CompatibilityFixes.h in Sources */ = {isa = PBXBuildFile; fileRef = CCB0BB3013FAC9F40095BD0A /* CompatibilityFixes.h */; };
                1CCB5F601A62A724004C3E90 /* ControlsBar.h in Sources */ = {isa = PBXBuildFile; fileRef = E0382C00160BA09E0031D7FF /* ControlsBar.h */; };
                1CCB5F611A62A724004C3E90 /* ControlsBar.m in Sources */ = {isa = PBXBuildFile; fileRef = E0382C01160BA09E0031D7FF /* ControlsBar.m */; };
-               1CCB5F621A62A724004C3E90 /* ConvertAndSave.h in Sources */ = {isa = PBXBuildFile; fileRef = CC0663341566C34C003A411C /* ConvertAndSave.h */; };
-               1CCB5F631A62A724004C3E90 /* ConvertAndSave.m in Sources */ = {isa = PBXBuildFile; fileRef = CC0663351566C34C003A411C /* ConvertAndSave.m */; };
+               1CCB5F621A62A724004C3E90 /* VLCConvertAndSaveWindowController.h in Sources */ = {isa = PBXBuildFile; fileRef = CC0663341566C34C003A411C /* VLCConvertAndSaveWindowController.h */; };
+               1CCB5F631A62A724004C3E90 /* VLCConvertAndSaveWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = CC0663351566C34C003A411C /* VLCConvertAndSaveWindowController.m */; };
                1CCB5F641A62A724004C3E90 /* VLCCoreDialogProvider.h in Sources */ = {isa = PBXBuildFile; fileRef = CC4A33220F8CB017000FC4A7 /* VLCCoreDialogProvider.h */; };
                1CCB5F651A62A724004C3E90 /* VLCCoreDialogProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = CC4A33210F8CB017000FC4A7 /* VLCCoreDialogProvider.m */; };
                1CCB5F661A62A724004C3E90 /* CoreInteraction.h in Sources */ = {isa = PBXBuildFile; fileRef = CC448A6013B68A0B009F72E0 /* CoreInteraction.h */; };
                CC0586B714ACF7C000659A99 /* sidebar-pictures.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "sidebar-pictures.png"; path = "Resources/sidebar-icons/sidebar-pictures.png"; sourceTree = "<group>"; };
                CC0586B814ACF7C000659A99 /* sidebar-playlist.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "sidebar-playlist.png"; path = "Resources/sidebar-icons/sidebar-playlist.png"; sourceTree = "<group>"; };
                CC0586B914ACF7C000659A99 /* sidebar-podcast.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "sidebar-podcast.png"; path = "Resources/sidebar-icons/sidebar-podcast.png"; sourceTree = "<group>"; };
-               CC0663341566C34C003A411C /* ConvertAndSave.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = ConvertAndSave.h; path = ../../../modules/gui/macosx/ConvertAndSave.h; sourceTree = SOURCE_ROOT; };
-               CC0663351566C34C003A411C /* ConvertAndSave.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = ConvertAndSave.m; path = ../../../modules/gui/macosx/ConvertAndSave.m; sourceTree = SOURCE_ROOT; };
+               CC0663341566C34C003A411C /* VLCConvertAndSaveWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = VLCConvertAndSaveWindowController.h; path = ../../../modules/gui/macosx/VLCConvertAndSaveWindowController.h; sourceTree = SOURCE_ROOT; };
+               CC0663351566C34C003A411C /* VLCConvertAndSaveWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = VLCConvertAndSaveWindowController.m; path = ../../../modules/gui/macosx/VLCConvertAndSaveWindowController.m; sourceTree = SOURCE_ROOT; };
                CC0663381566CD5A003A411C /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Resources/English.lproj/ConvertAndSave.xib; sourceTree = "<group>"; };
                CC0CD0DF13DE0EAE00B0D90D /* PXSourceList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PXSourceList.h; path = ../../../modules/gui/macosx/PXSourceList.h; sourceTree = SOURCE_ROOT; };
                CC0CD0E013DE0EAE00B0D90D /* PXSourceList.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PXSourceList.m; path = ../../../modules/gui/macosx/PXSourceList.m; sourceTree = SOURCE_ROOT; };
                                CCB0BB3013FAC9F40095BD0A /* CompatibilityFixes.h */,
                                E0382C00160BA09E0031D7FF /* ControlsBar.h */,
                                E0382C01160BA09E0031D7FF /* ControlsBar.m */,
-                               CC0663341566C34C003A411C /* ConvertAndSave.h */,
-                               CC0663351566C34C003A411C /* ConvertAndSave.m */,
+                               CC0663341566C34C003A411C /* VLCConvertAndSaveWindowController.h */,
+                               CC0663351566C34C003A411C /* VLCConvertAndSaveWindowController.m */,
                                CC4A33220F8CB017000FC4A7 /* VLCCoreDialogProvider.h */,
                                CC4A33210F8CB017000FC4A7 /* VLCCoreDialogProvider.m */,
                                CC448A6013B68A0B009F72E0 /* CoreInteraction.h */,
                                1CCB5F5D1A62A724004C3E90 /* CompatibilityFixes.h in Sources */,
                                1CCB5F601A62A724004C3E90 /* ControlsBar.h in Sources */,
                                1CCB5F611A62A724004C3E90 /* ControlsBar.m in Sources */,
-                               1CCB5F621A62A724004C3E90 /* ConvertAndSave.h in Sources */,
-                               1CCB5F631A62A724004C3E90 /* ConvertAndSave.m in Sources */,
+                               1CCB5F621A62A724004C3E90 /* VLCConvertAndSaveWindowController.h in Sources */,
+                               1CCB5F631A62A724004C3E90 /* VLCConvertAndSaveWindowController.m in Sources */,
                                1CCB5F641A62A724004C3E90 /* VLCCoreDialogProvider.h in Sources */,
                                1CCB5F651A62A724004C3E90 /* VLCCoreDialogProvider.m in Sources */,
                                1CCB5F661A62A724004C3E90 /* CoreInteraction.h in Sources */,
diff --git a/modules/gui/macosx/ConvertAndSave.h b/modules/gui/macosx/ConvertAndSave.h
deleted file mode 100644 (file)
index 2d9935a..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*****************************************************************************
- * ConvertAndSave.h: MacOS X interface module
- *****************************************************************************
- * Copyright (C) 2012 Felix Paul Kühne
- * $Id$
- *
- * Authors: 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.
- *****************************************************************************/
-
-#import <Cocoa/Cocoa.h>
-
-@class VLCDropDisabledImageView;
-@class VLCDragDropView;
-@class VLCPopupPanelController;
-@class VLCTextfieldPanelController;
-
-@interface VLCConvertAndSave : NSWindowController
-
-// main panel
-@property (weak) IBOutlet VLCDragDropView *dropBox;
-@property (weak) IBOutlet NSTextField *dropLabel;
-
-@property (weak) IBOutlet VLCDropDisabledImageView *dropImage;
-@property (weak) IBOutlet NSButton *dropButton;
-@property (weak) IBOutlet NSTextField *profileLabel;
-@property (weak) IBOutlet NSPopUpButton *profilePopup;
-@property (weak) IBOutlet NSButton *customizeButton;
-
-@property (weak) IBOutlet NSTextField *destinationLabel;
-@property (weak) IBOutlet NSBox *destinationBox;
-
-@property (weak) IBOutlet NSButton *destinationCancelBtn;
-@property (weak) IBOutlet NSButton *destinationStreamButton;
-@property (weak) IBOutlet NSButton *destinationFileButton;
-
-@property (weak) IBOutlet NSButton *okButton;
-
-@property (weak) IBOutlet NSView *dropinView;
-@property (weak) IBOutlet VLCDropDisabledImageView *dropinIcon;
-@property (weak) IBOutlet NSTextField *dropinMediaLabel;
-@property (weak) IBOutlet NSView *fileDestinationView;
-@property (weak) IBOutlet NSImageView *fileDestinationIcon;
-@property (weak) IBOutlet NSTextField *fileDestinationFileName;
-@property (weak) IBOutlet NSTextField *fileDestinationFileNameStub;
-@property (weak) IBOutlet NSButton *fileDestinationBrowseButton;
-@property (weak) IBOutlet NSView *streamDestinationView;
-@property (weak) IBOutlet NSTextField *streamDestinationURLLabel;
-@property (weak) IBOutlet NSButton *streamDestinationButton;
-
-// customize panel
-@property (weak) IBOutlet NSWindow *customizePanel;
-@property (weak) IBOutlet NSButton *customizeNewProfileButton;
-@property (weak) IBOutlet NSButton *customizeCancelButton;
-@property (weak) IBOutlet NSButton *customizeOkButton;
-@property (weak) IBOutlet NSTabView *customizeTabView;
-@property (weak) IBOutlet NSMatrix *customizeEncapMatrix;
-
-// customize panel: video
-@property (weak) IBOutlet NSButton *customizeVidCheckbox;
-@property (weak) IBOutlet NSButton *customizeVidKeepCheckbox;
-@property (weak) IBOutlet NSBox *customizeVidSettingsBox;
-@property (weak) IBOutlet NSTextField *customizeVidCodecLabel;
-@property (weak) IBOutlet NSTextField *customizeVidBitrateLabel;
-@property (weak) IBOutlet NSTextField *customizeVidFramerateLabel;
-@property (weak) IBOutlet NSBox *customizeVidResolutionBox;
-@property (weak) IBOutlet NSTextField *customizeVidWidthLabel;
-@property (weak) IBOutlet NSTextField *customizeVidHeightLabel;
-@property (weak) IBOutlet NSTextField *customizeVidScaleLabel;
-@property (weak) IBOutlet NSTextField *customizeVidResLabel;
-@property (weak) IBOutlet NSPopUpButton *customizeVidCodecPopup;
-@property (weak) IBOutlet NSTextField *customizeVidBitrateField;
-@property (weak) IBOutlet NSTextField *customizeVidFramerateField;
-@property (weak) IBOutlet NSTextField *customizeVidWidthField;
-@property (weak) IBOutlet NSTextField *customizeVidHeightField;
-@property (weak) IBOutlet NSPopUpButton *customizeVidScalePopup;
-
-// customize panel: audio
-@property (weak) IBOutlet NSButton *customizeAudCheckbox;
-@property (weak) IBOutlet NSButton *customizeAudKeepCheckbox;
-@property (weak) IBOutlet NSBox *customizeAudSettingsBox;
-@property (weak) IBOutlet NSTextField *customizeAudCodecLabel;
-@property (weak) IBOutlet NSTextField *customizeAudBitrateLabel;
-@property (weak) IBOutlet NSTextField *customizeAudChannelsLabel;
-@property (weak) IBOutlet NSTextField *customizeAudSamplerateLabel;
-@property (weak) IBOutlet NSPopUpButton *customizeAudCodecPopup;
-@property (weak) IBOutlet NSTextField *customizeAudBitrateField;
-@property (weak) IBOutlet NSTextField *customizeAudChannelsField;
-@property (weak) IBOutlet NSPopUpButton *customizeAudSampleratePopup;
-
-// customize panel: subs
-@property (weak) IBOutlet NSButton *customizeSubsCheckbox;
-@property (weak) IBOutlet NSButton *customizeSubsOverlayCheckbox;
-@property (weak) IBOutlet NSPopUpButton *customizeSubsPopup;
-
-// stream panel
-@property (weak) IBOutlet NSWindow *streamPanel;
-@property (weak) IBOutlet NSTextField *streamDestinationLabel;
-@property (weak) IBOutlet NSTextField *streamTypeLabel;
-@property (weak) IBOutlet NSTextField *streamAddressLabel;
-@property (weak) IBOutlet NSPopUpButton *streamTypePopup;
-@property (weak) IBOutlet NSTextField *streamAddressField;
-@property (weak) IBOutlet NSTextField *streamTTLLabel;
-@property (weak) IBOutlet NSTextField *streamTTLField;
-@property (weak) IBOutlet NSStepper *streamTTLStepper;
-@property (weak) IBOutlet NSTextField *streamPortLabel;
-@property (weak) IBOutlet NSTextField *streamPortField;
-@property (weak) IBOutlet NSTextField *streamAnnouncementLabel;
-@property (weak) IBOutlet NSButton *streamSAPCheckbox;
-@property (weak) IBOutlet NSTextField *streamChannelLabel;
-@property (weak) IBOutlet NSTextField *streamChannelField;
-@property (weak) IBOutlet NSMatrix *streamSDPMatrix;
-@property (weak) IBOutlet NSButton *streamSDPFileBrowseButton;
-@property (weak) IBOutlet NSTextField *streamSDPLabel;
-@property (weak) IBOutlet NSTextField *streamSDPField;
-@property (weak) IBOutlet NSButton *streamCancelButton;
-@property (weak) IBOutlet NSButton *streamOkButton;
-
-// other properties
-@property (strong) VLCPopupPanelController *popupPanel;
-@property (strong) VLCTextfieldPanelController *textfieldPanel;
-
-
-@property (readwrite, nonatomic, retain) NSString * MRL;
-@property (readwrite, nonatomic, retain) NSString * outputDestination;
-@property (readwrite, retain) NSArray * profileNames;
-@property (readwrite, retain) NSArray * profileValueList;
-@property (readwrite, retain) NSMutableArray * currentProfile;
-
-// Bindings for field / stepper combis
-@property (nonatomic) int vidBitrate;
-@property (nonatomic) int vidFramerate;
-@property (nonatomic) int audBitrate;
-@property (nonatomic) int audChannels;
-
-
-- (IBAction)finalizePanel:(id)sender;
-- (IBAction)openMedia:(id)sender;
-- (IBAction)switchProfile:(id)sender;
-- (IBAction)iWantAFile:(id)sender;
-- (IBAction)iWantAStream:(id)sender;
-- (IBAction)cancelDestination:(id)sender;
-- (IBAction)browseFileDestination:(id)sender;
-
-- (IBAction)customizeProfile:(id)sender;
-- (IBAction)closeCustomizationSheet:(id)sender;
-- (IBAction)videoSettingsChanged:(id)sender;
-- (IBAction)audioSettingsChanged:(id)sender;
-- (IBAction)subSettingsChanged:(id)sender;
-- (IBAction)newProfileAction:(id)sender;
-
-- (IBAction)showStreamPanel:(id)sender;
-- (IBAction)closeStreamPanel:(id)sender;
-- (IBAction)streamTypeToggle:(id)sender;
-- (IBAction)streamAnnouncementToggle:(id)sender;
-- (IBAction)sdpFileLocationSelector:(id)sender;
-
-@end
diff --git a/modules/gui/macosx/ConvertAndSave.m b/modules/gui/macosx/ConvertAndSave.m
deleted file mode 100644 (file)
index 5162350..0000000
+++ /dev/null
@@ -1,1043 +0,0 @@
-/*****************************************************************************
- * ConvertAndSave.m: MacOS X interface module
- *****************************************************************************
- * Copyright (C) 2012 Felix Paul Kühne
- * $Id$
- *
- * Authors: 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.
- *****************************************************************************/
-
-#import "ConvertAndSave.h"
-#import "intf.h"
-#import "VLCPlaylist.h"
-#import "misc.h"
-#import "SharedDialogs.h"
-
-#import <vlc_common.h>
-#import <vlc_url.h>
-
-/* mini doc:
- * the used NSMatrix includes a bunch of cells referenced most easily by tags. There you go: */
-#define MPEGTS 0
-#define WEBM 1
-#define OGG 2
-#define MP4 3
-#define MPEGPS 4
-#define MJPEG 5
-#define WAV 6
-#define FLV 7
-#define MPEG1 8
-#define MKV 9
-#define RAW 10
-#define AVI 11
-#define ASF 12
-/* 13-15 are present, but not set */
-
-@interface VLCConvertAndSave()
-{
-    NSArray *_videoCodecs;
-    NSArray *_audioCodecs;
-    NSArray *_subsCodecs;
-    BOOL b_streaming;
-}
-
-- (void)updateDropView;
-- (void)updateOKButton;
-- (void)resetCustomizationSheetBasedOnProfile:(NSString *)profileString;
-- (void)selectCellByEncapsulationFormat:(NSString *)format;
-- (NSString *)currentEncapsulationFormatAsFileExtension:(BOOL)b_extension;
-- (NSString *)composedOptions;
-- (void)updateCurrentProfile;
-- (void)storeProfilesOnDisk;
-- (void)recreateProfilePopup;
-@end
-
-@implementation VLCConvertAndSave
-
-#pragma mark -
-#pragma mark Initialization
-
-+ (void)initialize
-{
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-
-    /* We are using the same format as the Qt intf here:
-     * Container(string), transcode video(bool), transcode audio(bool),
-     * use subtitles(bool), video codec(string), video bitrate(integer),
-     * scale(float), fps(float), width(integer, height(integer),
-     * audio codec(string), audio bitrate(integer), channels(integer),
-     * samplerate(integer), subtitle codec(string), subtitle overlay(bool) */
-    NSArray * defaultProfiles = [[NSArray alloc] initWithObjects:
-                                 @"mp4;1;1;0;h264;0;0;0;0;0;mpga;128;2;44100;0;1",
-                                 @"webm;1;1;0;VP80;2000;0;0;0;0;vorb;128;2;44100;0;1",
-                                 @"ts;1;1;0;h264;800;1;0;0;0;mpga;128;2;44100;0;0",
-                                 @"ts;1;1;0;drac;800;1;0;0;0;mpga;128;2;44100;0;0",
-                                 @"ogg;1;1;0;theo;800;1;0;0;0;vorb;128;2;44100;0;0",
-                                 @"ogg;1;1;0;theo;800;1;0;0;0;flac;128;2;44100;0;0",
-                                 @"ts;1;1;0;mp2v;800;1;0;0;0;mpga;128;2;44100;0;0",
-                                 @"asf;1;1;0;WMV2;800;1;0;0;0;wma2;128;2;44100;0;0",
-                                 @"asf;1;1;0;DIV3;800;1;0;0;0;mp3;128;2;44100;0;0",
-                                 @"ogg;0;1;0;none;800;1;0;0;0;vorb;128;2;44100;none;0",
-                                 @"raw;0;1;0;none;800;1;0;0;0;mp3;128;2;44100;none;0",
-                                 @"mp4;0;1;0;none;800;1;0;0;0;mpga;128;2;44100;none;0",
-                                 @"raw;0;1;0;none;800;1;0;0;0;flac;128;2;44100;none;0",
-                                 @"wav;0;1;0;none;800;1;0;0;0;s16l;128;2;44100;none;0", nil];
-
-    NSArray * defaultProfileNames = [[NSArray alloc] initWithObjects:
-                                     @"Video - H.264 + MP3 (MP4)",
-                                     @"Video - VP80 + Vorbis (Webm)",
-                                     @"Video - H.264 + MP3 (TS)",
-                                     @"Video - Dirac + MP3 (TS)",
-                                     @"Video - Theora + Vorbis (OGG)",
-                                     @"Video - Theora + Flac (OGG)",
-                                     @"Video - MPEG-2 + MPGA (TS)",
-                                     @"Video - WMV + WMA (ASF)",
-                                     @"Video - DIV3 + MP3 (ASF)",
-                                     @"Audio - Vorbis (OGG)",
-                                     @"Audio - MP3",
-                                     @"Audio - MP3 (MP4)",
-                                     @"Audio - FLAC",
-                                     @"Audio - CD",
-                                     nil];
-
-    NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:defaultProfiles, @"CASProfiles", defaultProfileNames, @"CASProfileNames", nil];
-
-    [defaults registerDefaults:appDefaults];
-}
-
-- (id)init
-{
-    self = [super initWithWindowNibName:@"ConvertAndSave"];
-    if (self) {
-        self.popupPanel = [[VLCPopupPanelController alloc] init];
-        self.textfieldPanel = [[VLCTextfieldPanelController alloc] init];
-    }
-    return self;
-}
-
-- (void)windowDidLoad
-{
-    [self.window setTitle: _NS("Convert & Stream")];
-    [_okButton setTitle: _NS("Go!")];
-    [_dropLabel setStringValue: _NS("Drop media here")];
-    [_dropButton setTitle: _NS("Open media...")];
-    [_profileLabel setStringValue: _NS("Choose Profile")];
-    [_customizeButton setTitle: _NS("Customize...")];
-    [_destinationLabel setStringValue: _NS("Choose Destination")];
-    [_fileDestinationFileNameStub setStringValue: _NS("Choose an output location")];
-    [_fileDestinationFileName setHidden: YES];
-    [_fileDestinationBrowseButton setTitle:_NS("Browse...")];
-    [_streamDestinationButton setTitle:_NS("Setup Streaming...")];
-    [_streamDestinationURLLabel setStringValue:_NS("Select Streaming Method")];
-    [_destinationFileButton setTitle:_NS("Save as File")];
-    [_destinationStreamButton setTitle:_NS("Stream")];
-    [_destinationCancelBtn setHidden:YES];
-
-    [_customizeOkButton setTitle: _NS("Apply")];
-    [_customizeCancelButton setTitle: _NS("Cancel")];
-    [_customizeNewProfileButton setTitle: _NS("Save as new Profile...")];
-    [[_customizeTabView tabViewItemAtIndex:0] setLabel: _NS("Encapsulation")];
-    [[_customizeTabView tabViewItemAtIndex:1] setLabel: _NS("Video codec")];
-    [[_customizeTabView tabViewItemAtIndex:2] setLabel: _NS("Audio codec")];
-    [[_customizeTabView tabViewItemAtIndex:3] setLabel: _NS("Subtitles")];
-    [_customizeTabView selectTabViewItemAtIndex: 0];
-    [_customizeVidCheckbox setTitle: _NS("Video")];
-    [_customizeVidKeepCheckbox setTitle: _NS("Keep original video track")];
-    [_customizeVidCodecLabel setStringValue: _NS("Codec")];
-    [_customizeVidBitrateLabel setStringValue: _NS("Bitrate")];
-    [_customizeVidFramerateLabel setStringValue: _NS("Frame rate")];
-    [_customizeVidResolutionBox setTitle: _NS("Resolution")];
-    [_customizeVidResLabel setStringValue: _NS("You just need to fill one of the three following parameters, VLC will autodetect the other using the original aspect ratio")];
-    [_customizeVidWidthLabel setStringValue: _NS("Width")];
-    [_customizeVidHeightLabel setStringValue: _NS("Height")];
-    [_customizeVidScaleLabel setStringValue: _NS("Scale")];
-
-    [_customizeAudCheckbox setTitle: _NS("Audio")];
-    [_customizeAudKeepCheckbox setTitle: _NS("Keep original audio track")];
-    [_customizeAudCodecLabel setStringValue: _NS("Codec")];
-    [_customizeAudBitrateLabel setStringValue: _NS("Bitrate")];
-    [_customizeAudChannelsLabel setStringValue: _NS("Channels")];
-    [_customizeAudSamplerateLabel setStringValue: _NS("Samplerate")];
-
-    [_customizeSubsCheckbox setTitle: _NS("Subtitles")];
-    [_customizeSubsOverlayCheckbox setTitle: _NS("Overlay subtitles on the video")];
-
-    [_streamOkButton setTitle: _NS("Apply")];
-    [_streamCancelButton setTitle: _NS("Cancel")];
-    [_streamDestinationLabel setStringValue:_NS("Stream Destination")];
-    [_streamAnnouncementLabel setStringValue:_NS("Stream Announcement")];
-    [_streamTypeLabel setStringValue:_NS("Type")];
-    [_streamAddressLabel setStringValue:_NS("Address")];
-    [_streamTTLLabel setStringValue:_NS("TTL")];
-    [_streamTTLStepper setEnabled:NO];
-    [_streamPortLabel setStringValue:_NS("Port")];
-    [_streamSAPCheckbox setStringValue:_NS("SAP Announcement")];
-    [[_streamSDPMatrix cellWithTag:0] setTitle:_NS("None")];
-    [[_streamSDPMatrix cellWithTag:1] setTitle:_NS("HTTP Announcement")];
-    [[_streamSDPMatrix cellWithTag:2] setTitle:_NS("RTSP Announcement")];
-    [[_streamSDPMatrix cellWithTag:3] setTitle:_NS("Export SDP as file")];
-    [_streamSAPCheckbox setState:NSOffState];
-    [_streamSDPMatrix setEnabled:NO];
-    [_streamSDPFileBrowseButton setStringValue:_NS("Browse...")];
-    [_streamChannelLabel setStringValue:_NS("Channel Name")];
-    [_streamSDPLabel setStringValue:_NS("SDP URL")];
-
-    /* there is no way to hide single cells, so replace the existing ones with empty cells.. */
-    id blankCell = [[NSCell alloc] init];
-    [blankCell setEnabled:NO];
-    [_customizeEncapMatrix putCell:blankCell atRow:3 column:1];
-    [_customizeEncapMatrix putCell:blankCell atRow:3 column:2];
-    [_customizeEncapMatrix putCell:blankCell atRow:3 column:3];
-
-    /* fetch profiles from defaults */
-    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    [self setProfileValueList: [defaults arrayForKey:@"CASProfiles"]];
-    [self setProfileNames: [defaults arrayForKey:@"CASProfileNames"]];
-    [self recreateProfilePopup];
-
-    _videoCodecs = [[NSArray alloc] initWithObjects:
-                    [NSArray arrayWithObjects:@"MPEG-1", @"MPEG-2", @"MPEG-4", @"DIVX 1", @"DIVX 2", @"DIVX 3", @"H.263", @"H.264", @"VP8", @"WMV1", @"WMV2", @"M-JPEG", @"Theora", @"Dirac", nil],
-                    [NSArray arrayWithObjects:@"mpgv", @"mp2v", @"mp4v", @"DIV1", @"DIV2", @"DIV3", @"H263", @"h264", @"VP80", @"WMV1", @"WMV2", @"MJPG", @"theo", @"drac", nil],
-                    nil];
-    _audioCodecs = [[NSArray alloc] initWithObjects:
-                    [NSArray arrayWithObjects:@"MPEG Audio", @"MP3", @"MPEG 4 Audio (AAC)", @"A52/AC-3", @"Vorbis", @"Flac", @"Speex", @"WAV", @"WMA2", nil],
-                    [NSArray arrayWithObjects:@"mpga", @"mp3", @"mp4a", @"a52", @"vorb", @"flac", @"spx", @"s16l", @"wma2", nil],
-                    nil];
-    _subsCodecs = [[NSArray alloc] initWithObjects:
-                   [NSArray arrayWithObjects:@"DVB subtitle", @"T.140", nil],
-                   [NSArray arrayWithObjects:@"dvbs", @"t140", nil],
-                    nil];
-
-    [_customizeVidCodecPopup removeAllItems];
-    [_customizeVidScalePopup removeAllItems];
-    [_customizeAudCodecPopup removeAllItems];
-    [_customizeAudSampleratePopup removeAllItems];
-    [_customizeSubsPopup removeAllItems];
-
-    [_customizeVidCodecPopup addItemsWithTitles:[_videoCodecs firstObject]];
-    [_customizeAudCodecPopup addItemsWithTitles:[_audioCodecs firstObject]];
-    [_customizeSubsPopup addItemsWithTitles:[_subsCodecs firstObject]];
-
-    [_customizeAudSampleratePopup addItemWithTitle:@"8000"];
-    [_customizeAudSampleratePopup addItemWithTitle:@"11025"];
-    [_customizeAudSampleratePopup addItemWithTitle:@"22050"];
-    [_customizeAudSampleratePopup addItemWithTitle:@"44100"];
-    [_customizeAudSampleratePopup addItemWithTitle:@"48000"];
-
-    [_customizeVidScalePopup addItemWithTitle:@"1"];
-    [_customizeVidScalePopup addItemWithTitle:@"0.25"];
-    [_customizeVidScalePopup addItemWithTitle:@"0.5"];
-    [_customizeVidScalePopup addItemWithTitle:@"0.75"];
-    [_customizeVidScalePopup addItemWithTitle:@"1.25"];
-    [_customizeVidScalePopup addItemWithTitle:@"1.5"];
-    [_customizeVidScalePopup addItemWithTitle:@"1.75"];
-    [_customizeVidScalePopup addItemWithTitle:@"2"];
-
-    [_okButton setEnabled: NO];
-
-    // setup drop view
-    [_dropBox enablePlaylistItems];
-    [_dropBox setDropHandler: self];
-
-    [self resetCustomizationSheetBasedOnProfile:[self.profileValueList firstObject]];
-}
-
-# pragma mark -
-# pragma mark User Interaction - main window
-
-- (IBAction)finalizePanel:(id)sender
-{
-    if (b_streaming) {
-        if ([[[_streamTypePopup selectedItem] title] isEqualToString:@"HTTP"]) {
-            NSString *muxformat = [self.currentProfile firstObject];
-            if ([muxformat isEqualToString:@"wav"] || [muxformat isEqualToString:@"mov"] || [muxformat isEqualToString:@"mp4"] || [muxformat isEqualToString:@"mkv"]) {
-                NSBeginInformationalAlertSheet(_NS("Invalid container format for HTTP streaming"), _NS("OK"), @"", @"", self.window,
-                                               nil, nil, nil, nil,
-                                               _NS("Media encapsulated as %@ cannot be streamed through the HTTP protocol for technical reasons."),
-                                               [[self currentEncapsulationFormatAsFileExtension:YES] uppercaseString]);
-                return;
-            }
-        }
-    }
-
-    playlist_t * p_playlist = pl_Get(getIntf());
-
-    input_item_t *p_input = input_item_New([_MRL UTF8String], [[_dropinMediaLabel stringValue] UTF8String]);
-    if (!p_input)
-        return;
-
-    input_item_AddOption(p_input, [[self composedOptions] UTF8String], VLC_INPUT_OPTION_TRUSTED);
-    if (b_streaming)
-        input_item_AddOption(p_input, [[NSString stringWithFormat:@"ttl=%@", [_streamTTLField stringValue]] UTF8String], VLC_INPUT_OPTION_TRUSTED);
-
-    int returnValue;
-    returnValue = playlist_AddInput(p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END, true, pl_Unlocked);
-
-    if (returnValue == VLC_SUCCESS) {
-        /* let's "play" */
-        PL_LOCK;
-        playlist_item_t *p_item = playlist_ItemGetByInput(p_playlist, p_input);
-        playlist_Control(p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL,
-                         p_item);
-        PL_UNLOCK;
-    }
-    else
-        msg_Err(getIntf(), "CAS: playlist add input failed :(");
-
-    /* we're done with this input */
-    vlc_gc_decref(p_input);
-
-    [self.window performClose:sender];
-}
-
-- (IBAction)openMedia:(id)sender
-{
-    /* preliminary implementation until the open panel is cleaned up */
-    NSOpenPanel * openPanel = [NSOpenPanel openPanel];
-    [openPanel setCanChooseDirectories:NO];
-    [openPanel setResolvesAliases:YES];
-    [openPanel setAllowsMultipleSelection:NO];
-    [openPanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger returnCode) {
-        if (returnCode == NSOKButton)
-        {
-            [self setMRL: toNSStr(vlc_path2uri([[[openPanel URL] path] UTF8String], NULL))];
-            [self updateOKButton];
-            [self updateDropView];
-        }
-    }];
-}
-
-- (IBAction)switchProfile:(id)sender
-{
-    NSUInteger index = [_profilePopup indexOfSelectedItem];
-    // last index is "custom"
-    if (index <= ([self.profileValueList count] - 1))
-        [self resetCustomizationSheetBasedOnProfile:[self.profileValueList objectAtIndex:index]];
-}
-
-- (IBAction)deleteProfileAction:(id)sender
-{
-    /* show panel */
-    [_popupPanel setTitleString:_NS("Remove a profile")];
-    [_popupPanel setSubTitleString:_NS("Select the profile you would like to remove:")];
-    [_popupPanel setOkButtonString:_NS("Remove")];
-    [_popupPanel setCancelButtonString:_NS("Cancel")];
-    [_popupPanel setPopupButtonContent:self.profileNames];
-
-    __weak typeof(self) _self = self;
-    [_popupPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSInteger selectedIndex) {
-
-        if (returnCode != NSOKButton)
-            return;
-
-        /* remove requested profile from the arrays */
-        NSMutableArray * workArray = [[NSMutableArray alloc] initWithArray:_self.profileNames];
-        [workArray removeObjectAtIndex:selectedIndex];
-        [_self setProfileNames:[[NSArray alloc] initWithArray:workArray]];
-        workArray = [[NSMutableArray alloc] initWithArray:_self.profileValueList];
-        [workArray removeObjectAtIndex:selectedIndex];
-        [_self setProfileValueList:[[NSArray alloc] initWithArray:workArray]];
-
-        /* update UI */
-        [_self recreateProfilePopup];
-
-        /* update internals */
-        [_self switchProfile:_self];
-        [_self storeProfilesOnDisk];
-    }];
-}
-
-- (IBAction)iWantAFile:(id)sender
-{
-    NSRect boxFrame = [_destinationBox frame];
-    NSRect subViewFrame = [_fileDestinationView frame];
-    subViewFrame.origin.x = (boxFrame.size.width - subViewFrame.size.width) / 2;
-    subViewFrame.origin.y = ((boxFrame.size.height - subViewFrame.size.height) / 2) - 15.;
-    [_fileDestinationView setFrame: subViewFrame];
-    [[_destinationFileButton animator] setHidden: YES];
-    [[_destinationStreamButton animator] setHidden: YES];
-    [_destinationBox performSelector:@selector(addSubview:) withObject:_fileDestinationView afterDelay:0.2];
-    [[_destinationCancelBtn animator] setHidden:NO];
-    b_streaming = NO;
-    [_okButton setTitle:_NS("Save")];
-}
-
-- (IBAction)iWantAStream:(id)sender
-{
-    NSRect boxFrame = [_destinationBox frame];
-    NSRect subViewFrame = [_streamDestinationView frame];
-    subViewFrame.origin.x = (boxFrame.size.width - subViewFrame.size.width) / 2;
-    subViewFrame.origin.y = ((boxFrame.size.height - subViewFrame.size.height) / 2) - 15.;
-    [_streamDestinationView setFrame: subViewFrame];
-    [[_destinationFileButton animator] setHidden: YES];
-    [[_destinationStreamButton animator] setHidden: YES];
-    [_destinationBox performSelector:@selector(addSubview:) withObject:_streamDestinationView afterDelay:0.2];
-    [[_destinationCancelBtn animator] setHidden:NO];
-    b_streaming = YES;
-    [_okButton setTitle:_NS("Stream")];
-}
-
-- (IBAction)cancelDestination:(id)sender
-{
-    if ([_streamDestinationView superview] != nil)
-        [_streamDestinationView removeFromSuperview];
-    if ([_fileDestinationView superview] != nil)
-        [_fileDestinationView removeFromSuperview];
-
-    [_destinationCancelBtn setHidden:YES];
-    [[_destinationFileButton animator] setHidden: NO];
-    [[_destinationStreamButton animator] setHidden: NO];
-    b_streaming = NO;
-}
-
-- (IBAction)browseFileDestination:(id)sender
-{
-    NSSavePanel * saveFilePanel = [NSSavePanel savePanel];
-    [saveFilePanel setCanSelectHiddenExtension: YES];
-    [saveFilePanel setCanCreateDirectories: YES];
-    if ([[_customizeEncapMatrix selectedCell] tag] != RAW) // there is no clever guess for this
-        [saveFilePanel setAllowedFileTypes:[NSArray arrayWithObject:[self currentEncapsulationFormatAsFileExtension:YES]]];
-    [saveFilePanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger returnCode) {
-        if (returnCode == NSOKButton) {
-            [self setOutputDestination:[[saveFilePanel URL] path]];
-            [_fileDestinationFileName setStringValue: [[NSFileManager defaultManager] displayNameAtPath:_outputDestination]];
-            [[_fileDestinationFileNameStub animator] setHidden: YES];
-            [[_fileDestinationFileName animator] setHidden: NO];
-        } else {
-            [self setOutputDestination:@""];
-            [[_fileDestinationFileName animator] setHidden: YES];
-            [[_fileDestinationFileNameStub animator] setHidden: NO];
-        }
-        [self updateOKButton];
-    }];
-}
-
-#pragma mark -
-#pragma mark User interaction - customization panel
-
-- (IBAction)customizeProfile:(id)sender
-{
-    [NSApp beginSheet:_customizePanel modalForWindow:self.window modalDelegate:self didEndSelector:NULL contextInfo:nil];
-}
-
-- (IBAction)closeCustomizationSheet:(id)sender
-{
-    [_customizePanel orderOut:sender];
-    [NSApp endSheet: _customizePanel];
-
-    if (sender == _customizeOkButton)
-        [self updateCurrentProfile];
-}
-
-
-
-- (IBAction)videoSettingsChanged:(id)sender
-{
-    bool enableSettings = [_customizeVidCheckbox state] == NSOnState && [_customizeVidKeepCheckbox state] == NSOffState;
-    [_customizeVidSettingsBox enableSubviews:enableSettings];
-    [_customizeVidKeepCheckbox setEnabled:[_customizeVidCheckbox state] == NSOnState];
-}
-
-- (IBAction)audioSettingsChanged:(id)sender
-{
-    bool enableSettings = [_customizeAudCheckbox state] == NSOnState && [_customizeAudKeepCheckbox state] == NSOffState;
-    [_customizeAudSettingsBox enableSubviews:enableSettings];
-    [_customizeAudKeepCheckbox setEnabled:[_customizeAudCheckbox state] == NSOnState];
-}
-
-- (IBAction)subSettingsChanged:(id)sender
-{
-    bool enableSettings = [_customizeSubsCheckbox state] == NSOnState;
-    [_customizeSubsOverlayCheckbox setEnabled:enableSettings];
-    [_customizeSubsPopup setEnabled:enableSettings];
-}
-
-- (IBAction)newProfileAction:(id)sender
-{
-    /* show panel */
-    [_textfieldPanel setTitleString: _NS("Save as new profile")];
-    [_textfieldPanel setSubTitleString: _NS("Enter a name for the new profile:")];
-    [_textfieldPanel setCancelButtonString: _NS("Cancel")];
-    [_textfieldPanel setOkButtonString: _NS("Save")];
-
-    __weak typeof(self) _self = self;
-    [_textfieldPanel runModalForWindow:_customizePanel completionHandler:^(NSInteger returnCode, NSString *resultingText) {
-        if (returnCode != NSOKButton || [resultingText length] == 0)
-            return;
-
-        /* prepare current data */
-        [_self updateCurrentProfile];
-
-        /* add profile to arrays */
-        NSMutableArray * workArray = [[NSMutableArray alloc] initWithArray:self.profileNames];
-        [workArray addObject:resultingText];
-        [_self setProfileNames:[[NSArray alloc] initWithArray:workArray]];
-
-        workArray = [[NSMutableArray alloc] initWithArray:self.profileValueList];
-        [workArray addObject:[self.currentProfile componentsJoinedByString:@";"]];
-        [_self setProfileValueList:[[NSArray alloc] initWithArray:workArray]];
-
-        /* update UI */
-        [_self recreateProfilePopup];
-        [_profilePopup selectItemWithTitle:resultingText];
-
-        /* update internals */
-        [_self switchProfile:self];
-        [_self storeProfilesOnDisk];
-    }];
-}
-
-#pragma mark -
-#pragma mark User interaction - stream panel
-
-- (IBAction)showStreamPanel:(id)sender
-{
-    [NSApp beginSheet:_streamPanel modalForWindow:self.window modalDelegate:self didEndSelector:NULL contextInfo:nil];
-}
-
-- (IBAction)closeStreamPanel:(id)sender
-{
-    [_streamPanel orderOut:sender];
-    [NSApp endSheet: _streamPanel];
-
-    if (sender == _streamCancelButton)
-        return;
-
-    /* provide a summary of the user selections */
-    NSMutableString * labelContent = [[NSMutableString alloc] initWithFormat:_NS("%@ stream to %@:%@"), [_streamTypePopup titleOfSelectedItem], [_streamAddressField stringValue], [_streamPortField stringValue]];
-
-    if ([_streamTypePopup indexOfSelectedItem] > 1)
-        [labelContent appendFormat:@" (\"%@\")", [_streamChannelField stringValue]];
-
-    [_streamDestinationURLLabel setStringValue:labelContent];
-
-    /* catch obvious errors */
-    if ([[_streamAddressField stringValue] length] == 0) {
-        NSBeginInformationalAlertSheet(_NS("No Address given"),
-                                       _NS("OK"), @"", @"", _streamPanel, nil, nil, nil, nil,
-                                       @"%@", _NS("In order to stream, a valid destination address is required."));
-        return;
-    }
-
-    if ([_streamSAPCheckbox state] && [[_streamChannelField stringValue] length] == 0) {
-        NSBeginInformationalAlertSheet(_NS("No Channel Name given"),
-                                       _NS("OK"), @"", @"", _streamPanel, nil, nil, nil, nil,
-                                       @"%@", _NS("SAP stream announcement is enabled. However, no channel name is provided."));
-        return;
-    }
-
-    if ([_streamSDPMatrix isEnabled] && [_streamSDPMatrix selectedCell] != [_streamSDPMatrix cellWithTag:0] && [[_streamSDPField stringValue] length] == 0) {
-        NSBeginInformationalAlertSheet(_NS("No SDP URL given"),
-                                       _NS("OK"), @"", @"", _streamPanel, nil, nil, nil, nil,
-                                       @"%@", _NS("A SDP export is requested, but no URL is provided."));
-        return;
-    }
-
-    /* store destination for further reference and update UI */
-    [self setOutputDestination: [_streamAddressField stringValue]];
-    [self updateOKButton];
-}
-
-- (IBAction)streamTypeToggle:(id)sender
-{
-    NSUInteger index = [_streamTypePopup indexOfSelectedItem];
-    if (index <= 1) { // HTTP, MMSH
-        [_streamTTLField setEnabled:NO];
-        [_streamTTLStepper setEnabled:NO];
-        [_streamSAPCheckbox setEnabled:NO];
-        [_streamSDPMatrix setEnabled:NO];
-    } else if (index == 2) { // RTP
-        [_streamTTLField setEnabled:YES];
-        [_streamTTLStepper setEnabled:YES];
-        [_streamSAPCheckbox setEnabled:YES];
-        [_streamSDPMatrix setEnabled:YES];
-    } else { // UDP
-        [_streamTTLField setEnabled:YES];
-        [_streamTTLStepper setEnabled:YES];
-        [_streamSAPCheckbox setEnabled:YES];
-        [_streamSDPMatrix setEnabled:NO];
-    }
-    [self streamAnnouncementToggle:sender];
-}
-
-- (IBAction)streamAnnouncementToggle:(id)sender
-{
-    [_streamChannelField setEnabled:[_streamSAPCheckbox state] && [_streamSAPCheckbox isEnabled]];
-    [_streamSDPField setEnabled:[_streamSDPMatrix isEnabled] && ([_streamSDPMatrix selectedCell] != [_streamSDPMatrix cellWithTag:0])];
-
-    if ([[_streamSDPMatrix selectedCell] tag] == 3)
-        [_streamSDPFileBrowseButton setEnabled: YES];
-    else
-        [_streamSDPFileBrowseButton setEnabled: NO];
-}
-
-- (IBAction)sdpFileLocationSelector:(id)sender
-{
-    NSSavePanel * saveFilePanel = [NSSavePanel savePanel];
-    [saveFilePanel setCanSelectHiddenExtension: YES];
-    [saveFilePanel setCanCreateDirectories: YES];
-    [saveFilePanel setAllowedFileTypes:[NSArray arrayWithObject:@"sdp"]];
-    [saveFilePanel beginSheetModalForWindow:_streamPanel completionHandler:^(NSInteger returnCode) {
-        if (returnCode == NSOKButton)
-            [_streamSDPField setStringValue:[[saveFilePanel URL] path]];
-    }];
-}
-
-#pragma mark -
-#pragma mark User interaction - misc
-
-- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
-{
-    NSPasteboard *paste = [sender draggingPasteboard];
-    NSArray *types = [NSArray arrayWithObjects:NSFilenamesPboardType, @"VLCPlaylistItemPboardType", nil];
-    NSString *desired_type = [paste availableTypeFromArray: types];
-    NSData *carried_data = [paste dataForType: desired_type];
-
-    if (carried_data) {
-        if ([desired_type isEqualToString:NSFilenamesPboardType]) {
-            NSArray *values = [[paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
-
-            if ([values count] > 0) {
-                [self setMRL: toNSStr(vlc_path2uri([[values firstObject] UTF8String], NULL))];
-                [self updateOKButton];
-                [self updateDropView];
-                return YES;
-            }
-        } else if ([desired_type isEqualToString:@"VLCPlaylistItemPboardType"]) {
-            NSArray * array = [[[VLCMain sharedInstance] playlist] draggedItems];
-            NSUInteger count = [array count];
-            if (count > 0) {
-                playlist_t * p_playlist = pl_Get(getIntf());
-                playlist_item_t * p_item = NULL;
-
-                PL_LOCK;
-                /* let's look for the first proper input item */
-                for (NSUInteger x = 0; x < count; x++) {
-                    p_item = [[array objectAtIndex:x] pointerValue];
-                    if (p_item) {
-                        if (p_item->p_input) {
-                            if (p_item->p_input->psz_uri != nil) {
-                                [self setMRL: toNSStr(p_item->p_input->psz_uri)];
-                                [self updateDropView];
-                                [self updateOKButton];
-
-                                PL_UNLOCK;
-
-                                return YES;
-                            }
-                        }
-                    }
-                }
-                PL_UNLOCK;
-            }
-        }
-    }
-    return NO;
-}
-
-# pragma mark -
-# pragma mark Private Functionality
-
-- (void)updateDropView
-{
-    if ([_MRL length] > 0) {
-        NSString * path = [[NSURL URLWithString:_MRL] path];
-        [_dropinMediaLabel setStringValue: [[NSFileManager defaultManager] displayNameAtPath: path]];
-        NSImage * image = [[NSWorkspace sharedWorkspace] iconForFile: path];
-        [image setSize:NSMakeSize(128,128)];
-        [_dropinIcon setImage: image];
-
-        if (![_dropinView superview]) {
-            NSRect boxFrame = [_dropBox frame];
-            NSRect subViewFrame = [_dropinView frame];
-            subViewFrame.origin.x = (boxFrame.size.width - subViewFrame.size.width) / 2;
-            subViewFrame.origin.y = (boxFrame.size.height - subViewFrame.size.height) / 2;
-            [_dropinView setFrame: subViewFrame];
-            [[_dropImage animator] setHidden: YES];
-            [_dropBox performSelector:@selector(addSubview:) withObject:_dropinView afterDelay:0.6];
-        }
-    } else {
-        [_dropinView removeFromSuperview];
-        [[_dropImage animator] setHidden: NO];
-    }
-}
-
-- (void)updateOKButton
-{
-    if ([_outputDestination length] > 0 && [_MRL length] > 0)
-        [_okButton setEnabled: YES];
-    else
-        [_okButton setEnabled: NO];
-}
-
-- (void)resetCustomizationSheetBasedOnProfile:(NSString *)profileString
-{
-    /* Container(string), transcode video(bool), transcode audio(bool),
-    * use subtitles(bool), video codec(string), video bitrate(integer),
-    * scale(float), fps(float), width(integer, height(integer),
-    * audio codec(string), audio bitrate(integer), channels(integer),
-    * samplerate(integer), subtitle codec(string), subtitle overlay(bool) */
-
-    NSArray * components = [profileString componentsSeparatedByString:@";"];
-    if ([components count] != 16) {
-        msg_Err(getIntf(), "CAS: the requested profile '%s' is invalid", [profileString UTF8String]);
-        return;
-    }
-
-    [self selectCellByEncapsulationFormat:[components firstObject]];
-    [_customizeVidCheckbox setState:[[components objectAtIndex:1] intValue]];
-    [_customizeAudCheckbox setState:[[components objectAtIndex:2] intValue]];
-    [_customizeSubsCheckbox setState:[[components objectAtIndex:3] intValue]];
-    [self setVidBitrate:[[components objectAtIndex:5] intValue]];
-    [_customizeVidScalePopup selectItemWithTitle:[components objectAtIndex:6]];
-    [self setVidFramerate:[[components objectAtIndex:7] intValue]];
-    [_customizeVidWidthField setStringValue:[components objectAtIndex:8]];
-    [_customizeVidHeightField setStringValue:[components objectAtIndex:9]];
-    [self setAudBitrate:[[components objectAtIndex:11] intValue]];
-    [self setAudChannels:[[components objectAtIndex:12] intValue]];
-    [_customizeAudSampleratePopup selectItemWithTitle:[components objectAtIndex:13]];
-    [_customizeSubsOverlayCheckbox setState:[[components objectAtIndex:15] intValue]];
-
-    /* since there is no proper lookup mechanism in arrays, we need to implement a string specific one ourselves */
-    NSArray * tempArray = [_videoCodecs objectAtIndex:1];
-    NSUInteger count = [tempArray count];
-    NSString * searchString = [components objectAtIndex:4];
-    int videoKeep = [searchString isEqualToString:@"copy"];
-    [_customizeVidKeepCheckbox setState:videoKeep];
-    if ([searchString isEqualToString:@"none"] || [searchString isEqualToString:@"0"] || videoKeep) {
-        [_customizeVidCodecPopup selectItemAtIndex:-1];
-    } else {
-        for (NSUInteger x = 0; x < count; x++) {
-            if ([[tempArray objectAtIndex:x] isEqualToString: searchString]) {
-                [_customizeVidCodecPopup selectItemAtIndex:x];
-                break;
-            }
-        }
-    }
-
-    tempArray = [_audioCodecs objectAtIndex:1];
-    count = [tempArray count];
-    searchString = [components objectAtIndex:10];
-    int audioKeep = [searchString isEqualToString:@"copy"];
-    [_customizeAudKeepCheckbox setState:audioKeep];
-    if ([searchString isEqualToString:@"none"] || [searchString isEqualToString:@"0"] || audioKeep) {
-        [_customizeAudCodecPopup selectItemAtIndex:-1];
-    } else {
-        for (NSUInteger x = 0; x < count; x++) {
-            if ([[tempArray objectAtIndex:x] isEqualToString: searchString]) {
-                [_customizeAudCodecPopup selectItemAtIndex:x];
-                break;
-            }
-        }
-    }
-
-    tempArray = [_subsCodecs objectAtIndex:1];
-    count = [tempArray count];
-    searchString = [components objectAtIndex:14];
-    if ([searchString isEqualToString:@"none"] || [searchString isEqualToString:@"0"]) {
-        [_customizeSubsPopup selectItemAtIndex:-1];
-    } else {
-        for (NSUInteger x = 0; x < count; x++) {
-            if ([[tempArray objectAtIndex:x] isEqualToString: searchString]) {
-                [_customizeSubsPopup selectItemAtIndex:x];
-                break;
-            }
-        }
-    }
-
-    [self videoSettingsChanged:nil];
-    [self audioSettingsChanged:nil];
-    [self subSettingsChanged:nil];
-
-    [self setCurrentProfile: [[NSMutableArray alloc] initWithArray:[profileString componentsSeparatedByString:@";"]]];
-}
-
-- (void)selectCellByEncapsulationFormat:(NSString *)format
-{
-    if ([format isEqualToString:@"ts"])
-        [_customizeEncapMatrix selectCellWithTag:MPEGTS];
-    else if ([format isEqualToString:@"webm"])
-        [_customizeEncapMatrix selectCellWithTag:WEBM];
-    else if ([format isEqualToString:@"ogg"])
-        [_customizeEncapMatrix selectCellWithTag:OGG];
-    else if ([format isEqualToString:@"ogm"])
-        [_customizeEncapMatrix selectCellWithTag:OGG];
-    else if ([format isEqualToString:@"mp4"])
-        [_customizeEncapMatrix selectCellWithTag:MP4];
-    else if ([format isEqualToString:@"mov"])
-        [_customizeEncapMatrix selectCellWithTag:MP4];
-    else if ([format isEqualToString:@"ps"])
-        [_customizeEncapMatrix selectCellWithTag:MPEGPS];
-    else if ([format isEqualToString:@"mpjpeg"])
-        [_customizeEncapMatrix selectCellWithTag:MJPEG];
-    else if ([format isEqualToString:@"wav"])
-        [_customizeEncapMatrix selectCellWithTag:WAV];
-    else if ([format isEqualToString:@"flv"])
-        [_customizeEncapMatrix selectCellWithTag:FLV];
-    else if ([format isEqualToString:@"mpeg1"])
-        [_customizeEncapMatrix selectCellWithTag:MPEG1];
-    else if ([format isEqualToString:@"mkv"])
-        [_customizeEncapMatrix selectCellWithTag:MKV];
-    else if ([format isEqualToString:@"raw"])
-        [_customizeEncapMatrix selectCellWithTag:RAW];
-    else if ([format isEqualToString:@"avi"])
-        [_customizeEncapMatrix selectCellWithTag:AVI];
-    else if ([format isEqualToString:@"asf"])
-        [_customizeEncapMatrix selectCellWithTag:ASF];
-    else if ([format isEqualToString:@"wmv"])
-        [_customizeEncapMatrix selectCellWithTag:ASF];
-    else
-        msg_Err(getIntf(), "CAS: unknown encap format requested for customization");
-}
-
-- (NSString *)currentEncapsulationFormatAsFileExtension:(BOOL)b_extension
-{
-    NSUInteger cellTag = (NSUInteger) [[_customizeEncapMatrix selectedCell] tag];
-    NSString * returnValue;
-    switch (cellTag) {
-        case MPEGTS:
-            returnValue = @"ts";
-            break;
-        case WEBM:
-            returnValue = @"webm";
-            break;
-        case OGG:
-            returnValue = @"ogg";
-            break;
-        case MP4:
-        {
-            if (b_extension)
-                returnValue = @"m4v";
-            else
-                returnValue = @"mp4";
-            break;
-        }
-        case MPEGPS:
-        {
-            if (b_extension)
-                returnValue = @"mpg";
-            else
-                returnValue = @"ps";
-            break;
-        }
-        case MJPEG:
-            returnValue = @"mjpeg";
-            break;
-        case WAV:
-            returnValue = @"wav";
-            break;
-        case FLV:
-            returnValue = @"flv";
-            break;
-        case MPEG1:
-        {
-            if (b_extension)
-                returnValue = @"mpg";
-            else
-                returnValue = @"mpeg1";
-            break;
-        }
-        case MKV:
-            returnValue = @"mkv";
-            break;
-        case RAW:
-            returnValue = @"raw";
-            break;
-        case AVI:
-            returnValue = @"avi";
-            break;
-        case ASF:
-            returnValue = @"asf";
-            break;
-
-        default:
-            returnValue = @"none";
-            break;
-    }
-
-    return returnValue;
-}
-
-- (NSString *)composedOptions
-{
-    NSMutableString *composedOptions = [[NSMutableString alloc] initWithString:@":sout=#transcode{"];
-    BOOL haveVideo = YES;
-    if ([[self.currentProfile objectAtIndex:1] intValue]) {
-        // video is enabled
-        if (![[self.currentProfile objectAtIndex:4] isEqualToString:@"copy"]) {
-        [composedOptions appendFormat:@"vcodec=%@", [self.currentProfile objectAtIndex:4]];
-            if ([[self.currentProfile objectAtIndex:5] intValue] > 0) // bitrate
-                [composedOptions appendFormat:@",vb=%@", [self.currentProfile objectAtIndex:5]];
-            if ([[self.currentProfile objectAtIndex:6] floatValue] > 0.) // scale
-                [composedOptions appendFormat:@",scale=%@", [self.currentProfile objectAtIndex:6]];
-            if ([[self.currentProfile objectAtIndex:7] floatValue] > 0.) // fps
-                [composedOptions appendFormat:@",fps=%@", [self.currentProfile objectAtIndex:7]];
-            if ([[self.currentProfile objectAtIndex:8] intValue] > 0) // width
-                [composedOptions appendFormat:@",width=%@", [self.currentProfile objectAtIndex:8]];
-            if ([[self.currentProfile objectAtIndex:9] intValue] > 0) // height
-                [composedOptions appendFormat:@",height=%@", [self.currentProfile objectAtIndex:9]];
-        } else {
-            haveVideo = NO;
-        }
-    } else {
-        [composedOptions appendString:@"vcodec=none"];
-    }
-
-    BOOL haveAudio = YES;
-    if ([[self.currentProfile objectAtIndex:2] intValue]) {
-        // audio is enabled
-        if (![[self.currentProfile objectAtIndex:10] isEqualToString:@"copy"]) {
-            if(haveVideo)
-                [composedOptions appendString:@","];
-            [composedOptions appendFormat:@"acodec=%@", [self.currentProfile objectAtIndex:10]];
-            [composedOptions appendFormat:@",ab=%@", [self.currentProfile objectAtIndex:11]]; // bitrate
-            [composedOptions appendFormat:@",channels=%@", [self.currentProfile objectAtIndex:12]]; // channel number
-            [composedOptions appendFormat:@",samplerate=%@", [self.currentProfile objectAtIndex:13]]; // sample rate
-        } else {
-            haveAudio = NO;
-        }
-    } else {
-        if(haveVideo)
-            [composedOptions appendString:@","];
-
-        [composedOptions appendString:@"acodec=none"];
-    }
-    if ([self.currentProfile objectAtIndex:3]) {
-        if(haveVideo || haveAudio)
-            [composedOptions appendString:@","];
-        // subtitles enabled
-        [composedOptions appendFormat:@"scodec=%@", [self.currentProfile objectAtIndex:14]];
-        if ([[self.currentProfile objectAtIndex:15] intValue])
-            [composedOptions appendFormat:@",soverlay"];
-    }
-
-    if (!b_streaming) {
-        /* file transcoding */
-        // add muxer
-        [composedOptions appendFormat:@"}:standard{mux=%@", [self.currentProfile firstObject]];
-
-
-        // add output destination
-        [composedOptions appendFormat:@",access=file{no-overwrite},dst=%@}", _outputDestination];
-    } else {
-        /* streaming */
-        if ([[[_streamTypePopup selectedItem] title] isEqualToString:@"RTP"])
-            [composedOptions appendFormat:@":rtp{mux=ts,dst=%@,port=%@", _outputDestination, [_streamPortField stringValue]];
-        else if ([[[_streamTypePopup selectedItem] title] isEqualToString:@"UDP"])
-            [composedOptions appendFormat:@":standard{mux=ts,dst=%@,port=%@,access=udp", _outputDestination, [_streamPortField stringValue]];
-        else if ([[[_streamTypePopup selectedItem] title] isEqualToString:@"MMSH"])
-            [composedOptions appendFormat:@":standard{mux=asfh,dst=%@,port=%@,access=mmsh", _outputDestination, [_streamPortField stringValue]];
-        else
-            [composedOptions appendFormat:@":standard{mux=%@,dst=%@,port=%@,access=http", [self.currentProfile firstObject], [_streamPortField stringValue], _outputDestination];
-
-        if ([_streamSAPCheckbox state])
-            [composedOptions appendFormat:@",sap,name=\"%@\"", [_streamChannelField stringValue]];
-        if ([_streamSDPMatrix selectedCell] != [_streamSDPMatrix cellWithTag:0]) {
-            NSInteger tag = [[_streamSDPMatrix selectedCell] tag];
-            switch (tag) {
-                case 1:
-                    [composedOptions appendFormat:@",sdp=\"http://%@\"", [_streamSDPField stringValue]];
-                    break;
-                case 2:
-                    [composedOptions appendFormat:@",sdp=\"rtsp://%@\"", [_streamSDPField stringValue]];
-                    break;
-                case 3:
-                    [composedOptions appendFormat:@",sdp=\"file://%s\"", vlc_path2uri([[_streamSDPField stringValue] UTF8String], NULL)];
-                default:
-                    break;
-            }
-        }
-
-        [composedOptions appendString:@"} :sout-keep"];
-    }
-
-    return [NSString stringWithString:composedOptions];
-}
-
-- (void)updateCurrentProfile
-{
-    [self.currentProfile removeAllObjects];
-
-    NSInteger i;
-    [self.currentProfile addObject: [self currentEncapsulationFormatAsFileExtension:NO]];
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%li", [_customizeVidCheckbox state]]];
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%li", [_customizeAudCheckbox state]]];
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%li", [_customizeSubsCheckbox state]]];
-    
-    NSString *videoCodec;
-    if([_customizeVidKeepCheckbox state] == NSOnState)
-        videoCodec = @"copy";
-    else {
-        i = [_customizeVidCodecPopup indexOfSelectedItem];
-        if (i >= 0)
-            videoCodec = [[_videoCodecs objectAtIndex:1] objectAtIndex:i];
-        else
-            videoCodec = @"none";
-    }
-    [self.currentProfile addObject: videoCodec];
-
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [self vidBitrate]]];
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [[[_customizeVidScalePopup selectedItem] title] intValue]]];
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [self vidFramerate]]];
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [_customizeVidWidthField intValue]]];
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [_customizeVidHeightField intValue]]];
-
-    NSString *audioCodec;
-    if([_customizeAudKeepCheckbox state] == NSOnState)
-        audioCodec = @"copy";
-    else {
-        i = [_customizeAudCodecPopup indexOfSelectedItem];
-        if (i >= 0)
-            audioCodec = [[_audioCodecs objectAtIndex:1] objectAtIndex:i];
-        else
-            audioCodec = @"none";
-    }
-    [self.currentProfile addObject: audioCodec];
-    
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [self audBitrate]]];
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [self audChannels]]];
-    [self.currentProfile addObject: [[_customizeAudSampleratePopup selectedItem] title]];
-    i = [_customizeSubsPopup indexOfSelectedItem];
-    if (i >= 0)
-        [self.currentProfile addObject: [[_subsCodecs objectAtIndex:1] objectAtIndex:i]];
-    else
-        [self.currentProfile addObject: @"none"];
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%li", [_customizeSubsOverlayCheckbox state]]];
-}
-
-- (void)storeProfilesOnDisk
-{
-    NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
-    [defaults setObject:_profileNames forKey:@"CASProfileNames"];
-    [defaults setObject:_profileValueList forKey:@"CASProfiles"];
-    [defaults synchronize];
-}
-
-- (void)recreateProfilePopup
-{
-    [_profilePopup removeAllItems];
-    [_profilePopup addItemsWithTitles:self.profileNames];
-    [_profilePopup addItemWithTitle:_NS("Custom")];
-    [[_profilePopup menu] addItem:[NSMenuItem separatorItem]];
-    [_profilePopup addItemWithTitle:_NS("Organize Profiles...")];
-    [[_profilePopup lastItem] setTarget: self];
-    [[_profilePopup lastItem] setAction: @selector(deleteProfileAction:)];
-}
-
-- (IBAction)customizeSubsCheckbox:(id)sender {
-}
-@end
index 9359e75..d69962b 100644 (file)
@@ -29,7 +29,7 @@ libmacosx_plugin_la_SOURCES = \
        BWQuincyUI.h BWQuincyUI.m \
        CompatibilityFixes.h \
        ControlsBar.m ControlsBar.h \
-       ConvertAndSave.h ConvertAndSave.m \
+       VLCConvertAndSaveWindowController.h VLCConvertAndSaveWindowController.m \
        CoreInteraction.h CoreInteraction.m \
        ExtensionsDialogProvider.h ExtensionsDialogProvider.m \
        ExtensionsManager.h ExtensionsManager.m \
diff --git a/modules/gui/macosx/VLCConvertAndSaveWindowController.h b/modules/gui/macosx/VLCConvertAndSaveWindowController.h
new file mode 100644 (file)
index 0000000..1d24728
--- /dev/null
@@ -0,0 +1,171 @@
+/*****************************************************************************
+ * VLCConvertAndSaveWindowController.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2012 Felix Paul Kühne
+ * $Id$
+ *
+ * Authors: 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.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+@class VLCDropDisabledImageView;
+@class VLCDragDropView;
+@class VLCPopupPanelController;
+@class VLCTextfieldPanelController;
+
+@interface VLCConvertAndSaveWindowController : NSWindowController
+
+// main panel
+@property (weak) IBOutlet VLCDragDropView *dropBox;
+@property (weak) IBOutlet NSTextField *dropLabel;
+
+@property (weak) IBOutlet VLCDropDisabledImageView *dropImage;
+@property (weak) IBOutlet NSButton *dropButton;
+@property (weak) IBOutlet NSTextField *profileLabel;
+@property (weak) IBOutlet NSPopUpButton *profilePopup;
+@property (weak) IBOutlet NSButton *customizeButton;
+
+@property (weak) IBOutlet NSTextField *destinationLabel;
+@property (weak) IBOutlet NSBox *destinationBox;
+
+@property (weak) IBOutlet NSButton *destinationCancelBtn;
+@property (weak) IBOutlet NSButton *destinationStreamButton;
+@property (weak) IBOutlet NSButton *destinationFileButton;
+
+@property (weak) IBOutlet NSButton *okButton;
+
+@property (weak) IBOutlet NSView *dropinView;
+@property (weak) IBOutlet VLCDropDisabledImageView *dropinIcon;
+@property (weak) IBOutlet NSTextField *dropinMediaLabel;
+@property (weak) IBOutlet NSView *fileDestinationView;
+@property (weak) IBOutlet NSImageView *fileDestinationIcon;
+@property (weak) IBOutlet NSTextField *fileDestinationFileName;
+@property (weak) IBOutlet NSTextField *fileDestinationFileNameStub;
+@property (weak) IBOutlet NSButton *fileDestinationBrowseButton;
+@property (weak) IBOutlet NSView *streamDestinationView;
+@property (weak) IBOutlet NSTextField *streamDestinationURLLabel;
+@property (weak) IBOutlet NSButton *streamDestinationButton;
+
+// customize panel
+@property (weak) IBOutlet NSWindow *customizePanel;
+@property (weak) IBOutlet NSButton *customizeNewProfileButton;
+@property (weak) IBOutlet NSButton *customizeCancelButton;
+@property (weak) IBOutlet NSButton *customizeOkButton;
+@property (weak) IBOutlet NSTabView *customizeTabView;
+@property (weak) IBOutlet NSMatrix *customizeEncapMatrix;
+
+// customize panel: video
+@property (weak) IBOutlet NSButton *customizeVidCheckbox;
+@property (weak) IBOutlet NSButton *customizeVidKeepCheckbox;
+@property (weak) IBOutlet NSBox *customizeVidSettingsBox;
+@property (weak) IBOutlet NSTextField *customizeVidCodecLabel;
+@property (weak) IBOutlet NSTextField *customizeVidBitrateLabel;
+@property (weak) IBOutlet NSTextField *customizeVidFramerateLabel;
+@property (weak) IBOutlet NSBox *customizeVidResolutionBox;
+@property (weak) IBOutlet NSTextField *customizeVidWidthLabel;
+@property (weak) IBOutlet NSTextField *customizeVidHeightLabel;
+@property (weak) IBOutlet NSTextField *customizeVidScaleLabel;
+@property (weak) IBOutlet NSTextField *customizeVidResLabel;
+@property (weak) IBOutlet NSPopUpButton *customizeVidCodecPopup;
+@property (weak) IBOutlet NSTextField *customizeVidBitrateField;
+@property (weak) IBOutlet NSTextField *customizeVidFramerateField;
+@property (weak) IBOutlet NSTextField *customizeVidWidthField;
+@property (weak) IBOutlet NSTextField *customizeVidHeightField;
+@property (weak) IBOutlet NSPopUpButton *customizeVidScalePopup;
+
+// customize panel: audio
+@property (weak) IBOutlet NSButton *customizeAudCheckbox;
+@property (weak) IBOutlet NSButton *customizeAudKeepCheckbox;
+@property (weak) IBOutlet NSBox *customizeAudSettingsBox;
+@property (weak) IBOutlet NSTextField *customizeAudCodecLabel;
+@property (weak) IBOutlet NSTextField *customizeAudBitrateLabel;
+@property (weak) IBOutlet NSTextField *customizeAudChannelsLabel;
+@property (weak) IBOutlet NSTextField *customizeAudSamplerateLabel;
+@property (weak) IBOutlet NSPopUpButton *customizeAudCodecPopup;
+@property (weak) IBOutlet NSTextField *customizeAudBitrateField;
+@property (weak) IBOutlet NSTextField *customizeAudChannelsField;
+@property (weak) IBOutlet NSPopUpButton *customizeAudSampleratePopup;
+
+// customize panel: subs
+@property (weak) IBOutlet NSButton *customizeSubsCheckbox;
+@property (weak) IBOutlet NSButton *customizeSubsOverlayCheckbox;
+@property (weak) IBOutlet NSPopUpButton *customizeSubsPopup;
+
+// stream panel
+@property (weak) IBOutlet NSWindow *streamPanel;
+@property (weak) IBOutlet NSTextField *streamDestinationLabel;
+@property (weak) IBOutlet NSTextField *streamTypeLabel;
+@property (weak) IBOutlet NSTextField *streamAddressLabel;
+@property (weak) IBOutlet NSPopUpButton *streamTypePopup;
+@property (weak) IBOutlet NSTextField *streamAddressField;
+@property (weak) IBOutlet NSTextField *streamTTLLabel;
+@property (weak) IBOutlet NSTextField *streamTTLField;
+@property (weak) IBOutlet NSStepper *streamTTLStepper;
+@property (weak) IBOutlet NSTextField *streamPortLabel;
+@property (weak) IBOutlet NSTextField *streamPortField;
+@property (weak) IBOutlet NSTextField *streamAnnouncementLabel;
+@property (weak) IBOutlet NSButton *streamSAPCheckbox;
+@property (weak) IBOutlet NSTextField *streamChannelLabel;
+@property (weak) IBOutlet NSTextField *streamChannelField;
+@property (weak) IBOutlet NSMatrix *streamSDPMatrix;
+@property (weak) IBOutlet NSButton *streamSDPFileBrowseButton;
+@property (weak) IBOutlet NSTextField *streamSDPLabel;
+@property (weak) IBOutlet NSTextField *streamSDPField;
+@property (weak) IBOutlet NSButton *streamCancelButton;
+@property (weak) IBOutlet NSButton *streamOkButton;
+
+// other properties
+@property (strong) VLCPopupPanelController *popupPanel;
+@property (strong) VLCTextfieldPanelController *textfieldPanel;
+
+
+@property (readwrite, nonatomic, retain) NSString * MRL;
+@property (readwrite, nonatomic, retain) NSString * outputDestination;
+@property (readwrite, retain) NSArray * profileNames;
+@property (readwrite, retain) NSArray * profileValueList;
+@property (readwrite, retain) NSMutableArray * currentProfile;
+
+// Bindings for field / stepper combis
+@property (nonatomic) int vidBitrate;
+@property (nonatomic) int vidFramerate;
+@property (nonatomic) int audBitrate;
+@property (nonatomic) int audChannels;
+
+
+- (IBAction)finalizePanel:(id)sender;
+- (IBAction)openMedia:(id)sender;
+- (IBAction)switchProfile:(id)sender;
+- (IBAction)iWantAFile:(id)sender;
+- (IBAction)iWantAStream:(id)sender;
+- (IBAction)cancelDestination:(id)sender;
+- (IBAction)browseFileDestination:(id)sender;
+
+- (IBAction)customizeProfile:(id)sender;
+- (IBAction)closeCustomizationSheet:(id)sender;
+- (IBAction)videoSettingsChanged:(id)sender;
+- (IBAction)audioSettingsChanged:(id)sender;
+- (IBAction)subSettingsChanged:(id)sender;
+- (IBAction)newProfileAction:(id)sender;
+
+- (IBAction)showStreamPanel:(id)sender;
+- (IBAction)closeStreamPanel:(id)sender;
+- (IBAction)streamTypeToggle:(id)sender;
+- (IBAction)streamAnnouncementToggle:(id)sender;
+- (IBAction)sdpFileLocationSelector:(id)sender;
+
+@end
diff --git a/modules/gui/macosx/VLCConvertAndSaveWindowController.m b/modules/gui/macosx/VLCConvertAndSaveWindowController.m
new file mode 100644 (file)
index 0000000..ffd0be5
--- /dev/null
@@ -0,0 +1,1044 @@
+/*****************************************************************************
+ * VLCConvertAndSaveWindowController.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2012 Felix Paul Kühne
+ * $Id$
+ *
+ * Authors: 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.
+ *****************************************************************************/
+
+#import "VLCConvertAndSaveWindowController.h"
+
+#import "intf.h"
+#import "VLCPlaylist.h"
+#import "misc.h"
+#import "SharedDialogs.h"
+
+#import <vlc_common.h>
+#import <vlc_url.h>
+
+/* mini doc:
+ * the used NSMatrix includes a bunch of cells referenced most easily by tags. There you go: */
+#define MPEGTS 0
+#define WEBM 1
+#define OGG 2
+#define MP4 3
+#define MPEGPS 4
+#define MJPEG 5
+#define WAV 6
+#define FLV 7
+#define MPEG1 8
+#define MKV 9
+#define RAW 10
+#define AVI 11
+#define ASF 12
+/* 13-15 are present, but not set */
+
+@interface VLCConvertAndSaveWindowController()
+{
+    NSArray *_videoCodecs;
+    NSArray *_audioCodecs;
+    NSArray *_subsCodecs;
+    BOOL b_streaming;
+}
+
+- (void)updateDropView;
+- (void)updateOKButton;
+- (void)resetCustomizationSheetBasedOnProfile:(NSString *)profileString;
+- (void)selectCellByEncapsulationFormat:(NSString *)format;
+- (NSString *)currentEncapsulationFormatAsFileExtension:(BOOL)b_extension;
+- (NSString *)composedOptions;
+- (void)updateCurrentProfile;
+- (void)storeProfilesOnDisk;
+- (void)recreateProfilePopup;
+@end
+
+@implementation VLCConvertAndSaveWindowController
+
+#pragma mark -
+#pragma mark Initialization
+
++ (void)initialize
+{
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+
+    /* We are using the same format as the Qt intf here:
+     * Container(string), transcode video(bool), transcode audio(bool),
+     * use subtitles(bool), video codec(string), video bitrate(integer),
+     * scale(float), fps(float), width(integer, height(integer),
+     * audio codec(string), audio bitrate(integer), channels(integer),
+     * samplerate(integer), subtitle codec(string), subtitle overlay(bool) */
+    NSArray * defaultProfiles = [[NSArray alloc] initWithObjects:
+                                 @"mp4;1;1;0;h264;0;0;0;0;0;mpga;128;2;44100;0;1",
+                                 @"webm;1;1;0;VP80;2000;0;0;0;0;vorb;128;2;44100;0;1",
+                                 @"ts;1;1;0;h264;800;1;0;0;0;mpga;128;2;44100;0;0",
+                                 @"ts;1;1;0;drac;800;1;0;0;0;mpga;128;2;44100;0;0",
+                                 @"ogg;1;1;0;theo;800;1;0;0;0;vorb;128;2;44100;0;0",
+                                 @"ogg;1;1;0;theo;800;1;0;0;0;flac;128;2;44100;0;0",
+                                 @"ts;1;1;0;mp2v;800;1;0;0;0;mpga;128;2;44100;0;0",
+                                 @"asf;1;1;0;WMV2;800;1;0;0;0;wma2;128;2;44100;0;0",
+                                 @"asf;1;1;0;DIV3;800;1;0;0;0;mp3;128;2;44100;0;0",
+                                 @"ogg;0;1;0;none;800;1;0;0;0;vorb;128;2;44100;none;0",
+                                 @"raw;0;1;0;none;800;1;0;0;0;mp3;128;2;44100;none;0",
+                                 @"mp4;0;1;0;none;800;1;0;0;0;mpga;128;2;44100;none;0",
+                                 @"raw;0;1;0;none;800;1;0;0;0;flac;128;2;44100;none;0",
+                                 @"wav;0;1;0;none;800;1;0;0;0;s16l;128;2;44100;none;0", nil];
+
+    NSArray * defaultProfileNames = [[NSArray alloc] initWithObjects:
+                                     @"Video - H.264 + MP3 (MP4)",
+                                     @"Video - VP80 + Vorbis (Webm)",
+                                     @"Video - H.264 + MP3 (TS)",
+                                     @"Video - Dirac + MP3 (TS)",
+                                     @"Video - Theora + Vorbis (OGG)",
+                                     @"Video - Theora + Flac (OGG)",
+                                     @"Video - MPEG-2 + MPGA (TS)",
+                                     @"Video - WMV + WMA (ASF)",
+                                     @"Video - DIV3 + MP3 (ASF)",
+                                     @"Audio - Vorbis (OGG)",
+                                     @"Audio - MP3",
+                                     @"Audio - MP3 (MP4)",
+                                     @"Audio - FLAC",
+                                     @"Audio - CD",
+                                     nil];
+
+    NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:defaultProfiles, @"CASProfiles", defaultProfileNames, @"CASProfileNames", nil];
+
+    [defaults registerDefaults:appDefaults];
+}
+
+- (id)init
+{
+    self = [super initWithWindowNibName:@"ConvertAndSave"];
+    if (self) {
+        self.popupPanel = [[VLCPopupPanelController alloc] init];
+        self.textfieldPanel = [[VLCTextfieldPanelController alloc] init];
+    }
+    return self;
+}
+
+- (void)windowDidLoad
+{
+    [self.window setTitle: _NS("Convert & Stream")];
+    [_okButton setTitle: _NS("Go!")];
+    [_dropLabel setStringValue: _NS("Drop media here")];
+    [_dropButton setTitle: _NS("Open media...")];
+    [_profileLabel setStringValue: _NS("Choose Profile")];
+    [_customizeButton setTitle: _NS("Customize...")];
+    [_destinationLabel setStringValue: _NS("Choose Destination")];
+    [_fileDestinationFileNameStub setStringValue: _NS("Choose an output location")];
+    [_fileDestinationFileName setHidden: YES];
+    [_fileDestinationBrowseButton setTitle:_NS("Browse...")];
+    [_streamDestinationButton setTitle:_NS("Setup Streaming...")];
+    [_streamDestinationURLLabel setStringValue:_NS("Select Streaming Method")];
+    [_destinationFileButton setTitle:_NS("Save as File")];
+    [_destinationStreamButton setTitle:_NS("Stream")];
+    [_destinationCancelBtn setHidden:YES];
+
+    [_customizeOkButton setTitle: _NS("Apply")];
+    [_customizeCancelButton setTitle: _NS("Cancel")];
+    [_customizeNewProfileButton setTitle: _NS("Save as new Profile...")];
+    [[_customizeTabView tabViewItemAtIndex:0] setLabel: _NS("Encapsulation")];
+    [[_customizeTabView tabViewItemAtIndex:1] setLabel: _NS("Video codec")];
+    [[_customizeTabView tabViewItemAtIndex:2] setLabel: _NS("Audio codec")];
+    [[_customizeTabView tabViewItemAtIndex:3] setLabel: _NS("Subtitles")];
+    [_customizeTabView selectTabViewItemAtIndex: 0];
+    [_customizeVidCheckbox setTitle: _NS("Video")];
+    [_customizeVidKeepCheckbox setTitle: _NS("Keep original video track")];
+    [_customizeVidCodecLabel setStringValue: _NS("Codec")];
+    [_customizeVidBitrateLabel setStringValue: _NS("Bitrate")];
+    [_customizeVidFramerateLabel setStringValue: _NS("Frame rate")];
+    [_customizeVidResolutionBox setTitle: _NS("Resolution")];
+    [_customizeVidResLabel setStringValue: _NS("You just need to fill one of the three following parameters, VLC will autodetect the other using the original aspect ratio")];
+    [_customizeVidWidthLabel setStringValue: _NS("Width")];
+    [_customizeVidHeightLabel setStringValue: _NS("Height")];
+    [_customizeVidScaleLabel setStringValue: _NS("Scale")];
+
+    [_customizeAudCheckbox setTitle: _NS("Audio")];
+    [_customizeAudKeepCheckbox setTitle: _NS("Keep original audio track")];
+    [_customizeAudCodecLabel setStringValue: _NS("Codec")];
+    [_customizeAudBitrateLabel setStringValue: _NS("Bitrate")];
+    [_customizeAudChannelsLabel setStringValue: _NS("Channels")];
+    [_customizeAudSamplerateLabel setStringValue: _NS("Samplerate")];
+
+    [_customizeSubsCheckbox setTitle: _NS("Subtitles")];
+    [_customizeSubsOverlayCheckbox setTitle: _NS("Overlay subtitles on the video")];
+
+    [_streamOkButton setTitle: _NS("Apply")];
+    [_streamCancelButton setTitle: _NS("Cancel")];
+    [_streamDestinationLabel setStringValue:_NS("Stream Destination")];
+    [_streamAnnouncementLabel setStringValue:_NS("Stream Announcement")];
+    [_streamTypeLabel setStringValue:_NS("Type")];
+    [_streamAddressLabel setStringValue:_NS("Address")];
+    [_streamTTLLabel setStringValue:_NS("TTL")];
+    [_streamTTLStepper setEnabled:NO];
+    [_streamPortLabel setStringValue:_NS("Port")];
+    [_streamSAPCheckbox setStringValue:_NS("SAP Announcement")];
+    [[_streamSDPMatrix cellWithTag:0] setTitle:_NS("None")];
+    [[_streamSDPMatrix cellWithTag:1] setTitle:_NS("HTTP Announcement")];
+    [[_streamSDPMatrix cellWithTag:2] setTitle:_NS("RTSP Announcement")];
+    [[_streamSDPMatrix cellWithTag:3] setTitle:_NS("Export SDP as file")];
+    [_streamSAPCheckbox setState:NSOffState];
+    [_streamSDPMatrix setEnabled:NO];
+    [_streamSDPFileBrowseButton setStringValue:_NS("Browse...")];
+    [_streamChannelLabel setStringValue:_NS("Channel Name")];
+    [_streamSDPLabel setStringValue:_NS("SDP URL")];
+
+    /* there is no way to hide single cells, so replace the existing ones with empty cells.. */
+    id blankCell = [[NSCell alloc] init];
+    [blankCell setEnabled:NO];
+    [_customizeEncapMatrix putCell:blankCell atRow:3 column:1];
+    [_customizeEncapMatrix putCell:blankCell atRow:3 column:2];
+    [_customizeEncapMatrix putCell:blankCell atRow:3 column:3];
+
+    /* fetch profiles from defaults */
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+    [self setProfileValueList: [defaults arrayForKey:@"CASProfiles"]];
+    [self setProfileNames: [defaults arrayForKey:@"CASProfileNames"]];
+    [self recreateProfilePopup];
+
+    _videoCodecs = [[NSArray alloc] initWithObjects:
+                    [NSArray arrayWithObjects:@"MPEG-1", @"MPEG-2", @"MPEG-4", @"DIVX 1", @"DIVX 2", @"DIVX 3", @"H.263", @"H.264", @"VP8", @"WMV1", @"WMV2", @"M-JPEG", @"Theora", @"Dirac", nil],
+                    [NSArray arrayWithObjects:@"mpgv", @"mp2v", @"mp4v", @"DIV1", @"DIV2", @"DIV3", @"H263", @"h264", @"VP80", @"WMV1", @"WMV2", @"MJPG", @"theo", @"drac", nil],
+                    nil];
+    _audioCodecs = [[NSArray alloc] initWithObjects:
+                    [NSArray arrayWithObjects:@"MPEG Audio", @"MP3", @"MPEG 4 Audio (AAC)", @"A52/AC-3", @"Vorbis", @"Flac", @"Speex", @"WAV", @"WMA2", nil],
+                    [NSArray arrayWithObjects:@"mpga", @"mp3", @"mp4a", @"a52", @"vorb", @"flac", @"spx", @"s16l", @"wma2", nil],
+                    nil];
+    _subsCodecs = [[NSArray alloc] initWithObjects:
+                   [NSArray arrayWithObjects:@"DVB subtitle", @"T.140", nil],
+                   [NSArray arrayWithObjects:@"dvbs", @"t140", nil],
+                    nil];
+
+    [_customizeVidCodecPopup removeAllItems];
+    [_customizeVidScalePopup removeAllItems];
+    [_customizeAudCodecPopup removeAllItems];
+    [_customizeAudSampleratePopup removeAllItems];
+    [_customizeSubsPopup removeAllItems];
+
+    [_customizeVidCodecPopup addItemsWithTitles:[_videoCodecs firstObject]];
+    [_customizeAudCodecPopup addItemsWithTitles:[_audioCodecs firstObject]];
+    [_customizeSubsPopup addItemsWithTitles:[_subsCodecs firstObject]];
+
+    [_customizeAudSampleratePopup addItemWithTitle:@"8000"];
+    [_customizeAudSampleratePopup addItemWithTitle:@"11025"];
+    [_customizeAudSampleratePopup addItemWithTitle:@"22050"];
+    [_customizeAudSampleratePopup addItemWithTitle:@"44100"];
+    [_customizeAudSampleratePopup addItemWithTitle:@"48000"];
+
+    [_customizeVidScalePopup addItemWithTitle:@"1"];
+    [_customizeVidScalePopup addItemWithTitle:@"0.25"];
+    [_customizeVidScalePopup addItemWithTitle:@"0.5"];
+    [_customizeVidScalePopup addItemWithTitle:@"0.75"];
+    [_customizeVidScalePopup addItemWithTitle:@"1.25"];
+    [_customizeVidScalePopup addItemWithTitle:@"1.5"];
+    [_customizeVidScalePopup addItemWithTitle:@"1.75"];
+    [_customizeVidScalePopup addItemWithTitle:@"2"];
+
+    [_okButton setEnabled: NO];
+
+    // setup drop view
+    [_dropBox enablePlaylistItems];
+    [_dropBox setDropHandler: self];
+
+    [self resetCustomizationSheetBasedOnProfile:[self.profileValueList firstObject]];
+}
+
+# pragma mark -
+# pragma mark User Interaction - main window
+
+- (IBAction)finalizePanel:(id)sender
+{
+    if (b_streaming) {
+        if ([[[_streamTypePopup selectedItem] title] isEqualToString:@"HTTP"]) {
+            NSString *muxformat = [self.currentProfile firstObject];
+            if ([muxformat isEqualToString:@"wav"] || [muxformat isEqualToString:@"mov"] || [muxformat isEqualToString:@"mp4"] || [muxformat isEqualToString:@"mkv"]) {
+                NSBeginInformationalAlertSheet(_NS("Invalid container format for HTTP streaming"), _NS("OK"), @"", @"", self.window,
+                                               nil, nil, nil, nil,
+                                               _NS("Media encapsulated as %@ cannot be streamed through the HTTP protocol for technical reasons."),
+                                               [[self currentEncapsulationFormatAsFileExtension:YES] uppercaseString]);
+                return;
+            }
+        }
+    }
+
+    playlist_t * p_playlist = pl_Get(getIntf());
+
+    input_item_t *p_input = input_item_New([_MRL UTF8String], [[_dropinMediaLabel stringValue] UTF8String]);
+    if (!p_input)
+        return;
+
+    input_item_AddOption(p_input, [[self composedOptions] UTF8String], VLC_INPUT_OPTION_TRUSTED);
+    if (b_streaming)
+        input_item_AddOption(p_input, [[NSString stringWithFormat:@"ttl=%@", [_streamTTLField stringValue]] UTF8String], VLC_INPUT_OPTION_TRUSTED);
+
+    int returnValue;
+    returnValue = playlist_AddInput(p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END, true, pl_Unlocked);
+
+    if (returnValue == VLC_SUCCESS) {
+        /* let's "play" */
+        PL_LOCK;
+        playlist_item_t *p_item = playlist_ItemGetByInput(p_playlist, p_input);
+        playlist_Control(p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL,
+                         p_item);
+        PL_UNLOCK;
+    }
+    else
+        msg_Err(getIntf(), "CAS: playlist add input failed :(");
+
+    /* we're done with this input */
+    vlc_gc_decref(p_input);
+
+    [self.window performClose:sender];
+}
+
+- (IBAction)openMedia:(id)sender
+{
+    /* preliminary implementation until the open panel is cleaned up */
+    NSOpenPanel * openPanel = [NSOpenPanel openPanel];
+    [openPanel setCanChooseDirectories:NO];
+    [openPanel setResolvesAliases:YES];
+    [openPanel setAllowsMultipleSelection:NO];
+    [openPanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger returnCode) {
+        if (returnCode == NSOKButton)
+        {
+            [self setMRL: toNSStr(vlc_path2uri([[[openPanel URL] path] UTF8String], NULL))];
+            [self updateOKButton];
+            [self updateDropView];
+        }
+    }];
+}
+
+- (IBAction)switchProfile:(id)sender
+{
+    NSUInteger index = [_profilePopup indexOfSelectedItem];
+    // last index is "custom"
+    if (index <= ([self.profileValueList count] - 1))
+        [self resetCustomizationSheetBasedOnProfile:[self.profileValueList objectAtIndex:index]];
+}
+
+- (IBAction)deleteProfileAction:(id)sender
+{
+    /* show panel */
+    [_popupPanel setTitleString:_NS("Remove a profile")];
+    [_popupPanel setSubTitleString:_NS("Select the profile you would like to remove:")];
+    [_popupPanel setOkButtonString:_NS("Remove")];
+    [_popupPanel setCancelButtonString:_NS("Cancel")];
+    [_popupPanel setPopupButtonContent:self.profileNames];
+
+    __weak typeof(self) _self = self;
+    [_popupPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSInteger selectedIndex) {
+
+        if (returnCode != NSOKButton)
+            return;
+
+        /* remove requested profile from the arrays */
+        NSMutableArray * workArray = [[NSMutableArray alloc] initWithArray:_self.profileNames];
+        [workArray removeObjectAtIndex:selectedIndex];
+        [_self setProfileNames:[[NSArray alloc] initWithArray:workArray]];
+        workArray = [[NSMutableArray alloc] initWithArray:_self.profileValueList];
+        [workArray removeObjectAtIndex:selectedIndex];
+        [_self setProfileValueList:[[NSArray alloc] initWithArray:workArray]];
+
+        /* update UI */
+        [_self recreateProfilePopup];
+
+        /* update internals */
+        [_self switchProfile:_self];
+        [_self storeProfilesOnDisk];
+    }];
+}
+
+- (IBAction)iWantAFile:(id)sender
+{
+    NSRect boxFrame = [_destinationBox frame];
+    NSRect subViewFrame = [_fileDestinationView frame];
+    subViewFrame.origin.x = (boxFrame.size.width - subViewFrame.size.width) / 2;
+    subViewFrame.origin.y = ((boxFrame.size.height - subViewFrame.size.height) / 2) - 15.;
+    [_fileDestinationView setFrame: subViewFrame];
+    [[_destinationFileButton animator] setHidden: YES];
+    [[_destinationStreamButton animator] setHidden: YES];
+    [_destinationBox performSelector:@selector(addSubview:) withObject:_fileDestinationView afterDelay:0.2];
+    [[_destinationCancelBtn animator] setHidden:NO];
+    b_streaming = NO;
+    [_okButton setTitle:_NS("Save")];
+}
+
+- (IBAction)iWantAStream:(id)sender
+{
+    NSRect boxFrame = [_destinationBox frame];
+    NSRect subViewFrame = [_streamDestinationView frame];
+    subViewFrame.origin.x = (boxFrame.size.width - subViewFrame.size.width) / 2;
+    subViewFrame.origin.y = ((boxFrame.size.height - subViewFrame.size.height) / 2) - 15.;
+    [_streamDestinationView setFrame: subViewFrame];
+    [[_destinationFileButton animator] setHidden: YES];
+    [[_destinationStreamButton animator] setHidden: YES];
+    [_destinationBox performSelector:@selector(addSubview:) withObject:_streamDestinationView afterDelay:0.2];
+    [[_destinationCancelBtn animator] setHidden:NO];
+    b_streaming = YES;
+    [_okButton setTitle:_NS("Stream")];
+}
+
+- (IBAction)cancelDestination:(id)sender
+{
+    if ([_streamDestinationView superview] != nil)
+        [_streamDestinationView removeFromSuperview];
+    if ([_fileDestinationView superview] != nil)
+        [_fileDestinationView removeFromSuperview];
+
+    [_destinationCancelBtn setHidden:YES];
+    [[_destinationFileButton animator] setHidden: NO];
+    [[_destinationStreamButton animator] setHidden: NO];
+    b_streaming = NO;
+}
+
+- (IBAction)browseFileDestination:(id)sender
+{
+    NSSavePanel * saveFilePanel = [NSSavePanel savePanel];
+    [saveFilePanel setCanSelectHiddenExtension: YES];
+    [saveFilePanel setCanCreateDirectories: YES];
+    if ([[_customizeEncapMatrix selectedCell] tag] != RAW) // there is no clever guess for this
+        [saveFilePanel setAllowedFileTypes:[NSArray arrayWithObject:[self currentEncapsulationFormatAsFileExtension:YES]]];
+    [saveFilePanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger returnCode) {
+        if (returnCode == NSOKButton) {
+            [self setOutputDestination:[[saveFilePanel URL] path]];
+            [_fileDestinationFileName setStringValue: [[NSFileManager defaultManager] displayNameAtPath:_outputDestination]];
+            [[_fileDestinationFileNameStub animator] setHidden: YES];
+            [[_fileDestinationFileName animator] setHidden: NO];
+        } else {
+            [self setOutputDestination:@""];
+            [[_fileDestinationFileName animator] setHidden: YES];
+            [[_fileDestinationFileNameStub animator] setHidden: NO];
+        }
+        [self updateOKButton];
+    }];
+}
+
+#pragma mark -
+#pragma mark User interaction - customization panel
+
+- (IBAction)customizeProfile:(id)sender
+{
+    [NSApp beginSheet:_customizePanel modalForWindow:self.window modalDelegate:self didEndSelector:NULL contextInfo:nil];
+}
+
+- (IBAction)closeCustomizationSheet:(id)sender
+{
+    [_customizePanel orderOut:sender];
+    [NSApp endSheet: _customizePanel];
+
+    if (sender == _customizeOkButton)
+        [self updateCurrentProfile];
+}
+
+
+
+- (IBAction)videoSettingsChanged:(id)sender
+{
+    bool enableSettings = [_customizeVidCheckbox state] == NSOnState && [_customizeVidKeepCheckbox state] == NSOffState;
+    [_customizeVidSettingsBox enableSubviews:enableSettings];
+    [_customizeVidKeepCheckbox setEnabled:[_customizeVidCheckbox state] == NSOnState];
+}
+
+- (IBAction)audioSettingsChanged:(id)sender
+{
+    bool enableSettings = [_customizeAudCheckbox state] == NSOnState && [_customizeAudKeepCheckbox state] == NSOffState;
+    [_customizeAudSettingsBox enableSubviews:enableSettings];
+    [_customizeAudKeepCheckbox setEnabled:[_customizeAudCheckbox state] == NSOnState];
+}
+
+- (IBAction)subSettingsChanged:(id)sender
+{
+    bool enableSettings = [_customizeSubsCheckbox state] == NSOnState;
+    [_customizeSubsOverlayCheckbox setEnabled:enableSettings];
+    [_customizeSubsPopup setEnabled:enableSettings];
+}
+
+- (IBAction)newProfileAction:(id)sender
+{
+    /* show panel */
+    [_textfieldPanel setTitleString: _NS("Save as new profile")];
+    [_textfieldPanel setSubTitleString: _NS("Enter a name for the new profile:")];
+    [_textfieldPanel setCancelButtonString: _NS("Cancel")];
+    [_textfieldPanel setOkButtonString: _NS("Save")];
+
+    __weak typeof(self) _self = self;
+    [_textfieldPanel runModalForWindow:_customizePanel completionHandler:^(NSInteger returnCode, NSString *resultingText) {
+        if (returnCode != NSOKButton || [resultingText length] == 0)
+            return;
+
+        /* prepare current data */
+        [_self updateCurrentProfile];
+
+        /* add profile to arrays */
+        NSMutableArray * workArray = [[NSMutableArray alloc] initWithArray:self.profileNames];
+        [workArray addObject:resultingText];
+        [_self setProfileNames:[[NSArray alloc] initWithArray:workArray]];
+
+        workArray = [[NSMutableArray alloc] initWithArray:self.profileValueList];
+        [workArray addObject:[self.currentProfile componentsJoinedByString:@";"]];
+        [_self setProfileValueList:[[NSArray alloc] initWithArray:workArray]];
+
+        /* update UI */
+        [_self recreateProfilePopup];
+        [_profilePopup selectItemWithTitle:resultingText];
+
+        /* update internals */
+        [_self switchProfile:self];
+        [_self storeProfilesOnDisk];
+    }];
+}
+
+#pragma mark -
+#pragma mark User interaction - stream panel
+
+- (IBAction)showStreamPanel:(id)sender
+{
+    [NSApp beginSheet:_streamPanel modalForWindow:self.window modalDelegate:self didEndSelector:NULL contextInfo:nil];
+}
+
+- (IBAction)closeStreamPanel:(id)sender
+{
+    [_streamPanel orderOut:sender];
+    [NSApp endSheet: _streamPanel];
+
+    if (sender == _streamCancelButton)
+        return;
+
+    /* provide a summary of the user selections */
+    NSMutableString * labelContent = [[NSMutableString alloc] initWithFormat:_NS("%@ stream to %@:%@"), [_streamTypePopup titleOfSelectedItem], [_streamAddressField stringValue], [_streamPortField stringValue]];
+
+    if ([_streamTypePopup indexOfSelectedItem] > 1)
+        [labelContent appendFormat:@" (\"%@\")", [_streamChannelField stringValue]];
+
+    [_streamDestinationURLLabel setStringValue:labelContent];
+
+    /* catch obvious errors */
+    if ([[_streamAddressField stringValue] length] == 0) {
+        NSBeginInformationalAlertSheet(_NS("No Address given"),
+                                       _NS("OK"), @"", @"", _streamPanel, nil, nil, nil, nil,
+                                       @"%@", _NS("In order to stream, a valid destination address is required."));
+        return;
+    }
+
+    if ([_streamSAPCheckbox state] && [[_streamChannelField stringValue] length] == 0) {
+        NSBeginInformationalAlertSheet(_NS("No Channel Name given"),
+                                       _NS("OK"), @"", @"", _streamPanel, nil, nil, nil, nil,
+                                       @"%@", _NS("SAP stream announcement is enabled. However, no channel name is provided."));
+        return;
+    }
+
+    if ([_streamSDPMatrix isEnabled] && [_streamSDPMatrix selectedCell] != [_streamSDPMatrix cellWithTag:0] && [[_streamSDPField stringValue] length] == 0) {
+        NSBeginInformationalAlertSheet(_NS("No SDP URL given"),
+                                       _NS("OK"), @"", @"", _streamPanel, nil, nil, nil, nil,
+                                       @"%@", _NS("A SDP export is requested, but no URL is provided."));
+        return;
+    }
+
+    /* store destination for further reference and update UI */
+    [self setOutputDestination: [_streamAddressField stringValue]];
+    [self updateOKButton];
+}
+
+- (IBAction)streamTypeToggle:(id)sender
+{
+    NSUInteger index = [_streamTypePopup indexOfSelectedItem];
+    if (index <= 1) { // HTTP, MMSH
+        [_streamTTLField setEnabled:NO];
+        [_streamTTLStepper setEnabled:NO];
+        [_streamSAPCheckbox setEnabled:NO];
+        [_streamSDPMatrix setEnabled:NO];
+    } else if (index == 2) { // RTP
+        [_streamTTLField setEnabled:YES];
+        [_streamTTLStepper setEnabled:YES];
+        [_streamSAPCheckbox setEnabled:YES];
+        [_streamSDPMatrix setEnabled:YES];
+    } else { // UDP
+        [_streamTTLField setEnabled:YES];
+        [_streamTTLStepper setEnabled:YES];
+        [_streamSAPCheckbox setEnabled:YES];
+        [_streamSDPMatrix setEnabled:NO];
+    }
+    [self streamAnnouncementToggle:sender];
+}
+
+- (IBAction)streamAnnouncementToggle:(id)sender
+{
+    [_streamChannelField setEnabled:[_streamSAPCheckbox state] && [_streamSAPCheckbox isEnabled]];
+    [_streamSDPField setEnabled:[_streamSDPMatrix isEnabled] && ([_streamSDPMatrix selectedCell] != [_streamSDPMatrix cellWithTag:0])];
+
+    if ([[_streamSDPMatrix selectedCell] tag] == 3)
+        [_streamSDPFileBrowseButton setEnabled: YES];
+    else
+        [_streamSDPFileBrowseButton setEnabled: NO];
+}
+
+- (IBAction)sdpFileLocationSelector:(id)sender
+{
+    NSSavePanel * saveFilePanel = [NSSavePanel savePanel];
+    [saveFilePanel setCanSelectHiddenExtension: YES];
+    [saveFilePanel setCanCreateDirectories: YES];
+    [saveFilePanel setAllowedFileTypes:[NSArray arrayWithObject:@"sdp"]];
+    [saveFilePanel beginSheetModalForWindow:_streamPanel completionHandler:^(NSInteger returnCode) {
+        if (returnCode == NSOKButton)
+            [_streamSDPField setStringValue:[[saveFilePanel URL] path]];
+    }];
+}
+
+#pragma mark -
+#pragma mark User interaction - misc
+
+- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
+{
+    NSPasteboard *paste = [sender draggingPasteboard];
+    NSArray *types = [NSArray arrayWithObjects:NSFilenamesPboardType, @"VLCPlaylistItemPboardType", nil];
+    NSString *desired_type = [paste availableTypeFromArray: types];
+    NSData *carried_data = [paste dataForType: desired_type];
+
+    if (carried_data) {
+        if ([desired_type isEqualToString:NSFilenamesPboardType]) {
+            NSArray *values = [[paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
+
+            if ([values count] > 0) {
+                [self setMRL: toNSStr(vlc_path2uri([[values firstObject] UTF8String], NULL))];
+                [self updateOKButton];
+                [self updateDropView];
+                return YES;
+            }
+        } else if ([desired_type isEqualToString:@"VLCPlaylistItemPboardType"]) {
+            NSArray * array = [[[VLCMain sharedInstance] playlist] draggedItems];
+            NSUInteger count = [array count];
+            if (count > 0) {
+                playlist_t * p_playlist = pl_Get(getIntf());
+                playlist_item_t * p_item = NULL;
+
+                PL_LOCK;
+                /* let's look for the first proper input item */
+                for (NSUInteger x = 0; x < count; x++) {
+                    p_item = [[array objectAtIndex:x] pointerValue];
+                    if (p_item) {
+                        if (p_item->p_input) {
+                            if (p_item->p_input->psz_uri != nil) {
+                                [self setMRL: toNSStr(p_item->p_input->psz_uri)];
+                                [self updateDropView];
+                                [self updateOKButton];
+
+                                PL_UNLOCK;
+
+                                return YES;
+                            }
+                        }
+                    }
+                }
+                PL_UNLOCK;
+            }
+        }
+    }
+    return NO;
+}
+
+# pragma mark -
+# pragma mark Private Functionality
+
+- (void)updateDropView
+{
+    if ([_MRL length] > 0) {
+        NSString * path = [[NSURL URLWithString:_MRL] path];
+        [_dropinMediaLabel setStringValue: [[NSFileManager defaultManager] displayNameAtPath: path]];
+        NSImage * image = [[NSWorkspace sharedWorkspace] iconForFile: path];
+        [image setSize:NSMakeSize(128,128)];
+        [_dropinIcon setImage: image];
+
+        if (![_dropinView superview]) {
+            NSRect boxFrame = [_dropBox frame];
+            NSRect subViewFrame = [_dropinView frame];
+            subViewFrame.origin.x = (boxFrame.size.width - subViewFrame.size.width) / 2;
+            subViewFrame.origin.y = (boxFrame.size.height - subViewFrame.size.height) / 2;
+            [_dropinView setFrame: subViewFrame];
+            [[_dropImage animator] setHidden: YES];
+            [_dropBox performSelector:@selector(addSubview:) withObject:_dropinView afterDelay:0.6];
+        }
+    } else {
+        [_dropinView removeFromSuperview];
+        [[_dropImage animator] setHidden: NO];
+    }
+}
+
+- (void)updateOKButton
+{
+    if ([_outputDestination length] > 0 && [_MRL length] > 0)
+        [_okButton setEnabled: YES];
+    else
+        [_okButton setEnabled: NO];
+}
+
+- (void)resetCustomizationSheetBasedOnProfile:(NSString *)profileString
+{
+    /* Container(string), transcode video(bool), transcode audio(bool),
+    * use subtitles(bool), video codec(string), video bitrate(integer),
+    * scale(float), fps(float), width(integer, height(integer),
+    * audio codec(string), audio bitrate(integer), channels(integer),
+    * samplerate(integer), subtitle codec(string), subtitle overlay(bool) */
+
+    NSArray * components = [profileString componentsSeparatedByString:@";"];
+    if ([components count] != 16) {
+        msg_Err(getIntf(), "CAS: the requested profile '%s' is invalid", [profileString UTF8String]);
+        return;
+    }
+
+    [self selectCellByEncapsulationFormat:[components firstObject]];
+    [_customizeVidCheckbox setState:[[components objectAtIndex:1] intValue]];
+    [_customizeAudCheckbox setState:[[components objectAtIndex:2] intValue]];
+    [_customizeSubsCheckbox setState:[[components objectAtIndex:3] intValue]];
+    [self setVidBitrate:[[components objectAtIndex:5] intValue]];
+    [_customizeVidScalePopup selectItemWithTitle:[components objectAtIndex:6]];
+    [self setVidFramerate:[[components objectAtIndex:7] intValue]];
+    [_customizeVidWidthField setStringValue:[components objectAtIndex:8]];
+    [_customizeVidHeightField setStringValue:[components objectAtIndex:9]];
+    [self setAudBitrate:[[components objectAtIndex:11] intValue]];
+    [self setAudChannels:[[components objectAtIndex:12] intValue]];
+    [_customizeAudSampleratePopup selectItemWithTitle:[components objectAtIndex:13]];
+    [_customizeSubsOverlayCheckbox setState:[[components objectAtIndex:15] intValue]];
+
+    /* since there is no proper lookup mechanism in arrays, we need to implement a string specific one ourselves */
+    NSArray * tempArray = [_videoCodecs objectAtIndex:1];
+    NSUInteger count = [tempArray count];
+    NSString * searchString = [components objectAtIndex:4];
+    int videoKeep = [searchString isEqualToString:@"copy"];
+    [_customizeVidKeepCheckbox setState:videoKeep];
+    if ([searchString isEqualToString:@"none"] || [searchString isEqualToString:@"0"] || videoKeep) {
+        [_customizeVidCodecPopup selectItemAtIndex:-1];
+    } else {
+        for (NSUInteger x = 0; x < count; x++) {
+            if ([[tempArray objectAtIndex:x] isEqualToString: searchString]) {
+                [_customizeVidCodecPopup selectItemAtIndex:x];
+                break;
+            }
+        }
+    }
+
+    tempArray = [_audioCodecs objectAtIndex:1];
+    count = [tempArray count];
+    searchString = [components objectAtIndex:10];
+    int audioKeep = [searchString isEqualToString:@"copy"];
+    [_customizeAudKeepCheckbox setState:audioKeep];
+    if ([searchString isEqualToString:@"none"] || [searchString isEqualToString:@"0"] || audioKeep) {
+        [_customizeAudCodecPopup selectItemAtIndex:-1];
+    } else {
+        for (NSUInteger x = 0; x < count; x++) {
+            if ([[tempArray objectAtIndex:x] isEqualToString: searchString]) {
+                [_customizeAudCodecPopup selectItemAtIndex:x];
+                break;
+            }
+        }
+    }
+
+    tempArray = [_subsCodecs objectAtIndex:1];
+    count = [tempArray count];
+    searchString = [components objectAtIndex:14];
+    if ([searchString isEqualToString:@"none"] || [searchString isEqualToString:@"0"]) {
+        [_customizeSubsPopup selectItemAtIndex:-1];
+    } else {
+        for (NSUInteger x = 0; x < count; x++) {
+            if ([[tempArray objectAtIndex:x] isEqualToString: searchString]) {
+                [_customizeSubsPopup selectItemAtIndex:x];
+                break;
+            }
+        }
+    }
+
+    [self videoSettingsChanged:nil];
+    [self audioSettingsChanged:nil];
+    [self subSettingsChanged:nil];
+
+    [self setCurrentProfile: [[NSMutableArray alloc] initWithArray:[profileString componentsSeparatedByString:@";"]]];
+}
+
+- (void)selectCellByEncapsulationFormat:(NSString *)format
+{
+    if ([format isEqualToString:@"ts"])
+        [_customizeEncapMatrix selectCellWithTag:MPEGTS];
+    else if ([format isEqualToString:@"webm"])
+        [_customizeEncapMatrix selectCellWithTag:WEBM];
+    else if ([format isEqualToString:@"ogg"])
+        [_customizeEncapMatrix selectCellWithTag:OGG];
+    else if ([format isEqualToString:@"ogm"])
+        [_customizeEncapMatrix selectCellWithTag:OGG];
+    else if ([format isEqualToString:@"mp4"])
+        [_customizeEncapMatrix selectCellWithTag:MP4];
+    else if ([format isEqualToString:@"mov"])
+        [_customizeEncapMatrix selectCellWithTag:MP4];
+    else if ([format isEqualToString:@"ps"])
+        [_customizeEncapMatrix selectCellWithTag:MPEGPS];
+    else if ([format isEqualToString:@"mpjpeg"])
+        [_customizeEncapMatrix selectCellWithTag:MJPEG];
+    else if ([format isEqualToString:@"wav"])
+        [_customizeEncapMatrix selectCellWithTag:WAV];
+    else if ([format isEqualToString:@"flv"])
+        [_customizeEncapMatrix selectCellWithTag:FLV];
+    else if ([format isEqualToString:@"mpeg1"])
+        [_customizeEncapMatrix selectCellWithTag:MPEG1];
+    else if ([format isEqualToString:@"mkv"])
+        [_customizeEncapMatrix selectCellWithTag:MKV];
+    else if ([format isEqualToString:@"raw"])
+        [_customizeEncapMatrix selectCellWithTag:RAW];
+    else if ([format isEqualToString:@"avi"])
+        [_customizeEncapMatrix selectCellWithTag:AVI];
+    else if ([format isEqualToString:@"asf"])
+        [_customizeEncapMatrix selectCellWithTag:ASF];
+    else if ([format isEqualToString:@"wmv"])
+        [_customizeEncapMatrix selectCellWithTag:ASF];
+    else
+        msg_Err(getIntf(), "CAS: unknown encap format requested for customization");
+}
+
+- (NSString *)currentEncapsulationFormatAsFileExtension:(BOOL)b_extension
+{
+    NSUInteger cellTag = (NSUInteger) [[_customizeEncapMatrix selectedCell] tag];
+    NSString * returnValue;
+    switch (cellTag) {
+        case MPEGTS:
+            returnValue = @"ts";
+            break;
+        case WEBM:
+            returnValue = @"webm";
+            break;
+        case OGG:
+            returnValue = @"ogg";
+            break;
+        case MP4:
+        {
+            if (b_extension)
+                returnValue = @"m4v";
+            else
+                returnValue = @"mp4";
+            break;
+        }
+        case MPEGPS:
+        {
+            if (b_extension)
+                returnValue = @"mpg";
+            else
+                returnValue = @"ps";
+            break;
+        }
+        case MJPEG:
+            returnValue = @"mjpeg";
+            break;
+        case WAV:
+            returnValue = @"wav";
+            break;
+        case FLV:
+            returnValue = @"flv";
+            break;
+        case MPEG1:
+        {
+            if (b_extension)
+                returnValue = @"mpg";
+            else
+                returnValue = @"mpeg1";
+            break;
+        }
+        case MKV:
+            returnValue = @"mkv";
+            break;
+        case RAW:
+            returnValue = @"raw";
+            break;
+        case AVI:
+            returnValue = @"avi";
+            break;
+        case ASF:
+            returnValue = @"asf";
+            break;
+
+        default:
+            returnValue = @"none";
+            break;
+    }
+
+    return returnValue;
+}
+
+- (NSString *)composedOptions
+{
+    NSMutableString *composedOptions = [[NSMutableString alloc] initWithString:@":sout=#transcode{"];
+    BOOL haveVideo = YES;
+    if ([[self.currentProfile objectAtIndex:1] intValue]) {
+        // video is enabled
+        if (![[self.currentProfile objectAtIndex:4] isEqualToString:@"copy"]) {
+        [composedOptions appendFormat:@"vcodec=%@", [self.currentProfile objectAtIndex:4]];
+            if ([[self.currentProfile objectAtIndex:5] intValue] > 0) // bitrate
+                [composedOptions appendFormat:@",vb=%@", [self.currentProfile objectAtIndex:5]];
+            if ([[self.currentProfile objectAtIndex:6] floatValue] > 0.) // scale
+                [composedOptions appendFormat:@",scale=%@", [self.currentProfile objectAtIndex:6]];
+            if ([[self.currentProfile objectAtIndex:7] floatValue] > 0.) // fps
+                [composedOptions appendFormat:@",fps=%@", [self.currentProfile objectAtIndex:7]];
+            if ([[self.currentProfile objectAtIndex:8] intValue] > 0) // width
+                [composedOptions appendFormat:@",width=%@", [self.currentProfile objectAtIndex:8]];
+            if ([[self.currentProfile objectAtIndex:9] intValue] > 0) // height
+                [composedOptions appendFormat:@",height=%@", [self.currentProfile objectAtIndex:9]];
+        } else {
+            haveVideo = NO;
+        }
+    } else {
+        [composedOptions appendString:@"vcodec=none"];
+    }
+
+    BOOL haveAudio = YES;
+    if ([[self.currentProfile objectAtIndex:2] intValue]) {
+        // audio is enabled
+        if (![[self.currentProfile objectAtIndex:10] isEqualToString:@"copy"]) {
+            if(haveVideo)
+                [composedOptions appendString:@","];
+            [composedOptions appendFormat:@"acodec=%@", [self.currentProfile objectAtIndex:10]];
+            [composedOptions appendFormat:@",ab=%@", [self.currentProfile objectAtIndex:11]]; // bitrate
+            [composedOptions appendFormat:@",channels=%@", [self.currentProfile objectAtIndex:12]]; // channel number
+            [composedOptions appendFormat:@",samplerate=%@", [self.currentProfile objectAtIndex:13]]; // sample rate
+        } else {
+            haveAudio = NO;
+        }
+    } else {
+        if(haveVideo)
+            [composedOptions appendString:@","];
+
+        [composedOptions appendString:@"acodec=none"];
+    }
+    if ([self.currentProfile objectAtIndex:3]) {
+        if(haveVideo || haveAudio)
+            [composedOptions appendString:@","];
+        // subtitles enabled
+        [composedOptions appendFormat:@"scodec=%@", [self.currentProfile objectAtIndex:14]];
+        if ([[self.currentProfile objectAtIndex:15] intValue])
+            [composedOptions appendFormat:@",soverlay"];
+    }
+
+    if (!b_streaming) {
+        /* file transcoding */
+        // add muxer
+        [composedOptions appendFormat:@"}:standard{mux=%@", [self.currentProfile firstObject]];
+
+
+        // add output destination
+        [composedOptions appendFormat:@",access=file{no-overwrite},dst=%@}", _outputDestination];
+    } else {
+        /* streaming */
+        if ([[[_streamTypePopup selectedItem] title] isEqualToString:@"RTP"])
+            [composedOptions appendFormat:@":rtp{mux=ts,dst=%@,port=%@", _outputDestination, [_streamPortField stringValue]];
+        else if ([[[_streamTypePopup selectedItem] title] isEqualToString:@"UDP"])
+            [composedOptions appendFormat:@":standard{mux=ts,dst=%@,port=%@,access=udp", _outputDestination, [_streamPortField stringValue]];
+        else if ([[[_streamTypePopup selectedItem] title] isEqualToString:@"MMSH"])
+            [composedOptions appendFormat:@":standard{mux=asfh,dst=%@,port=%@,access=mmsh", _outputDestination, [_streamPortField stringValue]];
+        else
+            [composedOptions appendFormat:@":standard{mux=%@,dst=%@,port=%@,access=http", [self.currentProfile firstObject], [_streamPortField stringValue], _outputDestination];
+
+        if ([_streamSAPCheckbox state])
+            [composedOptions appendFormat:@",sap,name=\"%@\"", [_streamChannelField stringValue]];
+        if ([_streamSDPMatrix selectedCell] != [_streamSDPMatrix cellWithTag:0]) {
+            NSInteger tag = [[_streamSDPMatrix selectedCell] tag];
+            switch (tag) {
+                case 1:
+                    [composedOptions appendFormat:@",sdp=\"http://%@\"", [_streamSDPField stringValue]];
+                    break;
+                case 2:
+                    [composedOptions appendFormat:@",sdp=\"rtsp://%@\"", [_streamSDPField stringValue]];
+                    break;
+                case 3:
+                    [composedOptions appendFormat:@",sdp=\"file://%s\"", vlc_path2uri([[_streamSDPField stringValue] UTF8String], NULL)];
+                default:
+                    break;
+            }
+        }
+
+        [composedOptions appendString:@"} :sout-keep"];
+    }
+
+    return [NSString stringWithString:composedOptions];
+}
+
+- (void)updateCurrentProfile
+{
+    [self.currentProfile removeAllObjects];
+
+    NSInteger i;
+    [self.currentProfile addObject: [self currentEncapsulationFormatAsFileExtension:NO]];
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%li", [_customizeVidCheckbox state]]];
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%li", [_customizeAudCheckbox state]]];
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%li", [_customizeSubsCheckbox state]]];
+    
+    NSString *videoCodec;
+    if([_customizeVidKeepCheckbox state] == NSOnState)
+        videoCodec = @"copy";
+    else {
+        i = [_customizeVidCodecPopup indexOfSelectedItem];
+        if (i >= 0)
+            videoCodec = [[_videoCodecs objectAtIndex:1] objectAtIndex:i];
+        else
+            videoCodec = @"none";
+    }
+    [self.currentProfile addObject: videoCodec];
+
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [self vidBitrate]]];
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [[[_customizeVidScalePopup selectedItem] title] intValue]]];
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [self vidFramerate]]];
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [_customizeVidWidthField intValue]]];
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [_customizeVidHeightField intValue]]];
+
+    NSString *audioCodec;
+    if([_customizeAudKeepCheckbox state] == NSOnState)
+        audioCodec = @"copy";
+    else {
+        i = [_customizeAudCodecPopup indexOfSelectedItem];
+        if (i >= 0)
+            audioCodec = [[_audioCodecs objectAtIndex:1] objectAtIndex:i];
+        else
+            audioCodec = @"none";
+    }
+    [self.currentProfile addObject: audioCodec];
+    
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [self audBitrate]]];
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [self audChannels]]];
+    [self.currentProfile addObject: [[_customizeAudSampleratePopup selectedItem] title]];
+    i = [_customizeSubsPopup indexOfSelectedItem];
+    if (i >= 0)
+        [self.currentProfile addObject: [[_subsCodecs objectAtIndex:1] objectAtIndex:i]];
+    else
+        [self.currentProfile addObject: @"none"];
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%li", [_customizeSubsOverlayCheckbox state]]];
+}
+
+- (void)storeProfilesOnDisk
+{
+    NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
+    [defaults setObject:_profileNames forKey:@"CASProfileNames"];
+    [defaults setObject:_profileValueList forKey:@"CASProfiles"];
+    [defaults synchronize];
+}
+
+- (void)recreateProfilePopup
+{
+    [_profilePopup removeAllItems];
+    [_profilePopup addItemsWithTitles:self.profileNames];
+    [_profilePopup addItemWithTitle:_NS("Custom")];
+    [[_profilePopup menu] addItem:[NSMenuItem separatorItem]];
+    [_profilePopup addItemWithTitle:_NS("Organize Profiles...")];
+    [[_profilePopup lastItem] setTarget: self];
+    [[_profilePopup lastItem] setAction: @selector(deleteProfileAction:)];
+}
+
+- (IBAction)customizeSubsCheckbox:(id)sender {
+}
+@end
index 4c062ad..c8e4dd1 100644 (file)
@@ -43,7 +43,7 @@
 #import "VLCMainWindow.h"
 #import "ControlsBar.h"
 #import "ExtensionsManager.h"
-#import "ConvertAndSave.h"
+#import "VLCConvertAndSaveWindowController.h"
 #import "VLCDebugMessageWindowController.h"
 #import "VLCAddonsWindowController.h"
 #import "VLCTimeSelectionPanelController.h"
index 9505bd8..6ef500d 100644 (file)
@@ -70,7 +70,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
 @class VLCTrackSynchronizationWindowController;
 @class VLCAudioEffectsWindowController;
 @class VLCVideoEffectsWindowController;
-@class VLCConvertAndSave;
+@class VLCConvertAndSaveWindowController;
 @class ExtensionsManager;
 @class VLCInfo;
 @class VLCStatusBarIcon;
@@ -106,7 +106,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
 - (VLCInfo *)currentMediaInfoPanel;
 
 
-- (VLCConvertAndSave *)convertAndSaveWindow;
+- (VLCConvertAndSaveWindowController *)convertAndSaveWindow;
 
 - (void)setActiveVideoPlayback:(BOOL)b_value;
 - (BOOL)activeVideoPlayback;
index 7545a33..828e710 100644 (file)
@@ -60,7 +60,7 @@
 #import "BWQuincyManager.h"
 #import "VLCResumeDialogController.h"
 #import "VLCDebugMessageWindowController.h"
-#import "ConvertAndSave.h"
+#import "VLCConvertAndSaveWindowController.h"
 
 #import "VLCVideoEffectsWindowController.h"
 #import "VLCAudioEffectsWindowController.h"
@@ -179,7 +179,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
     VLCTrackSynchronizationWindowController *_trackSyncPanel;
     VLCAudioEffectsWindowController *_audioEffectsPanel;
     VLCVideoEffectsWindowController *_videoEffectsPanel;
-    VLCConvertAndSave *_convertAndSaveWindow;
+    VLCConvertAndSaveWindowController *_convertAndSaveWindow;
     ExtensionsManager *_extensionsManager;
     VLCInfo *_currentMediaInfoPanel;
 
@@ -592,10 +592,10 @@ static VLCMain *sharedInstance = nil;
     return _open;
 }
 
-- (VLCConvertAndSave *)convertAndSaveWindow
+- (VLCConvertAndSaveWindowController *)convertAndSaveWindow
 {
     if (_convertAndSaveWindow == nil)
-        _convertAndSaveWindow = [[VLCConvertAndSave alloc] init];
+        _convertAndSaveWindow = [[VLCConvertAndSaveWindowController alloc] init];
 
     return _convertAndSaveWindow;
 }