[MPlayer-dev-eng] Four small patches addressing build problems

Peter Breitenlohner peb at mppmu.mpg.de
Tue Dec 6 13:35:04 CET 2005


Hi,

attached please find four small patches for various (build) problems I
encountered when building MPlayer-1.0pre7try2.

Yes I know, I should have gotten the most recent CVS version and patched
against that one. But since the patches (1) are rather short and (2) equally
apply to MPlayer-1.0pre7 and MPlayer-1.0pre7try2, that shouldn't cause any
problems.

Each patch starts with a short comment repeated here:

patch-01-manpage_typos:
 	Fix some manpage (formatting) typos

patch-02-enable_gtk2:
 	Since GTK+-1.2 is obsoleted by GTK+-2.x since almost
 	4 years, MPlayer should switch to use these newer versions
 	instead of forcing users (sysadmins) to keep the ancient ones.

 	This patch allows to (optionally) use GTK+-2.x instead of GTK+-1.2.

 	Please feel free to remove my comment from Gui/mplayer/gtk/about.c.

patch-03-uninitialized:
 	Avoid gcc warnings:
 		'...' might be used uninitialized in this function

 	I think, in this case 'H', 'N', 'D', and 'F' can indeed be
 	used unitialized, thus possibly causing all sorts of problems.

patch-04-redefined:
 	Avoid gcc warnings:
 		"..." redefined
 		this is the location of the previous definition

regards
Peter Breitenlohner <peb at mppmu.mpg.de>
-------------- next part --------------
	Fix some manpage (formatting) typos

diff -ur MPlayer-1.0pre7try2.orig/DOCS/man/en/mplayer.1 MPlayer-1.0pre7try2/DOCS/man/en/mplayer.1
--- MPlayer-1.0pre7try2.orig/DOCS/man/en/mplayer.1	2005-04-16 16:33:19.000000000 +0200
+++ MPlayer-1.0pre7try2/DOCS/man/en/mplayer.1	2005-04-18 17:42:05.000000000 +0200
@@ -3874,7 +3874,7 @@
 Observe that the number of channels will automatically
 be increased to <ch> if necessary.
 .RE
-.PD1
+.PD 1
 .
 .TP
 .B surround[=delay]
diff -ur MPlayer-1.0pre7try2.orig/DOCS/man/fr/mplayer.1 MPlayer-1.0pre7try2/DOCS/man/fr/mplayer.1
--- MPlayer-1.0pre7try2.orig/DOCS/man/fr/mplayer.1	2005-04-16 17:57:08.000000000 +0200
+++ MPlayer-1.0pre7try2/DOCS/man/fr/mplayer.1	2005-04-18 17:42:59.000000000 +0200
@@ -4095,7 +4095,7 @@
 Notez que le nombre de canaux sera automatiquement augment? ? <ca>
 si n?cessaire.
 .RE
-.PD1
+.PD 1
 .
 .TP
 .REss
diff -ur MPlayer-1.0pre7try2.orig/DOCS/man/pl/mplayer.1 MPlayer-1.0pre7try2/DOCS/man/pl/mplayer.1
--- MPlayer-1.0pre7try2.orig/DOCS/man/pl/mplayer.1	2005-04-16 17:17:57.000000000 +0200
+++ MPlayer-1.0pre7try2/DOCS/man/pl/mplayer.1	2005-04-18 17:42:58.000000000 +0200
@@ -3931,7 +3931,7 @@
 Zauwa?, ?e liczba kana??w b?dzie automatycznie zwi?kszonado <ch>, je?li
 zajdzie taka potrzeba.
 .RE
-.PD1
+.PD 1
 .
 .TP
 .B surround[=opo?nienie]
-------------- next part --------------
	Since GTK+-1.2 is obsoleted by GTK+-2.x since almost
	4 years, MPlayer should switch to use these newer versions
	instead of forcing users (sysadmins) to keep the ancient ones.

	This patch allows to (optionally) use GTK+-2.x instead of GTK+-1.2.

	Please feel free to remove my comment from Gui/mplayer/gtk/about.c.

diff -ur MPlayer-1.0pre7try2.orig/Gui/mplayer/gtk/about.c MPlayer-1.0pre7try2/Gui/mplayer/gtk/about.c
--- MPlayer-1.0pre7try2.orig/Gui/mplayer/gtk/about.c	2004-06-15 12:52:36.000000000 +0200
+++ MPlayer-1.0pre7try2/Gui/mplayer/gtk/about.c	2005-12-03 20:15:41.000000000 +0100
@@ -67,11 +67,25 @@
   gtk_box_pack_start( GTK_BOX( vbox ),scrolledwindow1,TRUE,TRUE,0 );
   gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
 
+#if GTK_CHECK_VERSION(2,0,0)
+  /*
+   *  GTK+-2.x.y declares GtkText deprecated, unsupported, and buggy.
+   *  Moreover GTK_ENABLE_BROKEN must be defined before including the
+   *  GTK+ header files in order to have, e.g., gtk_text_new() defined.
+   *  Instead of doing this, we use GtkTextBuffer and GtkTextView.
+   */
+  AboutText=gtk_text_view_new( );
+#else
   AboutText=gtk_text_new( NULL,NULL );
+#endif
   gtk_widget_set_name( AboutText,"AboutText" );
   gtk_widget_show( AboutText );
   gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),AboutText );
+#if GTK_CHECK_VERSION(2,0,0)
+  gtk_text_buffer_set_text( gtk_text_view_get_buffer( GTK_TEXT_VIEW( AboutText )),
+#else
   gtk_text_insert( GTK_TEXT( AboutText ),NULL,NULL,NULL,
+#endif
   	"\n" 
 	MSGTR_ABOUT_UHU 
 	"             (http://www.uhulinux.hu/)\n" 
diff -ur MPlayer-1.0pre7try2.orig/configure MPlayer-1.0pre7try2/configure
--- MPlayer-1.0pre7try2.orig/configure	2005-04-13 13:46:35.000000000 +0200
+++ MPlayer-1.0pre7try2/configure	2005-12-03 21:04:17.000000000 +0100
@@ -150,7 +150,8 @@
 
 Optional features:
   --disable-mencoder     disable mencoder (a/v encoder) compilation [enable]
-  --enable-gui           enable gmplayer compilation (GTK 1.2 GUI) [disable]
+  --enable-gui           enable gmplayer compilation (GTK 1.2/2.x GUI) [disable]
+  --enable-gtk2          enable use of GTK 2.x [autodetect]
   --enable-largefiles    enable support for files > 2 GBytes [disable]
   --enable-linux-devfs   set default devices to devfs ones [disable]
   --enable-termcap       use termcap database for key codes [autodetect]
@@ -1373,6 +1374,7 @@
 _lirc=auto
 _lircc=auto
 _gui=no
+_gtk2=auto
 _termcap=auto
 _termios=auto
 _3dfx=no
@@ -1614,6 +1616,8 @@
   --disable-lircc)	_lircc=no	;;
   --enable-gui)		_gui=yes	;;
   --disable-gui)	_gui=no		;;
+  --enable-gtk2)	_gtk2=yes	;;
+  --disable-gtk2)	_gtk2=no	;;
   --enable-termcap)	_termcap=yes	;;
   --disable-termcap)	_termcap=no	;;
   --enable-termios)	_termios=yes    ;;
@@ -6415,6 +6419,23 @@
 
   # Check for GTK:
   echocheck "GTK version"
+  if test "$_gtk2" != no ; then
+    if ( pkg-config gtk+-2.0 --exists ) >/dev/null 2>&1 ; then
+      _gtkconfig="pkg-config gtk+-2.0"
+      _gtk=`$_gtkconfig --modversion 2>&1`
+      _inc_gtk=`$_gtkconfig --cflags 2>&1`
+      _ld_gtk=`$_gtkconfig --libs 2>&1`
+      echores "$_gtk (using $_gtkconfig)"
+    else
+      if test "$_gtk2" = yes ; then
+        die "You requested to use GTK 2.0 (which was not found)."
+      fi
+      _gtk2=no
+    fi
+  fi
+
+  if test "$_gtk2" = no ; then
+
   if test -z "$_gtkconfig" ; then
     if ( gtk-config --version ) >/dev/null 2>&1 ; then
       _gtkconfig="gtk-config"
@@ -6445,6 +6466,8 @@
   _ld_glib=`$_glibconfig --libs 2>&1`
   echores "$_glib (using $_glibconfig)"
 
+  fi
+
   _def_gui='#define HAVE_NEW_GUI 1'
   _ld_gui='$(GTKLIB) $(GLIBLIB)'
 
-------------- next part --------------
	Avoid gcc warnings:
		'...' might be used uninitialized in this function

	I think, in this case 'H', 'N', 'D', and 'F' can indeed be
	used unitialized, thus possibly causing all sorts of problems.

diff -ur MPlayer-1.0pre7try2.orig/Gui/mplayer/gtk/menu.c MPlayer-1.0pre7try2/Gui/mplayer/gtk/menu.c
--- MPlayer-1.0pre7try2.orig/Gui/mplayer/gtk/menu.c	2005-01-25 13:44:38.000000000 +0100
+++ MPlayer-1.0pre7try2/Gui/mplayer/gtk/menu.c	2005-12-04 23:29:32.000000000 +0100
@@ -594,14 +594,13 @@
     N=AddMenuCheckItem( window1, (const char*)normal_xpm, Menu,MSGTR_MENU_NormalSize"      ",b1,evNormalSize );
     D=AddMenuCheckItem( window1, (const char*)double_xpm, Menu,MSGTR_MENU_DoubleSize,b2,evDoubleSize );
     F=AddMenuCheckItem( window1, (const char*)fs_xpm, Menu,MSGTR_MENU_FullScreen,appMPlayer.subWindow.isFullScreen,evFullScreen );
-   }
-
-  if ( !gtkShowVideoWindow && !guiIntfStruct.Playing )
-   {
-    gtk_widget_set_sensitive( H,FALSE );
-    gtk_widget_set_sensitive( N,FALSE );
-    gtk_widget_set_sensitive( D,FALSE );
-    gtk_widget_set_sensitive( F,FALSE );
+    if ( !gtkShowVideoWindow && !guiIntfStruct.Playing )
+     {
+      gtk_widget_set_sensitive( H,FALSE );
+      gtk_widget_set_sensitive( N,FALSE );
+      gtk_widget_set_sensitive( D,FALSE );
+      gtk_widget_set_sensitive( F,FALSE );
+     }
    }
 
   AddSeparator( Menu );
-------------- next part --------------
	Avoid gcc warnings:
		"..." redefined
		this is the location of the previous definition

diff -ur MPlayer-1.0pre7try2.orig/libmpdemux/muxer_mpeg.c MPlayer-1.0pre7try2/libmpdemux/muxer_mpeg.c
--- MPlayer-1.0pre7try2.orig/libmpdemux/muxer_mpeg.c	2005-04-10 12:06:59.000000000 +0200
+++ MPlayer-1.0pre7try2/libmpdemux/muxer_mpeg.c	2005-12-04 23:00:44.000000000 +0100
@@ -993,8 +993,12 @@
 }
 
 
+#ifndef max
 #define max(a, b) ((a) >= (b) ? (a) : (b))
+#endif
+#ifndef min
 #define min(a, b) ((a) <= (b) ? (a) : (b))
+#endif
 
 
 static uint32_t get_audio_frame_size(muxer_headers_t *spriv, uint8_t *buf, int format, int samples_ps)
diff -ur MPlayer-1.0pre7try2.orig/libvo/vo_jpeg.c MPlayer-1.0pre7try2/libvo/vo_jpeg.c
--- MPlayer-1.0pre7try2.orig/libvo/vo_jpeg.c	2005-02-28 01:26:53.000000000 +0100
+++ MPlayer-1.0pre7try2/libvo/vo_jpeg.c	2005-12-04 23:05:46.000000000 +0100
@@ -32,6 +32,7 @@
 
 /* Local Includes */
 
+#undef HAVE_STDDEF_H		/* already defined (differently) in jpeglib.h */
 #include "config.h"
 #include "subopt-helper.h"
 #include "mp_msg.h"


More information about the MPlayer-dev-eng mailing list