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/mpegvideo_enc.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libavcodec/mpegvideo_enc.c') diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 84e9dc8c58..ceced188a9 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1589,6 +1589,7 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, /* output? */ if (s->new_picture.f->data[0]) { + uint8_t *sd; if (!pkt->data && (ret = ff_alloc_packet(pkt, s->mb_width*s->mb_height*MAX_MB_BYTES)) < 0) return ret; @@ -1630,6 +1631,12 @@ vbv_retry: frame_end(s); + sd = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_FACTOR, + sizeof(int)); + if (!sd) + return AVERROR(ENOMEM); + *(int *)sd = s->current_picture.f->quality; + if (CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG) ff_mjpeg_encode_picture_trailer(&s->pb, s->header_bits); -- cgit v1.2.3