Commit 665d0ef4 authored by Felix Paul Kühne's avatar Felix Paul Kühne

* adapted the extended panel to the latest video filter changes and...

* adapted the extended panel to the latest video filter changes and re-designed the interface a bit (by introducing some additional strings and moving the invert-option to the adjust image section, etc.)
* src/video_output/video_output.c: small fix to insert filters on the fly
parent 2bfe0a06
......@@ -27,15 +27,18 @@
"o_btn_rstrDefaults" = id;
"o_btn_vidFlts_mrInfo" = id;
"o_ckb_blur" = id;
"o_ckb_distortion" = id;
"o_ckb_enblAdjustImg" = id;
"o_ckb_gradient" = id;
"o_ckb_hdphnVirt" = id;
"o_ckb_imgClone" = id;
"o_ckb_imgCrop" = id;
"o_ckb_imgInvers" = id;
"o_ckb_intZoom" = id;
"o_ckb_psycho" = id;
"o_ckb_ripple" = id;
"o_ckb_trnsform" = id;
"o_ckb_vlme_norm" = id;
"o_ckb_wave" = id;
"o_expBtn_adjustImage" = id;
"o_expBtn_audioFlts" = id;
"o_expBtn_videoFlts" = id;
......@@ -47,7 +50,9 @@
"o_lbl_audioFlts" = id;
"o_lbl_brightness" = id;
"o_lbl_contrast" = id;
"o_lbl_distort" = id;
"o_lbl_gamma" = id;
"o_lbl_general" = id;
"o_lbl_hue" = id;
"o_lbl_maxLevel" = id;
"o_lbl_opaque" = id;
......
......@@ -3,18 +3,18 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>219 20 356 292 0 0 1440 878 </string>
<string>253 122 356 292 0 0 1440 878 </string>
<key>IBEditorPositions</key>
<dict>
<key>13</key>
<string>525 535 390 138 0 0 1440 878 </string>
<key>32</key>
<string>525 487 390 233 0 0 1440 878 </string>
<string>525 476 390 255 0 0 1440 878 </string>
<key>5</key>
<string>467 464 392 178 0 0 1440 878 </string>
<string>525 489 390 230 0 0 1440 878 </string>
</dict>
<key>IBFramework Version</key>
<string>443.0</string>
<string>446.1</string>
<key>IBLockedObjects</key>
<array>
<integer>32</integer>
......@@ -23,8 +23,9 @@
<array>
<integer>18</integer>
<integer>5</integer>
<integer>32</integer>
</array>
<key>IBSystem Version</key>
<string>8I127</string>
<string>8J135</string>
</dict>
</plist>
......@@ -54,12 +54,17 @@
/* video filters */
IBOutlet id o_btn_vidFlts_mrInfo;
IBOutlet id o_ckb_blur;
IBOutlet id o_ckb_distortion;
IBOutlet id o_ckb_imgClone;
IBOutlet id o_ckb_imgCrop;
IBOutlet id o_ckb_imgInvers;
IBOutlet id o_ckb_trnsform;
IBOutlet id o_ckb_intZoom;
IBOutlet id o_ckb_wave;
IBOutlet id o_ckb_ripple;
IBOutlet id o_ckb_psycho;
IBOutlet id o_ckb_gradient;
IBOutlet id o_lbl_general;
IBOutlet id o_lbl_distort;
/* audio filters */
IBOutlet id o_ckb_vlme_norm;
......@@ -110,7 +115,8 @@
- (void)showPanel;
- (void)initStrings;
- (void)changeVFiltersString: (char *)psz_name onOrOff: (vlc_bool_t )b_add;
- (void)changeVoutFiltersString: (char *)psz_name onOrOff: (vlc_bool_t )b_add;
- (void)changeVideoFiltersString: (char *)psz_name onOrOff: (vlc_bool_t )b_add;
- (void)changeAFiltersString: (char *)psz_name onOrOff: (vlc_bool_t )b_add;
- (void)savePrefs;
@end
......@@ -83,16 +83,20 @@ static VLCExtended *_o_sharedInstance = nil;
[o_lbl_videoFlts setStringValue: _NS("Video filters")];
[o_lbl_adjustImage setStringValue: _NS("Image adjustment")];
[o_btn_vidFlts_mrInfo setTitle: _NS("More Info")];
[o_ckb_blur setTitle: _NS("Blurring")];
[o_ckb_wave setTitle: _NS("Wave")];
[o_ckb_ripple setTitle: _NS("Ripple")];
[o_ckb_psycho setTitle: _NS("Psychedelic")];
[o_ckb_gradient setTitle: _NS("Gradient")];
[o_lbl_general setStringValue: _NS("General editing filters")];
[o_lbl_distort setStringValue: _NS("Distortion filters")];
[o_ckb_blur setTitle: _NS("Blur")];
[o_ckb_blur setToolTip: _NS("Adds motion blurring to the image")];
[o_ckb_distortion setTitle: _NS("Distortion")];
[o_ckb_distortion setToolTip: _NS("Adds distortion effects")];
[o_ckb_imgClone setTitle: _NS("Image clone")];
[o_ckb_imgClone setToolTip: _NS("Creates several copies of the Video "
"output window" )];
[o_ckb_imgCrop setTitle: _NS("Image cropping")];
[o_ckb_imgCrop setToolTip: _NS("Crops a defined part of the image")];
[o_ckb_imgInvers setTitle: _NS("Image inversion")];
[o_ckb_imgInvers setTitle: _NS("Invert colors")];
[o_ckb_imgInvers setToolTip: _NS("Inverts the colors of the image")];
[o_ckb_trnsform setTitle: _NS("Transformation")];
[o_ckb_trnsform setToolTip: _NS("Rotates or flips the image")];
......@@ -148,15 +152,27 @@ static VLCExtended *_o_sharedInstance = nil;
if( psz_vfilters )
{
[o_ckb_blur setState: (int)strstr( psz_vfilters, "motionblur")];
[o_ckb_distortion setState: (int)strstr( psz_vfilters, "distort")];
[o_ckb_imgClone setState: (int)strstr( psz_vfilters, "clone")];
[o_ckb_imgCrop setState: (int)strstr( psz_vfilters, "crop")];
[o_ckb_imgInvers setState: (int)strstr( psz_vfilters, "invert")];
[o_ckb_trnsform setState: (int)strstr( psz_vfilters, "transform")];
free( psz_vfilters );
}
/* set the video-filter checkboxes to the correct values */
char * psz_vifilters;
psz_vifilters = config_GetPsz( p_intf, "video-filter" );
if( psz_vifilters )
{
[o_ckb_wave setState: (int)strstr( psz_vifilters, "wave")];
[o_ckb_psycho setState: (int)strstr( psz_vifilters, "psychedelic")];
[o_ckb_ripple setState: (int)strstr( psz_vifilters, "ripple")];
[o_ckb_gradient setState: (int)strstr( psz_vifilters, "gradient")];
[o_ckb_imgInvers setState: (int)strstr( psz_vifilters, "invert")];
free( psz_vifilters );
}
/* set the audio-filter-checkboxes to the values taken from the prefs */
char * psz_afilters;
psz_afilters = config_GetPsz( p_intf, "audio-filter" );
......@@ -255,7 +271,7 @@ static VLCExtended *_o_sharedInstance = nil;
[o_sld_gamma setEnabled: YES];
[o_sld_hue setEnabled: YES];
[o_sld_saturation setEnabled: YES];
[self changeVFiltersString: "adjust" onOrOff: VLC_TRUE];
[self changeVoutFiltersString: "adjust" onOrOff: VLC_TRUE];
}else{
[o_btn_rstrDefaults setEnabled: NO];
[o_sld_brightness setEnabled: NO];
......@@ -263,7 +279,7 @@ static VLCExtended *_o_sharedInstance = nil;
[o_sld_gamma setEnabled: NO];
[o_sld_hue setEnabled: NO];
[o_sld_saturation setEnabled: NO];
[self changeVFiltersString: "adjust" onOrOff: VLC_FALSE];
[self changeVoutFiltersString: "adjust" onOrOff: VLC_FALSE];
}
}
......@@ -437,20 +453,20 @@ static VLCExtended *_o_sharedInstance = nil;
{
/* move the window contents upwards (partially done through settings
* inside the nib) and resize the window */
o_win_rect.size.height = o_win_rect.size.height - 171;
o_win_rect.origin.y = [o_extended_window frame].origin.y + 171;
o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 171;
o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y + 171;
o_win_rect.size.height = o_win_rect.size.height - 193;
o_win_rect.origin.y = [o_extended_window frame].origin.y + 193;
o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 193;
o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y + 193;
/* remove the inserted view */
[o_adjustImg_view removeFromSuperviewWithoutNeedingDisplay];
}else{
/* move the window contents downwards and resize the window */
o_win_rect.size.height = o_win_rect.size.height + 171;
o_win_rect.origin.y = [o_extended_window frame].origin.y - 171;
o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 171;
o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y - 171;
o_win_rect.size.height = o_win_rect.size.height + 193;
o_win_rect.origin.y = [o_extended_window frame].origin.y - 193;
o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 193;
o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y - 193;
}
[o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
......@@ -460,12 +476,12 @@ static VLCExtended *_o_sharedInstance = nil;
if (o_adjImg_expanded)
{
o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height - 171;
o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height - 193;
o_adjImg_expanded = NO;
} else {
/* insert view */
o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height + 171;
[o_adjustImg_view setFrame: NSMakeRect( 20, -10, 370, 181)];
o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height + 193;
[o_adjustImg_view setFrame: NSMakeRect( 20, -10, 370, 203)];
[o_adjustImg_view setNeedsDisplay:YES];
[o_adjustImg_view setAutoresizesSubviews: YES];
[[o_box_adjImg contentView] addSubview: o_adjustImg_view];
......@@ -525,18 +541,18 @@ static VLCExtended *_o_sharedInstance = nil;
{
/* move the window contents upwards (partially done through settings
* inside the nib) and resize the window */
o_win_rect.size.height = o_win_rect.size.height - 116;
o_win_rect.origin.y = [o_extended_window frame].origin.y + 116;
o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 116;
o_win_rect.size.height = o_win_rect.size.height - 188;
o_win_rect.origin.y = [o_extended_window frame].origin.y + 188;
o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 188;
/* remove the inserted view */
[o_videoFilters_view removeFromSuperviewWithoutNeedingDisplay];
}else{
/* move the window contents downwards and resize the window */
o_win_rect.size.height = o_win_rect.size.height + 116;
o_win_rect.origin.y = [o_extended_window frame].origin.y - 116;
o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 116;
o_win_rect.size.height = o_win_rect.size.height + 188;
o_win_rect.origin.y = [o_extended_window frame].origin.y - 188;
o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 188;
}
[o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
......@@ -545,12 +561,12 @@ static VLCExtended *_o_sharedInstance = nil;
if (o_vidFlts_expanded)
{
o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height - 116;
o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height - 188;
o_vidFlts_expanded = NO;
} else {
/* insert view */
o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height + 116;
[o_videoFilters_view setFrame: NSMakeRect( 20, -10, 370, 116)];
o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height + 188;
[o_videoFilters_view setFrame: NSMakeRect( 20, -10, 370, 188)];
[o_videoFilters_view setNeedsDisplay:YES];
[o_videoFilters_view setAutoresizesSubviews: YES];
[[o_box_vidFlts contentView] addSubview: o_videoFilters_view];
......@@ -563,33 +579,36 @@ static VLCExtended *_o_sharedInstance = nil;
{
/* en-/disable video filters */
if (sender == o_ckb_blur)
{
[self changeVFiltersString: "motionblur" onOrOff: [o_ckb_blur state]];
}
else if (sender == o_ckb_distortion)
{
[self changeVFiltersString: "distort" onOrOff: [o_ckb_distortion state]];
}
[self changeVoutFiltersString: "motionblur" onOrOff: [o_ckb_blur state]];
else if (sender == o_ckb_imgClone)
{
[self changeVFiltersString: "clone" onOrOff: [o_ckb_imgClone state]];
}
[self changeVoutFiltersString: "clone" onOrOff: [o_ckb_imgClone state]];
else if (sender == o_ckb_imgCrop)
{
[self changeVFiltersString: "crop" onOrOff: [o_ckb_imgCrop state]];
}
[self changeVoutFiltersString: "crop" onOrOff: [o_ckb_imgCrop state]];
else if (sender == o_ckb_imgInvers)
{
[self changeVFiltersString: "invert" onOrOff: [o_ckb_imgInvers state]];
}
[self changeVideoFiltersString: "invert" onOrOff: [o_ckb_imgInvers state]];
else if (sender == o_ckb_trnsform)
{
[self changeVFiltersString: "transform" onOrOff: [o_ckb_trnsform state]];
}
[self changeVoutFiltersString: "transform" onOrOff: [o_ckb_trnsform state]];
else if (sender == o_ckb_intZoom )
{
[self changeVFiltersString: "magnify" onOrOff: [o_ckb_intZoom state]];
} else {
[self changeVoutFiltersString: "magnify" onOrOff: [o_ckb_intZoom state]];
else if (sender == o_ckb_wave )
[self changeVideoFiltersString: "wave" onOrOff: [o_ckb_wave state]];
else if (sender == o_ckb_gradient )
[self changeVideoFiltersString: "gradient" onOrOff: [o_ckb_gradient state]];
else if (sender == o_ckb_psycho )
[self changeVideoFiltersString: "psychedelic" onOrOff: [o_ckb_psycho state]];
else if (sender == o_ckb_ripple )
[self changeVideoFiltersString: "ripple" onOrOff: [o_ckb_ripple state]];
else {
/* this shouldn't happen */
msg_Warn (VLCIntf, "cannot find switched video-filter");
}
......@@ -612,10 +631,13 @@ static VLCExtended *_o_sharedInstance = nil;
* methods to communicate changes to VLC's core
*****************************************************************************/
- (void)changeVFiltersString:(char *)psz_name onOrOff:(vlc_bool_t )b_add
- (void)changeVoutFiltersString:(char *)psz_name onOrOff:(vlc_bool_t )b_add
{
/* copied from ../wxwidgets/extrapanel.cpp
* renamed to conform with Cocoa's rules */
/* this method only changes 1st generation video filters (the ones which
* can't be used for transcoding). Have a look at changeVideoFiltersString
* for the 2nd generation filters. */
vout_thread_t *p_vout;
intf_thread_t * p_intf = VLCIntf;
......@@ -679,6 +701,72 @@ static VLCExtended *_o_sharedInstance = nil;
}
- (void)changeVideoFiltersString:(char *)psz_name onOrOff:(vlc_bool_t )b_add
{
/* same as changeVoutFiltersString but addressing the "video-filter"
* variable which represents the video filter 2 modules */
vout_thread_t *p_vout;
intf_thread_t * p_intf = VLCIntf;
char *psz_parser, *psz_string;
psz_string = config_GetPsz( p_intf, "video-filter" );
if( !psz_string ) psz_string = strdup("");
psz_parser = strstr( psz_string, psz_name );
if( b_add )
{
if( !psz_parser )
{
psz_parser = psz_string;
asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s",
psz_string, psz_name );
free( psz_parser );
}
else
{
return;
}
}
else
{
if( psz_parser )
{
memmove( psz_parser, psz_parser + strlen(psz_name) +
(*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),
strlen(psz_parser + strlen(psz_name)) + 1 );
/* Remove trailing : : */
if( *(psz_string+strlen(psz_string ) -1 ) == ':' )
{
*(psz_string+strlen(psz_string ) -1 ) = '\0';
}
}
else
{
free( psz_string );
return;
}
}
/* Vout is not kept, so put that in the config */
config_PutPsz( p_intf, "video-filter", psz_string );
/* Try to set on the fly */
p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout )
{
var_SetString( p_vout, "video-filter", psz_string );
vlc_object_release( p_vout );
}
free( psz_string );
o_config_changed = YES;
}
- (void)changeAFiltersString: (char *)psz_name onOrOff: (vlc_bool_t )b_add;
{
/* copied from ../wxwidgets/extrapanel.cpp
......
......@@ -1584,11 +1584,8 @@ static int VideoFilter2Callback( vlc_object_t *p_this, char const *psz_cmd,
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
if( !strcmp( oldval.psz_string, newval.psz_string ) )
{
ParseVideoFilter2Chain( p_vout, newval.psz_string );
p_vout->b_vfilter_change = VLC_TRUE;
}
ParseVideoFilter2Chain( p_vout, newval.psz_string );
p_vout->b_vfilter_change = VLC_TRUE;
return VLC_SUCCESS;
}
......
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