[vlc-commits] transform: correct chroma check

Rémi Denis-Courmont git at videolan.org
Sat Mar 17 17:44:43 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Mar 17 18:42:41 2012 +0200| [226b223837572d60937a25b5252f094a06d27dd4] | committer: Rémi Denis-Courmont

transform: correct chroma check

This should enable a few more chromas, at least GREY.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=226b223837572d60937a25b5252f094a06d27dd4
---

 modules/video_filter/transform.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/modules/video_filter/transform.c b/modules/video_filter/transform.c
index 0e887be..35da2b4 100644
--- a/modules/video_filter/transform.c
+++ b/modules/video_filter/transform.c
@@ -179,6 +179,22 @@ static int Mouse(filter_t *filter, vlc_mouse_t *mouse,
     return VLC_SUCCESS;
 }
 
+static bool SupportedChroma(const vlc_chroma_description_t *chroma)
+{
+    if (chroma == NULL)
+        return false;
+
+    if (chroma->pixel_size != 1)
+        return false;
+
+    for (unsigned i = 0; i < chroma->plane_count; i++)
+        if (chroma->p[i].w.num * chroma->p[i].h.den
+         != chroma->p[i].h.num * chroma->p[i].w.den)
+            return false;
+
+    return true;
+}
+
 static int Open(vlc_object_t *object)
 {
     filter_t *filter = (filter_t *)object;
@@ -187,7 +203,7 @@ static int Open(vlc_object_t *object)
 
     const vlc_chroma_description_t *chroma =
         vlc_fourcc_GetChromaDescription(src->i_chroma);
-    if (!chroma || chroma->plane_count < 3 || chroma->pixel_size != 1) {
+    if (!SupportedChroma(chroma)) {
         msg_Err(filter, "Unsupported chroma (%4.4s)", (char*)&src->i_chroma);
         /* TODO support packed and rgb */
         return VLC_EGENERIC;



More information about the vlc-commits mailing list