History

lavu/hwcontext: add AV_HWDEVICE_TYPE_MEDIACODEC

Aman Gupta committed 8 years ago

Commit e4d9f051 parent 54509728 files · +99 −1Browse files

Unified · Split

8 files
  1. doc/APIchanges +4 −0
  2. libavutil/Makefile +2 −0
  3. libavutil/hwcontext.c +4 −0
  4. libavutil/hwcontext.h +1 −0
  5. libavutil/hwcontext_internal.h +1 −0
  6. libavutil/hwcontext_mediacodec.c +50 −0
  7. libavutil/hwcontext_mediacodec.h +36 −0
  8. libavutil/version.h +1 −1
doc/APIchanges+4−0
@@ -15,6 +15,10 @@ 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 - lavu 56.6.100 - hwcontext.h hwcontext_mediacodec.h
19 Add AV_HWDEVICE_TYPE_MEDIACODEC and a new installed header with
20 MediaCodec-specific hwcontext definitions.
21
182017-xx-xx - xxxxxxc - lavc 58.7.100 - avcodec.h222017-xx-xx - xxxxxxc - lavc 58.7.100 - avcodec.h
19 Add AV_CODEC_CAP_HARDWARE, AV_CODEC_CAP_HYBRID, and AVCodec.wrapper_name,23 Add AV_CODEC_CAP_HARDWARE, AV_CODEC_CAP_HYBRID, and AVCodec.wrapper_name,
20 and mark all AVCodecs accordingly.24 and mark all AVCodecs accordingly.
libavutil/Makefile+2−0
@@ -37,6 +37,7 @@ HEADERS = adler32.h \ · 36 unmodified lines
37 hwcontext_drm.h \37 hwcontext_drm.h \
38 hwcontext_dxva2.h \38 hwcontext_dxva2.h \
39 hwcontext_qsv.h \39 hwcontext_qsv.h \
40 hwcontext_mediacodec.h \
40 hwcontext_vaapi.h \41 hwcontext_vaapi.h \
41 hwcontext_videotoolbox.h \42 hwcontext_videotoolbox.h \
42 hwcontext_vdpau.h \43 hwcontext_vdpau.h \
@@ -166,6 +167,7 @@ OBJS-$(CONFIG_OPENCL) += hwcontext_opencl.o · 123 unmodified lines
166OBJS-$(CONFIG_VAAPI) += hwcontext_vaapi.o167OBJS-$(CONFIG_VAAPI) += hwcontext_vaapi.o
167OBJS-$(CONFIG_VIDEOTOOLBOX) += hwcontext_videotoolbox.o168OBJS-$(CONFIG_VIDEOTOOLBOX) += hwcontext_videotoolbox.o
168OBJS-$(CONFIG_VDPAU) += hwcontext_vdpau.o169OBJS-$(CONFIG_VDPAU) += hwcontext_vdpau.o
170OBJS-$(CONFIG_MEDIACODEC) += hwcontext_mediacodec.o
169 171
170OBJS += $(COMPAT_OBJS:%=../compat/%)172OBJS += $(COMPAT_OBJS:%=../compat/%)
171 173
libavutil/hwcontext.c+4−0
@@ -55,6 +55,9 @@ static const HWContextType * const hw_table[] = { · 54 unmodified lines
55#endif55#endif
56#if CONFIG_VIDEOTOOLBOX56#if CONFIG_VIDEOTOOLBOX
57 &ff_hwcontext_type_videotoolbox,57 &ff_hwcontext_type_videotoolbox,
58#endif
59#if CONFIG_MEDIACODEC
60 &ff_hwcontext_type_mediacodec,
58#endif61#endif
59 NULL,62 NULL,
60};63};
@@ -69,6 +72,7 @@ static const char *const hw_type_names[] = { · 8 unmodified lines
69 [AV_HWDEVICE_TYPE_VAAPI] = "vaapi",72 [AV_HWDEVICE_TYPE_VAAPI] = "vaapi",
70 [AV_HWDEVICE_TYPE_VDPAU] = "vdpau",73 [AV_HWDEVICE_TYPE_VDPAU] = "vdpau",
71 [AV_HWDEVICE_TYPE_VIDEOTOOLBOX] = "videotoolbox",74 [AV_HWDEVICE_TYPE_VIDEOTOOLBOX] = "videotoolbox",
75 [AV_HWDEVICE_TYPE_MEDIACODEC] = "mediacodec",
72};76};
73 77
74enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name)78enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name)
libavutil/hwcontext.h+1−0
@@ -35,6 +35,7 @@ enum AVHWDeviceType { · 34 unmodified lines
35 AV_HWDEVICE_TYPE_D3D11VA,35 AV_HWDEVICE_TYPE_D3D11VA,
36 AV_HWDEVICE_TYPE_DRM,36 AV_HWDEVICE_TYPE_DRM,
37 AV_HWDEVICE_TYPE_OPENCL,37 AV_HWDEVICE_TYPE_OPENCL,
38 AV_HWDEVICE_TYPE_MEDIACODEC,
38};39};
39 40
40typedef struct AVHWDeviceInternal AVHWDeviceInternal;41typedef struct AVHWDeviceInternal AVHWDeviceInternal;
libavutil/hwcontext_internal.h+1−0
@@ -166,5 +166,6 @@ extern const HWContextType ff_hwcontext_type_qsv; · 165 unmodified lines
166extern const HWContextType ff_hwcontext_type_vaapi;166extern const HWContextType ff_hwcontext_type_vaapi;
167extern const HWContextType ff_hwcontext_type_vdpau;167extern const HWContextType ff_hwcontext_type_vdpau;
168extern const HWContextType ff_hwcontext_type_videotoolbox;168extern const HWContextType ff_hwcontext_type_videotoolbox;
169extern const HWContextType ff_hwcontext_type_mediacodec;
169 170
170#endif /* AVUTIL_HWCONTEXT_INTERNAL_H */171#endif /* AVUTIL_HWCONTEXT_INTERNAL_H */
libavutil/hwcontext_mediacodec.c+50−0
@@ -0,0 +1,50 @@
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include "config.h"
20
21#include "buffer.h"
22#include "common.h"
23#include "hwcontext.h"
24#include "hwcontext_internal.h"
25#include "hwcontext_mediacodec.h"
26
27static int mc_device_create(AVHWDeviceContext *ctx, const char *device,
28 AVDictionary *opts, int flags)
29{
30 if (device && device[0]) {
31 av_log(ctx, AV_LOG_ERROR, "Device selection unsupported.\n");
32 return AVERROR_UNKNOWN;
33 }
34
35 return 0;
36}
37
38const HWContextType ff_hwcontext_type_mediacodec = {
39 .type = AV_HWDEVICE_TYPE_MEDIACODEC,
40 .name = "mediacodec",
41
42 .device_hwctx_size = sizeof(AVMediaCodecDeviceContext),
43
44 .device_create = mc_device_create,
45
46 .pix_fmts = (const enum AVPixelFormat[]){
47 AV_PIX_FMT_MEDIACODEC,
48 AV_PIX_FMT_NONE
49 },
50};
libavutil/hwcontext_mediacodec.h+36−0
@@ -0,0 +1,36 @@
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef AVUTIL_HWCONTEXT_MEDIACODEC_H
20#define AVUTIL_HWCONTEXT_MEDIACODEC_H
21
22/**
23 * MediaCodec details.
24 *
25 * Allocated as AVHWDeviceContext.hwctx
26 */
27typedef struct AVMediaCodecDeviceContext {
28 /**
29 * android/view/Surface handle, to be filled by the user.
30 *
31 * This is the default surface used by decoders on this device.
32 */
33 void *surface;
34} AVMediaCodecDeviceContext;
35
36#endif /* AVUTIL_HWCONTEXT_MEDIACODEC_H */
libavutil/version.h+1−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
79 */79 */
80 80
81#define LIBAVUTIL_VERSION_MAJOR 5681#define LIBAVUTIL_VERSION_MAJOR 56
82#define LIBAVUTIL_VERSION_MINOR 582#define LIBAVUTIL_VERSION_MINOR 6
83#define LIBAVUTIL_VERSION_MICRO 10083#define LIBAVUTIL_VERSION_MICRO 100
84 84
85#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \85#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_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