Unified · Split
| @@ -15,6 +15,10 @@ libavutil: 2017-10-21 · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | API changes, most recent first: | 16 | API changes, most recent first: |
| 17 | 17 | ||
| 18 | 2017-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 | |||
| 18 | 2017-xx-xx - xxxxxxc - lavc 58.7.100 - avcodec.h | 22 | 2017-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. |
| @@ -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 | |||
| 166 | OBJS-$(CONFIG_VAAPI) += hwcontext_vaapi.o | 167 | OBJS-$(CONFIG_VAAPI) += hwcontext_vaapi.o |
| 167 | OBJS-$(CONFIG_VIDEOTOOLBOX) += hwcontext_videotoolbox.o | 168 | OBJS-$(CONFIG_VIDEOTOOLBOX) += hwcontext_videotoolbox.o |
| 168 | OBJS-$(CONFIG_VDPAU) += hwcontext_vdpau.o | 169 | OBJS-$(CONFIG_VDPAU) += hwcontext_vdpau.o |
| 170 | OBJS-$(CONFIG_MEDIACODEC) += hwcontext_mediacodec.o | ||
| 169 | 171 | ||
| 170 | OBJS += $(COMPAT_OBJS:%=../compat/%) | 172 | OBJS += $(COMPAT_OBJS:%=../compat/%) |
| 171 | 173 | ||
| @@ -55,6 +55,9 @@ static const HWContextType * const hw_table[] = { · 54 unmodified lines | |||
| 55 | #endif | 55 | #endif |
| 56 | #if CONFIG_VIDEOTOOLBOX | 56 | #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 | #endif | 61 | #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 | ||
| 74 | enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name) | 78 | enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name) |
| @@ -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 | ||
| 40 | typedef struct AVHWDeviceInternal AVHWDeviceInternal; | 41 | typedef struct AVHWDeviceInternal AVHWDeviceInternal; |
| @@ -166,5 +166,6 @@ extern const HWContextType ff_hwcontext_type_qsv; · 165 unmodified lines | |||
| 166 | extern const HWContextType ff_hwcontext_type_vaapi; | 166 | extern const HWContextType ff_hwcontext_type_vaapi; |
| 167 | extern const HWContextType ff_hwcontext_type_vdpau; | 167 | extern const HWContextType ff_hwcontext_type_vdpau; |
| 168 | extern const HWContextType ff_hwcontext_type_videotoolbox; | 168 | extern const HWContextType ff_hwcontext_type_videotoolbox; |
| 169 | extern const HWContextType ff_hwcontext_type_mediacodec; | ||
| 169 | 170 | ||
| 170 | #endif /* AVUTIL_HWCONTEXT_INTERNAL_H */ | 171 | #endif /* AVUTIL_HWCONTEXT_INTERNAL_H */ |
| @@ -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 | |||
| 27 | static 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 | |||
| 38 | const 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 | }; | ||
| @@ -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 | */ | ||
| 27 | typedef 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 */ | ||
| @@ -79,7 +79,7 @@ · 78 unmodified lines | |||
| 79 | */ | 79 | */ |
| 80 | 80 | ||
| 81 | #define LIBAVUTIL_VERSION_MAJOR 56 | 81 | #define LIBAVUTIL_VERSION_MAJOR 56 |
| 82 | #define LIBAVUTIL_VERSION_MINOR 5 | 82 | #define LIBAVUTIL_VERSION_MINOR 6 |
| 83 | #define LIBAVUTIL_VERSION_MICRO 100 | 83 | #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, \ |