comparison libmpcodecs/ve_x264.c @ 29263:0f1b5b68af32

whitespace cosmetics: Remove all trailing whitespace.
author diego
date Wed, 13 May 2009 02:58:57 +0000
parents 63630c09e237
children 0b61e12a6ca2
comparison
equal deleted inserted replaced
29262:7d545a6b8aff 29263:0f1b5b68af32
156 156
157 mod->mux->bih->biWidth = width; 157 mod->mux->bih->biWidth = width;
158 mod->mux->bih->biHeight = height; 158 mod->mux->bih->biHeight = height;
159 mod->mux->bih->biSizeImage = width * height * 3; 159 mod->mux->bih->biSizeImage = width * height * 3;
160 mod->mux->aspect = (float)d_width/d_height; 160 mod->mux->aspect = (float)d_width/d_height;
161 161
162 // make sure param is initialized 162 // make sure param is initialized
163 x264enc_set_param(NULL, ""); 163 x264enc_set_param(NULL, "");
164 param.i_width = width; 164 param.i_width = width;
165 param.i_height = height; 165 param.i_height = height;
166 param.i_fps_num = mod->mux->h.dwRate; 166 param.i_fps_num = mod->mux->h.dwRate;
179 break; 179 break;
180 default: 180 default:
181 mp_msg(MSGT_MENCODER, MSGL_ERR, "Wrong colorspace.\n"); 181 mp_msg(MSGT_MENCODER, MSGL_ERR, "Wrong colorspace.\n");
182 return 0; 182 return 0;
183 } 183 }
184 184
185 mod->x264 = x264_encoder_open(&param); 185 mod->x264 = x264_encoder_open(&param);
186 if(!mod->x264) { 186 if(!mod->x264) {
187 mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_open failed.\n"); 187 mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_open failed.\n");
188 return 0; 188 return 0;
189 } 189 }
204 204
205 mod->mux->bih= realloc(mod->mux->bih, sizeof(BITMAPINFOHEADER) + extradata_size); 205 mod->mux->bih= realloc(mod->mux->bih, sizeof(BITMAPINFOHEADER) + extradata_size);
206 memcpy(mod->mux->bih + 1, extradata, extradata_size); 206 memcpy(mod->mux->bih + 1, extradata, extradata_size);
207 mod->mux->bih->biSize= sizeof(BITMAPINFOHEADER) + extradata_size; 207 mod->mux->bih->biSize= sizeof(BITMAPINFOHEADER) + extradata_size;
208 } 208 }
209 209
210 if (param.i_bframe > 1 && param.b_bframe_pyramid) 210 if (param.i_bframe > 1 && param.b_bframe_pyramid)
211 mod->mux->decoder_delay = 2; 211 mod->mux->decoder_delay = 2;
212 else 212 else
213 mod->mux->decoder_delay = param.i_bframe ? 1 : 0; 213 mod->mux->decoder_delay = param.i_bframe ? 1 : 0;
214 214
215 return 1; 215 return 1;
216 } 216 }
217 217
218 static int control(struct vf_instance_s* vf, int request, void *data) 218 static int control(struct vf_instance_s* vf, int request, void *data)
219 { 219 {
249 249
250 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts) 250 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts)
251 { 251 {
252 h264_module_t *mod=(h264_module_t*)vf->priv; 252 h264_module_t *mod=(h264_module_t*)vf->priv;
253 int i; 253 int i;
254 254
255 memset(&mod->pic, 0, sizeof(x264_picture_t)); 255 memset(&mod->pic, 0, sizeof(x264_picture_t));
256 mod->pic.img.i_csp=param.i_csp; 256 mod->pic.img.i_csp=param.i_csp;
257 mod->pic.img.i_plane=3; 257 mod->pic.img.i_plane=3;
258 for(i=0; i<4; i++) { 258 for(i=0; i<4; i++) {
259 mod->pic.img.plane[i] = mpi->planes[i]; 259 mod->pic.img.plane[i] = mpi->planes[i];
276 276
277 if(x264_encoder_encode(mod->x264, &nal, &i_nal, pic_in, &pic_out) < 0) { 277 if(x264_encoder_encode(mod->x264, &nal, &i_nal, pic_in, &pic_out) < 0) {
278 mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_encode failed\n"); 278 mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_encode failed\n");
279 return -1; 279 return -1;
280 } 280 }
281 281
282 for(i=0; i < i_nal; i++) { 282 for(i=0; i < i_nal; i++) {
283 int i_data = mod->mux->buffer_size - i_size; 283 int i_data = mod->mux->buffer_size - i_size;
284 i_size += x264_nal_encode(mod->mux->buffer + i_size, &i_data, 1, &nal[i]); 284 i_size += x264_nal_encode(mod->mux->buffer + i_size, &i_data, 1, &nal[i]);
285 } 285 }
286 if(i_size>0) { 286 if(i_size>0) {