[MPlayer-dev-eng] main: [BUG?] draw_slice in vd_libmpeg2.c and [PATCH] some warning fixes

Dominik Mierzejewski dominik at rangers.eu.org
Sun Jun 1 21:00:45 CEST 2003


Hi.
I finally got to building the main branch and of course many new warnings
jumped at me.

This one revealed what I suspect to be a bug:

vd_libmpeg2.c:159: warning: assignment from incompatible pointer type
[...]
            if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK &&
                !(mpi->flags&MP_IMGFLAG_DIRECT)){
                   // nice, filter/vo likes draw_callback :)
-->                 mpeg2dec->decoder.convert=draw_slice; <--
                    mpeg2dec->decoder.fbuf_id=sh;
                } else
                    mpeg2dec->decoder.convert=NULL;
            break;
[...]

draw_slice() is defined in libmpcodecs/vf.h:
    void (*draw_slice)(struct vf_instance_s* vf,
        unsigned char** src, int* stride, int w,int h, int x, int y);

convert() is defined in libmpeg2/mpeg2_internal.h
    void (* convert) (void * fbuf_id, uint8_t * const * src,
                      unsigned int v_offset);

As you see, these are quite different.

And here's a patch that tries to fix some warnings:

vf.c:496: warning: passing arg 6 of `memcpy_pic' makes integer from pointer without a cast
-> I think it should be stride[0], not stride as parameter, but I don't
pretend to understand the code, so I might be wrong.

vf_expand.c:34: warning: initialization makes integer from pointer without a cast
vf_expand.c:37: warning: excess elements in struct initializer
vf_expand.c:37: warning: (near initialization for `vf_priv_dflt')
-> one NULL too many :)

vf_scale.c:35: warning: excess elements in struct initializer
vf_scale.c:35: warning: (near initialization for `vf_priv_dflt')
-> as above

vf_scale.c:322: warning: deprecated use of label at end of compound statement
-> missing "break;"

Also I think it's a good idea to remove duplicate definitions of
get_sws_cpuflags() from Gui/wm/ws.c and libmpcodecs/vf_scale.c and put it
in postproc/swscale.[ch] so that it can be automatically visible in
vf_sab.c and vf_smartblur.c where it's used (and gives "implicit
declaration" warnings now).

realrtsp/xbuffer.c:61: warning: implicit declaration of function `memcpy'
-> missing #include <string.h>

cache2.c:219: warning: implicit declaration of function `waitpid'
-> missing #include <sys/wait.h>

stream.c:394: warning: implicit declaration of function `cache_uninit'
-> cache_uninit is defined in cache2.c

tv.c:334: warning: implicit declaration of function `isdigit'
-> missing #include <ctype.h>

demux_ts.c:221: warning: implicit declaration of function `ts_parse'
-> either add a forward declaration or move the whole definition up

demux_realaud.c:104: warning: `return' with a value, in function returning void
demux_realaud.c:119: warning: `return' with a value, in function returning void
-> obvious

pnm.c:205: warning: implicit declaration of function `send'
pnm.c:241: warning: implicit declaration of function `recv'
-> can someone explain why #include <sys/socket.h> was commented out?

rgb2rgb.h:123: warning: implicit declaration of function `printf'
-> missing #include <stdio.h> in rgb2rgb.c

subreader.c:1651: warning: suggest parentheses around assignment used as truth value
-> obvious

m_option.c:1496: warning: assignment from incompatible pointer type
-> split the double assignment into two separate = NULL's

I don't know, what to do with this:
wine/debugtools.h:67: warning: useless keyword or type name in empty declaration
wine/debugtools.h:67: warning: empty declaration
because as far as I checked the gcc docs, it's correct. Yet gcc-3.1 complains.
Probably compiler bug. I think I should upgrade my system to RH9 finally :).

x11_common.c:418: warning: deprecated use of label at end of compound statement
-> missing break

vo_x11.c:400: warning: implicit declaration of function `sws_getContextFromCmdLine'
vo_x11.c:400: warning: assignment makes pointer from integer without a cast
vo_x11.c:484: warning: assignment makes pointer from integer without a cast
vo_vesa.c:805: warning: implicit declaration of function `sws_getContextFromCmdLine'
vo_vesa.c:805: warning: assignment makes pointer from integer without a cast
-> missing sws_getContextFromCmdLine declaration (it's in vf_scale)

vo_dga.c:328: warning: implicit declaration of function `rgb15to16'
-> missing #include "../postproc/rgb2rgb.h"

vo_dga.c:687: warning: implicit declaration of function `SwScale_Init'
-> could as well be removed, because it doesn't do anything according to
   postproc/swscale.c

swscale.c:1707: warning: implicit declaration of function `sws_rgb2rgb_init'
mga_common.c:428: warning: implicit declaration of function `sws_rgb2rgb_init'
wm/ws.c:327: warning: implicit declaration of function `sws_rgb2rgb_init'
-> missing declaration in rgb2rgb.h, added

-- 
MPlayer RPMs maintainer: http://www.piorunek.pl/~dominik/linux/pkgs/mplayer/
"The Universe doesn't give you any points for doing things that are easy."
        -- Sheridan to Garibaldi in Babylon 5:"The Geometry of Shadows"
-------------- next part --------------
--- MPlayer-20030601/Gui/wm/ws.c.gui	Sun Jun  1 16:00:34 2003
+++ MPlayer-20030601/Gui/wm/ws.c	Sun Jun  1 19:46:42 2003
@@ -93,13 +93,6 @@
 
 // ---
 
-static int get_sws_cpuflags()
-{
-    return (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0) |
-	(gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0) |
-	(gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0);
-}
-
 #define PACK_RGB16(r,g,b,pixel) pixel=(b>>3);\
                                 pixel<<=6;\
                                 pixel|=(g>>2);\
--- MPlayer-20030601/Gui/interface.c.gui	Sun Jun  1 16:00:34 2003
+++ MPlayer-20030601/Gui/interface.c	Sun Jun  1 20:03:02 2003
@@ -1045,7 +1048,7 @@
 	return NULL;
    case gtkSetExtraStereo:
         gtkAOExtraStereoMul=fparam;
-	audio_plugin_extrastereo.control( AOCONTROL_PLUGIN_ES_SET,(int)&gtkAOExtraStereoMul );
+	audio_plugin_extrastereo.control( AOCONTROL_PLUGIN_ES_SET,(void *)&gtkAOExtraStereoMul );
         return NULL;
    case gtkSetPanscan:
         {
@@ -1076,7 +1079,7 @@
         if ( eq )
 	 {
           gtkEquChannels[eq->channel][eq->band]=eq->gain;
-	  audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(int)eq );
+	  audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(void *)eq );
 	 }
 	 else
 	  {
@@ -1084,7 +1087,7 @@
 	   memset( gtkEquChannels,0,sizeof( gtkEquChannels ) );
 	   for ( i=0;i<6;i++ )
 	    for ( j=0;j<10;j++ )
-	     { tmp.channel=i; tmp.band=j; audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(int)&tmp ); }
+	     { tmp.channel=i; tmp.band=j; audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(void *)&tmp ); }
 	  }
 	return NULL;
   }
--- MPlayer-20030601/libmpcodecs/vf.c.warn	Sun Jun  1 16:00:37 2003
+++ MPlayer-20030601/libmpcodecs/vf.c	Sun Jun  1 18:28:48 2003
@@ -493,7 +493,7 @@
     }
     if (!(vf->dmpi->flags & MP_IMGFLAG_PLANAR)) {
 	memcpy_pic(vf->dmpi->planes[0]+y*vf->dmpi->stride[0]+vf->dmpi->bpp/8*x,
-	    src[0], vf->dmpi->bpp/8*w, h, vf->dmpi->stride[0], stride);
+	    src[0], vf->dmpi->bpp/8*w, h, vf->dmpi->stride[0], stride[0]);
 	return;
     }
     memcpy_pic(vf->dmpi->planes[0]+y*vf->dmpi->stride[0]+x, src[0],
--- MPlayer-20030601/libmpcodecs/vf_expand.c.warn	Sun Jun  1 16:00:38 2003
+++ MPlayer-20030601/libmpcodecs/vf_expand.c	Sun Jun  1 18:31:19 2003
@@ -31,7 +31,6 @@
 } vf_priv_dflt = {
   -1,-1,
   -1,-1,
-  NULL,
   0,
   NULL
 };
--- MPlayer-20030601/libmpcodecs/vf_scale.c.warn	Sun Jun  1 16:00:38 2003
+++ MPlayer-20030601/libmpcodecs/vf_scale.c	Sun Jun  1 18:41:10 2003
@@ -30,7 +30,6 @@
   0,
   0,
   NULL,
-  NULL,
   NULL
 };
 
@@ -319,6 +318,7 @@
 
 	return CONTROL_TRUE;
     default:
+	break;
     }
     
     return vf_next_control(vf,request,data);
@@ -404,13 +404,6 @@
 float sws_chr_sharpen= 0.0;
 float sws_lum_sharpen= 0.0;
 
-int get_sws_cpuflags(){
-    return 
-          (gCpuCaps.hasMMX   ? SWS_CPU_CAPS_MMX   : 0)
-	| (gCpuCaps.hasMMX2  ? SWS_CPU_CAPS_MMX2  : 0)
-	| (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0);
-}
-
 void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam)
 {
 	static int firstTime=1;
--- MPlayer-20030601/libmpdemux/realrtsp/xbuffer.c.warn	Thu Apr 17 22:38:57 2003
+++ MPlayer-20030601/libmpdemux/realrtsp/xbuffer.c	Sun Jun  1 18:15:15 2003
@@ -14,6 +14,7 @@
  */
 
 #include <stdlib.h>
+#include <string.h>
 #include <inttypes.h>
 #include "xbuffer.h"
 
--- MPlayer-20030601/libmpdemux/cache2.c.warn	Sun Jun  1 16:00:38 2003
+++ MPlayer-20030601/libmpdemux/cache2.c	Sun Jun  1 18:07:43 2003
@@ -15,6 +15,7 @@
 #include <string.h>
 #include <signal.h>
 #include <sys/types.h>
+#include <sys/wait.h>
 #include <unistd.h>
 
 #include "../osdep/timer.h"
--- MPlayer-20030601/libmpdemux/stream.c.warn	Sun Jun  1 16:00:39 2003
+++ MPlayer-20030601/libmpdemux/stream.c	Sun Jun  1 18:09:57 2003
@@ -26,6 +26,7 @@
 
 
 extern int verbose; // defined in mplayer.c
+void cache_uninit(stream_t *s); // defined in cache2.c
 
 #include "cue_read.h"
 
--- MPlayer-20030601/libmpdemux/tv.c.warn	Thu May  1 16:06:30 2003
+++ MPlayer-20030601/libmpdemux/tv.c	Sun Jun  1 18:10:33 2003
@@ -14,6 +14,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
+#include <ctype.h>
 #include <sys/time.h>
 
 #include "config.h"
--- MPlayer-20030601/libmpdemux/demux_ts.c.warn	Sun Jun  1 18:12:05 2003
+++ MPlayer-20030601/libmpdemux/demux_ts.c	Sun Jun  1 18:11:40 2003
@@ -199,6 +199,8 @@
     return size;
 }
 
+int ts_parse(demuxer_t * demuxer , ES_stream_t *es, unsigned char *packet); /* forward declaration */
+
 void ts_detect_streams(demuxer_t *demuxer)
 {
 	int video_found = 0, audio_found = 0;
--- MPlayer-20030601/libmpdemux/demux_realaud.c.warn	Sun Jun  1 16:00:38 2003
+++ MPlayer-20030601/libmpdemux/demux_realaud.c	Sun Jun  1 18:12:37 2003
@@ -101,7 +101,7 @@
 
   if ((ra_priv = (ra_priv_t *)malloc(sizeof(ra_priv_t))) == NULL) {
     mp_msg(MSGT_DEMUX, MSGL_ERR, "[RealAudio] Can't allocate memory for private data.\n");
-    return NULL;
+    return;
   }
 	memset(ra_priv, 0, sizeof(ra_priv_t));
 
@@ -116,7 +116,7 @@
 	if ((ra_priv->version < 3) || (ra_priv->version > 4)) {
 		mp_msg(MSGT_DEMUX,MSGL_WARN,"[RealAudio] ra version %d is not supported yet, please "
 			"contact MPlayer developers\n", ra_priv->version);
-		return NULL;
+		return;
 	}
 	if (ra_priv->version == 3) {
 		ra_priv->hdr_size = stream_read_word(demuxer->stream);
--- MPlayer-20030601/libmpdemux/pnm.c.warn	Sun Jun  1 16:00:39 2003
+++ MPlayer-20030601/libmpdemux/pnm.c	Sun Jun  1 18:14:24 2003
@@ -26,7 +26,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <assert.h>
-//#include <sys/socket.h>
+#include <sys/socket.h>
 //#include <netinet/in.h>
 //#include <netdb.h>
 #include <string.h>
--- MPlayer-20030601/libvo/mga_common.c.warn	Sun Jun  1 18:42:10 2003
+++ MPlayer-20030601/libvo/mga_common.c	Sun Jun  1 19:07:53 2003
@@ -415,13 +415,6 @@
   return 0;
 }
 
-static int get_sws_cpuflags(){
-    return 
-          (gCpuCaps.hasMMX   ? SWS_CPU_CAPS_MMX   : 0)
-	| (gCpuCaps.hasMMX2  ? SWS_CPU_CAPS_MMX2  : 0)
-	| (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0);
-}
-
 static uint32_t preinit(const char *vo_subdevice)
 {
   const char *devname=vo_subdevice?vo_subdevice:"/dev/mga_vid";
--- MPlayer-20030601/libvo/x11_common.c.warn	Sun Jun  1 16:00:40 2003
+++ MPlayer-20030601/libvo/x11_common.c	Sun Jun  1 18:58:40 2003
@@ -414,7 +414,7 @@
    case XF86XK_AudioStop:     mplayer_put_key(KEY_XF86_STOP); break;
    case XF86XK_AudioPrev:     mplayer_put_key(KEY_XF86_PREV); break;
    case XF86XK_AudioNext:     mplayer_put_key(KEY_XF86_NEXT); break;
-   default:
+   default: break;
   }
 }
 #endif
--- MPlayer-20030601/libvo/vo_x11.c.warn	Sun Jun  1 16:00:40 2003
+++ MPlayer-20030601/libvo/vo_x11.c	Sun Jun  1 19:01:42 2003
@@ -43,6 +43,9 @@
 
 LIBVO_EXTERN( x11 )
 
+/* vf_scale */
+struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat);
+
 /* private prototypes */
 static void Display_Image ( XImage * myximage,unsigned char *ImageData );
 static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride);
--- MPlayer-20030601/libvo/vo_dga.c.warn	Sun Jun  1 16:00:39 2003
+++ MPlayer-20030601/libvo/vo_dga.c	Sun Jun  1 19:05:58 2003
@@ -23,6 +23,7 @@
 #include "video_out.h"
 #include "video_out_internal.h"
 #include "../postproc/swscale.h"
+#include "../postproc/rgb2rgb.h"
 #include "aspect.h"
 #include "x11_common.h"
 #include "fastmemcpy.h"
@@ -684,7 +685,7 @@
     aspect_save_screenres(mX,mY);
     aspect_save_orig(scale_srcW,scale_srcH);
 	  aspect_save_prescale(scale_dstW,scale_dstH);
-    SwScale_Init();
+/*    SwScale_Init(); */ /* this function does nothing - see ../postproc/swscale.c */
     if(flags&0x01) /* -fs */
       aspect(&scale_dstW,&scale_dstH,A_ZOOM);
     else if(flags&0x04) /* -fs */
--- MPlayer-20030601/libvo/vo_vesa.c.warn	Thu May  1 16:06:49 2003
+++ MPlayer-20030601/libvo/vo_vesa.c	Sun Jun  1 19:11:38 2003
@@ -107,6 +107,10 @@
 static int flip_trigger = 0;
 static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride);
 
+/* vf_scale */
+struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH,
+int dstFormat);
+
 /* multibuffering */
 uint8_t*  video_base; /* should be never changed */
 uint32_t  multi_buff[MAX_BUFFERS]; /* contains offsets of buffers */
--- MPlayer-20030601/postproc/rgb2rgb.c.warn	Thu May  1 16:06:50 2003
+++ MPlayer-20030601/postproc/rgb2rgb.c	Sun Jun  1 18:50:50 2003
@@ -7,6 +7,7 @@
  *  Written by Nick Kurshev.
  *  palette & yuv & runtime cpu stuff by Michael (michaelni at gmx.at) (under GPL)
  */
+#include <stdio.h>
 #include <inttypes.h>
 #include "../config.h"
 #include "rgb2rgb.h"
--- MPlayer-20030601/postproc/swscale.c.warn	Sun Jun  1 16:00:40 2003
+++ MPlayer-20030601/postproc/swscale.c	Sun Jun  1 18:39:50 2003
@@ -2458,3 +2458,9 @@
 	free(c);
 }
 
+int get_sws_cpuflags(){
+    return
+          (gCpuCaps.hasMMX   ? SWS_CPU_CAPS_MMX   : 0)
+        | (gCpuCaps.hasMMX2  ? SWS_CPU_CAPS_MMX2  : 0)
+        | (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0);
+}
--- MPlayer-20030601/postproc/swscale.h.warn	Thu May  1 16:06:52 2003
+++ MPlayer-20030601/postproc/swscale.h	Sun Jun  1 18:40:37 2003
@@ -121,6 +121,7 @@
 				float chromaHShift, float chromaVShift,
 				int verbose);
 void sws_freeFilter(SwsFilter *filter);
+int get_sws_cpuflags();
 
 #ifdef __cplusplus
 }
--- MPlayer-20030601/postproc/rgb2rgb.h.warn	Thu May  1 16:06:51 2003
+++ MPlayer-20030601/postproc/rgb2rgb.h	Sun Jun  1 18:49:49 2003
@@ -127,4 +127,6 @@
 printf("broken, this should use the swscaler\n");
 }
 
+void sws_rgb2rgb_init(int flags);
+
 #endif
--- MPlayer-20030601/subreader.c.warn	Sun Jun  1 16:00:14 2003
+++ MPlayer-20030601/subreader.c	Sun Jun  1 17:45:04 2003
@@ -1648,7 +1648,7 @@
     for (j = 0; j <= 1; j++) {
 	d = opendir(j == 0 ? f_dir : path);
 	if (d) {
-	    while (de = readdir(d)) {
+	    while ( (de = readdir(d)) ) {
 		// retrieve various parts of the filename
 		strcpy_strip_ext(tmp_fname_noext, de->d_name);
 		strcpy_get_ext(tmp_fname_ext, de->d_name);
--- MPlayer-20030601/m_option.c.warn	Sun Jun  1 17:46:18 2003
+++ MPlayer-20030601/m_option.c	Sun Jun  1 17:46:26 2003
@@ -1493,7 +1493,7 @@
     d[n].attribs = NULL;
     copy_str_list(NULL,&(d[n].attribs),&(s[n].attribs));
   }
-  d[n].name = d[n].attribs = NULL;
+  d[n].name = NULL; d[n].attribs = NULL;
   VAL(dst) = d;
 }
 


More information about the MPlayer-dev-eng mailing list