File tree Expand file tree Collapse file tree 6 files changed +46
-1
lines changed Expand file tree Collapse file tree 6 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -695,6 +695,8 @@ Video
695
695
:rpi-copy: copies video back to system RAM (Raspberry Pi only)
696
696
:cuda: requires ``--vo=gpu `` (Any platform CUDA is available)
697
697
:cuda-copy: copies video back to system RAM (Any platform CUDA is available)
698
+ :nvdec: requires ``--vo=gpu `` (Any platform CUDA is available)
699
+ :nvdec-copy: copies video back to system RAM (Any platform CUDA is available)
698
700
:crystalhd: copies video back to system RAM (Any platform supported by hardware)
699
701
:rkmpp: requires ``--vo=gpu `` (some RockChip devices only)
700
702
@@ -723,6 +725,12 @@ Video
723
725
deinterlacing. ``cuda `` should always be preferred unless the ``gpu ``
724
726
vo is not being used or filters are required.
725
727
728
+ ``nvdec `` is a newer implementation of CUVID/CUDA decoding, which uses the
729
+ FFmpeg decoders for file parsing. Experimental, is known not to correctly
730
+ check whether decoding is supported by the hardware at all. Deinterlacing
731
+ is not supported. Since this uses FFmpeg's codec parsers, it is expected
732
+ that this generally causes fewer issues than ``cuda ``. Requires ffmpeg-mpv.
733
+
726
734
Most video filters will not work with hardware decoding as they are
727
735
primarily implemented on the CPU. Some exceptions are ``vdpaupp ``,
728
736
``vdpaurb `` and ``vavpp ``. See `VIDEO FILTERS `_ for more details.
Original file line number Diff line number Diff line change @@ -117,6 +117,8 @@ const struct m_opt_choice_alternatives mp_hwdec_names[] = {
117
117
{"mediacodec-copy" ,HWDEC_MEDIACODEC_COPY },
118
118
{"cuda" , HWDEC_CUDA },
119
119
{"cuda-copy" , HWDEC_CUDA_COPY },
120
+ {"nvdec" , HWDEC_NVDEC },
121
+ {"nvdec-copy" , HWDEC_NVDEC_COPY },
120
122
{"crystalhd" , HWDEC_CRYSTALHD },
121
123
{0 }
122
124
};
Original file line number Diff line number Diff line change @@ -158,6 +158,19 @@ static const struct vd_lavc_hwdec mp_vd_lavc_rkmpp = {
158
158
};
159
159
160
160
#if HAVE_CUDA_HWACCEL
161
+ static const struct vd_lavc_hwdec mp_vd_lavc_nvdec = {
162
+ .type = HWDEC_NVDEC ,
163
+ .image_format = IMGFMT_CUDA ,
164
+ .generic_hwaccel = true,
165
+ .set_hwframes = true,
166
+ };
167
+ static const struct vd_lavc_hwdec mp_vd_lavc_nvdec_copy = {
168
+ .type = HWDEC_NVDEC_COPY ,
169
+ .image_format = IMGFMT_CUDA ,
170
+ .generic_hwaccel = true,
171
+ .set_hwframes = true,
172
+ .copying = true,
173
+ };
161
174
static const struct vd_lavc_hwdec mp_vd_lavc_cuda = {
162
175
.type = HWDEC_CUDA ,
163
176
.image_format = IMGFMT_CUDA ,
@@ -272,6 +285,8 @@ static const struct vd_lavc_hwdec *const hwdec_list[] = {
272
285
& mp_vd_lavc_mediacodec_copy ,
273
286
#endif
274
287
#if HAVE_CUDA_HWACCEL
288
+ & mp_vd_lavc_nvdec ,
289
+ & mp_vd_lavc_nvdec_copy ,
275
290
& mp_vd_lavc_cuda ,
276
291
& mp_vd_lavc_cuda_copy ,
277
292
#endif
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ enum hwdec_type {
26
26
HWDEC_MEDIACODEC_COPY ,
27
27
HWDEC_CUDA ,
28
28
HWDEC_CUDA_COPY ,
29
+ HWDEC_NVDEC ,
30
+ HWDEC_NVDEC_COPY ,
29
31
HWDEC_CRYSTALHD ,
30
32
HWDEC_RKMPP ,
31
33
};
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ extern const struct ra_hwdec_driver ra_hwdec_d3d11eglrgb;
35
35
extern const struct ra_hwdec_driver ra_hwdec_dxva2gldx ;
36
36
extern const struct ra_hwdec_driver ra_hwdec_dxva2 ;
37
37
extern const struct ra_hwdec_driver ra_hwdec_cuda ;
38
+ extern const struct ra_hwdec_driver ra_hwdec_cuda_nvdec ;
38
39
extern const struct ra_hwdec_driver ra_hwdec_rpi_overlay ;
39
40
#if HAVE_DRMPRIME && HAVE_DRM
40
41
extern const struct ra_hwdec_driver ra_hwdec_drmprime_drm ;
@@ -65,6 +66,7 @@ static const struct ra_hwdec_driver *const mpgl_hwdec_drivers[] = {
65
66
#endif
66
67
#if HAVE_CUDA_HWACCEL
67
68
& ra_hwdec_cuda ,
69
+ & ra_hwdec_cuda_nvdec ,
68
70
#endif
69
71
#if HAVE_RPI
70
72
& ra_hwdec_rpi_overlay ,
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ static int cuda_init(struct ra_hwdec *hw)
160
160
goto error ;
161
161
162
162
p -> hwctx = (struct mp_hwdec_ctx ) {
163
- .type = HWDEC_CUDA ,
163
+ .type = hw -> driver -> api ,
164
164
.ctx = p -> decode_ctx ,
165
165
.av_device_ref = hw_device_ctx ,
166
166
};
@@ -340,3 +340,19 @@ const struct ra_hwdec_driver ra_hwdec_cuda = {
340
340
.unmap = mapper_unmap ,
341
341
},
342
342
};
343
+
344
+ const struct ra_hwdec_driver ra_hwdec_cuda_nvdec = {
345
+ .name = "cuda-nvdec" ,
346
+ .api = HWDEC_NVDEC ,
347
+ .imgfmts = {IMGFMT_CUDA , 0 },
348
+ .priv_size = sizeof (struct priv_owner ),
349
+ .init = cuda_init ,
350
+ .uninit = cuda_uninit ,
351
+ .mapper = & (const struct ra_hwdec_mapper_driver ){
352
+ .priv_size = sizeof (struct priv ),
353
+ .init = mapper_init ,
354
+ .uninit = mapper_uninit ,
355
+ .map = mapper_map ,
356
+ .unmap = mapper_unmap ,
357
+ },
358
+ };
You can’t perform that action at this time.
0 commit comments