[vlc-devel] [PATCH 9/9] Make most video filters bail if the input and output orientation doesn't match.

Matthias Keiser matthias at tristan-inc.com
Wed Mar 5 17:01:30 CET 2014


---
 modules/video_chroma/grey_yuv.c  | 3 ++-
 modules/video_chroma/i420_rgb.c  | 5 +++++
 modules/video_chroma/i420_yuy2.c | 3 ++-
 modules/video_chroma/i422_i420.c | 3 ++-
 modules/video_chroma/i422_yuy2.c | 5 +++++
 modules/video_chroma/omxdl.c     | 3 +++
 modules/video_chroma/rv32.c      | 3 ++-
 modules/video_chroma/swscale.c   | 4 ++++
 modules/video_chroma/yuy2_i420.c | 3 ++-
 modules/video_chroma/yuy2_i422.c | 3 ++-
 modules/video_filter/scale.c     | 3 +++
 modules/video_filter/yuvp.c      | 3 ++-
 12 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/modules/video_chroma/grey_yuv.c b/modules/video_chroma/grey_yuv.c
index b236cd7..d76eb88 100644
--- a/modules/video_chroma/grey_yuv.c
+++ b/modules/video_chroma/grey_yuv.c
@@ -72,7 +72,8 @@ static int Activate( vlc_object_t *p_this )
     }
 
     if( p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width
-     || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height )
+       || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height
+       || p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation )
         return -1;
 
     switch( p_filter->fmt_in.video.i_chroma )
diff --git a/modules/video_chroma/i420_rgb.c b/modules/video_chroma/i420_rgb.c
index c9dd5ed..194403b 100644
--- a/modules/video_chroma/i420_rgb.c
+++ b/modules/video_chroma/i420_rgb.c
@@ -113,6 +113,11 @@ static int Activate( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
+    if( p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation )
+    {
+        return VLC_EGENERIC;
+    }
+
     switch( p_filter->fmt_in.video.i_chroma )
     {
         case VLC_CODEC_YV12:
diff --git a/modules/video_chroma/i420_yuy2.c b/modules/video_chroma/i420_yuy2.c
index 7eb317c..5457f95 100644
--- a/modules/video_chroma/i420_yuy2.c
+++ b/modules/video_chroma/i420_yuy2.c
@@ -128,7 +128,8 @@ static int Activate( vlc_object_t *p_this )
     }
 
     if( p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width
-     || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height )
+       || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height
+       || p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation )
         return -1;
 
     switch( p_filter->fmt_in.video.i_chroma )
diff --git a/modules/video_chroma/i422_i420.c b/modules/video_chroma/i422_i420.c
index 3c7d606..b941907 100644
--- a/modules/video_chroma/i422_i420.c
+++ b/modules/video_chroma/i422_i420.c
@@ -74,7 +74,8 @@ static int Activate( vlc_object_t *p_this )
     }
 
     if( p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width
-     || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height )
+       || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height
+       || p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation )
         return -1;
 
     switch( p_filter->fmt_in.video.i_chroma )
diff --git a/modules/video_chroma/i422_yuy2.c b/modules/video_chroma/i422_yuy2.c
index 0916653..383fb3e 100644
--- a/modules/video_chroma/i422_yuy2.c
+++ b/modules/video_chroma/i422_yuy2.c
@@ -104,6 +104,11 @@ static int Activate( vlc_object_t *p_this )
         return -1;
     }
 
+    if( p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation )
+    {
+        return VLC_EGENERIC;
+    }
+
     switch( p_filter->fmt_in.video.i_chroma )
     {
         case VLC_CODEC_I422:
diff --git a/modules/video_chroma/omxdl.c b/modules/video_chroma/omxdl.c
index b4b7cb0..3cc6362 100644
--- a/modules/video_chroma/omxdl.c
+++ b/modules/video_chroma/omxdl.c
@@ -249,6 +249,9 @@ static int Open (vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
 
+    if (filter->fmt_in.video.orientation != filter->fmt_out.video.orientation)
+        return VLC_EGENERIC;
+
     if ((filter->fmt_in.video.i_width != filter->fmt_out.video.i_width)
      || (filter->fmt_in.video.i_height != filter->fmt_out.video.i_height))
         return OpenScaler (obj);
diff --git a/modules/video_chroma/rv32.c b/modules/video_chroma/rv32.c
index a9457c3..e74fa8d 100644
--- a/modules/video_chroma/rv32.c
+++ b/modules/video_chroma/rv32.c
@@ -63,7 +63,8 @@ static int OpenFilter( vlc_object_t *p_this )
     }
 
     if( p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width
-     || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height )
+     || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height
+     || p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation)
         return -1;
 
     p_filter->pf_video_filter = Filter;
diff --git a/modules/video_chroma/swscale.c b/modules/video_chroma/swscale.c
index 1751131..4b763dd 100644
--- a/modules/video_chroma/swscale.c
+++ b/modules/video_chroma/swscale.c
@@ -355,12 +355,16 @@ static int Init( filter_t *p_filter )
     const video_format_t *p_fmti = &p_filter->fmt_in.video;
     video_format_t       *p_fmto = &p_filter->fmt_out.video;
 
+    if( p_fmti->orientation != p_fmto->orientation )
+        return VLC_EGENERIC;
+
     if( video_format_IsSimilar( p_fmti, &p_sys->fmt_in ) &&
         video_format_IsSimilar( p_fmto, &p_sys->fmt_out ) &&
         p_sys->ctx )
     {
         return VLC_SUCCESS;
     }
+
     Clean( p_filter );
 
     /* Init with new parameters */
diff --git a/modules/video_chroma/yuy2_i420.c b/modules/video_chroma/yuy2_i420.c
index 2141fe3..134cfa5 100644
--- a/modules/video_chroma/yuy2_i420.c
+++ b/modules/video_chroma/yuy2_i420.c
@@ -76,7 +76,8 @@ static int Activate( vlc_object_t *p_this )
     }
 
     if( p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width
-     || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height )
+     || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height
+     || p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation)
         return -1;
 
     switch( p_filter->fmt_out.video.i_chroma )
diff --git a/modules/video_chroma/yuy2_i422.c b/modules/video_chroma/yuy2_i422.c
index 11181df..8ab149e 100644
--- a/modules/video_chroma/yuy2_i422.c
+++ b/modules/video_chroma/yuy2_i422.c
@@ -75,7 +75,8 @@ static int Activate( vlc_object_t *p_this )
     }
 
     if( p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width
-     || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height )
+     || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height
+     || p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation)
         return -1;
 
     switch( p_filter->fmt_out.video.i_chroma )
diff --git a/modules/video_filter/scale.c b/modules/video_filter/scale.c
index a812fbb..0884299 100644
--- a/modules/video_filter/scale.c
+++ b/modules/video_filter/scale.c
@@ -68,6 +68,9 @@ static int OpenFilter( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
+    if( p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation )
+        return VLC_EGENERIC;
+
     video_format_ScaleCropAr( &p_filter->fmt_out.video, &p_filter->fmt_in.video );
     p_filter->pf_video_filter = Filter;
 
diff --git a/modules/video_filter/yuvp.c b/modules/video_filter/yuvp.c
index cfb95db..c8ffbf2 100644
--- a/modules/video_filter/yuvp.c
+++ b/modules/video_filter/yuvp.c
@@ -69,7 +69,8 @@ static int Open( vlc_object_t *p_this )
           p_filter->fmt_out.video.i_chroma != VLC_CODEC_RGBA &&
           p_filter->fmt_out.video.i_chroma != VLC_CODEC_ARGB ) ||
         p_filter->fmt_in.video.i_width  != p_filter->fmt_out.video.i_width ||
-        p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height )
+        p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height ||
+        p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation )
     {
         return VLC_EGENERIC;
     }
-- 
1.8.3.4 (Apple Git-47)




More information about the vlc-devel mailing list