History

lavc/mediacodec: use AVMediaCodecDeviceContext hw_device_ctx if set

Aman Gupta committed 8 years ago

Commit 8bf4e6d1 parent e4d9f054 files · +20 −4Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavcodec/mediacodecdec.c +3 −2
  3. libavcodec/mediacodecdec_common.c +13 −1
  4. libavcodec/version.h +1 −1
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2017-10-21 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182017-xx-xx - xxxxxxx - lavc 58.8.100 - avcodec.h
19 The MediaCodec decoders now support AVCodecContext.hw_device_ctx.
20
182017-xx-xx - xxxxxxx - lavu 56.6.100 - hwcontext.h hwcontext_mediacodec.h212017-xx-xx - xxxxxxx - lavu 56.6.100 - hwcontext.h hwcontext_mediacodec.h
19 Add AV_HWDEVICE_TYPE_MEDIACODEC and a new installed header with22 Add AV_HWDEVICE_TYPE_MEDIACODEC and a new installed header with
20 MediaCodec-specific hwcontext definitions.23 MediaCodec-specific hwcontext definitions.
libavcodec/mediacodecdec.c+3−2
@@ -520,8 +520,9 @@ static const AVCodecHWConfigInternal *mediacodec_hw_configs[] = { · 519 unmodified lines
520 &(const AVCodecHWConfigInternal) {520 &(const AVCodecHWConfigInternal) {
521 .public = {521 .public = {
522 .pix_fmt = AV_PIX_FMT_MEDIACODEC,522 .pix_fmt = AV_PIX_FMT_MEDIACODEC,
523 .methods = AV_CODEC_HW_CONFIG_METHOD_AD_HOC,523 .methods = AV_CODEC_HW_CONFIG_METHOD_AD_HOC |
524 .device_type = AV_HWDEVICE_TYPE_NONE,524 AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX,
525 .device_type = AV_HWDEVICE_TYPE_MEDIACODEC,
525 },526 },
526 .hwaccel = NULL,527 .hwaccel = NULL,
527 },528 },
libavcodec/mediacodecdec_common.c+13−1
@@ -24,6 +24,7 @@ · 23 unmodified lines
24#include <sys/types.h>24#include <sys/types.h>
25 25
26#include "libavutil/common.h"26#include "libavutil/common.h"
27#include "libavutil/hwcontext_mediacodec.h"
27#include "libavutil/mem.h"28#include "libavutil/mem.h"
28#include "libavutil/log.h"29#include "libavutil/log.h"
29#include "libavutil/pixfmt.h"30#include "libavutil/pixfmt.h"
@@ -476,7 +477,18 @@ int ff_mediacodec_dec_init(AVCodecContext *avctx, MediaCodecDecContext *s, · 446 unmodified lines
476 if (pix_fmt == AV_PIX_FMT_MEDIACODEC) {477 if (pix_fmt == AV_PIX_FMT_MEDIACODEC) {
477 AVMediaCodecContext *user_ctx = avctx->hwaccel_context;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 s->surface = ff_mediacodec_surface_ref(user_ctx->surface, avctx);492 s->surface = ff_mediacodec_surface_ref(user_ctx->surface, avctx);
481 av_log(avctx, AV_LOG_INFO, "Using surface %p\n", s->surface);493 av_log(avctx, AV_LOG_INFO, "Using surface %p\n", s->surface);
482 }494 }
libavcodec/version.h+1−1
@@ -28,7 +28,7 @@ · 27 unmodified lines
28#include "libavutil/version.h"28#include "libavutil/version.h"
29 29
30#define LIBAVCODEC_VERSION_MAJOR 5830#define LIBAVCODEC_VERSION_MAJOR 58
31#define LIBAVCODEC_VERSION_MINOR 731#define LIBAVCODEC_VERSION_MINOR 8
32#define LIBAVCODEC_VERSION_MICRO 10032#define LIBAVCODEC_VERSION_MICRO 100
33 33
34#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \34#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t