Mercurial > mplayer.hg
comparison libmpcodecs/ve_x264.c @ 17659:92ac78a93625
Fix video delay when encoding with B-frames.
Encoding delay is adjusted for on-the-fly during encoding.
Decoding delay is compensated for by setting an appropriate dwStart on
the audio stream (only in muxer_avi at this point).
author | corey |
---|---|
date | Tue, 21 Feb 2006 09:39:22 +0000 |
parents | f0e7712385dc |
children | a3dd033ec92e |
comparison
equal
deleted
inserted
replaced
17658:d407eb5bcd68 | 17659:92ac78a93625 |
---|---|
433 if(!mod->x264) { | 433 if(!mod->x264) { |
434 mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_open failed.\n"); | 434 mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_open failed.\n"); |
435 return 0; | 435 return 0; |
436 } | 436 } |
437 | 437 |
438 if (mod->param.i_bframe > 1 && mod->param.b_bframe_pyramid) | |
439 mod->mux->decoder_delay = 2; | |
440 else | |
441 mod->mux->decoder_delay = mod->param.i_bframe ? 1 : 0; | |
442 | |
438 return 1; | 443 return 1; |
439 } | 444 } |
440 | 445 |
441 static int control(struct vf_instance_s* vf, int request, void *data) | 446 static int control(struct vf_instance_s* vf, int request, void *data) |
442 { | 447 { |
509 int keyframe = (pic_out.i_type == X264_TYPE_IDR) || | 514 int keyframe = (pic_out.i_type == X264_TYPE_IDR) || |
510 (pic_out.i_type == X264_TYPE_I | 515 (pic_out.i_type == X264_TYPE_I |
511 && frame_ref == 1 && !bframe); | 516 && frame_ref == 1 && !bframe); |
512 muxer_write_chunk(mod->mux, i_size, keyframe?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); | 517 muxer_write_chunk(mod->mux, i_size, keyframe?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); |
513 } | 518 } |
519 else | |
520 ++mod->mux->encoder_delay; | |
514 | 521 |
515 return i_size; | 522 return i_size; |
516 } | 523 } |
517 | 524 |
518 static void uninit(struct vf_instance_s *vf) | 525 static void uninit(struct vf_instance_s *vf) |