diff --git a/sys/va/gstvaallocator.c b/sys/va/gstvaallocator.c index f6d90e598b..8747347a07 100644 --- a/sys/va/gstvaallocator.c +++ b/sys/va/gstvaallocator.c @@ -885,7 +885,7 @@ gst_va_allocator_alloc (GstAllocator * allocator, { GstVaAllocator *self; GstVaMemory *mem; - GstVideoFormat format; + GstVideoFormat format, img_format; VAImage image = { 0, }; VASurfaceID surface; guint32 fourcc, rt_format; @@ -894,20 +894,22 @@ gst_va_allocator_alloc (GstAllocator * allocator, self = GST_VA_ALLOCATOR (allocator); - format = - gst_va_video_surface_format_from_image_format (GST_VIDEO_INFO_FORMAT - (¶ms->info), self->surface_formats); + img_format = GST_VIDEO_INFO_FORMAT (¶ms->info); + + format = gst_va_video_surface_format_from_image_format (img_format, + self->surface_formats); if (format == GST_VIDEO_FORMAT_UNKNOWN) { - GST_ERROR_OBJECT (allocator, "Unsupported format: %s", - gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (¶ms->info))); - return NULL; + /* try a surface without fourcc but rt_format only */ + fourcc = 0; + rt_format = gst_va_chroma_from_video_format (img_format); + } else { + fourcc = gst_va_fourcc_from_video_format (format); + rt_format = gst_va_chroma_from_video_format (format); } - fourcc = gst_va_fourcc_from_video_format (format); - rt_format = gst_va_chroma_from_video_format (format); - if (fourcc == 0 || rt_format == 0) { - GST_ERROR_OBJECT (allocator, "Unsupported format: %s", - gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (¶ms->info))); + if (rt_format == 0) { + GST_ERROR_OBJECT (allocator, "Unsupported image format: %s", + gst_video_format_to_string (img_format)); return NULL; } diff --git a/sys/va/gstvavideoformat.c b/sys/va/gstvavideoformat.c index 7e42bca13c..6acb0017f0 100644 --- a/sys/va/gstvavideoformat.c +++ b/sys/va/gstvavideoformat.c @@ -210,7 +210,7 @@ gst_va_video_surface_format_from_image_format (GstVideoFormat image_format, GArray * surface_formats) { GstVideoFormat surface_format; - guint i, image_chroma, surface_chroma; + guint i, image_chroma; if (image_format == GST_VIDEO_FORMAT_UNKNOWN) return GST_VIDEO_FORMAT_UNKNOWN; @@ -227,11 +227,6 @@ gst_va_video_surface_format_from_image_format (GstVideoFormat image_format, if (surface_format == image_format) return surface_format; - - surface_chroma = gst_va_chroma_from_video_format (surface_format); - - if (surface_chroma == image_chroma) - return surface_format; } return GST_VIDEO_FORMAT_UNKNOWN;