diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2016-01-19 08:44:50 +0100 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2016-01-19 08:44:50 +0100 |
commit | ed9cff9edf0f7f48d66e5700d154f79394f535a2 (patch) | |
tree | 1aba91f6803131f1815de9e3e6b4821dad72e059 /libavcodec/qsvenc.c | |
parent | b5513441e477f63e9627ce6eb7c4cad475a4ba35 (diff) | |
parent | d1cd20e4e33f8139e150034b3c457302312d81bd (diff) | |
download | ffmpeg-ed9cff9edf0f7f48d66e5700d154f79394f535a2.tar.gz |
Merge commit 'd1cd20e4e33f8139e150034b3c457302312d81bd'
* commit 'd1cd20e4e33f8139e150034b3c457302312d81bd':
qsvenc: split encoding frames and reading from the async FIFO
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavcodec/qsvenc.c')
-rw-r--r-- | libavcodec/qsvenc.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 28a01398a5..960dd981ed 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -907,8 +907,8 @@ static void print_interlace_msg(AVCodecContext *avctx, QSVEncContext *q) } } -int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, - AVPacket *pkt, const AVFrame *frame, int *got_packet) +static int encode_frame(AVCodecContext *avctx, QSVEncContext *q, + const AVFrame *frame) { AVPacket new_pkt = { 0 }; mfxBitstream *bs; @@ -983,8 +983,24 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, av_freep(&bs); } + return 0; +} + +int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q, + AVPacket *pkt, const AVFrame *frame, int *got_packet) +{ + int ret; + + ret = encode_frame(avctx, q, frame); + if (ret < 0) + return ret; + if (!av_fifo_space(q->async_fifo) || (!frame && av_fifo_size(q->async_fifo))) { + AVPacket new_pkt; + mfxBitstream *bs; + mfxSyncPoint sync; + av_fifo_generic_read(q->async_fifo, &new_pkt, sizeof(new_pkt), NULL); av_fifo_generic_read(q->async_fifo, &sync, sizeof(sync), NULL); av_fifo_generic_read(q->async_fifo, &bs, sizeof(bs), NULL); |