diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 19fa791..b238a52 100644
|
a
|
b
|
typedef struct QSVContext {
|
| 104 | 104 | int suggest_pool_size; |
| 105 | 105 | int initialized; |
| 106 | 106 | |
| | 107 | int flush; |
| | 108 | |
| 107 | 109 | // options set by the caller |
| 108 | 110 | int async_depth; |
| 109 | 111 | int iopattern; |
| … |
… |
static int qsv_decode_init_context(AVCodecContext *avctx, QSVContext *q, mfxVide
|
| 412 | 414 | |
| 413 | 415 | q->frame_info = param->mfx.FrameInfo; |
| 414 | 416 | |
| | 417 | q->flush = 0; |
| | 418 | |
| 415 | 419 | if (!avctx->hw_frames_ctx) { |
| 416 | 420 | ret = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(avctx->coded_width, 128), FFALIGN(avctx->coded_height, 64), 1); |
| 417 | 421 | if (ret < 0) |
| … |
… |
static int qsv_process_data(AVCodecContext *avctx, QSVContext *q,
|
| 1057 | 1061 | q->initialized = 1; |
| 1058 | 1062 | } |
| 1059 | 1063 | |
| | 1064 | if (q->flush) { |
| | 1065 | q->reinit_flag = 0; |
| | 1066 | ret = qsv_decode_header(avctx, q, pkt, pix_fmt, ¶m); |
| | 1067 | if (ret < 0) { |
| | 1068 | if (ret == AVERROR(EAGAIN)) |
| | 1069 | av_log(avctx, AV_LOG_VERBOSE, "More data is required to decode header\n"); |
| | 1070 | else |
| | 1071 | av_log(avctx, AV_LOG_ERROR, "Error decoding header\n"); |
| | 1072 | goto reinit_fail; |
| | 1073 | } |
| | 1074 | |
| | 1075 | q->orig_pix_fmt = avctx->pix_fmt = ff_qsv_map_fourcc(param.mfx.FrameInfo.FourCC); |
| | 1076 | q->flush = 0; |
| | 1077 | } |
| | 1078 | |
| 1060 | 1079 | return qsv_decode(avctx, q, frame, got_frame, pkt); |
| 1061 | 1080 | |
| 1062 | 1081 | reinit_fail: |
| … |
… |
static void qsv_decode_flush(AVCodecContext *avctx)
|
| 1209 | 1228 | |
| 1210 | 1229 | qsv_clear_buffers(s); |
| 1211 | 1230 | |
| | 1231 | if (s->qsv.session) { |
| | 1232 | mfxVideoParam param = { 0 }; |
| | 1233 | |
| | 1234 | int ret = MFXVideoDECODE_GetVideoParam(s->qsv.session, ¶m); |
| | 1235 | if (ret < 0) { |
| | 1236 | ff_qsv_print_error(avctx, ret, "MFX decode get param error"); |
| | 1237 | return; |
| | 1238 | } |
| | 1239 | |
| | 1240 | ret = MFXVideoDECODE_Reset(s->qsv.session, ¶m); |
| | 1241 | if (ret < 0) { |
| | 1242 | ff_qsv_print_error(avctx, ret, "MFX decode reset error"); |
| | 1243 | return; |
| | 1244 | } |
| | 1245 | } |
| | 1246 | |
| 1212 | 1247 | s->qsv.orig_pix_fmt = AV_PIX_FMT_NONE; |
| 1213 | | s->qsv.initialized = 0; |
| | 1248 | s->qsv.flush = 1; |
| 1214 | 1249 | } |
| 1215 | 1250 | |
| 1216 | 1251 | #define OFFSET(x) offsetof(QSVDecContext, x) |