diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-01-25 13:01:09 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-01-27 12:37:34 +0100 |
commit | b2e9b0f5d4dca93f54fba85f3345970a636e2b82 (patch) | |
tree | 3fb514861f3c7a2f19d22acbd6fe6c09b31ffe4d /libavcodec/hevc_refs.c | |
parent | 06894f1a04dda384ab3632b2342f0f97ec9ebed9 (diff) |
hevc: add hwaccel hooks
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/hevc_refs.c')
-rw-r--r-- | libavcodec/hevc_refs.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index 92196a1ee9..c705f1153b 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -21,6 +21,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/avassert.h" #include "libavutil/pixdesc.h" #include "internal.h" @@ -46,6 +47,9 @@ void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags) frame->refPicList = NULL; frame->collocated_ref = NULL; + + av_buffer_unref(&frame->hwaccel_priv_buf); + frame->hwaccel_picture_private = NULL; } } @@ -106,6 +110,18 @@ static HEVCFrame *alloc_frame(HEVCContext *s) frame->frame->top_field_first = s->picture_struct == AV_PICTURE_STRUCTURE_TOP_FIELD; frame->frame->interlaced_frame = (s->picture_struct == AV_PICTURE_STRUCTURE_TOP_FIELD) || (s->picture_struct == AV_PICTURE_STRUCTURE_BOTTOM_FIELD); + + if (s->avctx->hwaccel) { + const AVHWAccel *hwaccel = s->avctx->hwaccel; + av_assert0(!frame->hwaccel_picture_private); + if (hwaccel->frame_priv_data_size) { + frame->hwaccel_priv_buf = av_buffer_allocz(hwaccel->frame_priv_data_size); + if (!frame->hwaccel_priv_buf) + goto fail; + frame->hwaccel_picture_private = frame->hwaccel_priv_buf->data; + } + } + return frame; fail: ff_hevc_unref_frame(s, frame, ~0); @@ -390,6 +406,7 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc) if (!frame) return NULL; + if (!s->avctx->hwaccel) { if (!s->sps->pixel_shift) { for (i = 0; frame->frame->buf[i]; i++) memset(frame->frame->buf[i]->data, 1 << (s->sps->bit_depth - 1), @@ -402,6 +419,7 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc) 1 << (s->sps->bit_depth - 1)); } } + } frame->poc = poc; frame->sequence = s->seq_decode; |