Mercurial > mplayer.hg
changeset 32105:c08363dc5320
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.
author | reimar |
---|---|
date | Sun, 12 Sep 2010 13:01:05 +0000 |
parents | e24003316c1c |
children | 67f44db4fee9 |
files | 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/ve_raw.c libmpdemux/aviheader.c libmpdemux/demux_film.c libmpdemux/demux_mf.c libmpdemux/demux_mov.c libmpdemux/demux_nsv.c libmpdemux/demux_ogg.c libmpdemux/demux_smjpeg.c libmpdemux/demux_ts.c libmpdemux/demux_y4m.c libmpdemux/muxer_avi.c libmpdemux/video.c stream/tv.c |
diffstat | 20 files changed, 70 insertions(+), 70 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/ad_ffmpeg.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpcodecs/ad_ffmpeg.c Sun Sep 12 13:01:05 2010 +0000 @@ -126,7 +126,7 @@ 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); }
--- a/libmpcodecs/ae_pcm.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpcodecs/ae_pcm.c Sun Sep 12 13:01:05 2010 +0000 @@ -37,7 +37,7 @@ { 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;
--- a/libmpcodecs/vd_ffmpeg.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpcodecs/vd_ffmpeg.c Sun Sep 12 13:01:05 2010 +0000 @@ -373,10 +373,10 @@ /* 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 @@ (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 @@ 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 @@ 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,
--- a/libmpcodecs/vd_qtvideo.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpcodecs/vd_qtvideo.c Sun Sep 12 13:01:05 2010 +0000 @@ -98,7 +98,7 @@ // 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)
--- a/libmpcodecs/vd_realvid.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpcodecs/vd_realvid.c Sun Sep 12 13:01:05 2010 +0000 @@ -263,11 +263,11 @@ 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
--- a/libmpcodecs/ve_lavc.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpcodecs/ve_lavc.c Sun Sep 12 13:01:05 2010 +0000 @@ -704,9 +704,9 @@ 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 @@ 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;
--- a/libmpcodecs/ve_qtvideo.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpcodecs/ve_qtvideo.c Sun Sep 12 13:01:05 2010 +0000 @@ -302,8 +302,8 @@ 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;
--- a/libmpcodecs/ve_raw.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpcodecs/ve_raw.c Sun Sep 12 13:01:05 2010 +0000 @@ -159,8 +159,8 @@ 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;
--- a/libmpdemux/aviheader.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpdemux/aviheader.c Sun Sep 12 13:01:05 2010 +0000 @@ -266,12 +266,12 @@ 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 @@ } } 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 &&
--- a/libmpdemux/demux_film.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpdemux/demux_film.c Sun Sep 12 13:01:05 2010 +0000 @@ -326,7 +326,7 @@ 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 @@ 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;
--- a/libmpdemux/demux_mf.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpdemux/demux_mf.c Sun Sep 12 13:01:05 2010 +0000 @@ -160,7 +160,7 @@ 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;
--- a/libmpdemux/demux_mov.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpdemux/demux_mov.c Sun Sep 12 13:01:05 2010 +0000 @@ -916,7 +916,7 @@ 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 @@ // 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 @@ 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; } }
--- a/libmpdemux/demux_nsv.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpdemux/demux_nsv.c Sun Sep 12 13:01:05 2010 +0000 @@ -226,8 +226,8 @@ // 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);
--- a/libmpdemux/demux_ogg.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpdemux/demux_ogg.c Sun Sep 12 13:01:05 2010 +0000 @@ -719,7 +719,7 @@ 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 @@ } 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 @@ 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 @@ 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 @@ // 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 @@ 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 @@ 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 @@ /// 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 @@ } 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 @@ 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;
--- a/libmpdemux/demux_smjpeg.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpdemux/demux_smjpeg.c Sun Sep 12 13:01:05 2010 +0000 @@ -129,7 +129,7 @@ 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 @@ 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);
--- a/libmpdemux/demux_ts.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpdemux/demux_ts.c Sun Sep 12 13:01:05 2010 +0000 @@ -358,7 +358,7 @@ 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 @@ 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);
--- a/libmpdemux/demux_y4m.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpdemux/demux_y4m.c Sun Sep 12 13:01:05 2010 +0000 @@ -255,7 +255,7 @@ 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;
--- a/libmpdemux/muxer_avi.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpdemux/muxer_avi.c Sun Sep 12 13:01:05 2010 +0000 @@ -270,7 +270,7 @@ 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];
--- a/libmpdemux/video.c Sun Sep 12 12:49:28 2010 +0000 +++ b/libmpdemux/video.c Sun Sep 12 13:01:05 2010 +0000 @@ -384,12 +384,12 @@ } 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;
--- a/stream/tv.c Sun Sep 12 12:49:28 2010 +0000 +++ b/stream/tv.c Sun Sep 12 13:01:05 2010 +0000 @@ -809,7 +809,7 @@ 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;