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/svq1enc.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libavcodec/svq1enc.c') diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 82e2f74bc4..ebbc54e589 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -569,6 +569,7 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, { SVQ1EncContext *const s = avctx->priv_data; int i, ret; + uint8_t *sd; if (!pkt->data && (ret = av_new_packet(pkt, s->y_block_width * s->y_block_height * @@ -611,6 +612,11 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, avctx->coded_frame->pict_type = s->pict_type; avctx->coded_frame->key_frame = s->pict_type == AV_PICTURE_TYPE_I; + sd = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_FACTOR, sizeof(int)); + if (!sd) + return AVERROR(ENOMEM); + *(int *)sd = pict->quality; + svq1_write_header(s, s->pict_type); for (i = 0; i < 3; i++) if (svq1_encode_plane(s, i, -- cgit v1.2.3