Mercurial > mplayer.hg
comparison libmpcodecs/ve_x264.c @ 30642:a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
author | diego |
---|---|
date | Sun, 21 Feb 2010 15:48:03 +0000 |
parents | 58e73accaeb7 |
children | 7ac542b9ca24 |
comparison
equal
deleted
inserted
replaced
30641:b14b32c20935 | 30642:a972c1a4a012 |
---|---|
57 extern char* passtmpfile; | 57 extern char* passtmpfile; |
58 static int turbo = 0; | 58 static int turbo = 0; |
59 static x264_param_t param; | 59 static x264_param_t param; |
60 static int parse_error = 0; | 60 static int parse_error = 0; |
61 | 61 |
62 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts); | 62 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts); |
63 static int encode_frame(struct vf_instance_s *vf, x264_picture_t *pic_in); | 63 static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in); |
64 | 64 |
65 void x264enc_set_param(const m_option_t* opt, char* arg) | 65 void x264enc_set_param(const m_option_t* opt, char* arg) |
66 { | 66 { |
67 static int initted = 0; | 67 static int initted = 0; |
68 if(!initted) { | 68 if(!initted) { |
132 param.analyse.i_trellis = 0; | 132 param.analyse.i_trellis = 0; |
133 } | 133 } |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) { | 137 static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) { |
138 h264_module_t *mod=(h264_module_t*)vf->priv; | 138 h264_module_t *mod=(h264_module_t*)vf->priv; |
139 | 139 |
140 if(parse_error) | 140 if(parse_error) |
141 return 0; | 141 return 0; |
142 | 142 |
191 mod->mux->decoder_delay = param.i_bframe ? 1 : 0; | 191 mod->mux->decoder_delay = param.i_bframe ? 1 : 0; |
192 | 192 |
193 return 1; | 193 return 1; |
194 } | 194 } |
195 | 195 |
196 static int control(struct vf_instance_s* vf, int request, void *data) | 196 static int control(struct vf_instance *vf, int request, void *data) |
197 { | 197 { |
198 h264_module_t *mod=(h264_module_t*)vf->priv; | 198 h264_module_t *mod=(h264_module_t*)vf->priv; |
199 switch(request){ | 199 switch(request){ |
200 case VFCTRL_FLUSH_FRAMES: | 200 case VFCTRL_FLUSH_FRAMES: |
201 while (x264_encoder_delayed_frames(mod->x264) > 0) | 201 while (x264_encoder_delayed_frames(mod->x264) > 0) |
204 default: | 204 default: |
205 return CONTROL_UNKNOWN; | 205 return CONTROL_UNKNOWN; |
206 } | 206 } |
207 } | 207 } |
208 | 208 |
209 static int query_format(struct vf_instance_s* vf, unsigned int fmt) | 209 static int query_format(struct vf_instance *vf, unsigned int fmt) |
210 { | 210 { |
211 switch(fmt) { | 211 switch(fmt) { |
212 case IMGFMT_I420: | 212 case IMGFMT_I420: |
213 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; | 213 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; |
214 case IMGFMT_YV12: | 214 case IMGFMT_YV12: |
223 return 0; /* VFCAP_CSP_SUPPORTED */ | 223 return 0; /* VFCAP_CSP_SUPPORTED */ |
224 } | 224 } |
225 return 0; | 225 return 0; |
226 } | 226 } |
227 | 227 |
228 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts) | 228 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) |
229 { | 229 { |
230 h264_module_t *mod=(h264_module_t*)vf->priv; | 230 h264_module_t *mod=(h264_module_t*)vf->priv; |
231 int i; | 231 int i; |
232 | 232 |
233 memset(&mod->pic, 0, sizeof(x264_picture_t)); | 233 memset(&mod->pic, 0, sizeof(x264_picture_t)); |
241 mod->pic.i_type = X264_TYPE_AUTO; | 241 mod->pic.i_type = X264_TYPE_AUTO; |
242 | 242 |
243 return encode_frame(vf, &mod->pic) >= 0; | 243 return encode_frame(vf, &mod->pic) >= 0; |
244 } | 244 } |
245 | 245 |
246 static int encode_frame(struct vf_instance_s *vf, x264_picture_t *pic_in) | 246 static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in) |
247 { | 247 { |
248 h264_module_t *mod=(h264_module_t*)vf->priv; | 248 h264_module_t *mod=(h264_module_t*)vf->priv; |
249 x264_picture_t pic_out; | 249 x264_picture_t pic_out; |
250 x264_nal_t *nal; | 250 x264_nal_t *nal; |
251 int i_nal; | 251 int i_nal; |
269 ++mod->mux->encoder_delay; | 269 ++mod->mux->encoder_delay; |
270 | 270 |
271 return i_size; | 271 return i_size; |
272 } | 272 } |
273 | 273 |
274 static void uninit(struct vf_instance_s *vf) | 274 static void uninit(struct vf_instance *vf) |
275 { | 275 { |
276 h264_module_t *mod=(h264_module_t*)vf->priv; | 276 h264_module_t *mod=(h264_module_t*)vf->priv; |
277 if (mod->x264) | 277 if (mod->x264) |
278 x264_encoder_close(mod->x264); | 278 x264_encoder_close(mod->x264); |
279 } | 279 } |