comparison libmpcodecs/ve_lavc.c @ 32103:04da24405c6c

Replace malloc+memset by calloc.
author reimar
date Sun, 12 Sep 2010 12:41:37 +0000
parents a735105a66b6
children c08363dc5320
comparison
equal deleted inserted replaced
32102:52f920e9c540 32103:04da24405c6c
926 vf->config=config; 926 vf->config=config;
927 vf->default_caps=VFCAP_CONSTANT; 927 vf->default_caps=VFCAP_CONSTANT;
928 vf->control=control; 928 vf->control=control;
929 vf->query_format=query_format; 929 vf->query_format=query_format;
930 vf->put_image=put_image; 930 vf->put_image=put_image;
931 vf->priv=malloc(sizeof(struct vf_priv_s)); 931 vf->priv=calloc(1, sizeof(struct vf_priv_s));
932 memset(vf->priv,0,sizeof(struct vf_priv_s));
933 vf->priv->mux=(muxer_stream_t*)args; 932 vf->priv->mux=(muxer_stream_t*)args;
934 933
935 /* XXX: hack: some of the MJPEG decoder DLL's needs exported huffman 934 /* XXX: hack: some of the MJPEG decoder DLL's needs exported huffman
936 table, so we define a zero-table, also lavc mjpeg encoder is putting 935 table, so we define a zero-table, also lavc mjpeg encoder is putting
937 huffman tables into the stream, so no problem */ 936 huffman tables into the stream, so no problem */
938 if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "mjpeg")) 937 if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "mjpeg"))
939 { 938 {
940 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)+28); 939 mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+28);
941 memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER)+28);
942 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+28; 940 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+28;
943 } 941 }
944 else if (lavc_param_vcodec && (!strcasecmp(lavc_param_vcodec, "huffyuv") 942 else if (lavc_param_vcodec && (!strcasecmp(lavc_param_vcodec, "huffyuv")
945 || !strcasecmp(lavc_param_vcodec, "ffvhuff"))) 943 || !strcasecmp(lavc_param_vcodec, "ffvhuff")))
946 { 944 {
947 /* XXX: hack: huffyuv needs to store huffman tables (allthough we dunno the size yet ...) */ 945 /* XXX: hack: huffyuv needs to store huffman tables (allthough we dunno the size yet ...) */
948 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)+1000); 946 mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+1000);
949 memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER)+1000);
950 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+1000; 947 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+1000;
951 } 948 }
952 else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "asv1")) 949 else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "asv1"))
953 { 950 {
954 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)+8); 951 mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+8);
955 memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER)+8);
956 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+8; 952 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+8;
957 } 953 }
958 else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "asv2")) 954 else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "asv2"))
959 { 955 {
960 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)+8); 956 mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+8);
961 memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER)+8);
962 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+8; 957 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+8;
963 } 958 }
964 else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "wmv2")) 959 else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "wmv2"))
965 { 960 {
966 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)+4); 961 mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)+4);
967 memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER)+4);
968 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+4; 962 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+4;
969 } 963 }
970 else 964 else
971 { 965 {
972 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)); 966 mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER));
973 memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER));
974 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); 967 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER);
975 } 968 }
976 mux_v->bih->biWidth=0; 969 mux_v->bih->biWidth=0;
977 mux_v->bih->biHeight=0; 970 mux_v->bih->biHeight=0;
978 mux_v->bih->biPlanes=1; 971 mux_v->bih->biPlanes=1;