From 5d3addb937946eca5391e40b5e6308e74ac6f77b Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Wed, 15 Jul 2015 18:41:21 +0100 Subject: Add a quality factor packet side data This is necessary to preserve the quality information currently exported with coded_frame. Add the new side data to every encoder that needs it, and use it in avconv. Signed-off-by: Vittorio Giovara --- libavcodec/libxavs.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libavcodec/libxavs.c') diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c index 9b80243..0cabe63 100644 --- a/libavcodec/libxavs.c +++ b/libavcodec/libxavs.c @@ -119,6 +119,7 @@ static int XAVS_frame(AVCodecContext *avctx, AVPacket *pkt, xavs_nal_t *nal; int nnal, i, ret; xavs_picture_t pic_out; + uint8_t *sd; x4->pic.img.i_csp = XAVS_CSP_I420; x4->pic.img.i_plane = 3; @@ -193,6 +194,11 @@ static int XAVS_frame(AVCodecContext *avctx, AVPacket *pkt, avctx->coded_frame->quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA; + sd = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_FACTOR, sizeof(int)); + if (!sd) + return AVERROR(ENOMEM); + *(int *)sd = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA; + x4->out_frame_count++; *got_packet = ret; return 0; -- cgit v1.1