[vlc-devel] [PATCH v2 1/2] decoder: Give packetizer aspect ratio to decoder.

Julian Scheel julian at jusst.de
Fri Sep 27 14:32:39 CEST 2013


When the packetizer detects a valid pixel aspect ratio this should be
forwarded to the decoders input format. This is helpful for decoder modules
which do not detect the aspect ratio on their own.

Signed-off-by: Julian Scheel <julian at jusst.de>
---
 src/input/decoder.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index b7e2ff9..09bb1a7 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1819,6 +1819,21 @@ static void DecoderProcessVideo( decoder_t *p_dec, block_t *p_block, bool b_flus
                 es_format_Clean( &p_dec->fmt_in );
                 es_format_Copy( &p_dec->fmt_in, &p_packetizer->fmt_out );
             }
+
+            /* If the packetizer provides aspect ratio information use it as
+             * long as the decoder itself provides no aspect ratio
+             * information. */
+            if( p_packetizer->fmt_out.video.i_sar_num > 0 &&
+                    p_packetizer->fmt_out.video.i_sar_den > 0 &&
+                    (p_dec->fmt_in.video.i_sar_num == 0 ||
+                     p_dec->fmt_in.video.i_sar_den == 0) )
+            {
+                p_dec->fmt_in.video.i_sar_num =
+                    p_packetizer->fmt_out.video.i_sar_num;
+                p_dec->fmt_in.video.i_sar_den=
+                    p_packetizer->fmt_out.video.i_sar_den;
+            }
+
             if( p_packetizer->pf_get_cc )
                 DecoderGetCc( p_dec, p_packetizer );
 
-- 
1.8.4




More information about the vlc-devel mailing list