[vlc-commits] demux: ts: handle video stream descriptor

Francois Cartegnie git at videolan.org
Thu Aug 24 18:03:15 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Aug 24 17:29:22 2017 +0200| [bfff7192a1dc55362b328752d9970ccf177f1ed0] | committer: Francois Cartegnie

demux: ts: handle video stream descriptor

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

 modules/demux/mpeg/ts_psi.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mpeg/ts_psi.c b/modules/demux/mpeg/ts_psi.c
index 37ebab8555..a438ed55d1 100644
--- a/modules/demux/mpeg/ts_psi.c
+++ b/modules/demux/mpeg/ts_psi.c
@@ -925,8 +925,31 @@ explicit_config_too_short:
 static void PMTSetupEs0x02( ts_es_t *p_es,
                             const dvbpsi_pmt_es_t *p_dvbpsies )
 {
+    dvbpsi_descriptor_t *p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x02 );
+    if( p_dr )
+    {
+        /* sample: wcbs.ts */
+        const dvbpsi_vstream_dr_t *p_vdr = dvbpsi_DecodeVStreamDr( p_dr );
+        if( p_vdr )
+        {
+            if( p_vdr->i_frame_rate_code > 1 && p_vdr->i_frame_rate_code < 9 &&
+                !p_vdr->b_multiple_frame_rate )
+            {
+                static const int code_to_frame_rate[8][2] =
+                {
+                    { 24000, 1001 }, { 24, 1 }, { 25, 1 },       { 30000, 1001 },
+                    { 30, 1 },       { 50, 1 }, { 60000, 1001 }, { 60, 1 },
+                };
+                p_es->fmt.video.i_frame_rate = code_to_frame_rate[p_vdr->i_frame_rate_code - 1][0];
+                p_es->fmt.video.i_frame_rate_base = code_to_frame_rate[p_vdr->i_frame_rate_code - 1][1];
+            }
+            if( !p_vdr->b_mpeg2 && p_es->fmt.i_codec == VLC_CODEC_MPGV )
+                p_es->fmt.i_original_fourcc = VLC_CODEC_MP1V;
+        }
+    }
+
     /* MPEG2_stereoscopic_video_format_descriptor */
-    dvbpsi_descriptor_t *p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x34 );
+    p_dr = PMTEsFindDescriptor( p_dvbpsies, 0x34 );
     if( p_dr && p_dr->i_length > 0 && (p_dr->p_data[0] & 0x80) )
     {
         video_multiview_mode_t mode;



More information about the vlc-commits mailing list