]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/invert.c
invert: check supported chroma (fixes #8840, fixes #8841)
[vlc] / modules / video_filter / invert.c
index 147743151f7f0785627ee44a3dc3e4da6d924392..681c992398a41ebacecedde9d3f1cb21184e32b2 100644 (file)
@@ -64,9 +64,19 @@ vlc_module_end ()
 static int Create( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t *)p_this;
+    vlc_fourcc_t fourcc = p_filter->fmt_in.video.i_chroma;
 
-    p_filter->pf_video_filter = Filter;
+    if( fourcc == VLC_CODEC_YUVP || fourcc == VLC_CODEC_RGBP
+     || fourcc == VLC_CODEC_RGBA )
+        return VLC_EGENERIC;
+
+    const vlc_chroma_description_t *p_chroma =
+        vlc_fourcc_GetChromaDescription( fourcc );
+    if( p_chroma == NULL
+     || p_chroma->pixel_size * 8 != p_chroma->pixel_bits )
+        return VLC_EGENERIC;
 
+    p_filter->pf_video_filter = Filter;
     return VLC_SUCCESS;
 }