]> git.sesse.net Git - vlc/commitdiff
Implemented matroska DEMUX_GET_FPS (close #2014)
authorLaurent Aimar <fenrir@videolan.org>
Mon, 8 Sep 2008 17:59:06 +0000 (19:59 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 8 Sep 2008 18:02:05 +0000 (20:02 +0200)
modules/demux/mkv.cpp

index 7fe77bfe67ba9022a07ba2a8f82f3063c560662b..1034cf634b5d1c2c0a1f49687580ef31a161fa87 100644 (file)
@@ -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;
     }