summaryrefslogtreecommitdiff
path: root/libavcodec/qsvenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-07-09 11:17:12 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-07-09 11:17:12 +0200
commit96ee6b9962ec0479deddedd64a46aef4846d90ba (patch)
tree5e04e55a9a85d82b124c76fd4cb36ef948306dea /libavcodec/qsvenc.c
parent07ae8fa20ef202206157efebf0a09db9a9cb9634 (diff)
parent3a85397e8bb477eb34678d9edc52893f57003226 (diff)
Merge commit '3a85397e8bb477eb34678d9edc52893f57003226'
* commit '3a85397e8bb477eb34678d9edc52893f57003226': lavc: add Intel libmfx-based MPEG2 encoder Conflicts: Changelog configure libavcodec/allcodecs.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/qsvenc.c')
-rw-r--r--libavcodec/qsvenc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 066662410c..2e147b75c0 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -164,6 +164,7 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q)
(mfxExtBuffer*)&extradata,
};
+ int need_pps = avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO;
int ret;
q->param.ExtParam = ext_buffers;
@@ -175,19 +176,20 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q)
q->packet_size = q->param.mfx.BufferSizeInKB * 1000;
- if (!extradata.SPSBufSize || !extradata.PPSBufSize) {
+ if (!extradata.SPSBufSize || (need_pps && !extradata.PPSBufSize)) {
av_log(avctx, AV_LOG_ERROR, "No extradata returned from libmfx.\n");
return AVERROR_UNKNOWN;
}
- avctx->extradata = av_malloc(extradata.SPSBufSize + extradata.PPSBufSize +
+ avctx->extradata = av_malloc(extradata.SPSBufSize + need_pps * extradata.PPSBufSize +
FF_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return AVERROR(ENOMEM);
memcpy(avctx->extradata, sps_buf, extradata.SPSBufSize);
- memcpy(avctx->extradata + extradata.SPSBufSize, pps_buf, extradata.PPSBufSize);
- avctx->extradata_size = extradata.SPSBufSize + extradata.PPSBufSize;
+ if (need_pps)
+ memcpy(avctx->extradata + extradata.SPSBufSize, pps_buf, extradata.PPSBufSize);
+ avctx->extradata_size = extradata.SPSBufSize + need_pps * extradata.PPSBufSize;
memset(avctx->extradata + avctx->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
return 0;