GstH264Encoder *h264_encoder = GST_H264_ENCODER(encoder);
GstH264EncoderPrivate *h264_prv = GST_H264_ENCODER_GET_PRIVATE(h264_encoder);
GstVaapiVideoBuffer *return_buf = NULL;
- GstVaapiVideoBuffer *tmp_next_buf = NULL;
//guint64 pts = 0;
if (NULL == display_buf && g_queue_is_empty(h264_prv->queued_buffers)) {
va_status = vaCreateBuffer(va_dpy, context_id,
VAEncSequenceParameterBufferType,
sizeof(seq_h264), 1, &seq_h264, &h264_prv->seq_parameter);
- ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS == va_status, ENCODER_ENC_RES_ERR, "alloc seq-buffer failed.\n");
+ ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS == va_status,
+ ENCODER_ENC_RES_ERR, "alloc seq-buffer failed.");
va_status = vaRenderPicture(va_dpy, context_id, &h264_prv->seq_parameter, 1);
- ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS == va_status, ENCODER_PICTURE_ERR, "vaRenderPicture seq-parameters failed.\n");
+ ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS == va_status,
+ ENCODER_PICTURE_ERR, "vaRenderPicture seq-parameters failed.");
}
/* set pic_parameters*/
if (!h264_prv->ref_surface1) {
h264_prv->ref_surface1 = gst_vaapi_context_get_surface(context);
- ENCODER_CHECK_STATUS(h264_prv->ref_surface1, ENCODER_SURFACE_ERR, "reference surface, h264_pop_free_surface failed.\n");
+ ENCODER_CHECK_STATUS(h264_prv->ref_surface1, ENCODER_SURFACE_ERR,
+ "reference surface, h264_pop_free_surface failed.");
}
if (!h264_prv->recon_surface) {
h264_prv->recon_surface = gst_vaapi_context_get_surface(context);
- ENCODER_CHECK_STATUS(h264_prv->recon_surface, ENCODER_SURFACE_ERR, "reconstructed surface, h264_pop_free_surface failed.\n");
+ ENCODER_CHECK_STATUS(h264_prv->recon_surface, ENCODER_SURFACE_ERR,
+ "reconstructed surface, h264_pop_free_surface failed.");
}
pic_h264.reference_picture = GST_VAAPI_OBJECT_ID(h264_prv->ref_surface1);
va_status = vaCreateBuffer(va_dpy, context_id, VAEncPictureParameterBufferType,
sizeof(pic_h264), 1, &pic_h264, &h264_prv->pic_parameter);
- ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS ==va_status, ENCODER_PICTURE_ERR, "creating pic-param buffer failed.\n");
+ ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS ==va_status,
+ ENCODER_PICTURE_ERR, "creating pic-param buffer failed.");
va_status = vaRenderPicture(va_dpy, context_id, &h264_prv->pic_parameter, 1);
- ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS ==va_status, ENCODER_PICTURE_ERR, "rendering pic-param buffer failed.\n");
+ ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS ==va_status,
+ ENCODER_PICTURE_ERR, "rendering pic-param buffer failed.");
/* set slice parameters, support multiple slices */
int i = 0;
h264_encoder->slice_num,
h264_prv->slice_param_buffers,
&h264_prv->slice_parameter);
- ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS ==va_status, ENCODER_PICTURE_ERR, "creating slice-parameters buffer failed.\n");
+ ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS ==va_status,
+ ENCODER_PICTURE_ERR, "creating slice-parameters buffer failed.");
va_status = vaRenderPicture(va_dpy, context_id, &h264_prv->slice_parameter, 1);
- ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS ==va_status, ENCODER_PICTURE_ERR, "rendering slice-parameters buffer failed.\n");
+ ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS ==va_status,
+ ENCODER_PICTURE_ERR, "rendering slice-parameters buffer failed.");
/*after finished, set ref_surface1_index, recon_surface_index */
GstVaapiSurface *swap = h264_prv->ref_surface1;
else if (h264_encoder->init_qp == -2)
seq_h264.rate_control_method = BR_VBR;
else {
- assert(h264_encoder->init_qp >= 0 && h264_encoder->init_qp <= 51);
+ ENCODER_ASSERT(h264_encoder->init_qp >= 0 && h264_encoder->init_qp <= 51);
seq_h264.rate_control_method = BR_CQP;
}
sizeof(seq_h264), 1,
&seq_h264, &h264_prv->seq_parameter);
ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS == va_status,
- FALSE, "alloc seq-buffer failed.\n");
+ FALSE, "alloc seq-buffer failed.");
/*pack sps header buffer/data */
if (NULL == h264_prv->sps_data) {
frame_type = "P";
if (h264_prv->cur_slice_type == SLICE_TYPE_B)
frame_type = "B";
- ENCODER_LOG_INFO("type:%s, frame_num:%d, display_num:%d\n",
+ ENCODER_LOG_INFO("type:%s, frame_num:%d, display_num:%d",
frame_type, pic_h264.frame_num, pic_h264.CurrPic.TopFieldOrderCnt);
if (VA_INVALID_ID != h264_prv->pic_parameter) { /* share the same pic_parameter*/
va_status = vaCreateBuffer(va_dpy, context_id, VAEncPictureParameterBufferType,
sizeof(pic_h264), 1, &pic_h264, &h264_prv->pic_parameter);
- ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS ==va_status, FALSE, "creating pic-param buffer failed.\n");
+ ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS ==va_status,
+ FALSE, "creating pic-param buffer failed.");
//if (NULL == h264_prv->pps_data) {
if (VA_INVALID_ID == h264_prv->packed_pps_data_buf) {
h264_encoder->slice_num,
h264_prv->slice_param_buffers,
&h264_prv->slice_parameter);
- ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS ==va_status, FALSE, "creating slice-parameters buffer failed.\n");
+ ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS ==va_status,
+ FALSE, "creating slice-parameters buffer failed.");
end:
return ret;
if (!h264_prv->ref_surface1) {
h264_prv->ref_surface1 = gst_vaapi_context_get_surface(context);
- ENCODER_CHECK_STATUS(h264_prv->ref_surface1, ENCODER_SURFACE_ERR, "reference surface, h264_pop_free_surface failed.\n");
+ ENCODER_CHECK_STATUS(h264_prv->ref_surface1,
+ ENCODER_SURFACE_ERR,
+ "reference surface, h264_pop_free_surface failed.");
}
if (!h264_prv->ref_surface2) {
h264_prv->ref_surface2 = gst_vaapi_context_get_surface(context);
- ENCODER_CHECK_STATUS(h264_prv->ref_surface2, ENCODER_SURFACE_ERR, "reference surface, h264_pop_free_surface failed.\n");
+ ENCODER_CHECK_STATUS(h264_prv->ref_surface2,
+ ENCODER_SURFACE_ERR,
+ "reference surface, h264_pop_free_surface failed.");
}
if (!h264_prv->recon_surface) {
h264_prv->recon_surface = gst_vaapi_context_get_surface(context);
- ENCODER_CHECK_STATUS(h264_prv->recon_surface, ENCODER_SURFACE_ERR, "reconstructed surface, h264_pop_free_surface failed.\n");
+ ENCODER_CHECK_STATUS(h264_prv->recon_surface,
+ ENCODER_SURFACE_ERR,
+ "reconstructed surface, h264_pop_free_surface failed.");
}
if (SLICE_TYPE_P == h264_prv->cur_slice_type) {
va_status = vaRenderPicture(va_dpy, context_id, va_buffers, va_buffers_count);
ENCODER_CHECK_STATUS(VA_STATUS_SUCCESS == va_status, ENCODER_PICTURE_ERR,
- "vaRenderH264Picture failed.\n");
+ "vaRenderH264Picture failed.");
/*after finished, swap recon and surface2*/
if (SLICE_TYPE_P == h264_prv->cur_slice_type ||
}
VAAPI_UNUSED_ARG(ret);
- ENCODER_CHECK_STATUS(TRUE == h264_bitstream_auto_grow(bitstream, bit_size), FALSE, "h264_bitstream_auto_grow failed.\n");
+ ENCODER_CHECK_STATUS(TRUE == h264_bitstream_auto_grow(bitstream, bit_size),
+ FALSE,
+ "h264_bitstream_auto_grow failed.");
byte_pos = (bitstream->bit_size>>3);
bit_offset = (bitstream->bit_size&0x07);
cur_byte = bitstream->buffer + byte_pos;
}
VAAPI_UNUSED_ARG(ret);
- ENCODER_CHECK_STATUS(TRUE == h264_bitstream_auto_grow(bitstream, byte_size<<3), FALSE, "h264_bitstream_auto_grow failed.\n");
+ ENCODER_CHECK_STATUS(TRUE == h264_bitstream_auto_grow(bitstream, byte_size<<3),
+ FALSE,
+ "h264_bitstream_auto_grow failed.");
if (0 == (bitstream->bit_size&0x07)) {
memcpy(&bitstream->buffer[bitstream->bit_size>>3], buf, byte_size);
bitstream->bit_size += (byte_size<<3);
++size_in_bits;
tmp_value >>= 1;
}
- ENCODER_CHECK_STATUS(h264_bitstream_write_uint(bitstream, 0, size_in_bits-1), FALSE, "h264_bitstream_write_ue failed.\n");
- ENCODER_CHECK_STATUS(h264_bitstream_write_uint(bitstream, value, size_in_bits), FALSE, "h264_bitstream_write_ue failed.\n");
+ ENCODER_CHECK_STATUS(h264_bitstream_write_uint(bitstream, 0, size_in_bits-1),
+ FALSE,
+ "h264_bitstream_write_ue failed.");
+ ENCODER_CHECK_STATUS(h264_bitstream_write_uint(bitstream, value, size_in_bits),
+ FALSE,
+ "h264_bitstream_write_ue failed.");
end:
return ret;
new_val = (value<<1) - 1;
}
- ENCODER_CHECK_STATUS(h264_bitstream_write_ue(bitstream, new_val), FALSE, "h264_bitstream_write_se failed.\n");
+ ENCODER_CHECK_STATUS(h264_bitstream_write_ue(bitstream, new_val),
+ FALSE,
+ "h264_bitstream_write_se failed.");
end:
return ret;