[MPlayer-dev-eng] [PATCH] Fix compilation on NetBSD
Diego Biurrun
diego at biurrun.de
Tue Oct 4 14:37:49 CEST 2005
On Wed, Sep 28, 2005 at 09:50:50PM +0200, Diego Biurrun wrote:
> On Wed, Sep 28, 2005 at 09:58:33PM +0300, Jan Knutar wrote:
> > On Wednesday 28 September 2005 02:07, Diego Biurrun wrote:
> >
> > <lrintf problems, avutil.h not defining lrintf unless HAVE_AV_CONFIG_H is defined>
> >
> > > Look at libvo/jpeg_enc.c, it has the same problem and a more or less
> > > clean solution.
> >
> > Right. jpeg_enc is written as if it was inside ffmpeg. When I define
> > HAVE_AV_CONFIG_H before including avutil.h, that also means
> > that malloc, free and printf among others get disabled. I suppose
> > one could just replace those in vf_qp.c with the av_ equivalents...
>
> Yes, you could. I'm not sure what the best solution is. Anyone?
>
> > Also replace the printf with mp_msg. This either requires an
> > #include "mp_msg.h" to be added to mp_image.h (ugly), or then
> > #include "mp_msg.h" to be added or moved in nearly every
> > file in libvo/ (sigh).
>
> Huh? There is no printf in vf_qp.c, besides many files in libvo/
> already #include mp_msg.h...
Does the attached patch work for you?
Diego
-------------- next part --------------
Index: libmpcodecs/vf_qp.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_qp.c,v
retrieving revision 1.2
diff -u -r1.2 vf_qp.c
--- libmpcodecs/vf_qp.c 5 Feb 2004 22:03:42 -0000 1.2
+++ libmpcodecs/vf_qp.c 4 Oct 2005 12:37:54 -0000
@@ -39,9 +39,11 @@
#ifdef USE_LIBAVCODEC_SO
#include <ffmpeg/avcodec.h>
#include <ffmpeg/dsputil.h>
+#include <ffmpeg/common.h>
#else
#include "../libavcodec/avcodec.h"
#include "../libavcodec/dsputil.h"
+#include "../libavutil/common.h"
#endif
#ifdef HAVE_MALLOC_H
@@ -68,7 +70,7 @@
int i;
vf->priv->qp_stride= (width+15)>>4;
- vf->priv->qp= malloc(vf->priv->qp_stride*h*sizeof(int8_t));
+ vf->priv->qp= av_malloc(vf->priv->qp_stride*h*sizeof(int8_t));
for(i=-129; i<128; i++){
double const_values[]={
@@ -155,10 +157,10 @@
static void uninit(struct vf_instance_s* vf){
if(!vf->priv) return;
- if(vf->priv->qp) free(vf->priv->qp);
+ if(vf->priv->qp) av_free(vf->priv->qp);
vf->priv->qp= NULL;
- free(vf->priv);
+ av_free(vf->priv);
vf->priv=NULL;
}
@@ -168,7 +170,7 @@
vf->put_image=put_image;
vf->get_image=get_image;
vf->uninit=uninit;
- vf->priv=malloc(sizeof(struct vf_priv_s));
+ vf->priv=av_malloc(sizeof(struct vf_priv_s));
memset(vf->priv, 0, sizeof(struct vf_priv_s));
// avcodec_init();
More information about the MPlayer-dev-eng
mailing list