Commit 8df3fe36 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fixed video filter enable/disable code

loosely merged with the qt4 code
parent a75b97ad
......@@ -21,7 +21,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1"/>
<integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -68,7 +68,7 @@
<object class="BGHUDTabViewItem" id="313931694">
<string key="NSIdentifier">basic</string>
<object class="NSView" key="NSView" id="1044285835">
<nil key="NSNextResponder"/>
<reference key="NSNextResponder" ref="898819366"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -255,28 +255,6 @@
<reference key="NSTextColor" ref="314723737"/>
</object>
</object>
<object class="NSSlider" id="248577800">
<reference key="NSNextResponder" ref="627843039"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{119, 14}, {171, 15}}</string>
<reference key="NSSuperview" ref="627843039"/>
<bool key="NSEnabled">YES</bool>
<object class="BGHUDSliderCell" key="NSCell" id="631341256">
<int key="NSCellFlags">-2079981824</int>
<int key="NSCellFlags2">131072</int>
<string key="NSContents"/>
<reference key="NSControlView" ref="248577800"/>
<double key="NSMaxValue">1</double>
<double key="NSMinValue">0.0</double>
<double key="NSValue">1</double>
<double key="NSAltIncValue">0.0</double>
<int key="NSNumberOfTickMarks">0</int>
<int key="NSTickMarkPosition">1</int>
<bool key="NSAllowsTickMarkValuesOnly">NO</bool>
<bool key="NSVertical">NO</bool>
<string key="themeKey">gradientTheme</string>
</object>
</object>
<object class="NSSlider" id="1033837370">
<reference key="NSNextResponder" ref="627843039"/>
<int key="NSvFlags">268</int>
......@@ -343,22 +321,6 @@
<string key="themeKey">gradientTheme</string>
</object>
</object>
<object class="NSTextField" id="502307597">
<reference key="NSNextResponder" ref="627843039"/>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{15, 14}, {99, 14}}</string>
<reference key="NSSuperview" ref="627843039"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="381045278">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">272629760</int>
<string key="NSContents">Opaqueness</string>
<reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="502307597"/>
<reference key="NSBackgroundColor" ref="279270326"/>
<reference key="NSTextColor" ref="314723737"/>
</object>
</object>
</object>
<string key="NSFrame">{{1, 1}, {308, 164}}</string>
<reference key="NSSuperview" ref="308548124"/>
......@@ -709,6 +671,7 @@
</object>
</object>
<string key="NSFrame">{{10, 33}, {638, 197}}</string>
<reference key="NSSuperview" ref="898819366"/>
</object>
<string key="NSLabel">Basic</string>
<reference key="NSColor" ref="279270326"/>
......@@ -717,7 +680,7 @@
<object class="BGHUDTabViewItem" id="52756061">
<string key="NSIdentifier">crop</string>
<object class="NSView" key="NSView" id="838226260">
<reference key="NSNextResponder" ref="898819366"/>
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -1220,7 +1183,6 @@
</object>
</object>
<string key="NSFrame">{{10, 33}, {638, 197}}</string>
<reference key="NSSuperview" ref="898819366"/>
</object>
<string key="NSLabel">Crop</string>
<reference key="NSColor" ref="279270326"/>
......@@ -3457,7 +3419,7 @@
<reference key="NSTabView" ref="898819366"/>
</object>
</object>
<reference key="NSSelectedTabViewItem" ref="52756061"/>
<reference key="NSSelectedTabViewItem" ref="313931694"/>
<object class="NSFont" key="NSFont">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">13</double>
......@@ -3469,7 +3431,7 @@
<nil key="themeKey"/>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="838226260"/>
<reference ref="1044285835"/>
</object>
</object>
</object>
......@@ -3656,22 +3618,6 @@
</object>
<int key="connectionID">497</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">o_adjust_opaque_lbl</string>
<reference key="source" ref="707254443"/>
<reference key="destination" ref="502307597"/>
</object>
<int key="connectionID">498</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">o_adjust_opaque_sld</string>
<reference key="source" ref="707254443"/>
<reference key="destination" ref="248577800"/>
</object>
<int key="connectionID">499</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">o_adjust_saturation_lbl</string>
......@@ -4232,14 +4178,6 @@
</object>
<int key="connectionID">581</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">adjustSliderChanged:</string>
<reference key="source" ref="707254443"/>
<reference key="destination" ref="248577800"/>
</object>
<int key="connectionID">582</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">bandingSliderChanged:</string>
......@@ -5011,7 +4949,6 @@
<reference ref="665985520"/>
<reference ref="714538558"/>
<reference ref="372967191"/>
<reference ref="248577800"/>
<reference ref="1033837370"/>
<reference ref="376722054"/>
<reference ref="760066178"/>
......@@ -5020,7 +4957,6 @@
<reference ref="685913676"/>
<reference ref="396951138"/>
<reference ref="279446133"/>
<reference ref="502307597"/>
</object>
<reference key="parent" ref="1044285835"/>
</object>
......@@ -5136,20 +5072,6 @@
<reference key="object" ref="353533066"/>
<reference key="parent" ref="279446133"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">26</int>
<reference key="object" ref="248577800"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="631341256"/>
</object>
<reference key="parent" ref="308548124"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">37</int>
<reference key="object" ref="631341256"/>
<reference key="parent" ref="248577800"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">31</int>
<reference key="object" ref="1033837370"/>
......@@ -5192,20 +5114,6 @@
<reference key="object" ref="920103185"/>
<reference key="parent" ref="760066178"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">20</int>
<reference key="object" ref="502307597"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="381045278"/>
</object>
<reference key="parent" ref="308548124"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">43</int>
<reference key="object" ref="381045278"/>
<reference key="parent" ref="502307597"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">49</int>
<reference key="object" ref="702049168"/>
......@@ -6883,10 +6791,6 @@
<string>199.IBPluginDependency</string>
<string>199.IBViewBoundsToFrameTransform</string>
<string>2.IBPluginDependency</string>
<string>20.CustomClassName</string>
<string>20.IBPluginDependency</string>
<string>20.IBViewBoundsToFrameTransform</string>
<string>20.ImportedFromIB2</string>
<string>200.IBPluginDependency</string>
<string>201.IBPluginDependency</string>
<string>201.IBViewBoundsToFrameTransform</string>
......@@ -6969,8 +6873,6 @@
<string>258.IBPluginDependency</string>
<string>258.IBViewBoundsToFrameTransform</string>
<string>259.IBPluginDependency</string>
<string>26.IBPluginDependency</string>
<string>26.IBViewBoundsToFrameTransform</string>
<string>260.IBPluginDependency</string>
<string>260.IBViewBoundsToFrameTransform</string>
<string>261.IBPluginDependency</string>
......@@ -7069,14 +6971,12 @@
<string>363.IBNumberFormatterBehaviorMetadataKey</string>
<string>363.IBNumberFormatterLocalizesFormatMetadataKey</string>
<string>363.IBPluginDependency</string>
<string>37.IBPluginDependency</string>
<string>38.IBPluginDependency</string>
<string>39.IBPluginDependency</string>
<string>4.IBPluginDependency</string>
<string>40.IBPluginDependency</string>
<string>41.IBPluginDependency</string>
<string>42.IBPluginDependency</string>
<string>43.IBPluginDependency</string>
<string>46.IBPluginDependency</string>
<string>46.IBViewBoundsToFrameTransform</string>
<string>47.IBPluginDependency</string>
......@@ -7346,12 +7246,6 @@
<bytes key="NSTransformStruct">P4AAAL+AAABDpgAAww8AAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>BGHUDLabel</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABBcAAAwdAAAA</bytes>
</object>
<boolean value="YES"/>
<string>com.binarymethod.BGHUDAppKitPlugin</string>
<string>com.binarymethod.BGHUDAppKitPlugin</string>
<object class="NSAffineTransform">
......@@ -7485,10 +7379,6 @@
</object>
<string>com.binarymethod.BGHUDAppKitPlugin</string>
<string>com.binarymethod.BGHUDAppKitPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABC7gAAwlQAAA</bytes>
</object>
<string>com.binarymethod.BGHUDAppKitPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABDz4AAwagAAA</bytes>
</object>
......@@ -7650,14 +7540,12 @@
<integer value="1040"/>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.binarymethod.BGHUDAppKitPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.binarymethod.BGHUDAppKitPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.binarymethod.BGHUDAppKitPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABC6AAAwrwAAA</bytes>
......
......@@ -43,8 +43,6 @@
IBOutlet id o_adjust_saturation_sld;
IBOutlet id o_adjust_gamma_lbl;
IBOutlet id o_adjust_gamma_sld;
IBOutlet id o_adjust_opaque_lbl;
IBOutlet id o_adjust_opaque_sld;
IBOutlet id o_sharpen_ckb;
IBOutlet id o_sharpen_lbl;
IBOutlet id o_sharpen_sld;
......
......@@ -24,6 +24,7 @@
#import "CompatibilityFixes.h"
#import "intf.h"
#import <vlc_common.h>
#import <vlc_modules.h>
#import "VideoEffects.h"
#pragma mark -
......@@ -77,7 +78,6 @@ static VLCVideoEffects *_o_sharedInstance = nil;
[o_adjust_brightness_ckb setTitle:_NS("Brightness Threshold")];
[o_adjust_saturation_lbl setStringValue:_NS("Saturation")];
[o_adjust_gamma_lbl setStringValue:_NS("Gamma")];
[o_adjust_opaque_lbl setStringValue:_NS("Opaqueness")];
[o_sharpen_ckb setTitle:_NS("Sharpen")];
[o_sharpen_lbl setStringValue:_NS("Sigma")];
[o_banding_ckb setTitle:_NS("Banding removal")];
......@@ -132,7 +132,7 @@ static VLCVideoEffects *_o_sharedInstance = nil;
[o_invert_ckb setTitle:_NS("Invert colors")];
[o_posterize_ckb setTitle:_NS("Posterize")];
[o_posterize_lbl setStringValue:_NS("Posterize level")];
[o_blur_ckb setTitle:_NS("Motion blue")];
[o_blur_ckb setTitle:_NS("Motion blur")];
[o_blur_lbl setStringValue:_NS("Factor")];
[o_motiondetect_ckb setTitle:_NS("Motion Detect")];
[o_watereffect_ckb setTitle:_NS("Water effect")];
......@@ -223,9 +223,6 @@ static VLCVideoEffects *_o_sharedInstance = nil;
[o_adjust_gamma_lbl setEnabled: [o_adjust_ckb state]];
[o_adjust_hue_lbl setEnabled: [o_adjust_ckb state]];
[o_adjust_saturation_lbl setEnabled: [o_adjust_ckb state]];
[o_adjust_opaque_sld setFloatValue: config_GetFloat( p_intf, "macosx-opaqueness" )];
[o_adjust_opaque_sld setEnabled: [o_adjust_ckb state]];
[o_adjust_opaque_lbl setEnabled: [o_adjust_ckb state]];
[o_sharpen_sld setFloatValue: config_GetFloat( p_intf, "sharpen-sigma" )];
[o_sharpen_sld setEnabled: [o_sharpen_ckb state]];
[o_sharpen_lbl setEnabled: [o_sharpen_ckb state]];
......@@ -335,36 +332,92 @@ static VLCVideoEffects *_o_sharedInstance = nil;
- (void)setVideoFilter: (char *)psz_name on:(BOOL)b_on
{
char *psz_tmp;
vout_thread_t * p_vout = getVout();
if( p_vout )
psz_tmp = var_GetNonEmptyString( p_vout, "video-filter" );
else
psz_tmp = config_GetPsz( p_intf, "video-filter" );
char *psz_string, *psz_parser;
const char *psz_filter_type;
if( b_on )
module_t *p_obj = module_find( psz_name );
if( !p_obj )
{
if(! psz_tmp)
config_PutPsz( p_intf, "video-filter", psz_name );
else if( (NSInteger)strstr( psz_tmp, psz_name ) == NO )
msg_Err( p_intf, "Unable to find filter module \"%s\".", psz_name );
return;
}
msg_Dbg( p_intf, "will set filter %s", psz_name );
if( module_provides( p_obj, "video splitter" ) )
{
psz_filter_type = "video-splitter";
}
else if( module_provides( p_obj, "video filter2" ) )
{
psz_filter_type = "video-filter";
}
else if( module_provides( p_obj, "sub source" ) )
{
psz_filter_type = "sub-source";
}
else if( module_provides( p_obj, "sub filter" ) )
{
psz_filter_type = "sub-filter";
}
else
{
psz_tmp = (char *)[[NSString stringWithFormat: @"%s:%s", psz_tmp, psz_name] UTF8String];
config_PutPsz( p_intf, "video-filter", psz_tmp );
msg_Err( p_intf, "Unknown video filter type." );
return;
}
psz_string = config_GetPsz( p_intf, psz_filter_type );
if (b_on) {
if(! psz_string)
psz_string = psz_name;
else if( (NSInteger)strstr( psz_string, psz_name ) == NO )
psz_string = (char *)[[NSString stringWithFormat: @"%s:%s", psz_string, psz_name] UTF8String];
} else {
if( psz_tmp )
psz_parser = strstr( psz_string, psz_name );
if( psz_parser )
{
psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithFormat:@":%s",psz_name]]] UTF8String];
psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithFormat:@"%s:",psz_name]]] UTF8String];
psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithUTF8String:psz_name]]] UTF8String];
config_PutPsz( p_intf, "video-filter", psz_tmp );
if( *( psz_parser + strlen( psz_name ) ) == ':' )
{
memmove( psz_parser, psz_parser + strlen( psz_name ) + 1,
strlen( psz_parser + strlen( psz_name ) + 1 ) + 1 );
}
else
{
*psz_parser = '\0';
}
if( p_vout ) {
var_SetString( p_vout, "video-filter", psz_tmp );
/* Remove trailing : : */
if( strlen( psz_string ) > 0 &&
*( psz_string + strlen( psz_string ) -1 ) == ':' )
{
*( psz_string + strlen( psz_string ) -1 ) = '\0';
}
}
else
{
free( psz_string );
return;
}
}
config_PutPsz( p_intf, psz_filter_type, psz_string );
msg_Dbg( p_intf, "set string '%s'", psz_string );
/* Try to set on the fly */
if( !strcmp( psz_filter_type, "video-splitter" ) )
{
playlist_t *p_playlist = pl_Get( p_intf );
var_SetString( p_playlist, psz_filter_type, psz_string );
}
else
{
vout_thread_t *p_vout = getVout();
if( p_vout )
{
NSLog( @"set on the fly" );
var_SetString( p_vout, psz_filter_type, psz_string );
vlc_object_release( p_vout );
}
}
}
- (void)setVideoFilterProperty: (char *)psz_name forFilter: (char *)psz_filter integer: (int)i_value
......@@ -382,8 +435,8 @@ static VLCVideoEffects *_o_sharedInstance = nil;
vlc_object_release( p_vout );
return;
}
var_SetFloat( p_filter, psz_name, i_value );
config_PutFloat( p_intf, psz_name, i_value );
var_SetInteger( p_filter, psz_name, i_value );
config_PutInt( p_intf, psz_name, i_value );
vlc_object_release( p_vout );
}
}
......@@ -468,45 +521,10 @@ static VLCVideoEffects *_o_sharedInstance = nil;
[o_adjust_hue_lbl setEnabled: state];
[o_adjust_saturation_sld setEnabled: state];
[o_adjust_saturation_lbl setEnabled: state];
[o_adjust_opaque_sld setEnabled: state];
[o_adjust_opaque_lbl setEnabled: state];
}
- (IBAction)adjustSliderChanged:(id)sender
{
if( sender == o_adjust_opaque_sld ){
vlc_value_t val;
id o_tmpWindow = [NSApp keyWindow];
NSArray *o_windows = [NSApp orderedWindows];
NSEnumerator *o_enumerator = [o_windows objectEnumerator];
playlist_t * p_playlist = pl_Get( p_intf );
vout_thread_t *p_vout = getVout();
vout_thread_t *p_real_vout;
val.f_float = [o_adjust_opaque_sld floatValue];
if( p_vout != NULL )
{
//FIXME: update this implementation once the vout is fixed
#if 0
p_real_vout = [VLCVoutView realVout: p_vout];
var_Set( p_real_vout, "macosx-opaqueness", val );
while ((o_tmpWindow = [o_enumerator nextObject]))
{
if( [[o_tmpWindow className] isEqualToString: @"VLCVoutWindow"] ||
[[[VLCMain sharedInstance] embeddedList] windowContainsEmbedded: o_tmpWindow])
{
[o_tmpWindow setAlphaValue: val.f_float];
}
break;
}
#endif
vlc_object_release( p_vout );
}
config_PutFloat( p_playlist , "macosx-opaqueness" , val.f_float );
} else {
if( sender == o_adjust_brightness_sld )
[self setVideoFilterProperty: "brightness" forFilter: "adjust" float: [o_adjust_brightness_sld floatValue]];
else if( sender == o_adjust_contrast_sld )
......@@ -517,7 +535,6 @@ static VLCVideoEffects *_o_sharedInstance = nil;
[self setVideoFilterProperty: "hue" forFilter: "adjust" integer: [o_adjust_hue_sld intValue]];
else if( sender == o_adjust_saturation_sld )
[self setVideoFilterProperty: "saturation" forFilter: "adjust" float: [o_adjust_saturation_sld floatValue]];
}
}
- (IBAction)enableAdjustBrightnessThreshold:(id)sender
......
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