diff mbox series

[FFmpeg-devel] lavu/hwcontext_drm: don't fail mapping when dst format is unset

Message ID 20220103032418.539294-1-aicommander@gmail.com
State New
Headers show
Series [FFmpeg-devel] lavu/hwcontext_drm: don't fail mapping when dst format is unset | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc fail Make fate failed

Commit Message

Cameron Gutman Jan. 3, 2022, 3:24 a.m. UTC
av_hwframe_map() is documented to work with a blank dst frame, but
hwcontext_drm currently fails if dst->format == AV_PIX_FMT_NONE.

Signed-off-by: Cameron Gutman <aicommander@gmail.com>
---
 libavutil/hwcontext_drm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavutil/hwcontext_drm.c b/libavutil/hwcontext_drm.c
index 7a9fdbd263..85a9fd4984 100644
--- a/libavutil/hwcontext_drm.c
+++ b/libavutil/hwcontext_drm.c
@@ -287,7 +287,9 @@  static int drm_map_from(AVHWFramesContext *hwfc, AVFrame *dst,
 {
     int err;
 
-    if (hwfc->sw_format != dst->format)
+    if (dst->format == AV_PIX_FMT_NONE)
+        dst->format = hwfc->sw_format;
+    else if (hwfc->sw_format != dst->format)
         return AVERROR(ENOSYS);
 
     err = drm_map_frame(hwfc, dst, src, flags);