Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2017-03-31 00:00:03 +0300
committerMark Thompson <sw@jkqxz.net>2017-03-31 00:00:03 +0300
commit2f18e452f88fc6ed7b0e308d4de5c386ee1b3a12 (patch)
treed46ae6e853bc8837cb691269d6c4cb4a0ee14a00 /libavcodec/qsvdec.c
parente3f9c5826ace91bf8d933bd924df2eb4081da6c6 (diff)
parent404e51478ecad060249d5b9bee6ab39a8a9d8c1c (diff)
Merge commit '404e51478ecad060249d5b9bee6ab39a8a9d8c1c'
* commit '404e51478ecad060249d5b9bee6ab39a8a9d8c1c': qsv{dec,enc}: always use an internal mfxFrameSurface1 Minor fixups for differences in the QSV encoder because of a53cc. Merged-by: Mark Thompson <sw@jkqxz.net>
Diffstat (limited to 'libavcodec/qsvdec.c')
-rw-r--r--libavcodec/qsvdec.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 7d496d9a07..e11aa71a2a 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -194,17 +194,17 @@ static int alloc_frame(AVCodecContext *avctx, QSVContext *q, QSVFrame *frame)
return ret;
if (frame->frame->format == AV_PIX_FMT_QSV) {
- frame->surface = (mfxFrameSurface1*)frame->frame->data[3];
+ frame->surface = *(mfxFrameSurface1*)frame->frame->data[3];
} else {
- frame->surface_internal.Info = q->frame_info;
+ frame->surface.Info = q->frame_info;
- frame->surface_internal.Data.PitchLow = frame->frame->linesize[0];
- frame->surface_internal.Data.Y = frame->frame->data[0];
- frame->surface_internal.Data.UV = frame->frame->data[1];
-
- frame->surface = &frame->surface_internal;
+ frame->surface.Data.PitchLow = frame->frame->linesize[0];
+ frame->surface.Data.Y = frame->frame->data[0];
+ frame->surface.Data.UV = frame->frame->data[1];
}
+ frame->used = 1;
+
return 0;
}
@@ -212,8 +212,8 @@ static void qsv_clear_unused_frames(QSVContext *q)
{
QSVFrame *cur = q->work_frames;
while (cur) {
- if (cur->surface && !cur->surface->Data.Locked && !cur->queued) {
- cur->surface = NULL;
+ if (cur->used && !cur->surface.Data.Locked && !cur->queued) {
+ cur->used = 0;
av_frame_unref(cur->frame);
}
cur = cur->next;
@@ -230,11 +230,11 @@ static int get_surface(AVCodecContext *avctx, QSVContext *q, mfxFrameSurface1 **
frame = q->work_frames;
last = &q->work_frames;
while (frame) {
- if (!frame->surface) {
+ if (!frame->used) {
ret = alloc_frame(avctx, q, frame);
if (ret < 0)
return ret;
- *surf = frame->surface;
+ *surf = &frame->surface;
return 0;
}
@@ -256,7 +256,7 @@ static int get_surface(AVCodecContext *avctx, QSVContext *q, mfxFrameSurface1 **
if (ret < 0)
return ret;
- *surf = frame->surface;
+ *surf = &frame->surface;
return 0;
}
@@ -265,7 +265,7 @@ static QSVFrame *find_frame(QSVContext *q, mfxFrameSurface1 *surf)
{
QSVFrame *cur = q->work_frames;
while (cur) {
- if (surf == cur->surface)
+ if (surf == &cur->surface)
return cur;
cur = cur->next;
}
@@ -363,7 +363,7 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q,
if (ret < 0)
return ret;
- outsurf = out_frame->surface;
+ outsurf = &out_frame->surface;
#if FF_API_PKT_PTS
FF_DISABLE_DEPRECATION_WARNINGS
@@ -381,6 +381,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
frame->interlaced_frame =
!(outsurf->Info.PicStruct & MFX_PICSTRUCT_PROGRESSIVE);
+ /* update the surface properties */
+ if (avctx->pix_fmt == AV_PIX_FMT_QSV)
+ ((mfxFrameSurface1*)frame->data[3])->Info = outsurf->Info;
+
*got_frame = 1;
}