decoder: Give packetizer aspect ratio to decoder.
authorJulian Scheel <julian@jusst.de>
Fri, 27 Sep 2013 12:32:39 +0000 (14:32 +0200)
committerMartin Storsjö <martin@martin.st>
Fri, 7 Feb 2014 18:42:40 +0000 (20:42 +0200)
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 expose the aspect ratio on their own.

Signed-off-by: Martin Storsjö <martin@martin.st>
src/input/decoder.c

index d7caf2d..995851f 100644 (file)
@@ -1569,6 +1569,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, pass it
+             * to the decoder as a hint if the decoder itself can't provide
+             * it. Copy it regardless of the current value of the decoder input
+             * format aspect ratio, to properly propagate changes in aspect
+             * ratio. */
+            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 =
+                    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 );