Unified · Split
| @@ -15,6 +15,9 @@ libavutil: 2017-10-21 · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | API changes, most recent first: |
| 17 | 17 | |
| 18 | +2017-xx-xx - xxxxxxx - lavc 58.8.100 - avcodec.h | |
| 19 | + The MediaCodec decoders now support AVCodecContext.hw_device_ctx. | |
| 20 | + | |
| 18 | 21 | 2017-xx-xx - xxxxxxx - lavu 56.6.100 - hwcontext.h hwcontext_mediacodec.h |
| 19 | 22 | Add AV_HWDEVICE_TYPE_MEDIACODEC and a new installed header with |
| 20 | 23 | MediaCodec-specific hwcontext definitions. |
| @@ -520,8 +520,9 @@ static const AVCodecHWConfigInternal *mediacodec_hw_configs[] = { · 519 unmodified lines | ||
| 520 | 520 | &(const AVCodecHWConfigInternal) { |
| 521 | 521 | .public = { |
| 522 | 522 | .pix_fmt = AV_PIX_FMT_MEDIACODEC, |
| 523 | − .methods = AV_CODEC_HW_CONFIG_METHOD_AD_HOC, | |
| 524 | − .device_type = AV_HWDEVICE_TYPE_NONE, | |
| 523 | + .methods = AV_CODEC_HW_CONFIG_METHOD_AD_HOC | | |
| 524 | + AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX, | |
| 525 | + .device_type = AV_HWDEVICE_TYPE_MEDIACODEC, | |
| 525 | 526 | }, |
| 526 | 527 | .hwaccel = NULL, |
| 527 | 528 | }, |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <sys/types.h> |
| 25 | 25 | |
| 26 | 26 | #include "libavutil/common.h" |
| 27 | +#include "libavutil/hwcontext_mediacodec.h" | |
| 27 | 28 | #include "libavutil/mem.h" |
| 28 | 29 | #include "libavutil/log.h" |
| 29 | 30 | #include "libavutil/pixfmt.h" |
| @@ -476,7 +477,18 @@ int ff_mediacodec_dec_init(AVCodecContext *avctx, MediaCodecDecContext *s, · 446 unmodified lines | ||
| 476 | 477 | if (pix_fmt == AV_PIX_FMT_MEDIACODEC) { |
| 477 | 478 | AVMediaCodecContext *user_ctx = avctx->hwaccel_context; |
| 478 | 479 | |
| 479 | − if (user_ctx && user_ctx->surface) { | |
| 480 | + if (avctx->hw_device_ctx) { | |
| 481 | + AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)(avctx->hw_device_ctx->data); | |
| 482 | + if (device_ctx->type == AV_HWDEVICE_TYPE_MEDIACODEC) { | |
| 483 | + if (device_ctx->hwctx) { | |
| 484 | + AVMediaCodecDeviceContext *mediacodec_ctx = (AVMediaCodecDeviceContext *)device_ctx->hwctx; | |
| 485 | + s->surface = ff_mediacodec_surface_ref(mediacodec_ctx->surface, avctx); | |
| 486 | + av_log(avctx, AV_LOG_INFO, "Using surface %p\n", s->surface); | |
| 487 | + } | |
| 488 | + } | |
| 489 | + } | |
| 490 | + | |
| 491 | + if (!s->surface && user_ctx && user_ctx->surface) { | |
| 480 | 492 | s->surface = ff_mediacodec_surface_ref(user_ctx->surface, avctx); |
| 481 | 493 | av_log(avctx, AV_LOG_INFO, "Using surface %p\n", s->surface); |
| 482 | 494 | } |
| @@ -28,7 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | #include "libavutil/version.h" |
| 29 | 29 | |
| 30 | 30 | #define LIBAVCODEC_VERSION_MAJOR 58 |
| 31 | −#define LIBAVCODEC_VERSION_MINOR 7 | |
| 31 | +#define LIBAVCODEC_VERSION_MINOR 8 | |
| 32 | 32 | #define LIBAVCODEC_VERSION_MICRO 100 |
| 33 | 33 | |
| 34 | 34 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |