/*
* H.264 encoding using the x264 library
- * Copyright (C) 2005 Måns Rullgård <mru@inprovide.com>
+ * Copyright (C) 2005 Mans Rullgard <mru@inprovide.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
static int
-encode_nals(u_char *buf, int size, x264_nal_t *nals, int nnal)
+encode_nals(uint8_t *buf, int size, x264_nal_t *nals, int nnal)
{
- u_char *p = buf;
+ uint8_t *p = buf;
int i;
for(i = 0; i < nnal; i++){
break;
}
- x4->out_pic.key_frame = x4->out_pic.key_frame == FF_I_TYPE;
+ x4->out_pic.key_frame = pic_out.i_type == X264_TYPE_IDR;
+ x4->out_pic.quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA;
return bufsize;
}
x4->params.i_keyint_max = avctx->gop_size;
x4->params.rc.i_bitrate = avctx->bit_rate / 1000;
- x4->params.rc.i_rc_buffer_size = avctx->rc_buffer_size / 1000;
+ x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000;
if(avctx->rc_buffer_size)
x4->params.rc.b_cbr = 1;
+ x4->params.i_bframe = avctx->max_b_frames;
+ x4->params.b_cabac = avctx->coder_type == FF_CODER_TYPE_AC;
+
x4->params.rc.i_qp_min = avctx->qmin;
x4->params.rc.i_qp_max = avctx->qmax;
x4->params.rc.i_qp_step = avctx->max_qdiff;
+ if(avctx->flags & CODEC_FLAG_QSCALE && avctx->global_quality > 0)
+ x4->params.rc.i_qp_constant =
+ 12 + 6 * log2((double) avctx->global_quality / FF_QP2LAMBDA);
+
x4->params.i_width = avctx->width;
x4->params.i_height = avctx->height;
x4->params.vui.i_sar_width = avctx->sample_aspect_ratio.num;
x4->params.vui.i_sar_height = avctx->sample_aspect_ratio.den;
- x4->params.i_fps_num = avctx->frame_rate;
- x4->params.i_fps_den = avctx->frame_rate_base;
+ x4->params.i_fps_num = avctx->time_base.den;
+ x4->params.i_fps_den = avctx->time_base.num;
x4->enc = x264_encoder_open(&x4->params);
if(!x4->enc)