[vlc-devel] [PATCH] fix video playback on contextes with width and height differing from coded_width and coded_height

Vittorio Giovara vittorio.giovara at gmail.com
Thu Jun 27 17:46:16 CEST 2013


 This patch is needed when either container or bitstream impose some limitation on the final video size. Apparently it exposes a little problem with OSD in which text is rendered with the display aspect ratio instead of the orignal one. I'm not sure this problem is related to this patch but I can look at it I'm given some pointers.
 Also this brings a nice "Display resolution" entry in Codec Information.
 Thanks to courmisch for helping me with this contribution.

---
 modules/codec/avcodec/video.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 5338144..d9e5057 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -125,8 +125,14 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    p_dec->fmt_out.video.i_width = p_context->width;
-    p_dec->fmt_out.video.i_height = p_context->height;
+    if( p_context->coded_width != p_context->width ||
+        p_context->coded_height != p_context->height )
+    {
+        p_dec->fmt_out.video.i_visible_width = p_context->width;
+        p_dec->fmt_out.video.i_visible_height = p_context->height;
+    }
+    p_dec->fmt_out.video.i_width = p_context->coded_width;
+    p_dec->fmt_out.video.i_height = p_context->coded_height;
 
     if( !p_context->width || !p_context->height )
     {
-- 
1.7.9.5




More information about the vlc-devel mailing list