[vlc-devel] commit: Implemented matroska DEMUX_GET_FPS (close #2014) (Laurent Aimar )

git version control git at videolan.org
Mon Sep 8 19:59:07 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Sep  8 19:59:06 2008 +0200| [5c139f1f170a384caf6f49797acfe771b80c221d] | committer: Laurent Aimar 

Implemented matroska DEMUX_GET_FPS (close #2014)

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

 modules/demux/mkv.cpp |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/modules/demux/mkv.cpp b/modules/demux/mkv.cpp
index 7fe77bf..1034cf6 100644
--- a/modules/demux/mkv.cpp
+++ b/modules/demux/mkv.cpp
@@ -1730,8 +1730,25 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             }
             return VLC_EGENERIC;
 
-        case DEMUX_SET_TIME:
         case DEMUX_GET_FPS:
+            pf = (double *)va_arg( args, double * );
+            *pf = 0.0;
+            if( p_sys->p_current_segment && p_sys->p_current_segment->Segment() )
+            {
+                const matroska_segment_c *p_segment = p_sys->p_current_segment->Segment();
+                for( size_t i = 0; i < p_segment->tracks.size(); i++ )
+                {
+                    mkv_track_t *tk = p_segment->tracks[i];
+                    if( tk->fmt.i_cat == VIDEO_ES && tk->fmt.video.i_frame_rate_base > 0 )
+                    {
+                        *pf = (double)tk->fmt.video.i_frame_rate / tk->fmt.video.i_frame_rate_base;
+                        break;
+                    }
+                }
+            }
+            return VLC_SUCCESS;
+
+        case DEMUX_SET_TIME:
         default:
             return VLC_EGENERIC;
     }




More information about the vlc-devel mailing list