[vlc-devel] On-the-fly AR change from decoder

Marian Ďurkovič md at bts.sk
Wed Sep 10 15:44:47 CEST 2008


Hi all,

  please find below the "proof of concept" patch for on-the-fly AR change
triggered by the decoder. It lacks a lot of stuff - but it's only meant
to demonstrate it can work. Obviously, it avoids crash on AR change.


   With kind regards,

        M.


diff --git a/src/input/decoder.c b/src/input/decoder.c
index 0ed169b..2c3591f 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1248,8 +1248,7 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
     if( p_sys->p_vout == NULL ||
         p_dec->fmt_out.video.i_width != p_sys->video.i_width ||
         p_dec->fmt_out.video.i_height != p_sys->video.i_height ||
-        p_dec->fmt_out.video.i_chroma != p_sys->video.i_chroma ||
-        p_dec->fmt_out.video.i_aspect != p_sys->video.i_aspect )
+        p_dec->fmt_out.video.i_chroma != p_sys->video.i_chroma )
     {
         if( !p_dec->fmt_out.video.i_width ||
             !p_dec->fmt_out.video.i_height )
@@ -1322,6 +1321,15 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
         if( p_sys->video.i_bmask )
             p_sys->p_vout->render.i_bmask = p_sys->video.i_bmask;
     }
+
+    if (p_dec->fmt_out.video.i_aspect != p_sys->video.i_aspect )
+    {
+        p_sys->video.i_aspect=p_dec->fmt_out.video.i_aspect;
+        p_sys->p_vout->fmt_in.i_sar_num = p_dec->fmt_out.video.i_sar_num;
+        p_sys->p_vout->fmt_in.i_sar_den = p_dec->fmt_out.video.i_sar_den;
+        p_sys->p_vout->fmt_in.i_aspect = p_dec->fmt_out.video.i_aspect;
+        p_sys->p_vout->i_changes |= VOUT_ASPECT_CHANGE;
+    }

     /* Get a new picture
      */



More information about the vlc-devel mailing list