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

git version control git at videolan.org
Tue Sep 9 20:52:43 CEST 2008


vlc | branch: 0.9-bugfix | Laurent Aimar <fenrir at videolan.org> | Mon Sep  8 19:59:06 2008 +0200| [9e2e48ad3f4cb2ae955cf68a0d57b221212b782c] | committer: Laurent Aimar 

Implemented matroska DEMUX_GET_FPS (close #2014)
(cherry picked from commit 5c139f1f170a384caf6f49797acfe771b80c221d)

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

 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 a20c8e4..97fa3e0 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