Mercurial > mplayer.hg
changeset 6755:a31b9f15cbff
- fix audio equalizer
- rewrite video equalizer handling (i teszted with mga g400 [x]mga,xv,xvidix and radeon xv,xvidix )
- fix some small gtk bug
- i dunno, i don't remember ... :)
author | pontscho |
---|---|
date | Fri, 19 Jul 2002 20:51:48 +0000 |
parents | c925dd9372f1 |
children | 6af6d7b40638 |
files | DOCS/German/mplayer.1 DOCS/Polish/mplayer.1 DOCS/mplayer.1 Gui/interface.c Gui/interface.h Gui/mplayer/gtk/about.c Gui/mplayer/gtk/eq.c Gui/mplayer/gtk/fs.c Gui/mplayer/gtk/mb.c Gui/mplayer/gtk/pl.c Gui/mplayer/gtk/sb.c Gui/mplayer/gtk/url.c Gui/mplayer/mw.h Gui/mplayer/widgets.c Gui/mplayer/widgets.h Gui/skin/font.h libvo/mga_common.c libvo/video_out.c libvo/video_out.h libvo/vo_xmga.c libvo/vo_xv.c libvo/vo_xvidix.c libvo/vosub_vidix.c mplayer.c vidix/drivers/mga_vid.c |
diffstat | 25 files changed, 251 insertions(+), 219 deletions(-) [+] |
line wrap: on
line diff
--- a/DOCS/German/mplayer.1 Fri Jul 19 07:51:01 2002 +0000 +++ b/DOCS/German/mplayer.1 Fri Jul 19 20:51:48 2002 +0000 @@ -626,11 +626,11 @@ Benutzt eine andere Farbtiefe als die automatisch ermittelte. Nicht alle -vo Treiber unterstützen dies (fbdev, dga2, svga, vesa). .TP -.B \-brightness <\-1000\ \-\ 1000> +.B \-brightness <\-100\ \-\ 100> Verändert die Helligkeit der Videoausgabe (Standard 0). Es verändert die Intensität der RGB Anteile des Videosignals von einer schwarzen bis zu einer weissen Ausgabe. .TP -.B \-contrast <\-1000\ \-\ 1000> +.B \-contrast <\-100\ \-\ 100> Verändert den Kontrast der Videoausgabe (Standard 0). Funktioniert ähnlich wie \-brightness. .TP .B \-display <Name> @@ -675,7 +675,7 @@ .B \-green_intensity <\-1000\ \-\ 1000> Verändert die Intensität der grünen Anteile des Videosignals (Standard 0). .TP -.B \-hue <\-1000\ \-\ 1000> +.B \-hue <\-100\ \-\ 100> Verändert den Farbton des Videosignals (Standard 0). Man kann damit ein Farbnegativ des Bildes erzeugen. .TP .B \-icelayer <0-15> (nur icewm) @@ -725,7 +725,7 @@ .B \-red_intensity <\-1000\ \-\ 1000> Verändert die Intensität der roten Anteile des Videosignals (Standard 0). .TP -.B \-saturation <\-1000\ \-\ 1000> +.B \-saturation <\-100\ \-\ 100> Verändert die Sättigung der Videoausgabe (Standard 0). Man kann damit Graustufen-Ausgaben erzeugen. .TP .B \-rootwin
--- a/DOCS/Polish/mplayer.1 Fri Jul 19 07:51:01 2002 +0000 +++ b/DOCS/Polish/mplayer.1 Fri Jul 19 20:51:48 2002 +0000 @@ -596,11 +596,11 @@ Używaj innych kolorów głębi niż autodetekcja. Nie wszystkie sterowniki wspierają \-vo jak (fbdev, dga2, svga, vesa). .TP -.B \-brightness <\-1000\ \-\ 1000> +.B \-brightness <\-100\ \-\ 100> Modyfikuj jasność wyjścia wideo (domyślne 0). Zmienia to intensywność RGB składników sygnału wideo od czerni do białości ekranu. .TP -.B \-contrast <\-1000\ \-\ 1000> +.B \-contrast <\-100\ \-\ 100> Modyfikuj kontrast wyjścia wideo (domyślnie 0). Działa w podobny sposób jak jasność. .TP .B \-display <nazwa> @@ -643,7 +643,7 @@ .B \-green_intensity <\-1000\ \-\ 1000> Modyfikuj intensywność zielonych składników sygnału wideo (domyślnie 0). .TP -.B \-hue <\-1000\ \-\ 1000> +.B \-hue <\-100\ \-\ 100> Modyfikuj barwę sygnału wideo (domyślnie 0). Możesz otrzymać dzięki tej opcji kolorowy negatyw obrazu. .TP @@ -679,7 +679,7 @@ .B \-red_intensity <\-1000\ \-\ 1000> Modyfikuj intensywność czerwonych składników sygnału wideo (domyślnie 0). .TP -.B \-saturation <\-1000\ \-\ 1000> +.B \-saturation <\-100\ \-\ 100> Modyfikuj nasycenie wyjścia wideo (domyślnie 0). Dzięki tej opcji możesz uzyskać obraz w skali szarości. .TP
--- a/DOCS/mplayer.1 Fri Jul 19 07:51:01 2002 +0000 +++ b/DOCS/mplayer.1 Fri Jul 19 20:51:48 2002 +0000 @@ -713,11 +713,11 @@ Use different color depth than autodetect. Not all \-vo drivers support it (fbdev, dga2, svga, vesa). .TP -.B \-brightness <\-1000\ \-\ 1000> +.B \-brightness <\-100\ \-\ 100> Adjust brightness of video output (default 0). It changes intensity of RGB components of video signal from black to white screen. .TP -.B \-contrast <\-1000\ \-\ 1000> +.B \-contrast <\-100\ \-\ 100> Adjust contrast of video output (default 0). Works in similar manner as brightness. .TP .B \-display <name> @@ -782,7 +782,7 @@ .B \-green_intensity <\-1000\ \-\ 1000> Adjust intensity of green component of video signal (default 0). .TP -.B \-hue <\-1000\ \-\ 1000> +.B \-hue <\-100\ \-\ 100> Adjust hue of video signal (default 0). You can get colored negative of image with this option. .TP @@ -835,7 +835,7 @@ .B \-red_intensity <\-1000\ \-\ 1000> Adjust intensity of red component of video signal (default 0). .TP -.B \-saturation <\-1000\ \-\ 1000> +.B \-saturation <\-100\ \-\ 100> Adjust saturation of video output (default 0). You can get grayscale output with this option. .TP
--- a/Gui/interface.c Fri Jul 19 07:51:01 2002 +0000 +++ b/Gui/interface.c Fri Jul 19 20:51:48 2002 +0000 @@ -90,6 +90,7 @@ } tmp_sh_video_t; extern ao_functions_t * audio_out; +extern vo_functions_t * video_out; void guiGetEvent( int type,char * arg ) { @@ -214,16 +215,6 @@ btnModify( evSetBalance,guiIntfStruct.Balance ); } -#if 0 -#warning video equalizer support disabled - if ( gtkEnableVideoEqualizer ) - { - gtkSet( gtkSetContrast,gtkContrast,NULL ); - gtkSet( gtkSetBrightness,gtkBrightness,NULL ); - gtkSet( gtkSetHue,gtkHue,NULL ); - gtkSet( gtkSetSaturation,gtkSaturation,NULL ); - } -#endif if ( gtkEnableAudioEqualizer ) { equalizer_t eq; @@ -266,7 +257,7 @@ if ( gtkEnableAudioEqualizer ) { - if ( ao_plugin_cfg.plugin_list ) { if ( !strstr( ao_plugin_cfg.plugin_list,"eq" ) ) gstrcat( &ao_plugin_cfg.plugin_list,"," ); } + if ( ao_plugin_cfg.plugin_list ) { if ( !strstr( ao_plugin_cfg.plugin_list,"eq" ) ) gstrcat( &ao_plugin_cfg.plugin_list,",eq" ); } else gstrcat( &ao_plugin_cfg.plugin_list,"eq" ); } @@ -282,16 +273,10 @@ if ( !guiIntfStruct.Playing || guiIntfStruct.AudioOnly ) wsHandleEvents(); gtkEventHandling(); mplTimer=GetTimerMS() / 20; -// if ( !( GetTimerMS()%2 ) ) } // --- -float gtkContrast = 0.0f; -float gtkBrightness = 0.0f; -float gtkHue = 0.0f; -float gtkSaturation = 0.0f; - float gtkEquChannels[6][10]; plItem * plCurrent = NULL; @@ -323,7 +308,7 @@ switch ( cmd ) { // --- handle playlist - case gtkAddPlItem: // add item to platlist + case gtkAddPlItem: // add item to playlist if ( plList ) { plItem * next = plList; @@ -384,19 +369,15 @@ // --- set equalizers case gtkSetContrast: mp_cmd->id=MP_CMD_CONTRAST; mp_cmd->name=strdup( "contrast" ); - gtkContrast=fparam; break; case gtkSetBrightness: mp_cmd->id=MP_CMD_BRIGHTNESS; mp_cmd->name=strdup( "brightness" ); - gtkBrightness=fparam; break; case gtkSetHue: mp_cmd->id=MP_CMD_HUE; mp_cmd->name=strdup( "hue" ); - gtkHue=fparam; break; case gtkSetSaturation: mp_cmd->id=MP_CMD_SATURATION; mp_cmd->name=strdup( "saturation" ); - gtkSaturation=fparam; break; case gtkSetEqualizer: if ( eq )
--- a/Gui/interface.h Fri Jul 19 07:51:01 2002 +0000 +++ b/Gui/interface.h Fri Jul 19 20:51:48 2002 +0000 @@ -153,11 +153,6 @@ #define gtkGetCurrPlItem 8 #define gtkDelPl 9 -extern float gtkContrast; -extern float gtkBrightness; -extern float gtkHue; -extern float gtkSaturation; - extern float gtkEquChannels[6][10]; extern void * gtkSet( int cmd,float param, void * vparam );
--- a/Gui/mplayer/gtk/about.c Fri Jul 19 07:51:01 2002 +0000 +++ b/Gui/mplayer/gtk/about.c Fri Jul 19 20:51:48 2002 +0000 @@ -15,6 +15,7 @@ if ( gtkVAboutBox ) gtkActive( AboutBox ); else AboutBox=create_About(); gtk_widget_show( AboutBox ); + gtkVisible++; } void ab_AboutBox_show( GtkButton * button,gpointer user_data ) @@ -24,6 +25,7 @@ { gtkVAboutBox=(int)user_data; gtk_widget_destroy( AboutBox ); + gtkVisible--; } GtkWidget * create_About( void )
--- a/Gui/mplayer/gtk/eq.c Fri Jul 19 07:51:01 2002 +0000 +++ b/Gui/mplayer/gtk/eq.c Fri Jul 19 20:51:48 2002 +0000 @@ -15,6 +15,7 @@ #include "../../../help_mp.h" #include "../../../mplayer.h" #include "../../../libao2/eq.h" +#include "../../../libvo/video_out.h" #include "../widgets.h" #include "../mplayer.h" @@ -64,10 +65,11 @@ gtk_adjustment_set_value( A4000adj,0.0f - gtkEquChannels[channel][7] ); gtk_adjustment_set_value( A8000adj,0.0f - gtkEquChannels[channel][8] ); gtk_adjustment_set_value( A16000adj,0.0f - gtkEquChannels[channel][9] ); - gtk_adjustment_set_value( VContrastadj,gtkContrast ); - gtk_adjustment_set_value( VBrightnessadj,gtkBrightness ); - gtk_adjustment_set_value( VHueadj,gtkHue ); - gtk_adjustment_set_value( VSaturationadj,gtkSaturation ); + + gtk_adjustment_set_value( VContrastadj,(float)vo_gamma_contrast ); + gtk_adjustment_set_value( VBrightnessadj,(float)vo_gamma_brightness ); + gtk_adjustment_set_value( VHueadj,(float)vo_gamma_hue ); + gtk_adjustment_set_value( VSaturationadj,(float)vo_gamma_saturation ); } static void eqSetChannelNames( void ) @@ -92,7 +94,7 @@ str[0]=gtkEquChannel5; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); str[0]=gtkEquChannel6; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); } - gtk_clist_select_row( GTK_CLIST( ChannelsList ),1,0 ); + gtk_clist_select_row( GTK_CLIST( ChannelsList ),0,0 ); } void ShowEqualizer( void ) @@ -109,10 +111,10 @@ eqSetChannelNames(); - VContrastadj->value=gtkContrast; - VBrightnessadj->value=gtkBrightness; - VHueadj->value=gtkHue; - VSaturationadj->value=gtkSaturation; + VContrastadj->value=(float)vo_gamma_contrast; + VBrightnessadj->value=(float)vo_gamma_brightness; + VHueadj->value=(float)vo_gamma_hue; + VSaturationadj->value=(float)vo_gamma_saturation; if ( !guiIntfStruct.Playing && gtkEnableVideoEqualizer ) { @@ -138,13 +140,15 @@ gtk_widget_set_sensitive( A16000,FALSE ); } - gtk_widget_show( Config ); + if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( Notebook ) ) == 0 ) gtk_widget_show( Config ); gtk_widget_show( Equalizer ); + gtkVisible++; } void HideEqualizer( void ) { - gtkVEqualizer=0; + if ( !gtkVEqualizer ) return; + gtkVEqualizer=0; gtkVisible--; gtk_widget_hide( Equalizer ); gtk_widget_destroy( Equalizer ); if ( gtkVEquConfig ) HideEquConfig(); @@ -186,7 +190,7 @@ { case 1: gtkSet( gtkSetContrast,VContrastadj->value,NULL ); break; case 2: gtkSet( gtkSetBrightness,VBrightnessadj->value,NULL ); break; - case 3: gtkSet( gtkSetHue,VHueadj->value,NULL ); break; + case 3: gtkSet( gtkSetHue,VHueadj->value,NULL ); break; case 4: gtkSet( gtkSetSaturation,VSaturationadj->value,NULL ); break; } @@ -207,11 +211,13 @@ } else { - if ( !guiIntfStruct.Playing && !gtkEnableVideoEqualizer ) break; + if ( !guiIntfStruct.Playing || !gtkEnableVideoEqualizer ) break; gtkSet( gtkSetContrast,0.0f,NULL ); gtkSet( gtkSetBrightness,0.0f,NULL ); gtkSet( gtkSetHue,0.0f,NULL ); gtkSet( gtkSetSaturation,0.0f,NULL ); + vo_gamma_brightness=vo_gamma_contrast=vo_gamma_hue=vo_gamma_saturation=0; + eqSetBands( Channel ); } break; case 2: @@ -375,7 +381,7 @@ gtk_table_set_row_spacings( GTK_TABLE( table1 ),4 ); gtk_table_set_col_spacings( GTK_TABLE( table1 ),9 ); - A3125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-15,15,0.5,0,0 ) ); + A3125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) ); A3125=gtk_vscale_new( A3125adj ); gtk_widget_set_name( A3125,"A3125" ); gtk_widget_ref( A3125 ); @@ -384,7 +390,7 @@ gtk_table_attach( GTK_TABLE( table1 ),A3125,0,1,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 ); gtk_scale_set_draw_value( GTK_SCALE( A3125 ),FALSE ); - A6250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-15,15,0.5,0,0 ) ); + A6250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) ); A6250=gtk_vscale_new( A6250adj ); gtk_widget_set_name( A6250,"A6250" ); gtk_widget_ref( A6250 ); @@ -393,7 +399,7 @@ gtk_table_attach( GTK_TABLE( table1 ),A6250,1,2,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 ); gtk_scale_set_draw_value( GTK_SCALE( A6250 ),FALSE ); - A125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-15,15,0.5,0,0 ) ); + A125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) ); A125=gtk_vscale_new( A125adj ); gtk_widget_set_name( A125,"A125" ); gtk_widget_ref( A125 ); @@ -402,7 +408,7 @@ gtk_table_attach( GTK_TABLE( table1 ),A125,2,3,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 ); gtk_scale_set_draw_value( GTK_SCALE( A125 ),FALSE ); - A250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-15,15,0.5,0,0 ) ); + A250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) ); A250=gtk_vscale_new( A250adj ); gtk_widget_set_name( A250,"A250" ); gtk_widget_ref( A250 ); @@ -411,7 +417,7 @@ gtk_table_attach( GTK_TABLE( table1 ),A250,3,4,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 ); gtk_scale_set_draw_value( GTK_SCALE( A250 ),FALSE ); - A500adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-15,15,0.5,0,0 ) ); + A500adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) ); A500=gtk_vscale_new( A500adj ); gtk_widget_set_name( A500,"A500" ); gtk_widget_ref( A500 ); @@ -420,7 +426,7 @@ gtk_table_attach( GTK_TABLE( table1 ),A500,4,5,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 ); gtk_scale_set_draw_value( GTK_SCALE( A500 ),FALSE ); - A1000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-15,15,0.5,0,0 ) ); + A1000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) ); A1000=gtk_vscale_new( A1000adj ); gtk_widget_set_name( A1000,"A1000" ); gtk_widget_ref( A1000 ); @@ -429,7 +435,7 @@ gtk_table_attach( GTK_TABLE( table1 ),A1000,5,6,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 ); gtk_scale_set_draw_value( GTK_SCALE( A1000 ),FALSE ); - A2000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-15,15,0.5,0,0 ) ); + A2000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) ); A2000=gtk_vscale_new( A2000adj ); gtk_widget_set_name( A2000,"A2000" ); gtk_widget_ref( A2000 ); @@ -438,7 +444,7 @@ gtk_table_attach( GTK_TABLE( table1 ),A2000,6,7,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 ); gtk_scale_set_draw_value( GTK_SCALE( A2000 ),FALSE ); - A4000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-15,15,0.5,0,0 ) ); + A4000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) ); A4000=gtk_vscale_new( A4000adj ); gtk_widget_set_name( A4000,"A4000" ); gtk_widget_ref( A4000 ); @@ -447,7 +453,7 @@ gtk_table_attach( GTK_TABLE( table1 ),A4000,7,8,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 ); gtk_scale_set_draw_value( GTK_SCALE( A4000 ),FALSE ); - A8000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-15,15,0.5,0,0 ) ); + A8000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) ); A8000=gtk_vscale_new( A8000adj ); gtk_widget_set_name( A8000,"A8000" ); gtk_widget_ref( A8000 ); @@ -456,7 +462,7 @@ gtk_table_attach( GTK_TABLE( table1 ),A8000,8,9,0,1,( GtkAttachOptions )( GTK_FILL ),( GtkAttachOptions )( GTK_EXPAND | GTK_FILL ),0,0 ); gtk_scale_set_draw_value( GTK_SCALE( A8000 ),FALSE ); - A16000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-15,15,0.5,0,0 ) ); + A16000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-3,3,0.5,0,0 ) ); A16000=gtk_vscale_new( A16000adj ); gtk_widget_set_name( A16000,"A16000" ); gtk_widget_ref( A16000 ); @@ -618,7 +624,7 @@ gtk_widget_show( vbox3 ); gtk_box_pack_start( GTK_BOX( hbox2 ),vbox3,TRUE,TRUE,0 ); - VContrastadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,1,0,0 ) ); + VContrastadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); VContrast=gtk_hscale_new( VContrastadj ); gtk_widget_set_name( VContrast,"VContrast" ); gtk_widget_ref( VContrast ); @@ -627,7 +633,7 @@ gtk_box_pack_start( GTK_BOX( vbox3 ),VContrast,TRUE,TRUE,0 ); gtk_scale_set_value_pos( GTK_SCALE( VContrast ),GTK_POS_RIGHT ); - VBrightnessadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,1,0,0 ) ); + VBrightnessadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); VBrightness=gtk_hscale_new( VBrightnessadj ); gtk_widget_set_name( VBrightness,"VBrightness" ); gtk_widget_ref( VBrightness ); @@ -636,7 +642,7 @@ gtk_box_pack_start( GTK_BOX( vbox3 ),VBrightness,TRUE,TRUE,0 ); gtk_scale_set_value_pos( GTK_SCALE( VBrightness ),GTK_POS_RIGHT ); - VHueadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,1,0,0 ) ); + VHueadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); VHue=gtk_hscale_new( VHueadj ); gtk_widget_set_name( VHue,"VHue" ); gtk_widget_ref( VHue ); @@ -645,7 +651,7 @@ gtk_box_pack_start( GTK_BOX( vbox3 ),VHue,TRUE,TRUE,0 ); gtk_scale_set_value_pos( GTK_SCALE( VHue ),GTK_POS_RIGHT ); - VSaturationadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,1,0,0 ) ); + VSaturationadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); VSaturation=gtk_hscale_new( VSaturationadj ); gtk_widget_set_name( VSaturation,"VSaturation" ); gtk_widget_ref( VSaturation ); @@ -784,6 +790,7 @@ gtk_entry_set_text( GTK_ENTRY( CEChannel6 ),gtkEquChannel6 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel6 ),FALSE ); gtk_widget_show( EquConfig ); + gtkSetLayer( EquConfig ); } void HideEquConfig( void )
--- a/Gui/mplayer/gtk/fs.c Fri Jul 19 07:51:01 2002 +0000 +++ b/Gui/mplayer/gtk/fs.c Fri Jul 19 20:51:48 2002 +0000 @@ -252,14 +252,15 @@ gtk_window_set_modal( GTK_WINDOW( fsFileSelect ),modal ); - gtk_widget_show( fsFileSelect ); + gtk_widget_show( fsFileSelect ); gtkVisible++; } void HideFileSelect( void ) { + if ( !gtkVFileSelect ) return; gtk_widget_hide( fsFileSelect ); gtk_widget_destroy( fsFileSelect ); - gtkVFileSelect=0; + gtkVFileSelect=0; gtkVisible--; } void fs_fsFileSelect_destroy( GtkObject * object,gpointer user_data )
--- a/Gui/mplayer/gtk/mb.c Fri Jul 19 07:51:01 2002 +0000 +++ b/Gui/mplayer/gtk/mb.c Fri Jul 19 20:51:48 2002 +0000 @@ -19,10 +19,11 @@ if ( gtkVMessageBox ) gtkActive( MessageBox ); else MessageBox=create_MessageBox( 0 ); if ( strlen( msg ) < 20 ) gtk_widget_set_usize( MessageBox,196,-1 ); + gtkVisible++; } static void on_Ok_released( GtkButton * button,gpointer user_data ) -{ gtkVMessageBox=0; gtk_widget_destroy( MessageBox ); } +{ gtkVMessageBox=0; gtk_widget_hide( MessageBox ); gtk_widget_destroy( MessageBox ); gtkVisible--; } static void on_MessageBox_show( GtkButton * button,gpointer user_data ) { gtkVMessageBox=(int)user_data; }
--- a/Gui/mplayer/gtk/pl.c Fri Jul 19 07:51:01 2002 +0000 +++ b/Gui/mplayer/gtk/pl.c Fri Jul 19 20:51:48 2002 +0000 @@ -169,17 +169,18 @@ } gtk_clist_thaw( GTK_CLIST( CLSelected ) ); - gtk_widget_show( PlayList ); + gtk_widget_show( PlayList ); gtkVisible++; } void HidePlayList( void ) { + if ( !gtkVPlaylist ) return; gtkVPlaylist=NrOfSelected=NrOfEntrys=0; if ( CLListSelected ) free( CLListSelected ); CLListSelected=NULL; if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=NULL; if ( old_path ) free( old_path ); old_path=strdup( current_path ); gtk_widget_hide( PlayList ); - gtk_widget_destroy( PlayList ); + gtk_widget_destroy( PlayList ); gtkVisible--; } static void plDestroy( GtkObject * object,gpointer user_data )
--- a/Gui/mplayer/gtk/sb.c Fri Jul 19 07:51:01 2002 +0000 +++ b/Gui/mplayer/gtk/sb.c Fri Jul 19 20:51:48 2002 +0000 @@ -29,11 +29,13 @@ { if ( gtkVSkinBrowser ) gtkActive( SkinBrowser ); else SkinBrowser=create_SkinBrowser(); + gtkVisible++; } void HideSkinBrowser( void ) { - gtkVSkinBrowser=0; + if ( !gtkVSkinBrowser ) return; + gtkVSkinBrowser=0; gtkVisible--; gtk_widget_destroy( SkinBrowser ); }
--- a/Gui/mplayer/gtk/url.c Fri Jul 19 07:51:01 2002 +0000 +++ b/Gui/mplayer/gtk/url.c Fri Jul 19 20:51:48 2002 +0000 @@ -34,14 +34,15 @@ } gtk_widget_show( URL ); - gtkVURLDialogBox=1; + gtkVURLDialogBox=1; gtkVisible++; } void HideURLDialogBox( void ) { + if ( !gtkVURLDialogBox ) return; gtk_widget_hide( URL ); gtk_widget_destroy( URL ); - gtkVURLDialogBox=0; + gtkVURLDialogBox=0; gtkVisible--; } static gboolean on_URL_destroy_event( GtkWidget * widget,GdkEvent * event,gpointer user_data )
--- a/Gui/mplayer/mw.h Fri Jul 19 07:51:01 2002 +0000 +++ b/Gui/mplayer/mw.h Fri Jul 19 20:51:48 2002 +0000 @@ -192,7 +192,11 @@ image=fntRender( item->fontid,0,item->width,"%s",item->label ); goto drawrenderedtext; case itDLabel: - image=fntRender( item->fontid,mplTimer%item->width,item->width,"%s",Translate( item->label ) ); + { + char * t = Translate( item->label ); + int l = fntTextWidth( item->fontid,t ); + image=fntRender( item->fontid,mplTimer%(l?l:item->width),item->width,"%s",t ); + } drawrenderedtext: if ( image ) { @@ -499,6 +503,7 @@ switch ( Button ) { case wsPMMouseButton: + gtkShow( evHidePopUpMenu,NULL ); mplShowMenu( RX,RY ); itemtype=itPRMButton; break; @@ -507,6 +512,7 @@ break; case wsPLMouseButton: + gtkShow( evHidePopUpMenu,NULL ); sx=X; sy=Y; boxMoved=1; itemtype=itPLMButton; // if move the main window SelectedItem=currentselected; if ( SelectedItem == -1 ) break; // yeees, i'm move the fucking window
--- a/Gui/mplayer/widgets.c Fri Jul 19 07:51:01 2002 +0000 +++ b/Gui/mplayer/widgets.c Fri Jul 19 20:51:48 2002 +0000 @@ -39,6 +39,7 @@ int gtkPopupMenu = 0; int gtkPopupMenuParam = 0; int gtkInited = 0; +int gtkVisible = 0; #include "gtk/sb.h" #include "gtk/pl.h" @@ -117,7 +118,8 @@ void gtkEventHandling( void ) { int i; - for( i=0;i < 25;i++ ) gtk_main_iteration_do( 0 ); + if ( gtkVisible > 0 ) + for( i=0;i < 25;i++ ) gtk_main_iteration_do( 0 ); } // --- funcs @@ -180,7 +182,7 @@ } else { - gtk_widget_destroy( SkinBrowser ); + gtk_widget_destroy( SkinBrowser ); gtkVisible--; gtkMessageBox( GTK_MB_ERROR,"Skin dirs not found ... Please install skins." ); } break; @@ -218,15 +220,17 @@ case evShowPopUpMenu: gtkPopupMenu=evNone; gtkPopupMenuParam=0; - if ( PopUpMenu ) gtk_widget_hide_on_delete( PopUpMenu ); + if ( PopUpMenu ) { gtk_widget_hide_on_delete( PopUpMenu ); gtkVisible--; } PopUpMenu=create_PopUpMenu(); gtk_menu_popup( GTK_MENU( PopUpMenu ),NULL,NULL,NULL,NULL,0,0 ); + gtkVisible++; break; case evHidePopUpMenu: - if ( PopUpMenu ) gtk_widget_hide_on_delete( PopUpMenu ); + if ( PopUpMenu ) { gtk_widget_hide_on_delete( PopUpMenu ); gtkVisible--; PopUpMenu=NULL; } break; case evPlayNetwork: ShowURLDialogBox(); + gtkSetLayer( URL ); break; } }
--- a/Gui/mplayer/widgets.h Fri Jul 19 07:51:01 2002 +0000 +++ b/Gui/mplayer/widgets.h Fri Jul 19 20:51:48 2002 +0000 @@ -41,6 +41,8 @@ extern Pixmap guiIcon; extern Pixmap guiIconMask; +extern int gtkVisible; + extern void widgetsCreate( void ); extern void gtkInit( void );
--- a/Gui/skin/font.h Fri Jul 19 07:51:01 2002 +0000 +++ b/Gui/skin/font.h Fri Jul 19 20:51:48 2002 +0000 @@ -23,6 +23,8 @@ extern int fntAddNewFont( char * name ); extern void fntFreeFont( void ); extern int fntFindID( char * name ); +extern int fntTextHeight( int id,char * str ); +extern int fntTextWidth( int id,char * str ); extern int fntRead( char * path,char * fname ); extern txSample * fntRender( int id,int px,int sx,char * fmt,... );
--- a/libvo/mga_common.c Fri Jul 19 07:51:01 2002 +0000 +++ b/libvo/mga_common.c Fri Jul 19 20:51:48 2002 +0000 @@ -37,9 +37,21 @@ uint32_t luma; float factor = 256.0 / 2000; + static int prev_br = 0; + static int prev_c = 0; - luma = ((int)(info->brightness * factor) << 16) + - ((int)(info->contrast * factor) & 0xFFFF); + if ( info->cap & VEQ_CAP_BRIGHTNESS ) + { + prev_br=info->brightness; + if ( prev_br == 1000 ) prev_br=999; // i dunno why needed this line -- Pontscho + } + if ( info->cap & VEQ_CAP_CONTRAST ) + { + prev_c=info->contrast; + if ( prev_c == 1000 ) prev_c=999; // i dunno why needed this line -- Pontscho + } + + luma = ((int)(prev_br * factor) << 16) + ((int)(prev_c * factor) & 0xFFFF); if (ioctl(f,MGA_VID_SET_LUMA,luma)) { perror("Error in mga_vid_config ioctl()"); printf("Could not set luma values in the kernel module!\n");
--- a/libvo/video_out.c Fri Jul 19 07:51:01 2002 +0000 +++ b/libvo/video_out.c Fri Jul 19 20:51:48 2002 +0000 @@ -66,10 +66,10 @@ /**************************************** * GAMMA CORRECTION * ****************************************/ -int vo_gamma_brightness=0; -int vo_gamma_saturation=0; -int vo_gamma_contrast=0; -int vo_gamma_hue=0; +int vo_gamma_brightness=-101; +int vo_gamma_saturation=-101; +int vo_gamma_contrast=-101; +int vo_gamma_hue=-101; int vo_gamma_red_intensity=0; int vo_gamma_green_intensity=0; int vo_gamma_blue_intensity=0;
--- a/libvo/video_out.h Fri Jul 19 07:51:01 2002 +0000 +++ b/libvo/video_out.h Fri Jul 19 20:51:48 2002 +0000 @@ -220,6 +220,14 @@ extern int vo_fsmode; extern float vo_panscan; +extern int vo_gamma_brightness; +extern int vo_gamma_saturation; +extern int vo_gamma_contrast; +extern int vo_gamma_hue; +extern int vo_gamma_red_intensity; +extern int vo_gamma_green_intensity; +extern int vo_gamma_blue_intensity; + extern int vo_mouse_timer_const; extern int vo_pts;
--- a/libvo/vo_xmga.c Fri Jul 19 07:51:01 2002 +0000 +++ b/libvo/vo_xmga.c Fri Jul 19 20:51:48 2002 +0000 @@ -328,6 +328,11 @@ set_window(); + saver_off(mDisplay); + + XFlush( mDisplay ); + XSync( mDisplay,False ); + mga_vid_config.src_width=width; mga_vid_config.src_height=height; @@ -335,15 +340,10 @@ mga_vid_config.colkey_red=255; mga_vid_config.colkey_green=0; mga_vid_config.colkey_blue=255; + + mga_vid_config.version=MGA_VID_VERSION; - if(mga_init()) return -1; - - XFlush( mDisplay ); - XSync( mDisplay,False ); - - saver_off(mDisplay); - - return 0; + return mga_init(); } static const vo_info_t* get_info( void )
--- a/libvo/vo_xv.c Fri Jul 19 07:51:01 2002 +0000 +++ b/libvo/vo_xv.c Fri Jul 19 20:51:48 2002 +0000 @@ -138,8 +138,7 @@ { for (i = 0; i < howmany && attributes; i++) { - if (attributes[i].flags & XvSettable && !strcmp(attributes[i].name,"XV_SET_DEFAULTS" -)) + if (attributes[i].flags & XvSettable && !strcmp(attributes[i].name,"XV_SET_DEFAULTS")) { was_reset = 1; mp_msg(MSGT_VO,MSGL_V,"vo_xv: reset gamma correction\n"); @@ -290,14 +289,6 @@ return 0; } -extern int vo_gamma_brightness; -extern int vo_gamma_saturation; -extern int vo_gamma_contrast; -extern int vo_gamma_hue; -extern int vo_gamma_red_intensity; -extern int vo_gamma_green_intensity; -extern int vo_gamma_blue_intensity; - static void set_gamma_correction( void ) { vidix_video_eq_t info;
--- a/libvo/vo_xvidix.c Fri Jul 19 07:51:01 2002 +0000 +++ b/libvo/vo_xvidix.c Fri Jul 19 20:51:48 2002 +0000 @@ -73,6 +73,8 @@ static uint32_t drwX, drwY, drwWidth, drwHeight, drwBorderWidth, drwDepth, drwcX, drwcY, dwidth, dheight; +extern void set_video_eq( int cap ); + static void set_window(int force_update,const vo_tune_info_t *info) { Window mRoot; @@ -172,6 +174,13 @@ mp_msg(MSGT_VO, MSGL_V, "[xvidix] window properties: pos: %dx%d, size: %dx%d\n", vo_dx, vo_dy, window_width, window_height); + + { // á.c.s. technologies (C) Pontscho + vidix_video_eq_t eq; + vo_vaa_t vo_vaa; + if ( vidix_control( VOCTRL_QUERY_VAA,&vo_vaa) != VO_NOTIMPL ) + if ( vo_vaa.get_video_eq && vo_vaa.get_video_eq( &eq ) == 0 ) set_video_eq( eq.cap ); + } /* mDrawColorKey: */ @@ -332,6 +341,7 @@ } set_window(1,info); + if(info) memcpy(&vtune,info,sizeof(vo_tune_info_t)); else memset(&vtune,0,sizeof(vo_tune_info_t)); XFlush(mDisplay);
--- a/libvo/vosub_vidix.c Fri Jul 19 07:51:01 2002 +0000 +++ b/libvo/vosub_vidix.c Fri Jul 19 20:51:48 2002 +0000 @@ -71,14 +71,6 @@ vaa->set_deint=vidix_set_deint; } -extern int vo_gamma_brightness; -extern int vo_gamma_saturation; -extern int vo_gamma_contrast; -extern int vo_gamma_hue; -extern int vo_gamma_red_intensity; -extern int vo_gamma_green_intensity; -extern int vo_gamma_blue_intensity; - static vidix_video_eq_t vid_eq; int vidix_start(void)
--- a/mplayer.c Fri Jul 19 07:51:01 2002 +0000 +++ b/mplayer.c Fri Jul 19 20:51:48 2002 +0000 @@ -151,7 +151,7 @@ int use_stdin=0; //**************************************************************************// -static vo_functions_t *video_out=NULL; +vo_functions_t *video_out=NULL; ao_functions_t *audio_out=NULL; // benchmark: @@ -269,6 +269,38 @@ char* current_module=NULL; // for debugging +int v_hw_equ_cap=0; +/* +For future: +int v_red_intensity=0; +int v_green_intensity=0; +int v_blue_intensity=0; +*/ + +void set_video_eq( int cap ) +{ + mp_cmd_t * mp_cmd; + + v_hw_equ_cap=cap; + + mp_cmd = (mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) ); + mp_cmd->id=MP_CMD_CONTRAST; mp_cmd->name=strdup( "contrast" ); + mp_cmd->args[0].v.i=vo_gamma_contrast; mp_cmd->args[1].v.i=1; mp_input_queue_cmd( mp_cmd ); + + mp_cmd = (mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) ); + mp_cmd->id=MP_CMD_BRIGHTNESS; mp_cmd->name=strdup( "brightness" ); + mp_cmd->args[0].v.i=vo_gamma_brightness; mp_cmd->args[1].v.i=1; mp_input_queue_cmd( mp_cmd ); + + mp_cmd = (mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) ); + mp_cmd->id=MP_CMD_HUE; mp_cmd->name=strdup( "hue" ); + mp_cmd->args[0].v.i=vo_gamma_hue; mp_cmd->args[1].v.i=1; mp_input_queue_cmd( mp_cmd ); + + mp_cmd = (mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) ); + mp_cmd->id=MP_CMD_SATURATION; mp_cmd->name=strdup( "saturation" ); + mp_cmd->args[0].v.i=vo_gamma_saturation; mp_cmd->args[1].v.i=1; mp_input_queue_cmd( mp_cmd ); +} +// --- + #ifdef HAVE_RTC int nortc; #endif @@ -490,6 +522,7 @@ static sh_audio_t *sh_audio=NULL; static sh_video_t *sh_video=NULL; + // for multifile support: play_tree_iter_t* playtree_iter = NULL; @@ -507,18 +540,6 @@ int osd_show_av_delay = 0; int osd_show_sub_delay = 0; -int v_hw_equ_cap=0; -int v_bright=50; -int v_cont=50; -int v_hue=50; -int v_saturation=50; -/* -For future: -int v_red_intensity=0; -int v_green_intensity=0; -int v_blue_intensity=0; -*/ - int rtc_fd=-1; //float a_frame=0; // Audio @@ -1343,13 +1364,13 @@ if(vo_vaa.get_video_eq) { vidix_video_eq_t veq; - if(vo_vaa.get_video_eq(&veq) == 0) + if( vo_vaa.get_video_eq(&veq) == 0) { v_hw_equ_cap = veq.cap; - if(veq.cap & VEQ_CAP_BRIGHTNESS) v_bright = veq.brightness/10; - if(veq.cap & VEQ_CAP_CONTRAST) v_cont = veq.contrast/10; - if(veq.cap & VEQ_CAP_HUE) v_hue = veq.hue/10; - if(veq.cap & VEQ_CAP_SATURATION) v_saturation=veq.saturation/10; + if ( ( vo_gamma_brightness == -101 )&&( veq.cap & VEQ_CAP_BRIGHTNESS ) ) vo_gamma_brightness = veq.brightness / 10; + if ( ( vo_gamma_contrast == -101 )&&( veq.cap & VEQ_CAP_CONTRAST ) ) vo_gamma_contrast = veq.contrast / 10; + if ( ( vo_gamma_hue == -101 )&&( veq.cap & VEQ_CAP_HUE ) ) vo_gamma_hue = veq.hue / 10; + if ( ( vo_gamma_saturation == -101 )&&( veq.cap & VEQ_CAP_SATURATION ) ) vo_gamma_saturation=veq.saturation / 10; /* v_red_intensity=veq.red_intensity/10; v_green_intensity=veq.green_intensity/10; @@ -1358,6 +1379,13 @@ } } + if ( vo_gamma_brightness == -101 ) vo_gamma_brightness=0.0f; + if ( vo_gamma_contrast == -101 ) vo_gamma_contrast=0.0f; + if ( vo_gamma_hue == -101 ) vo_gamma_hue=0.0f; + if ( vo_gamma_saturation == -101 ) vo_gamma_saturation=0.0f; + + set_video_eq( v_hw_equ_cap ); + if(vo_flags & 0x08 && vo_spudec) spudec_set_hw_spu(vo_spudec,video_out); @@ -2162,25 +2190,25 @@ case '1': case '2': if(c=='2'){ - if ( ++v_cont > 100 ) v_cont = 100; + if ( ++vo_gamma_contrast > 100 ) vo_gamma_contrast = 100; } else { - --v_cont; + --vo_gamma_contrast; if(v_hw_equ_cap & VEQ_CAP_CONTRAST) { - if(v_cont < -100) v_cont = -100; + if(vo_gamma_contrast < -100) vo_gamma_contrast = -100; } else { - if ( v_cont < 0 ) v_cont = 0; + if ( vo_gamma_contrast < 0 ) vo_gamma_contrast = 0; } } - if(set_video_colors(sh_video,"Contrast",v_cont)){ + if(set_video_colors(sh_video,"Contrast",vo_gamma_contrast)){ #ifdef USE_OSD if(osd_level){ osd_visible=sh_video->fps; // 1 sec vo_osd_progbar_type=OSD_CONTRAST; - vo_osd_progbar_value=((v_cont)<<8)/100; - if(v_hw_equ_cap) vo_osd_progbar_value = ((v_cont+100)<<8)/200; + vo_osd_progbar_value=((vo_gamma_contrast)<<8)/100; + if(v_hw_equ_cap) vo_osd_progbar_value = ((vo_gamma_contrast+100)<<8)/200; vo_osd_changed(OSDTYPE_PROGBAR); } #endif @@ -2191,25 +2219,25 @@ case '3': case '4': if(c=='4'){ - if ( ++v_bright > 100 ) v_bright = 100; + if ( ++vo_gamma_brightness > 100 ) vo_gamma_brightness = 100; } else { - --v_bright; + --vo_gamma_brightness; if(v_hw_equ_cap & VEQ_CAP_BRIGHTNESS) { - if(v_bright < -100) v_bright = -100; + if(vo_gamma_brightness < -100) vo_gamma_brightness = -100; } else { - if ( v_bright < 0 ) v_bright = 0; + if ( vo_gamma_brightness < 0 ) vo_gamma_brightness = 0; } } - if(set_video_colors(sh_video,"Brightness",v_bright)){ + if(set_video_colors(sh_video,"Brightness",vo_gamma_brightness)){ #ifdef USE_OSD if(osd_level){ osd_visible=sh_video->fps; // 1 sec vo_osd_progbar_type=OSD_BRIGHTNESS; - vo_osd_progbar_value=((v_bright)<<8)/100; - if(v_hw_equ_cap) vo_osd_progbar_value = ((v_bright+100)<<8)/200; + vo_osd_progbar_value=((vo_gamma_brightness)<<8)/100; + if(v_hw_equ_cap) vo_osd_progbar_value = ((vo_gamma_brightness+100)<<8)/200; vo_osd_changed(OSDTYPE_PROGBAR); } #endif @@ -2220,25 +2248,25 @@ case '5': case '6': if(c=='6'){ - if ( ++v_hue > 100 ) v_hue = 100; + if ( ++vo_gamma_hue > 100 ) vo_gamma_hue = 100; } else { - --v_hue; + --vo_gamma_hue; if(v_hw_equ_cap & VEQ_CAP_HUE) { - if(v_hue < -100) v_hue = -100; + if(vo_gamma_hue < -100) vo_gamma_hue = -100; } else { - if ( v_hue < 0 ) v_hue = 0; + if ( vo_gamma_hue < 0 ) vo_gamma_hue = 0; } } - if(set_video_colors(sh_video,"Hue",v_hue)){ + if(set_video_colors(sh_video,"Hue",vo_gamma_hue)){ #ifdef USE_OSD if(osd_level){ osd_visible=sh_video->fps; // 1 sec vo_osd_progbar_type=OSD_HUE; - vo_osd_progbar_value=((v_hue)<<8)/100; - if(v_hw_equ_cap) vo_osd_progbar_value = ((v_hue+100)<<8)/200; + vo_osd_progbar_value=((vo_gamma_hue)<<8)/100; + if(v_hw_equ_cap) vo_osd_progbar_value = ((vo_gamma_hue+100)<<8)/200; vo_osd_changed(OSDTYPE_PROGBAR); } #endif @@ -2249,25 +2277,25 @@ case '7': case '8': if(c=='8'){ - if ( ++v_saturation > 100 ) v_saturation = 100; + if ( ++vo_gamma_saturation > 100 ) vo_gamma_saturation = 100; } else { - --v_saturation; + --vo_gamma_saturation; if(v_hw_equ_cap & VEQ_CAP_SATURATION) { - if(v_saturation < -100) v_saturation = -100; + if(vo_gamma_saturation < -100) vo_gamma_saturation = -100; } else { - if ( v_saturation < 0 ) v_saturation = 0; + if ( vo_gamma_saturation < 0 ) vo_gamma_saturation = 0; } } - if(set_video_colors(sh_video,"Saturation",v_saturation)){ + if(set_video_colors(sh_video,"Saturation",vo_gamma_saturation)){ #ifdef USE_OSD if(osd_level){ osd_visible=sh_video->fps; // 1 sec vo_osd_progbar_type=OSD_SATURATION; - vo_osd_progbar_value=((v_saturation)<<8)/100; - if(v_hw_equ_cap) vo_osd_progbar_value = ((v_saturation+100)<<8)/200; + vo_osd_progbar_value=((vo_gamma_saturation)<<8)/100; + if(v_hw_equ_cap) vo_osd_progbar_value = ((vo_gamma_saturation+100)<<8)/200; vo_osd_changed(OSDTYPE_PROGBAR); } #endif @@ -2413,25 +2441,21 @@ } break; case MP_CMD_CONTRAST : { int v = cmd->args[0].v.i, abs = cmd->args[1].v.i; + int e; if(abs) - v_cont = v > 100 ? 100 : v; + vo_gamma_contrast = v > 100 ? 100 : v; else { - if ( (v_cont += v) > 100 ) v_cont = 100; + if ( (vo_gamma_contrast += v) > 100 ) vo_gamma_contrast = 100; } - if(v_hw_equ_cap & VEQ_CAP_CONTRAST) { - if(v_cont < -100) v_cont = -100; - } else { - if(v_cont < 0) v_cont = 0; - } - if(set_video_colors(sh_video,"Contrast",v_cont)){ + if(vo_gamma_contrast < -100) vo_gamma_contrast = -100; + if(v_hw_equ_cap & VEQ_CAP_CONTRAST) e=vo_gamma_contrast; + else e=( vo_gamma_contrast + 100 ) / 2; + if(set_video_colors(sh_video,"Contrast",e)){ #ifdef USE_OSD if(osd_level){ osd_visible=sh_video->fps; // 1 sec vo_osd_progbar_type=OSD_CONTRAST; - if(v_hw_equ_cap & VEQ_CAP_CONTRAST) - vo_osd_progbar_value=((v_cont)<<7)/100 + 128; - else - vo_osd_progbar_value=((v_cont)<<8)/100; + vo_osd_progbar_value=(vo_gamma_contrast<<7)/100 + 128; vo_osd_changed(OSDTYPE_PROGBAR); } #endif @@ -2439,51 +2463,43 @@ } break; case MP_CMD_BRIGHTNESS : { int v = cmd->args[0].v.i, abs = cmd->args[1].v.i; + int e; if(abs) - v_bright = v > 100 ? 100 : v; + vo_gamma_brightness = v > 100 ? 100 : v; else { - if ( (v_bright += v) > 100 ) v_bright = 100; + if ( (vo_gamma_brightness += v) > 100 ) vo_gamma_brightness = 100; } - if(v_hw_equ_cap & VEQ_CAP_BRIGHTNESS) { - if(v_bright < -100) v_bright = -100; - } else { - if ( v_bright < 0 ) v_bright = 0; - } - if(set_video_colors(sh_video,"Brightness",v_bright)){ + if ( vo_gamma_brightness < -100 ) vo_gamma_brightness = -100; + if ( v_hw_equ_cap & VEQ_CAP_BRIGHTNESS ) e=vo_gamma_brightness; + else e=( vo_gamma_brightness + 100 ) / 2; + if(set_video_colors(sh_video,"Brightness",e)){ #ifdef USE_OSD - if(osd_level){ - osd_visible=sh_video->fps; // 1 sec - vo_osd_progbar_type=OSD_BRIGHTNESS; - if(v_hw_equ_cap & VEQ_CAP_BRIGHTNESS) - vo_osd_progbar_value=((v_bright)<<7)/100 + 128; - else - vo_osd_progbar_value=((v_bright)<<8)/100; - vo_osd_changed(OSDTYPE_PROGBAR); - } -#endif - } + if(osd_level){ + osd_visible=sh_video->fps; // 1 sec + vo_osd_progbar_type=OSD_BRIGHTNESS; + vo_osd_progbar_value=(vo_gamma_brightness<<7)/100 + 128; + vo_osd_changed(OSDTYPE_PROGBAR); + } +#endif // USE_OSD + } } break; case MP_CMD_HUE : { int v = cmd->args[0].v.i, abs = cmd->args[1].v.i; + int e; if(abs) - v_hue = v > 100 ? 100 : v; + vo_gamma_hue = v > 100 ? 100 : v; else { - if ( (v_hue += v) > 100 ) v_hue = 100; + if ( (vo_gamma_hue += v) > 100 ) vo_gamma_hue = 100; } - if(v_hw_equ_cap & VEQ_CAP_HUE) { - if(v_hue < -100) v_hue = -100; - } else { - if ( v_hue < 0 ) v_hue = 0; - } - if(set_video_colors(sh_video,"Hue",v_hue)){ + if ( vo_gamma_hue < -100 ) vo_gamma_hue = -100; + if(v_hw_equ_cap & VEQ_CAP_HUE) e=vo_gamma_hue; + else e=( vo_gamma_hue + 100 ) / 2; + if(set_video_colors(sh_video,"Hue",e)){ #ifdef USE_OSD if(osd_level){ osd_visible=sh_video->fps; // 1 sec vo_osd_progbar_type=OSD_HUE; - if(v_hw_equ_cap & VEQ_CAP_HUE) - vo_osd_progbar_value=((v_hue)<<7)/100 + 128; - else - vo_osd_progbar_value=((v_hue)<<8)/100; + vo_osd_progbar_value=(vo_gamma_hue<<7)/100 + 128; vo_osd_changed(OSDTYPE_PROGBAR); } #endif @@ -2491,25 +2507,21 @@ } break; case MP_CMD_SATURATION : { int v = cmd->args[0].v.i, abs = cmd->args[1].v.i; + int e; if(abs) - v_saturation = v > 100 ? 100 : v; + vo_gamma_saturation = v > 100 ? 100 : v; else { - if ( (v_saturation += v) > 100 ) v_saturation = 100; + if ( (vo_gamma_saturation += v) > 100 ) vo_gamma_saturation = 100; } - if(v_hw_equ_cap & VEQ_CAP_SATURATION) { - if(v_saturation < -100) v_saturation = -100; - } else { - if ( v_saturation < 0 ) v_saturation = 0; - } - if(set_video_colors(sh_video,"Saturation",v_saturation)){ + if ( vo_gamma_saturation < -100 ) vo_gamma_saturation = -100; + if(v_hw_equ_cap & VEQ_CAP_SATURATION) e=vo_gamma_saturation; + else e=( vo_gamma_saturation + 100 ) / 2; + if(set_video_colors(sh_video,"Saturation",e)){ #ifdef USE_OSD if(osd_level){ osd_visible=sh_video->fps; // 1 sec vo_osd_progbar_type=OSD_SATURATION; - if(v_hw_equ_cap & VEQ_CAP_SATURATION) - vo_osd_progbar_value=((v_saturation)<<7)/100 + 128; - else - vo_osd_progbar_value=((v_saturation)<<8)/100; + vo_osd_progbar_value=(vo_gamma_saturation<<7)/100 + 128; vo_osd_changed(OSDTYPE_PROGBAR); } #endif
--- a/vidix/drivers/mga_vid.c Fri Jul 19 07:51:01 2002 +0000 +++ b/vidix/drivers/mga_vid.c Fri Jul 19 20:51:48 2002 +0000 @@ -1437,6 +1437,8 @@ { uint32_t luma = 0; float factor = 256.0 / 2000; + static int32_t prev_br = 0; + static int32_t prev_c = 0; /* contrast and brightness control isn't supported on G200 - alex */ if (!is_g400) @@ -1444,11 +1446,11 @@ if (mga_verbose) printf("[mga] equalizer isn't supported with G200\n"); return(ENOTSUP); } - - if (eq->cap & VEQ_CAP_BRIGHTNESS) - luma += ((int)(eq->brightness * factor) << 16); - if (eq->cap & VEQ_CAP_CONTRAST) - luma += ((int)(eq->contrast * factor) & 0xFFFF); + + if (eq->cap & VEQ_CAP_BRIGHTNESS) { prev_br=eq->brightness; if ( prev_br == 1000 ) prev_br=999; } + if (eq->cap & VEQ_CAP_CONTRAST) { prev_c=eq->contrast; if ( prev_c == 1000 ) prev_c=999; } + + luma = ((int)(prev_br * factor) << 16) + ((int)(prev_c * factor) & 0xFFFF); regs.beslumactl = luma+0x80; @@ -1471,8 +1473,8 @@ regs.beslumactl = readl(mga_mmio_base + BESLUMACTL); luma = regs.beslumactl-0x80; - eq->brightness = (luma >> 16) * factor; - eq->contrast = (luma & 0xFFFF) * factor; + eq->brightness = (signed short int)(luma >> 16) * factor; + eq->contrast = (signed short int)(luma & 0xFFFF) * factor; eq->cap = VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST; return(0);