diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-07-15 18:41:21 +0100 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-07-20 15:06:47 +0100 |
commit | 5d3addb937946eca5391e40b5e6308e74ac6f77b (patch) | |
tree | e758d6b07dd07480a3b32901ccedc421d45b33c0 /libavcodec/mpegvideo_enc.c | |
parent | d6604b29ef544793479d7fb4e05ef6622bb3e534 (diff) | |
download | ffmpeg-5d3addb937946eca5391e40b5e6308e74ac6f77b.tar.gz |
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 <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 7 |
1 files changed, 7 insertions, 0 deletions
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); |