[vlc-commits] demux: avformat: use guess_ar

Francois Cartegnie git at videolan.org
Wed Jun 13 15:30:25 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jun 12 17:22:22 2018 +0200| [90b75f8e8184ae2a59aa24db93c9a7b709ca0161] | committer: Francois Cartegnie

demux: avformat: use guess_ar

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=90b75f8e8184ae2a59aa24db93c9a7b709ca0161
---

 modules/demux/avformat/demux.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 397bf003d3..de66091059 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -444,11 +444,12 @@ int avformat_OpenDemux( vlc_object_t *p_this )
                 es_fmt.video.i_frame_rate_base = rate.den;
             }
 
-            es_fmt.video.i_sar_num = s->sample_aspect_ratio.num;
-            if (s->sample_aspect_ratio.num > 0)
-                es_fmt.video.i_sar_den = s->sample_aspect_ratio.den;
-            else
-                es_fmt.video.i_sar_den = 0;
+            AVRational ar = av_guess_sample_aspect_ratio( p_sys->ic, s, NULL );
+            if( ar.num && ar.den )
+            {
+                es_fmt.video.i_sar_den = ar.den;
+                es_fmt.video.i_sar_num = ar.num;
+            }
             break;
 
         case AVMEDIA_TYPE_SUBTITLE:



More information about the vlc-commits mailing list