[vlc-devel] [PATCH 1/2] vlc_vout: add VOUT_FMTS_* compare helper

Thomas Guillem thomas at gllm.fr
Wed Jul 29 13:58:20 CEST 2015


like AOUT_FMTS_*
---
 include/vlc_vout.h  | 16 ++++++++++++++++
 src/input/decoder.c | 10 +---------
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/include/vlc_vout.h b/include/vlc_vout.h
index 600cb56..19cf7cb 100644
--- a/include/vlc_vout.h
+++ b/include/vlc_vout.h
@@ -44,6 +44,22 @@
  * Video output thread interface
  */
 
+#define VOUT_FMTS_IDENTICAL( p_first, p_second ) ( \
+    (p_first)->i_chroma == (p_second)->i_chroma && \
+    VOUT_FMTS_SIMILAR( p_first, p_second ) )
+
+/* Check if video size, position and orientation are the same */
+#define VOUT_FMTS_SIMILAR( p_first, p_second ) (                            \
+     (p_first)->i_width == (p_second)->i_width && \
+     (p_first)->i_height == (p_second)->i_height && \
+     (p_first)->i_visible_width == (p_second)->i_visible_width && \
+     (p_first)->i_visible_height == (p_second)->i_visible_height && \
+     (p_first)->i_x_offset == (p_second)->i_x_offset && \
+     (p_first)->i_y_offset == (p_second)->i_y_offset && \
+     (int64_t)(p_first)->i_sar_num * (p_second)->i_sar_den == \
+     (int64_t)(p_first)->i_sar_den * (p_second)->i_sar_num && \
+     (p_first)->orientation == (p_second)->orientation )
+
 /**
  * Vout configuration
  */
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 253ca99..41cca5e 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -299,16 +299,8 @@ static int vout_update_format( decoder_t *p_dec )
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
 
     if( p_owner->p_vout == NULL
-     || p_dec->fmt_out.video.i_width != p_owner->fmt.video.i_width
-     || p_dec->fmt_out.video.i_height != p_owner->fmt.video.i_height
-     || p_dec->fmt_out.video.i_visible_width != p_owner->fmt.video.i_visible_width
-     || p_dec->fmt_out.video.i_visible_height != p_owner->fmt.video.i_visible_height
-     || p_dec->fmt_out.video.i_x_offset != p_owner->fmt.video.i_x_offset
-     || p_dec->fmt_out.video.i_y_offset != p_owner->fmt.video.i_y_offset
      || p_dec->fmt_out.i_codec != p_owner->fmt.video.i_chroma
-     || (int64_t)p_dec->fmt_out.video.i_sar_num * p_owner->fmt.video.i_sar_den !=
-        (int64_t)p_dec->fmt_out.video.i_sar_den * p_owner->fmt.video.i_sar_num ||
-        p_dec->fmt_out.video.orientation != p_owner->fmt.video.orientation )
+     || !VOUT_FMTS_SIMILAR( &p_dec->fmt_out.video, &p_owner->fmt.video ) )
     {
         vout_thread_t *p_vout;
 
-- 
2.1.4




More information about the vlc-devel mailing list