Commit 52a47a8f authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: CAS: enforce the chosen encapsulation format's file extension for the...

macosx: CAS: enforce the chosen encapsulation format's file extension for the destination selection panel

Note that the extension isn't magically switched yet when choosing a different encapsulation format after your output destination.
parent 6a352469
...@@ -315,7 +315,7 @@ static VLCConvertAndSave *_o_sharedInstance = nil; ...@@ -315,7 +315,7 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
if (sender == _customize_ok_btn && [_currentProfile count] == 16) { if (sender == _customize_ok_btn && [_currentProfile count] == 16) {
NSInteger i; NSInteger i;
[_currentProfile replaceObjectAtIndex:0 withObject:[self currentEncapsulationFormat]]; [_currentProfile replaceObjectAtIndex:0 withObject:[self currentEncapsulationFormatAsFileExtension:NO]];
[_currentProfile replaceObjectAtIndex:1 withObject:[NSString stringWithFormat:@"%li", [_customize_vid_ckb state]]]; [_currentProfile replaceObjectAtIndex:1 withObject:[NSString stringWithFormat:@"%li", [_customize_vid_ckb state]]];
[_currentProfile replaceObjectAtIndex:2 withObject:[NSString stringWithFormat:@"%li", [_customize_aud_ckb state]]]; [_currentProfile replaceObjectAtIndex:2 withObject:[NSString stringWithFormat:@"%li", [_customize_aud_ckb state]]];
[_currentProfile replaceObjectAtIndex:3 withObject:[NSString stringWithFormat:@"%li", [_customize_subs_ckb state]]]; [_currentProfile replaceObjectAtIndex:3 withObject:[NSString stringWithFormat:@"%li", [_customize_subs_ckb state]]];
...@@ -351,6 +351,8 @@ static VLCConvertAndSave *_o_sharedInstance = nil; ...@@ -351,6 +351,8 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
NSSavePanel * saveFilePanel = [NSSavePanel savePanel]; NSSavePanel * saveFilePanel = [NSSavePanel savePanel];
[saveFilePanel setCanSelectHiddenExtension: YES]; [saveFilePanel setCanSelectHiddenExtension: YES];
[saveFilePanel setCanCreateDirectories: YES]; [saveFilePanel setCanCreateDirectories: YES];
if ([[_customize_encap_matrix selectedCell] tag] != RAW) // there is no clever guess for this
[saveFilePanel setAllowedFileTypes:[NSArray arrayWithObject:[self currentEncapsulationFormatAsFileExtension:YES]]];
[saveFilePanel beginSheetForDirectory:nil file:nil modalForWindow:_window modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:nil]; [saveFilePanel beginSheetForDirectory:nil file:nil modalForWindow:_window modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:nil];
} }
...@@ -566,7 +568,7 @@ static VLCConvertAndSave *_o_sharedInstance = nil; ...@@ -566,7 +568,7 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
msg_Err(VLCIntf, "CAS: unknown encap format requested for customization"); msg_Err(VLCIntf, "CAS: unknown encap format requested for customization");
} }
- (NSString *)currentEncapsulationFormat - (NSString *)currentEncapsulationFormatAsFileExtension:(BOOL)b_extension
{ {
NSUInteger cellTag = [[_customize_encap_matrix selectedCell] tag]; NSUInteger cellTag = [[_customize_encap_matrix selectedCell] tag];
NSString * returnValue; NSString * returnValue;
...@@ -581,11 +583,21 @@ static VLCConvertAndSave *_o_sharedInstance = nil; ...@@ -581,11 +583,21 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
returnValue = @"ogg"; returnValue = @"ogg";
break; break;
case MP4: case MP4:
{
if (b_extension)
returnValue = @"m4v";
else
returnValue = @"mp4"; returnValue = @"mp4";
break; break;
}
case MPEGPS: case MPEGPS:
{
if (b_extension)
returnValue = @"mpg";
else
returnValue = @"ps"; returnValue = @"ps";
break; break;
}
case MJPEG: case MJPEG:
returnValue = @"mjpeg"; returnValue = @"mjpeg";
break; break;
...@@ -596,8 +608,13 @@ static VLCConvertAndSave *_o_sharedInstance = nil; ...@@ -596,8 +608,13 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
returnValue = @"flv"; returnValue = @"flv";
break; break;
case MPEG1: case MPEG1:
{
if (b_extension)
returnValue = @"mpg";
else
returnValue = @"mpeg1"; returnValue = @"mpeg1";
break; break;
}
case MKV: case MKV:
returnValue = @"mkv"; returnValue = @"mkv";
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment