[MPlayer-dev-eng] [PATCH] multiple patches from NetBSD pkgsrc

Sergey Svishchev svs+mplayer at grep.ru
Tue Oct 10 22:34:48 CEST 2006


Good day,

I'm forwarding patches from NetBSD pkgsrc; their descriptions are taken directly from
cvs commit logs.

-- 
Sergey Svishchev
-------------- next part --------------
date: 2006/06/15 21:58:55;  author: dogcow;  state: Exp;  lines: +142 -23
hack around lvalue casting nonsense; mplayer now compiles with gcc4.

Index: stream/tvi_bsdbt848.c
===================================================================
--- stream/tvi_bsdbt848.c	(revision 20147)
+++ stream/tvi_bsdbt848.c	(working copy)
@@ -176,6 +176,7 @@
 
 static int control(priv_t *priv, int cmd, void *arg)
 {
+    int *bogus = (int *) arg;
     switch(cmd)
     {
 
@@ -193,13 +194,13 @@
             return(TVI_CONTROL_FALSE);
             }
 
-        (int)*(void **)arg = priv->tunerfreq;
+        *bogus = priv->tunerfreq;
         return(TVI_CONTROL_TRUE);
         }
     
     case TVI_CONTROL_TUN_SET_FREQ:
         {
-        priv->tunerfreq = (int)*(void **)arg;
+        priv->tunerfreq = *bogus;
 
         if(ioctl(priv->tunerfd, TVTUNER_SETFREQ, &priv->tunerfreq) < 0) 
             {
@@ -223,13 +224,13 @@
             return(TVI_CONTROL_FALSE);
             }
 
-        (int)*(void **)arg = priv->input;
+        *bogus = priv->input;
         return(TVI_CONTROL_TRUE);
         }
     
     case TVI_CONTROL_SPC_SET_INPUT:
         {
-        priv->input = getinput((int)*(void **)arg);
+        priv->input = getinput(*bogus);
 
         if(ioctl(priv->btfd, METEORSINPUT, &priv->input) < 0) 
             {
@@ -248,17 +249,17 @@
 
     case TVI_CONTROL_AUD_GET_FORMAT:
         {
-        (int)*(void **)arg = AF_FORMAT_S16_LE;
+        *bogus = AF_FORMAT_S16_LE;
         return(TVI_CONTROL_TRUE);
         }
     case TVI_CONTROL_AUD_GET_CHANNELS:
         {
-        (int)*(void **)arg = 2;
+        *bogus = 2;
         return(TVI_CONTROL_TRUE);
         }
     case TVI_CONTROL_AUD_SET_SAMPLERATE:
         {
-        int dspspeed = (int)*(void **)arg;
+        int dspspeed = *bogus;
 
            if(ioctl(priv->dspfd, SNDCTL_DSP_SPEED, &dspspeed) == -1) 
             {
@@ -277,12 +278,12 @@
         }
     case TVI_CONTROL_AUD_GET_SAMPLERATE:
         {
-        (int)*(void **)arg = priv->dspspeed;
+        *bogus = priv->dspspeed;
         return(TVI_CONTROL_TRUE);
         }
     case TVI_CONTROL_AUD_GET_SAMPLESIZE:
         {
-        (int)*(void **)arg = priv->dspsamplesize/8;
+        *bogus = priv->dspsamplesize/8;
         return(TVI_CONTROL_TRUE);
         }
 
@@ -294,7 +295,7 @@
 
     case TVI_CONTROL_TUN_SET_NORM:
         {
-        int req_mode = (int)*(void **)arg;
+        int req_mode = *bogus;
 	u_short tmp_fps;
 
         priv->iformat = METEOR_FMT_AUTOMODE;
@@ -379,19 +380,19 @@
         }
     
     case TVI_CONTROL_VID_GET_FORMAT:
-        (int)*(void **)arg = IMGFMT_UYVY;
+        *bogus = IMGFMT_UYVY;
         return(TVI_CONTROL_TRUE);
 
     case TVI_CONTROL_VID_SET_FORMAT:
         {
-        int req_fmt = (int)*(void **)arg;
+        int req_fmt = *bogus;
 
         if(req_fmt != IMGFMT_UYVY) return(TVI_CONTROL_FALSE);
 
         return(TVI_CONTROL_TRUE);
         }
     case TVI_CONTROL_VID_SET_WIDTH:
-        priv->geom.columns = (int)*(void **)arg;
+        priv->geom.columns = *bogus;
 
         if(priv->geom.columns > priv->maxwidth) 
             {
@@ -407,11 +408,11 @@
         return(TVI_CONTROL_TRUE);
 
     case TVI_CONTROL_VID_GET_WIDTH:
-        (int)*(void **)arg = priv->geom.columns;
+        *bogus = priv->geom.columns;
         return(TVI_CONTROL_TRUE);
 
     case TVI_CONTROL_VID_SET_HEIGHT:
-        priv->geom.rows = (int)*(void **)arg;
+        priv->geom.rows = *bogus;
 
         if(priv->geom.rows > priv->maxheight) 
             {
@@ -432,7 +433,7 @@
         return(TVI_CONTROL_TRUE);        
 
     case TVI_CONTROL_VID_GET_HEIGHT:
-        (int)*(void **)arg = priv->geom.rows;
+        *bogus = priv->geom.rows;
         return(TVI_CONTROL_TRUE);        
 
     case TVI_CONTROL_VID_GET_FPS:
@@ -441,7 +442,7 @@
 
 /*
     case TVI_CONTROL_VID_SET_FPS:
-        priv->fps = (int)*(void **)arg;
+        priv->fps = *bogus;
 
         if(priv->fps > priv->maxfps) priv->fps = priv->maxfps;
 
date: 2006/06/14 10:30:06;  author: drochner;  state: Exp;
normalize a "struct timeval" before use as timeout in select(2),
suggested by Mihai Chelaru per PM
(affects RTP)

Index: stream/udp.c
===================================================================
--- stream/udp.c	(revision 20147)
+++ stream/udp.c	(working copy)
@@ -157,8 +157,8 @@
     }
   }
 
-  tv.tv_sec = 0;
-  tv.tv_usec = (1 * 1000000);	/* 1 second timeout */
+  tv.tv_sec = 1;
+  tv.tv_usec = 0;	/* 1 second timeout */
 
   FD_ZERO (&set);
   FD_SET (socket_server_fd, &set);
Index: stream/librtsp/rtsp_rtp.c
===================================================================
--- stream/librtsp/rtsp_rtp.c	(revision 20147)
+++ stream/librtsp/rtsp_rtp.c	(working copy)
@@ -343,8 +343,8 @@
     }
   }
 
-  tv.tv_sec = 0;
-  tv.tv_usec = (1 * 1000000); /* 1 second timeout */
+  tv.tv_sec = 1;
+  tv.tv_usec = 0;	/* 1 second timeout */
   
   FD_ZERO (&set);
   FD_SET (s, &set);

date: 2004/11/06 00:47:34;  author: wiz;  state: Exp;  lines: +12 -12
Fix faad2 test in configure script on -current;
based on PR 26412 by Tom Spindler.
Original PR:
http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=26412

Index: libfaad2/common.h
===================================================================
--- libfaad2/common.h	(revision 20147)
+++ libfaad2/common.h	(working copy)
@@ -334,7 +334,7 @@
   #elif (defined(__i386__) && defined(__GNUC__)) && !defined(HAVE_LRINTF)
     #define HAS_LRINTF
     // from http://www.stereopsis.com/FPU.html
-    static INLINE int lrintf(float f)
+    static INLINE long int lrintf(float f)
     {
         int i;
         __asm__ __volatile__ (

date: 2006/08/04 21:01:21;  author: wiz;  state: Exp;  lines: +16 -7
Recognize cpu type on x86_64. Patch from Rhialto in PR 33946.
Original PR:
http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=33946

date: 2006/10/03 14:32:24;  author: tron;  state: Exp;  lines: +30 -3
Fix a few broken "test ... ==" checks in the configure script found
by "check-portability.mk".

Index: configure
===================================================================
--- configure	(revision 20147)
+++ configure	(working copy)
@@ -842,7 +842,7 @@
 elif aix; then
   # use 'lsattr' on AIX
   _cpuinfo="lsattr -E -l proc0 -a type"
-elif x86; then
+elif x86 || x86_64; then
   # all other OSes try to extract CPU information from a small helper
   # program TOOLS/cpuinfo instead
   $_cc -o TOOLS/cpuinfo TOOLS/cpuinfo.c
@@ -6206,7 +6206,7 @@
   elif cc_check -lavutil $_ld_lm ; then
     _libavutil_so=yes
   fi
-  if test "$_libavutil_so" == yes ; then
+  if test "$_libavutil_so" = yes ; then
     _res_comment="using libavutil.so, but static libavutil is recommended"
   fi
 fi
@@ -6237,7 +6237,7 @@
   elif cc_check -lavcodec $_ld_lm ; then
     _libavcodec_so=yes
   fi
-  if test "$_libavcodec_so" == yes ; then
+  if test "$_libavcodec_so" = yes ; then
     _res_comment="using libavcodec.so, but static libavcodec is recommended"
   fi
 fi
@@ -6260,7 +6260,7 @@
   elif cc_check $_ld_lm -lavformat ; then
     _libavformat_so=yes  
   fi
-  if test "$_libavformat_so" == yes ; then
+  if test "$_libavformat_so" = yes ; then
     _res_comment="using libavformat.so, but static libavformat is recommended"
   fi
 fi

date: 2005/10/24 19:46:05;  author: minskim;  state: Exp;
Call isspace(3) with unsigned char, instead of char, to handle
non-ASCII characters properly.  Based on patches provided by Kevin Kim

Index: subreader.c
===================================================================
--- subreader.c	(revision 20147)
+++ subreader.c	(working copy)
@@ -74,10 +74,10 @@
 /* Remove leading and trailing space */
 static void trail_space(char *s) {
 	int i = 0;
-	while (isspace(s[i])) ++i;
+	while (isspace((unsigned char)s[i])) ++i;
 	if (i) strcpy(s, s + i);
 	i = strlen(s) - 1;
-	while (i > 0 && isspace(s[i])) s[i--] = '\0';
+	while (i > 0 && isspace((unsigned char)s[i])) s[i--] = '\0';
 }
 
 static char *stristr(const char *haystack, const char *needle) {
@@ -628,7 +628,7 @@
     if (!stream_read_line (st, line, LINE_LEN))
 	return NULL;
     /* skip spaces */
-    for (s=line; *s && isspace(*s); s++);
+    for (s=line; *s && isspace(*(unsigned char*)s); s++);
     /* allow empty lines at the end of the file */
     if (*s==0)
 	return NULL;
@@ -681,7 +681,7 @@
 			else return current;
 		}
 		p=line;
-		while (isspace(*p)) p++;
+		while (isspace(*(unsigned char*)p)) p++;
 		if (eol(*p) && num > 0) return current;
 		if (eol(*p)) return NULL;
 
date: 2004/07/24 01:19:35;  author: wiz;  state: Exp;  lines: +13 -15
Unlocking a mutex before destroying it makes libpthread much happier.

Index: loader/win32.c
===================================================================
--- loader/win32.c	(revision 20147)
+++ loader/win32.c	(working copy)
@@ -451,8 +451,10 @@
 
     if (last_alloc)
 	pthread_mutex_unlock(&memmut);
-    else
+    else {
+	pthread_mutex_unlock(&memmut);
 	pthread_mutex_destroy(&memmut);
+    }
 
     //if (alccnt < 40000) printf("MY_RELEASE: %p\t%ld    (%d)\n", header, header->size, alccnt);
 #else


More information about the MPlayer-dev-eng mailing list