[MPlayer-cvslog] r32189 - in trunk: libmpcodecs/ad_ffmpeg.c libmpcodecs/ae_pcm.c libmpcodecs/vd_ffmpeg.c libmpcodecs/vd_qtvideo.c libmpcodecs/vd_realvid.c libmpcodecs/ve_lavc.c libmpcodecs/ve_qtvideo.c libmpcodecs/...

reimar subversion at mplayerhq.hu
Sun Sep 12 15:01:05 CEST 2010


Author: reimar
Date: Sun Sep 12 15:01:05 2010
New Revision: 32189

Log:
Replace sizoef(type) by sizeof(*ptrvar).
Besides being consistent with FFmpeg style,
this reduces the size of a patch to rename these
types to not conflict with the windows.h definitions.

Modified:
   trunk/libmpcodecs/ad_ffmpeg.c
   trunk/libmpcodecs/ae_pcm.c
   trunk/libmpcodecs/vd_ffmpeg.c
   trunk/libmpcodecs/vd_qtvideo.c
   trunk/libmpcodecs/vd_realvid.c
   trunk/libmpcodecs/ve_lavc.c
   trunk/libmpcodecs/ve_qtvideo.c
   trunk/libmpcodecs/ve_raw.c
   trunk/libmpdemux/aviheader.c
   trunk/libmpdemux/demux_film.c
   trunk/libmpdemux/demux_mf.c
   trunk/libmpdemux/demux_mov.c
   trunk/libmpdemux/demux_nsv.c
   trunk/libmpdemux/demux_ogg.c
   trunk/libmpdemux/demux_smjpeg.c
   trunk/libmpdemux/demux_ts.c
   trunk/libmpdemux/demux_y4m.c
   trunk/libmpdemux/muxer_avi.c
   trunk/libmpdemux/video.c
   trunk/stream/tv.c

Modified: trunk/libmpcodecs/ad_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/ad_ffmpeg.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpcodecs/ad_ffmpeg.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -126,7 +126,7 @@ static int init(sh_audio_t *sh_audio)
     if (sh_audio->wf && sh_audio->wf->cbSize > 0) {
         lavc_context->extradata = av_mallocz(sh_audio->wf->cbSize + FF_INPUT_BUFFER_PADDING_SIZE);
         lavc_context->extradata_size = sh_audio->wf->cbSize;
-        memcpy(lavc_context->extradata, (char *)sh_audio->wf + sizeof(WAVEFORMATEX),
+        memcpy(lavc_context->extradata, sh_audio->wf + 1,
                lavc_context->extradata_size);
     }
 

Modified: trunk/libmpcodecs/ae_pcm.c
==============================================================================
--- trunk/libmpcodecs/ae_pcm.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpcodecs/ae_pcm.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -37,7 +37,7 @@ static int bind_pcm(audio_encoder_t *enc
 {
 	mux_a->h.dwScale=1;
 	mux_a->h.dwRate=encoder->params.sample_rate;
-	mux_a->wf=malloc(sizeof(WAVEFORMATEX));
+	mux_a->wf=malloc(sizeof(*mux_a->wf));
 	mux_a->wf->wFormatTag=0x1; // PCM
 	mux_a->wf->nChannels=encoder->params.channels;
 	mux_a->h.dwSampleSize=2*mux_a->wf->nChannels;

Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpcodecs/vd_ffmpeg.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -373,10 +373,10 @@ static int init(sh_video_t *sh){
     /* AVRn stores huffman table in AVI header */
     /* Pegasus MJPEG stores it also in AVI header, but it uses the common
        MJPG fourcc :( */
-        if (!sh->bih || sh->bih->biSize <= sizeof(BITMAPINFOHEADER))
+        if (!sh->bih || sh->bih->biSize <= sizeof(*sh->bih))
             break;
         avctx->flags |= CODEC_FLAG_EXTERN_HUFF;
-        avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER);
+        avctx->extradata_size = sh->bih->biSize-sizeof(*sh->bih);
         avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
         memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size);
 
@@ -406,7 +406,7 @@ static int init(sh_video_t *sh){
                 (sh->format == mmioFOURCC('R', 'V', '1', '3')) ? 0x10003001 : 0x10000000;
         } else {
             /* has extra slice header (demux_rm or rm->avi streamcopy) */
-            avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER);
+            avctx->extradata_size = sh->bih->biSize-sizeof(*sh->bih);
             avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
             memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size);
         }
@@ -416,9 +416,9 @@ static int init(sh_video_t *sh){
         break;
 
     default:
-        if (!sh->bih || sh->bih->biSize <= sizeof(BITMAPINFOHEADER))
+        if (!sh->bih || sh->bih->biSize <= sizeof(*sh->bih))
             break;
-        avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER);
+        avctx->extradata_size = sh->bih->biSize-sizeof(*sh->bih);
         avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
         memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size);
         break;
@@ -427,10 +427,10 @@ static int init(sh_video_t *sh){
     if (sh->bih && (sh->bih->biBitCount <= 8)) {
         avctx->palctrl = calloc(1, sizeof(AVPaletteControl));
         avctx->palctrl->palette_changed = 1;
-        if (sh->bih->biSize-sizeof(BITMAPINFOHEADER))
+        if (sh->bih->biSize-sizeof(*sh->bih))
             /* Palette size in biSize */
             memcpy(avctx->palctrl->palette, sh->bih+1,
-                   FFMIN(sh->bih->biSize-sizeof(BITMAPINFOHEADER), AVPALETTE_SIZE));
+                   FFMIN(sh->bih->biSize-sizeof(*sh->bih), AVPALETTE_SIZE));
         else
             /* Palette size in biClrUsed */
             memcpy(avctx->palctrl->palette, sh->bih+1,

Modified: trunk/libmpcodecs/vd_qtvideo.c
==============================================================================
--- trunk/libmpcodecs/vd_qtvideo.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpcodecs/vd_qtvideo.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -98,7 +98,7 @@ static int control(sh_video_t *sh,int cm
 // init driver
 static int init(sh_video_t *sh){
     OSErr result = 1;
-    int extradata_size = sh->bih ? sh->bih->biSize - sizeof(BITMAPINFOHEADER) : 0;
+    int extradata_size = sh->bih ? sh->bih->biSize - sizeof(*sh->bih) : 0;
     void *extradata = sh->bih + 1;
 
     if (!sh->ImageDesc)

Modified: trunk/libmpcodecs/vd_realvid.c
==============================================================================
--- trunk/libmpcodecs/vd_realvid.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpcodecs/vd_realvid.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -263,11 +263,11 @@ static int init(sh_video_t *sh){
 	int result;
 	// we export codec id and sub-id from demuxer in bitmapinfohdr:
 	unsigned char* extrahdr=(unsigned char*)(sh->bih+1);
-	unsigned int extrahdr_size = sh->bih->biSize - sizeof(BITMAPINFOHEADER);
+	unsigned int extrahdr_size = sh->bih->biSize - sizeof(*sh->bih);
 	struct rv_init_t init_data;
 
 	if(extrahdr_size < 8) {
-	    mp_msg(MSGT_DECVIDEO,MSGL_ERR,"realvideo: extradata too small (%u)\n", sh->bih->biSize - sizeof(BITMAPINFOHEADER));
+	    mp_msg(MSGT_DECVIDEO,MSGL_ERR,"realvideo: extradata too small (%u)\n", extrahdr_size);
 	    return 0;
 	}
 	init_data = (struct rv_init_t){11, sh->disp_w, sh->disp_h, 0, 0, AV_RB32(extrahdr), 1, AV_RB32(extrahdr + 4)}; // rv30

Modified: trunk/libmpcodecs/ve_lavc.c
==============================================================================
--- trunk/libmpcodecs/ve_lavc.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpcodecs/ve_lavc.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -704,9 +704,9 @@ static int config(struct vf_instance *vf
     if(lavc_venc_context->bits_per_coded_sample)
         mux_v->bih->biBitCount= lavc_venc_context->bits_per_coded_sample;
     if(lavc_venc_context->extradata_size){
-        mux_v->bih= realloc(mux_v->bih, sizeof(BITMAPINFOHEADER) + lavc_venc_context->extradata_size);
+        mux_v->bih= realloc(mux_v->bih, sizeof(*mux_v->bih) + lavc_venc_context->extradata_size);
         memcpy(mux_v->bih + 1, lavc_venc_context->extradata, lavc_venc_context->extradata_size);
-        mux_v->bih->biSize= sizeof(BITMAPINFOHEADER) + lavc_venc_context->extradata_size;
+        mux_v->bih->biSize= sizeof(*mux_v->bih) + lavc_venc_context->extradata_size;
     }
 
     mux_v->decoder_delay = lavc_venc_context->max_b_frames ? 1 : 0;
@@ -936,35 +936,35 @@ static int vf_open(vf_instance_t *vf, ch
        huffman tables into the stream, so no problem */
     if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "mjpeg"))
     {
-	mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+28);
-	mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+28;
+	mux_v->bih=calloc(1, sizeof(*mux_v->bih)+28);
+	mux_v->bih->biSize=sizeof(*mux_v->bih)+28;
     }
     else if (lavc_param_vcodec && (!strcasecmp(lavc_param_vcodec, "huffyuv")
                                 || !strcasecmp(lavc_param_vcodec, "ffvhuff")))
     {
     /* XXX: hack: huffyuv needs to store huffman tables (allthough we dunno the size yet ...) */
-	mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+1000);
-	mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+1000;
+	mux_v->bih=calloc(1, sizeof(*mux_v->bih)+1000);
+	mux_v->bih->biSize=sizeof(*mux_v->bih)+1000;
     }
     else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "asv1"))
     {
-	mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+8);
-	mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+8;
+	mux_v->bih=calloc(1, sizeof(*mux_v->bih)+8);
+	mux_v->bih->biSize=sizeof(*mux_v->bih)+8;
     }
     else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "asv2"))
     {
-	mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+8);
-	mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+8;
+	mux_v->bih=calloc(1, sizeof(*mux_v->bih)+8);
+	mux_v->bih->biSize=sizeof(*mux_v->bih)+8;
     }
     else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "wmv2"))
     {
-	mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+4);
-	mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+4;
+	mux_v->bih=calloc(1, sizeof(*mux_v->bih)+4);
+	mux_v->bih->biSize=sizeof(*mux_v->bih)+4;
     }
     else
     {
-	mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER));
-	mux_v->bih->biSize=sizeof(BITMAPINFOHEADER);
+	mux_v->bih=calloc(1, sizeof(*mux_v->bih));
+	mux_v->bih->biSize=sizeof(*mux_v->bih);
     }
     mux_v->bih->biWidth=0;
     mux_v->bih->biHeight=0;

Modified: trunk/libmpcodecs/ve_qtvideo.c
==============================================================================
--- trunk/libmpcodecs/ve_qtvideo.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpcodecs/ve_qtvideo.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -302,8 +302,8 @@ static int vf_open(vf_instance_t *vf, ch
     memset(vf->priv,0,sizeof(struct vf_priv_s));
     vf->priv->mux=(muxer_stream_t*)args;
 
-    mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+MAX_IDSIZE);
-    mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+MAX_IDSIZE;
+    mux_v->bih=calloc(1, sizeof(*mux_v->bih)+MAX_IDSIZE);
+    mux_v->bih->biSize=sizeof(*mux_v->bih)+MAX_IDSIZE;
     mux_v->bih->biWidth=0;
     mux_v->bih->biHeight=0;
     mux_v->bih->biCompression=format;

Modified: trunk/libmpcodecs/ve_raw.c
==============================================================================
--- trunk/libmpcodecs/ve_raw.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpcodecs/ve_raw.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -159,8 +159,8 @@ static int vf_open(vf_instance_t *vf, ch
     memset(vf->priv, 0, sizeof(struct vf_priv_s));
     vf->priv->mux = (muxer_stream_t*)args;
 
-    mux_v->bih = calloc(1, sizeof(BITMAPINFOHEADER));
-    mux_v->bih->biSize = sizeof(BITMAPINFOHEADER);
+    mux_v->bih = calloc(1, sizeof(*mux_v->bih));
+    mux_v->bih->biSize = sizeof(*mux_v->bih);
     mux_v->bih->biWidth = 0;
     mux_v->bih->biHeight = 0;
 

Modified: trunk/libmpdemux/aviheader.c
==============================================================================
--- trunk/libmpdemux/aviheader.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpdemux/aviheader.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -266,12 +266,12 @@ while(1){
       break; }
     case ckidSTREAMFORMAT: {      // read 'strf'
       if(last_fccType==streamtypeVIDEO){
-        sh_video->bih=calloc(FFMAX(chunksize, sizeof(BITMAPINFOHEADER)), 1);
+        sh_video->bih=calloc(FFMAX(chunksize, sizeof(*sh_video->bih)), 1);
 //        sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize);
-        mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundBitmapInfoHeader,chunksize,sizeof(BITMAPINFOHEADER));
+        mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundBitmapInfoHeader,chunksize,sizeof(*sh_video->bih));
         stream_read(demuxer->stream,(char*) sh_video->bih,chunksize);
 	le2me_BITMAPINFOHEADER(sh_video->bih);  // swap to machine endian
-	if (sh_video->bih->biSize > chunksize && sh_video->bih->biSize > sizeof(BITMAPINFOHEADER))
+	if (sh_video->bih->biSize > chunksize && sh_video->bih->biSize > sizeof(*sh_video->bih))
 		sh_video->bih->biSize = chunksize;
 	// fixup MS-RLE header (seems to be broken for <256 color files)
 	if(sh_video->bih->biCompression<=1 && sh_video->bih->biSize==40)
@@ -321,15 +321,15 @@ while(1){
         }
       } else
       if(last_fccType==streamtypeAUDIO){
-	unsigned wf_size = chunksize<sizeof(WAVEFORMATEX)?sizeof(WAVEFORMATEX):chunksize;
+	unsigned wf_size = chunksize<sizeof(*sh_audio->wf)?sizeof(*sh_audio->wf):chunksize;
         sh_audio->wf=calloc(wf_size,1);
 //        sh_audio->wf=malloc(chunksize); memset(sh_audio->wf,0,chunksize);
-        mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundWaveFmt,chunksize,sizeof(WAVEFORMATEX));
+        mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundWaveFmt,chunksize,sizeof(*sh_audio->wf));
         stream_read(demuxer->stream,(char*) sh_audio->wf,chunksize);
 	le2me_WAVEFORMATEX(sh_audio->wf);
 	if (sh_audio->wf->cbSize != 0 &&
-	    wf_size < sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize) {
-	    sh_audio->wf=realloc(sh_audio->wf, sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize);
+	    wf_size < sizeof(*sh_audio->wf)+sh_audio->wf->cbSize) {
+	    sh_audio->wf=realloc(sh_audio->wf, sizeof(*sh_audio->wf)+sh_audio->wf->cbSize);
 	}
 	sh_audio->format=sh_audio->wf->wFormatTag;
 	if (sh_audio->format == 1 &&

Modified: trunk/libmpdemux/demux_film.c
==============================================================================
--- trunk/libmpdemux/demux_film.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpdemux/demux_film.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -326,7 +326,7 @@ static demuxer_t* demux_open_film(demuxe
           demuxer->audio->sh = sh_audio;
           sh_audio->ds = demuxer->audio;
 
-          sh_audio->wf = malloc(sizeof(WAVEFORMATEX));
+          sh_audio->wf = malloc(sizeof(*sh_audio->wf));
 
           // uncompressed PCM format
           sh_audio->wf->wFormatTag = 1;
@@ -357,7 +357,7 @@ static demuxer_t* demux_open_film(demuxe
         demuxer->audio->sh = sh_audio;
         sh_audio->ds = demuxer->audio;
 
-        sh_audio->wf = malloc(sizeof(WAVEFORMATEX));
+        sh_audio->wf = malloc(sizeof(*sh_audio->wf));
 
         // uncompressed PCM format
         sh_audio->wf->wFormatTag = 1;

Modified: trunk/libmpdemux/demux_mf.c
==============================================================================
--- trunk/libmpdemux/demux_mf.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpdemux/demux_mf.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -160,7 +160,7 @@ static demuxer_t* demux_open_mf(demuxer_
   sh_video->frametime = 1 / sh_video->fps;
 
   // emulate BITMAPINFOHEADER:
-  sh_video->bih=calloc(1, sizeof(BITMAPINFOHEADER));
+  sh_video->bih=calloc(1, sizeof(*sh_video->bih));
   sh_video->bih->biSize=40;
   sh_video->bih->biWidth = mf_w;
   sh_video->bih->biHeight = mf_h;

Modified: trunk/libmpdemux/demux_mov.c
==============================================================================
--- trunk/libmpdemux/demux_mov.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpdemux/demux_mov.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -916,7 +916,7 @@ quit_vorbis_block:
 		  fclose(f); }
 #endif
 		// Emulate WAVEFORMATEX struct:
-		sh->wf=calloc(1, sizeof(WAVEFORMATEX) + (is_vorbis ? sh->codecdata_len : 0));
+		sh->wf=calloc(1, sizeof(*sh->wf) + (is_vorbis ? sh->codecdata_len : 0));
 		sh->wf->nChannels=sh->channels;
 		sh->wf->wBitsPerSample=(trak->stdata[18]<<8)+trak->stdata[19];
 		// sh->wf->nSamplesPerSec=trak->timescale;
@@ -1160,7 +1160,7 @@ static int gen_sh_video(sh_video_t* sh, 
 		// emulate BITMAPINFOHEADER:
 		if (palette_count)
 		{
-		  sh->bih=calloc(1, sizeof(BITMAPINFOHEADER) + palette_count * 4);
+		  sh->bih=calloc(1, sizeof(*sh->bih) + palette_count * 4);
 		  sh->bih->biSize=40 + palette_count * 4;
 		  // fetch the relevant fields
 		  flag = AV_RB16(&trak->stdata[hdr_ptr]);
@@ -1244,18 +1244,18 @@ static int gen_sh_video(sh_video_t* sh, 
 		else
 		{
 		 if (trak->fourcc == mmioFOURCC('a','v','c','1')) {
-		  if (trak->stream_header_len > 0xffffffff - sizeof(BITMAPINFOHEADER)) {
+		  if (trak->stream_header_len > 0xffffffff - sizeof(*sh->bih)) {
 		    mp_msg(MSGT_DEMUXER, MSGL_ERR, "Invalid extradata size %d, skipping\n",trak->stream_header_len);
 		    trak->stream_header_len = 0;
 		  }
-		  sh->bih=calloc(1, sizeof(BITMAPINFOHEADER) + trak->stream_header_len);
+		  sh->bih=calloc(1, sizeof(*sh->bih) + trak->stream_header_len);
 		  sh->bih->biSize=40  + trak->stream_header_len;
 		  memcpy(((unsigned char *)sh->bih)+40,  trak->stream_header, trak->stream_header_len);
 		  free (trak->stream_header);
 		  trak->stream_header_len = 0;
 		  trak->stream_header = NULL;
 		 } else {
-		  sh->bih=calloc(1, sizeof(BITMAPINFOHEADER));
+		  sh->bih=calloc(1, sizeof(*sh->bih));
 		  sh->bih->biSize=40;
 		 }
 		}

Modified: trunk/libmpdemux/demux_nsv.c
==============================================================================
--- trunk/libmpdemux/demux_nsv.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpdemux/demux_nsv.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -226,8 +226,8 @@ static demuxer_t* demux_open_nsv ( demux
             // new video stream! parse header
             sh_video->disp_w=hdr[12]|(hdr[13]<<8);
             sh_video->disp_h=hdr[14]|(hdr[15]<<8);
-            sh_video->bih=calloc(1,sizeof(BITMAPINFOHEADER));
-            sh_video->bih->biSize=sizeof(BITMAPINFOHEADER);
+            sh_video->bih=calloc(1,sizeof(*sh_video->bih));
+            sh_video->bih->biSize=sizeof(*sh_video->bih);
             sh_video->bih->biPlanes=1;
             sh_video->bih->biBitCount=24;
             sh_video->bih->biWidth=hdr[12]|(hdr[13]<<8);

Modified: trunk/libmpdemux/demux_ogg.c
==============================================================================
--- trunk/libmpdemux/demux_ogg.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpdemux/demux_ogg.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -719,7 +719,7 @@ static void fixup_vorbis_wf(sh_audio_t *
         os->vi_initialized = 1;
 
     len = op[0].bytes + op[1].bytes + op[2].bytes;
-    sh->wf = calloc(1, sizeof(WAVEFORMATEX) + len + len / 255 + 64);
+    sh->wf = calloc(1, sizeof(*sh->wf) + len + len / 255 + 64);
     ptr = (unsigned char*)(sh->wf + 1);
 
     ptr[0] = 2;
@@ -735,7 +735,7 @@ static void fixup_vorbis_wf(sh_audio_t *
     }
     sh->wf->cbSize = offset;
     mp_msg(MSGT_DEMUX, MSGL_V, "demux_ogg, extradata size: %d\n", sh->wf->cbSize);
-    sh->wf = realloc(sh->wf, sizeof(WAVEFORMATEX) + sh->wf->cbSize);
+    sh->wf = realloc(sh->wf, sizeof(*sh->wf) + sh->wf->cbSize);
 
     if (op[0].bytes >= 29) {
         unsigned int br;
@@ -869,7 +869,7 @@ int demux_ogg_open(demuxer_t *demuxer)
                    ogg_d->num_sub, n_audio - 1);
         } else if (pack.bytes >= 80 && !strncmp(pack.packet, "Speex", 5)) {
             sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio, NULL);
-            sh_a->wf         = calloc(1, sizeof(WAVEFORMATEX) + pack.bytes);
+            sh_a->wf         = calloc(1, sizeof(*sh_a->wf) + pack.bytes);
             sh_a->format     = FOURCC_SPEEX;
             sh_a->samplerate = sh_a->wf->nSamplesPerSec = AV_RL32(&pack.packet[36]);
             sh_a->channels   = sh_a->wf->nChannels = AV_RL32(&pack.packet[48]);
@@ -950,7 +950,7 @@ int demux_ogg_open(demuxer_t *demuxer)
             ogg_d->subs[ogg_d->num_sub].id = n_audio;
             n_audio++;
             ogg_d->subs[ogg_d->num_sub].flac = 2;
-            sh_a->wf = calloc(1, sizeof(WAVEFORMATEX) + 34);
+            sh_a->wf = calloc(1, sizeof(*sh_a->wf) + 34);
             sh_a->wf->wFormatTag = sh_a->format;
             sh_a->wf->cbSize     = 34;
             memcpy(&sh_a->wf[1], &pack.packet[17], 34);
@@ -965,8 +965,8 @@ int demux_ogg_open(demuxer_t *demuxer)
             // Old video header
             if (AV_RL32(pack.packet + 96) == 0x05589f80 && pack.bytes >= 184) {
                 sh_v = new_sh_video_vid(demuxer, ogg_d->num_sub, n_video);
-                sh_v->bih = calloc(1, sizeof(BITMAPINFOHEADER));
-                sh_v->bih->biSize        = sizeof(BITMAPINFOHEADER);
+                sh_v->bih = calloc(1, sizeof(*sh_v->bih));
+                sh_v->bih->biSize        = sizeof(*sh_v->bih);
                 sh_v->bih->biCompression = sh_v->format = mmioFOURCC(pack.packet[68], pack.packet[69],
                                                                      pack.packet[70], pack.packet[71]);
                 sh_v->frametime = AV_RL64(pack.packet + 164) * 0.0000001;
@@ -994,7 +994,7 @@ int demux_ogg_open(demuxer_t *demuxer)
 
                 sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio, NULL);
                 extra_size = AV_RL16(pack.packet + 140);
-                sh_a->wf         = calloc(1, sizeof(WAVEFORMATEX) + extra_size);
+                sh_a->wf         = calloc(1, sizeof(*sh_a->wf) + extra_size);
                 sh_a->format     = sh_a->wf->wFormatTag     = AV_RL16(pack.packet + 124);
                 sh_a->channels   = sh_a->wf->nChannels      = AV_RL16(pack.packet + 126);
                 sh_a->samplerate = sh_a->wf->nSamplesPerSec = AV_RL32(pack.packet + 128);
@@ -1004,7 +1004,7 @@ int demux_ogg_open(demuxer_t *demuxer)
                 sh_a->samplesize = (sh_a->wf->wBitsPerSample + 7) / 8;
                 sh_a->wf->cbSize = extra_size;
                 if (extra_size > 0)
-                    memcpy(((char *)sh_a->wf) + sizeof(WAVEFORMATEX),
+                    memcpy(sh_a->wf + 1,
                            pack.packet + 142, extra_size);
 
                 ogg_d->subs[ogg_d->num_sub].samplerate = sh_a->samplerate; // * sh_a->channels;
@@ -1027,8 +1027,8 @@ int demux_ogg_open(demuxer_t *demuxer)
             /// New video header
             if (strncmp(st->streamtype, "video", 5) == 0) {
                 sh_v = new_sh_video_vid(demuxer, ogg_d->num_sub, n_video);
-                sh_v->bih         = calloc(1, sizeof(BITMAPINFOHEADER));
-                sh_v->bih->biSize = sizeof(BITMAPINFOHEADER);
+                sh_v->bih         = calloc(1, sizeof(*sh_v->bih));
+                sh_v->bih->biSize = sizeof(*sh_v->bih);
                 sh_v->bih->biCompression = sh_v->format = mmioFOURCC(st->subtype[0], st->subtype[1],
                                                                      st->subtype[2], st->subtype[3]);
                 sh_v->frametime = AV_RL64(&st->time_unit) * 0.0000001;
@@ -1070,7 +1070,7 @@ int demux_ogg_open(demuxer_t *demuxer)
                 }
 
                 sh_a = new_sh_audio_aid(demuxer, ogg_d->num_sub, n_audio, NULL);
-                sh_a->wf         = calloc(1, sizeof(WAVEFORMATEX) + extra_size);
+                sh_a->wf         = calloc(1, sizeof(*sh_a->wf) + extra_size);
                 sh_a->format     = sh_a->wf->wFormatTag = strtol(buffer, NULL, 16);
                 sh_a->channels   = sh_a->wf->nChannels  = AV_RL16(&st->sh.audio.channels);
                 sh_a->samplerate = sh_a->wf->nSamplesPerSec = AV_RL64(&st->samples_per_unit);
@@ -1080,7 +1080,7 @@ int demux_ogg_open(demuxer_t *demuxer)
                 sh_a->samplesize = (sh_a->wf->wBitsPerSample + 7) / 8;
                 sh_a->wf->cbSize = extra_size;
                 if (extra_size)
-                    memcpy(((char *)sh_a->wf)+sizeof(WAVEFORMATEX),
+                    memcpy(sh_a->wf+1,
                            ((char *)(st+1))+extra_offset, extra_size);
 
                 ogg_d->subs[ogg_d->num_sub].samplerate = sh_a->samplerate; // * sh_a->channels;

Modified: trunk/libmpdemux/demux_smjpeg.c
==============================================================================
--- trunk/libmpdemux/demux_smjpeg.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpdemux/demux_smjpeg.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -129,7 +129,7 @@ static demuxer_t* demux_open_smjpeg(demu
 	    demuxer->video->sh = sh_video;
 	    sh_video->ds = demuxer->video;
 
-	    sh_video->bih = calloc(1, sizeof(BITMAPINFOHEADER));
+	    sh_video->bih = calloc(1, sizeof(*sh_video->bih));
 
 	    stream_skip(demuxer->stream, 4); /* number of frames */
 //	    sh_video->fps = 24;
@@ -153,7 +153,7 @@ static demuxer_t* demux_open_smjpeg(demu
 	    demuxer->audio->sh = sh_audio;
 	    sh_audio->ds = demuxer->audio;
 
-	    sh_audio->wf = calloc(1, sizeof(WAVEFORMATEX));
+	    sh_audio->wf = calloc(1, sizeof(*sh_audio->wf));
 
 	    sh_audio->samplerate = stream_read_word(demuxer->stream);
 	    sh_audio->wf->wBitsPerSample = stream_read_char(demuxer->stream);

Modified: trunk/libmpdemux/demux_ts.c
==============================================================================
--- trunk/libmpdemux/demux_ts.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpdemux/demux_ts.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -358,7 +358,7 @@ static void ts_add_stream(demuxer_t * de
 
 		if(es->extradata && es->extradata_len)
 		{
-			sh->wf = malloc(sizeof (WAVEFORMATEX) + es->extradata_len);
+			sh->wf = malloc(sizeof (MPWAVEFORMATEX) + es->extradata_len);
 			sh->wf->cbSize = es->extradata_len;
 			memcpy(sh->wf + 1, es->extradata, es->extradata_len);
 		}
@@ -382,8 +382,8 @@ static void ts_add_stream(demuxer_t * de
 			if(sh->format == VIDEO_AVC && es->extradata && es->extradata_len)
 			{
 				int w = 0, h = 0;
-				sh->bih = calloc(1, sizeof(BITMAPINFOHEADER) + es->extradata_len);
-				sh->bih->biSize= sizeof(BITMAPINFOHEADER) + es->extradata_len;
+				sh->bih = calloc(1, sizeof(*sh->bih) + es->extradata_len);
+				sh->bih->biSize= sizeof(*sh->bih) + es->extradata_len;
 				sh->bih->biCompression = sh->format;
 				memcpy(sh->bih + 1, es->extradata, es->extradata_len);
 				mp_msg(MSGT_DEMUXER,MSGL_DBG2, "EXTRADATA(%d BYTES): \n", es->extradata_len);

Modified: trunk/libmpdemux/demux_y4m.c
==============================================================================
--- trunk/libmpdemux/demux_y4m.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpdemux/demux_y4m.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -255,7 +255,7 @@ static demuxer_t* demux_open_y4m(demuxer
     priv->framenum = 0;
     priv->si = malloc(sizeof(y4m_stream_info_t));
 
-    sh->bih=calloc(1, sizeof(BITMAPINFOHEADER));
+    sh->bih=calloc(1, sizeof(*sh->bih));
 
     demuxer->video->sh=sh;
     sh->ds=demuxer->video;

Modified: trunk/libmpdemux/muxer_avi.c
==============================================================================
--- trunk/libmpdemux/muxer_avi.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpdemux/muxer_avi.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -270,7 +270,7 @@ static void write_avi_list(stream_t *str
   stream_write_buffer(stream, &le_id, 4);
 }
 
-#define WFSIZE(wf) (sizeof(WAVEFORMATEX)+(wf)->cbSize)
+#define WFSIZE(wf) (sizeof(*wf)+(wf)->cbSize)
 
 static void avifile_write_header(muxer_t *muxer){
   uint32_t riff[3];

Modified: trunk/libmpdemux/video.c
==============================================================================
--- trunk/libmpdemux/video.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/libmpdemux/video.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -384,12 +384,12 @@ mpeg_header_parser:
    }
 
    if(mp_vc1_decode_sequence_header(&picture, &videobuffer[4], videobuf_len-4)) {
-     sh_video->bih = calloc(1, sizeof(BITMAPINFOHEADER) + videobuf_len);
+     sh_video->bih = calloc(1, sizeof(*sh_video->bih) + videobuf_len);
      if(sh_video->bih == NULL) {
-       mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Couldn't alloc %d bytes for VC-1 extradata!\n", sizeof(BITMAPINFOHEADER) + videobuf_len);
+       mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Couldn't alloc %d bytes for VC-1 extradata!\n", sizeof(*sh_video->bih) + videobuf_len);
        return 0;
      }
-     sh_video->bih->biSize= sizeof(BITMAPINFOHEADER) + videobuf_len;
+     sh_video->bih->biSize= sizeof(*sh_video->bih) + videobuf_len;
      memcpy(sh_video->bih + 1, videobuffer, videobuf_len);
      sh_video->bih->biCompression = sh_video->format;
      sh_video->bih->biWidth = sh_video->disp_w = picture.display_picture_width;

Modified: trunk/stream/tv.c
==============================================================================
--- trunk/stream/tv.c	Sun Sep 12 14:49:28 2010	(r32188)
+++ trunk/stream/tv.c	Sun Sep 12 15:01:05 2010	(r32189)
@@ -809,7 +809,7 @@ static demuxer_t* demux_open_tv(demuxer_
 	    sh_audio->channels;
 
 	// emulate WF for win32 codecs:
-	sh_audio->wf = malloc(sizeof(WAVEFORMATEX));
+	sh_audio->wf = malloc(sizeof(*sh_audio->wf));
 	sh_audio->wf->wFormatTag = sh_audio->format;
 	sh_audio->wf->nChannels = sh_audio->channels;
 	sh_audio->wf->wBitsPerSample = sh_audio->samplesize * 8;


More information about the MPlayer-cvslog mailing list