[vlc-devel] [PATCH 14/28] vlc_es: use vlc_rational_t for the frame rate

Steve Lhomme robux4 at videolabs.io
Mon Apr 3 10:22:02 CEST 2017


---
 include/vlc_es.h                                   |  3 +-
 lib/media.c                                        |  4 +-
 lib/media_player.c                                 |  6 +--
 modules/access/avcapture.m                         |  4 +-
 modules/access/dcp/dcp.cpp                         |  4 +-
 modules/access/decklink.cpp                        |  6 +--
 modules/access/dshow/dshow.cpp                     |  5 +--
 modules/access/imem.c                              |  6 +--
 modules/access/linsys/linsys_hdsdi.c               |  4 +-
 modules/access/linsys/linsys_sdi.c                 |  4 +-
 modules/access/rdp.c                               |  4 +-
 modules/access/screen/mac.c                        |  4 +-
 modules/access/screen/wayland.c                    |  4 +-
 modules/access/screen/xcb.c                        |  4 +-
 modules/access/shm.c                               |  4 +-
 modules/access/v4l2/demux.c                        |  8 ++--
 modules/access/vnc.c                               |  4 +-
 modules/codec/avcodec/d3d11va.c                    |  4 +-
 modules/codec/avcodec/directx_va.c                 |  4 +-
 modules/codec/avcodec/dxva2.c                      |  6 +--
 modules/codec/avcodec/encoder.c                    | 14 +++----
 modules/codec/avcodec/video.c                      | 26 ++++++------
 modules/codec/daala.c                              | 12 +++---
 modules/codec/gstreamer/gstdecode.c                | 14 +++----
 .../codec/gstreamer/gstvlcpictureplaneallocator.c  |  4 +-
 modules/codec/libmpeg2.c                           |  4 +-
 modules/codec/oggspots.c                           |  4 +-
 modules/codec/omxil/omxil.c                        | 12 +++---
 modules/codec/qsv.c                                | 10 ++---
 modules/codec/rawvideo.c                           | 12 +++---
 modules/codec/schroedinger.c                       | 14 +++----
 modules/codec/theora.c                             | 12 +++---
 modules/codec/videotoolbox.m                       |  2 +-
 modules/codec/x264.c                               | 10 ++---
 modules/codec/x265.c                               | 14 +++----
 modules/demux/asf/asf.c                            |  4 +-
 modules/demux/avformat/demux.c                     |  4 +-
 modules/demux/avformat/mux.c                       | 16 ++++----
 modules/demux/avi/avi.c                            |  4 +-
 modules/demux/dirac.c                              |  6 +--
 modules/demux/image.c                              |  6 +--
 modules/demux/mkv/matroska_segment_parse.cpp       |  8 ++--
 modules/demux/mkv/mkv.cpp                          |  4 +-
 modules/demux/mp4/mp4.c                            |  8 ++--
 modules/demux/mpeg/h26x.c                          | 12 +++---
 modules/demux/mpeg/ts_psi.c                        |  4 +-
 modules/demux/ogg.c                                | 36 ++++++++--------
 modules/demux/rawvid.c                             |  8 ++--
 modules/demux/real.c                               |  4 +-
 modules/demux/vc1.c                                |  8 ++--
 modules/hw/mmal/codec.c                            |  4 +-
 modules/hw/mmal/deinterlace.c                      | 12 +++---
 modules/hw/mmal/vout.c                             | 10 ++---
 modules/hw/vdpau/deinterlace.c                     |  8 ++--
 modules/mux/asf.c                                  |  6 +--
 modules/mux/mp4/mp4.c                              | 22 +++++-----
 modules/mux/mpeg/ts.c                              |  8 ++--
 modules/mux/ogg.c                                  | 34 +++++++--------
 modules/packetizer/dirac.c                         |  4 +-
 modules/packetizer/h264.c                          | 16 ++++----
 modules/packetizer/hevc.c                          |  6 +--
 modules/packetizer/mpeg4video.c                    |  8 ++--
 modules/packetizer/mpegvideo.c                     |  8 ++--
 modules/packetizer/vc1.c                           | 10 ++---
 modules/stream_out/transcode/video.c               | 48 +++++++++++-----------
 modules/video_filter/deinterlace/deinterlace.c     |  2 +-
 modules/video_filter/fps.c                         | 20 ++++-----
 modules/video_output/decklink.cpp                  |  6 +--
 modules/video_output/yuv.c                         |  2 +-
 src/input/es_out.c                                 | 18 ++++----
 src/misc/image.c                                   |  4 +-
 71 files changed, 321 insertions(+), 323 deletions(-)

diff --git a/include/vlc_es.h b/include/vlc_es.h
index 462531a4a9..6d7eb58352 100644
--- a/include/vlc_es.h
+++ b/include/vlc_es.h
@@ -321,8 +321,7 @@ struct video_format_t
     unsigned int i_sar_num;                   /**< sample/pixel aspect ratio */
     unsigned int i_sar_den;
 
-    unsigned int i_frame_rate;                     /**< frame rate numerator */
-    unsigned int i_frame_rate_base;              /**< frame rate denominator */
+    vlc_rational_t frame_rate;                               /**< frame rate */
 
     uint32_t i_rmask, i_gmask, i_bmask;      /**< color masks for RGB chroma */
     int i_rrshift, i_lrshift;
diff --git a/lib/media.c b/lib/media.c
index f3be2c93db..9593b6e1a9 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -1009,8 +1009,8 @@ libvlc_media_tracks_get( libvlc_media_t *p_md, libvlc_media_track_t *** pp_es )
             p_mes->video->i_width = p_es->video.i_visible_width;
             p_mes->video->i_sar_num = p_es->video.i_sar_num;
             p_mes->video->i_sar_den = p_es->video.i_sar_den;
-            p_mes->video->i_frame_rate_num = p_es->video.i_frame_rate;
-            p_mes->video->i_frame_rate_den = p_es->video.i_frame_rate_base;
+            p_mes->video->i_frame_rate_num = p_es->video.frame_rate.num;
+            p_mes->video->i_frame_rate_den = p_es->video.frame_rate.den;
 
             assert( p_es->video.orientation >= ORIENT_TOP_LEFT &&
                     p_es->video.orientation <= ORIENT_RIGHT_BOTTOM );
diff --git a/lib/media_player.c b/lib/media_player.c
index 2c5aa727fb..7cd7bf88f6 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -1685,9 +1685,9 @@ float libvlc_media_player_get_fps( libvlc_media_player_t *p_mi )
     {
         const es_format_t *fmt = item->es[i];
 
-        if( fmt->i_cat == VIDEO_ES && fmt->video.i_frame_rate_base > 0 )
-            fps = (float)fmt->video.i_frame_rate
-                  / (float)fmt->video.i_frame_rate_base;
+        if( fmt->i_cat == VIDEO_ES && fmt->video.frame_rate.den > 0 )
+            fps = (float)fmt->video.frame_rate.num
+                  / (float)fmt->video.frame_rate.den;
     }
     vlc_mutex_unlock( &item->lock );
     libvlc_media_release( media );
diff --git a/modules/access/avcapture.m b/modules/access/avcapture.m
index 7d3267b86d..05f22c3312 100644
--- a/modules/access/avcapture.m
+++ b/modules/access/avcapture.m
@@ -417,8 +417,8 @@ static int Demux(demux_t *p_demux)
             }
             else if ( !p_sys->b_es_setup )
             {
-                p_sys->fmt.video.i_frame_rate_base = [(__bridge VLCAVDecompressedVideoOutput *)p_sys->output timeScale];
-                msg_Dbg(p_demux, "using frame rate base: %i", p_sys->fmt.video.i_frame_rate_base);
+                p_sys->fmt.video.frame_rate.den = [(__bridge VLCAVDecompressedVideoOutput *)p_sys->output timeScale];
+                msg_Dbg(p_demux, "using frame rate base: %i", p_sys->fmt.video.frame_rate.den);
                 p_sys->width = p_sys->fmt.video.i_width = [(__bridge VLCAVDecompressedVideoOutput *)p_sys->output width];
                 p_sys->height = p_sys->fmt.video.i_height = [(__bridge VLCAVDecompressedVideoOutput *)p_sys->output height];
                 p_sys->p_es_video = es_out_Add(p_demux->out, &p_sys->fmt);
diff --git a/modules/access/dcp/dcp.cpp b/modules/access/dcp/dcp.cpp
index fbe7f8f66c..1437ee36c4 100644
--- a/modules/access/dcp/dcp.cpp
+++ b/modules/access/dcp/dcp.cpp
@@ -863,8 +863,8 @@ static inline void fillVideoFmt( video_format_t * fmt, unsigned int width, unsig
     fmt->i_height = height;
     /* As input are square pixels let VLC  or decoder fix SAR, origin,
      * and visible area */
-    fmt->i_frame_rate = frame_rate_num;
-    fmt->i_frame_rate_base = frame_rate_denom;
+    fmt->frame_rate.num = frame_rate_num;
+    fmt->frame_rate.den = frame_rate_denom;
 }
 
 /**
diff --git a/modules/access/decklink.cpp b/modules/access/decklink.cpp
index ee3ba6398f..e9b4a41624 100644
--- a/modules/access/decklink.cpp
+++ b/modules/access/decklink.cpp
@@ -192,9 +192,9 @@ static es_format_t GetModeSettings(demux_t *demux, IDeckLinkDisplayMode *m)
     video_fmt.video.i_height = m->GetHeight();
     video_fmt.video.i_sar_num = 1;
     video_fmt.video.i_sar_den = 1;
-    video_fmt.video.i_frame_rate = time_scale;
-    video_fmt.video.i_frame_rate_base = frame_duration;
-    video_fmt.i_bitrate = video_fmt.video.i_width * video_fmt.video.i_height * video_fmt.video.i_frame_rate * 2 * 8;
+    video_fmt.video.frame_rate.num = time_scale;
+    video_fmt.video.frame_rate.den = frame_duration;
+    video_fmt.i_bitrate = video_fmt.video.i_width * video_fmt.video.i_height * video_fmt.video.frame_rate.num * 2 * 8;
 
     vlc_rational_t aspect;
     if (!var_InheritURational(demux, &aspect, "decklink-aspect-ratio") &&
diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index dbd0f0345e..3ec963a7d6 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -733,9 +733,8 @@ static int DemuxOpen( vlc_object_t *p_this )
 
             if( p_stream->header.video.AvgTimePerFrame )
             {
-                fmt.video.i_frame_rate = 10000000;
-                fmt.video.i_frame_rate_base =
-                    p_stream->header.video.AvgTimePerFrame;
+                fmt.video.frame_rate.num = 10000000;
+                fmt.video.frame_rate.den = p_stream->header.video.AvgTimePerFrame;
             }
         }
         else if( p_stream->mt.majortype == MEDIATYPE_Audio )
diff --git a/modules/access/imem.c b/modules/access/imem.c
index e6974e1182..5116dac208 100644
--- a/modules/access/imem.c
+++ b/modules/access/imem.c
@@ -438,15 +438,15 @@ static int OpenDemux(vlc_object_t *object)
             }
         }
         if (!var_InheritURational(object, &rat, "imem-fps") && rat.num && rat.den) {
-            fmt.video.i_frame_rate      = rat.num;
-            fmt.video.i_frame_rate_base = rat.den;
+            fmt.video.frame_rate.num = rat.num;
+            fmt.video.frame_rate.den = rat.den;
         }
 
         msg_Dbg(object, "Video %4.4s %dx%d  SAR %d:%d frame rate %u/%u",
                 (const char *)&fmt.i_codec,
                 fmt.video.i_width, fmt.video.i_height,
                 fmt.video.i_sar_num, fmt.video.i_sar_den,
-                fmt.video.i_frame_rate, fmt.video.i_frame_rate_base);
+                fmt.video.frame_rate.num, fmt.video.frame_rate.den);
         break;
     }
     case 3: {
diff --git a/modules/access/linsys/linsys_hdsdi.c b/modules/access/linsys/linsys_hdsdi.c
index b1bc1f4670..2b4e31b0b0 100644
--- a/modules/access/linsys/linsys_hdsdi.c
+++ b/modules/access/linsys/linsys_hdsdi.c
@@ -508,8 +508,8 @@ static int InitVideo( demux_t *p_demux )
     /* Video ES */
     es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC('I','4','2','0') );
     fmt.i_id                    = p_sys->i_id_video;
-    fmt.video.i_frame_rate      = p_sys->i_frame_rate.num;
-    fmt.video.i_frame_rate_base = p_sys->i_frame_rate.den;
+    fmt.video.frame_rate.num    = p_sys->frame_rate.num;
+    fmt.video.frame_rate.den    = p_sys->frame_rate.den;
     fmt.video.i_width           = fmt.video.i_visible_width = p_sys->i_width;
     fmt.video.i_height          = fmt.video.i_visible_height = p_sys->i_height;
     fmt.video.i_sar_num         = p_sys->i_aspect * fmt.video.i_height
diff --git a/modules/access/linsys/linsys_sdi.c b/modules/access/linsys/linsys_sdi.c
index 2790186aa2..6a07b156ad 100644
--- a/modules/access/linsys/linsys_sdi.c
+++ b/modules/access/linsys/linsys_sdi.c
@@ -442,8 +442,8 @@ static int StartDecode( demux_t *p_demux )
     /* Video ES */
     es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_I420 );
     fmt.i_id                    = p_sys->i_id_video;
-    fmt.video.i_frame_rate      = p_sys->frame_rate.num;
-    fmt.video.i_frame_rate_base = p_sys->frame_rate.den;
+    fmt.video.frame_rate.num    = p_sys->frame_rate.num;
+    fmt.video.frame_rate.den    = p_sys->frame_rate.den;
     fmt.video.i_width           = p_sys->i_width;
     fmt.video.i_height          = p_sys->i_height;
     int i_aspect = p_sys->i_forced_aspect ? p_sys->i_forced_aspect
diff --git a/modules/access/rdp.c b/modules/access/rdp.c
index c9bcd6f3b0..cab7cdd61e 100644
--- a/modules/access/rdp.c
+++ b/modules/access/rdp.c
@@ -174,8 +174,8 @@ static void desktopResizeHandler( rdpContext *p_context )
     fmt.video.i_width = p_gdi->width;
     fmt.video.i_visible_height =
     fmt.video.i_height = p_gdi->height;
-    fmt.video.i_frame_rate_base = 1000;
-    fmt.video.i_frame_rate = 1000 * p_sys->f_fps;
+    fmt.video.frame_rate.den = 1000;
+    fmt.video.frame_rate.num = 1000 * p_sys->f_fps;
     p_sys->i_framebuffersize = p_gdi->width * p_gdi->height * p_gdi->bytesPerPixel;
 
     if ( p_sys->p_block )
diff --git a/modules/access/screen/mac.c b/modules/access/screen/mac.c
index ae8a67fd82..e9ae7bcf76 100644
--- a/modules/access/screen/mac.c
+++ b/modules/access/screen/mac.c
@@ -126,8 +126,8 @@ int screen_InitCapture(demux_t *p_demux)
     p_sys->fmt.video.i_bmask           = 0x000000ff;
     p_sys->fmt.video.i_sar_num         =
     p_sys->fmt.video.i_sar_den         = 1;
-    p_sys->fmt.video.i_frame_rate      = 1000 * p_data->rate;
-    p_sys->fmt.video.i_frame_rate_base = 1000;
+    p_sys->fmt.video.frame_rate.num    = 1000 * p_data->rate;
+    p_sys->fmt.video.frame_rate.den    = 1000;
 
     return VLC_SUCCESS;
 }
diff --git a/modules/access/screen/wayland.c b/modules/access/screen/wayland.c
index f6b300da20..5b9cf2f133 100644
--- a/modules/access/screen/wayland.c
+++ b/modules/access/screen/wayland.c
@@ -124,8 +124,8 @@ static void output_mode_cb(void *data, struct wl_output *output,
     fmt.video.i_chroma = VLC_CODEC_RGB32;
     fmt.video.i_bits_per_pixel = 32;
     fmt.video.i_sar_num = fmt.video.i_sar_den = 1;
-    fmt.video.i_frame_rate = lroundf(1000.f * sys->rate);
-    fmt.video.i_frame_rate_base = 1000;
+    fmt.video.frame_rate.num = lroundf(1000.f * sys->rate);
+    fmt.video.frame_rate.den = 1000;
     fmt.video.i_width = width;
 
     if (sys->w != 0 && width > sys->w + sys->x)
diff --git a/modules/access/screen/xcb.c b/modules/access/screen/xcb.c
index bfdfacf055..7a69cfebfe 100644
--- a/modules/access/screen/xcb.c
+++ b/modules/access/screen/xcb.c
@@ -567,8 +567,8 @@ static es_out_id_t *InitES (demux_t *demux, uint_fast16_t width,
     fmt.video.i_chroma = chroma;
     fmt.video.i_bits_per_pixel = *bpp;
     fmt.video.i_sar_num = fmt.video.i_sar_den = 1;
-    fmt.video.i_frame_rate = 1000 * p_sys->rate;
-    fmt.video.i_frame_rate_base = 1000;
+    fmt.video.frame_rate.num = 1000 * p_sys->rate;
+    fmt.video.frame_rate.den = 1000;
     fmt.video.i_visible_width = fmt.video.i_width = width;
     fmt.video.i_visible_height = fmt.video.i_height = height;
 
diff --git a/modules/access/shm.c b/modules/access/shm.c
index 0d9369efe9..69f741035b 100644
--- a/modules/access/shm.c
+++ b/modules/access/shm.c
@@ -232,8 +232,8 @@ static int Open (vlc_object_t *obj)
     fmt.video.i_chroma = chroma;
     fmt.video.i_bits_per_pixel = bpp;
     fmt.video.i_sar_num = fmt.video.i_sar_den = 1;
-    fmt.video.i_frame_rate = 1000 * rate;
-    fmt.video.i_frame_rate_base = 1000;
+    fmt.video.frame_rate.num = 1000 * rate;
+    fmt.video.frame_rate.den = 1000;
     fmt.video.i_visible_width = fmt.video.i_width = width;
     fmt.video.i_visible_height = fmt.video.i_height = height;
 
diff --git a/modules/access/v4l2/demux.c b/modules/access/v4l2/demux.c
index e56714cc7a..37db002770 100644
--- a/modules/access/v4l2/demux.c
+++ b/modules/access/v4l2/demux.c
@@ -400,8 +400,8 @@ static int InitVideo (demux_t *demux, int fd, uint32_t caps)
         es_fmt.video.i_width = fmt.fmt.pix.width;
     es_fmt.video.i_visible_height =
     es_fmt.video.i_height = fmt.fmt.pix.height;
-    es_fmt.video.i_frame_rate = parm.parm.capture.timeperframe.denominator;
-    es_fmt.video.i_frame_rate_base = parm.parm.capture.timeperframe.numerator;
+    es_fmt.video.frame_rate.num = parm.parm.capture.timeperframe.denominator;
+    es_fmt.video.frame_rate.den = parm.parm.capture.timeperframe.numerator;
     GetAR (fd, &es_fmt.video.i_sar_num, &es_fmt.video.i_sar_den);
 
     msg_Dbg (demux, "color primaries: %u", fmt.fmt.pix.colorspace);
@@ -542,8 +542,8 @@ static int InitVideo (demux_t *demux, int fd, uint32_t caps)
              (char *)&es_fmt.i_codec,
              es_fmt.video.i_visible_width, es_fmt.video.i_visible_height,
              es_fmt.video.i_width, es_fmt.video.i_height);
-    msg_Dbg (demux, " frame rate: %u/%u", es_fmt.video.i_frame_rate,
-             es_fmt.video.i_frame_rate_base);
+    msg_Dbg (demux, " frame rate: %u/%u", es_fmt.video.frame_rate.num,
+             es_fmt.video.frame_rate.den);
     msg_Dbg (demux, " aspect ratio: %u/%u", es_fmt.video.i_sar_num,
              es_fmt.video.i_sar_den);
     sys->es = es_out_Add (demux->out, &es_fmt);
diff --git a/modules/access/vnc.c b/modules/access/vnc.c
index c8eca5b166..d5a88506ae 100644
--- a/modules/access/vnc.c
+++ b/modules/access/vnc.c
@@ -208,8 +208,8 @@ static rfbBool mallocFrameBufferHandler( rfbClient* p_client )
     fmt.video.i_visible_height =
             fmt.video.i_height = i_height;
 
-    fmt.video.i_frame_rate_base = 1000;
-    fmt.video.i_frame_rate = 1000 * p_sys->f_fps;
+    fmt.video.frame_rate.den = 1000;
+    fmt.video.frame_rate.num = 1000 * p_sys->f_fps;
 
     fmt.video.i_bits_per_pixel = i_depth;
     fmt.video.i_rmask = p_client->format.redMax << p_client->format.redShift;
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 6cdd166a2f..c3da9ab7b9 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -795,8 +795,8 @@ static bool SetupProcessor(vlc_va_t *va, const video_format_t *fmt)
     D3D11_VIDEO_PROCESSOR_CONTENT_DESC processorDesc = {
         .InputFrameFormat = D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE,   /* TODO */
         .InputFrameRate = {
-            .Numerator   = fmt->i_frame_rate_base > 0 ? fmt->i_frame_rate : 0,
-            .Denominator = fmt->i_frame_rate_base,
+            .Numerator   = fmt->frame_rate.den > 0 ? fmt->frame_rate.num : 0,
+            .Denominator = fmt->frame_rate.den,
         },
         .InputWidth   = fmt->i_width,
         .InputHeight  = fmt->i_height,
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index 1c26edcd6e..47f9c03408 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -329,8 +329,8 @@ int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, AVCodecContext *avctx)
     memset(&fmt, 0, sizeof(fmt));
     fmt.i_width = dx_sys->width;
     fmt.i_height = dx_sys->height;
-    fmt.i_frame_rate = avctx->framerate.num;
-    fmt.i_frame_rate_base = avctx->framerate.den;
+    fmt.frame_rate.num = avctx->framerate.num;
+    fmt.frame_rate.den = avctx->framerate.den;
 
     if (dx_sys->pf_create_decoder_surfaces(va, dx_sys->codec_id, &fmt))
         return VLC_EGENERIC;
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index f2ff49777e..2399677b5e 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -759,9 +759,9 @@ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id, const video_format_t
     dsc.SampleWidth     = fmt->i_width;
     dsc.SampleHeight    = fmt->i_height;
     dsc.Format          = p_sys->render;
-    if (fmt->i_frame_rate > 0 && fmt->i_frame_rate_base > 0) {
-        dsc.InputSampleFreq.Numerator   = fmt->i_frame_rate;
-        dsc.InputSampleFreq.Denominator = fmt->i_frame_rate_base;
+    if (fmt->frame_rate.num > 0 && fmt->frame_rate.den > 0) {
+        dsc.InputSampleFreq.Numerator   = fmt->frame_rate.num;
+        dsc.InputSampleFreq.Denominator = fmt->frame_rate.den;
     } else {
         dsc.InputSampleFreq.Numerator   = 0;
         dsc.InputSampleFreq.Denominator = 0;
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 2514ef9055..ffd88bdba5 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -240,12 +240,12 @@ static const int DEFAULT_ALIGN = 0;
  *****************************************************************************/
 static void probe_video_frame_rate( encoder_t *p_enc, AVCodecContext *p_context, AVCodec *p_codec )
 {
-    /* if we don't have i_frame_rate_base, we are probing and just checking if we can find codec
+    /* if we don't have frame_rate.den, we are probing and just checking if we can find codec
      * so set fps to requested fps if asked by user or input fps is availabled */
-    p_context->time_base.num = p_enc->fmt_in.video.i_frame_rate_base ? p_enc->fmt_in.video.i_frame_rate_base : 1;
+    p_context->time_base.num = p_enc->fmt_in.video.frame_rate.den ? p_enc->fmt_in.video.frame_rate.den : 1;
 
     // MP4V doesn't like CLOCK_FREQ denominator in time_base, so use 1/25 as default for that
-    p_context->time_base.den = p_enc->fmt_in.video.i_frame_rate_base ? p_enc->fmt_in.video.i_frame_rate :
+    p_context->time_base.den = p_enc->fmt_in.video.frame_rate.den ? p_enc->fmt_in.video.frame_rate.num :
                                   ( p_enc->fmt_out.i_codec == VLC_CODEC_MP4V ? 25 : CLOCK_FREQ );
 
     msg_Dbg( p_enc, "Time base for probing set to %d/%d", p_context->time_base.num, p_context->time_base.den );
@@ -263,11 +263,11 @@ static void probe_video_frame_rate( encoder_t *p_enc, AVCodecContext *p_context,
         /* If we have something reasonable on supported framerates, use that*/
         if( p_context->time_base.den && p_context->time_base.den < CLOCK_FREQ )
         {
-            p_enc->fmt_out.video.i_frame_rate_base =
-                p_enc->fmt_in.video.i_frame_rate_base =
+            p_enc->fmt_out.video.frame_rate.den =
+                p_enc->fmt_in.video.frame_rate.den =
                 p_context->time_base.num;
-            p_enc->fmt_out.video.i_frame_rate =
-                p_enc->fmt_in.video.i_frame_rate =
+            p_enc->fmt_out.video.frame_rate.num =
+                p_enc->fmt_in.video.frame_rate.num =
                 p_context->time_base.den;
         }
     }
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index f9b982bc33..715a86f530 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -173,25 +173,25 @@ static int lavc_GetVideoFormat(decoder_t *dec, video_format_t *restrict fmt,
             fmt->i_sar_num = fmt->i_sar_den = 1;
     }
 
-    if (dec->fmt_in.video.i_frame_rate > 0
-     && dec->fmt_in.video.i_frame_rate_base > 0)
+    if (dec->fmt_in.video.frame_rate.num > 0
+     && dec->fmt_in.video.frame_rate.den > 0)
     {
-        fmt->i_frame_rate = dec->fmt_in.video.i_frame_rate;
-        fmt->i_frame_rate_base = dec->fmt_in.video.i_frame_rate_base;
+        fmt->frame_rate.num = dec->fmt_in.video.frame_rate.num;
+        fmt->frame_rate.den = dec->fmt_in.video.frame_rate.den;
     }
     else if (ctx->framerate.num > 0 && ctx->framerate.den > 0)
     {
-        fmt->i_frame_rate = ctx->framerate.num;
-        fmt->i_frame_rate_base = ctx->framerate.den;
+        fmt->frame_rate.num = ctx->framerate.num;
+        fmt->frame_rate.den = ctx->framerate.den;
 # if LIBAVCODEC_VERSION_MICRO <  100
         // for some reason libav don't thinkg framerate presents actually same thing as in ffmpeg
-        fmt->i_frame_rate_base *= __MAX(ctx->ticks_per_frame, 1);
+        fmt->frame_rate.den *= __MAX(ctx->ticks_per_frame, 1);
 # endif
     }
     else if (ctx->time_base.num > 0 && ctx->time_base.den > 0)
     {
-        fmt->i_frame_rate = ctx->time_base.den;
-        fmt->i_frame_rate_base = ctx->time_base.num
+        fmt->frame_rate.num = ctx->time_base.den;
+        fmt->frame_rate.den = ctx->time_base.num
                                  * __MAX(ctx->ticks_per_frame, 1);
     }
 
@@ -681,12 +681,12 @@ static void interpolate_next_pts( decoder_t *p_dec, AVFrame *frame )
         return;
 
     /* interpolate the next PTS */
-    if( p_dec->fmt_in.video.i_frame_rate > 0 &&
-        p_dec->fmt_in.video.i_frame_rate_base > 0 )
+    if( p_dec->fmt_in.video.frame_rate.num > 0 &&
+        p_dec->fmt_in.video.frame_rate.den > 0 )
     {
         p_sys->i_pts += CLOCK_FREQ * (2 + frame->repeat_pict) *
-            p_dec->fmt_in.video.i_frame_rate_base /
-            (2 * p_dec->fmt_in.video.i_frame_rate);
+            p_dec->fmt_in.video.frame_rate.den /
+            (2 * p_dec->fmt_in.video.frame_rate.num);
     }
     else if( p_context->time_base.den > 0 )
     {
diff --git a/modules/codec/daala.c b/modules/codec/daala.c
index ca94b67107..15b487423b 100644
--- a/modules/codec/daala.c
+++ b/modules/codec/daala.c
@@ -346,8 +346,8 @@ static int ProcessHeaders( decoder_t *p_dec )
 
     if( p_sys->di.timebase_numerator > 0 && p_sys->di.timebase_denominator > 0 )
     {
-        p_dec->fmt_out.video.i_frame_rate = p_sys->di.timebase_numerator;
-        p_dec->fmt_out.video.i_frame_rate_base = p_sys->di.timebase_denominator;
+        p_dec->fmt_out.video.frame_rate.num = p_sys->di.timebase_numerator;
+        p_dec->fmt_out.video.frame_rate.den = p_sys->di.timebase_denominator;
     }
 
     msg_Dbg( p_dec, "%dx%d %.02f fps video, frame content ",
@@ -656,16 +656,16 @@ static int OpenEncoder( vlc_object_t *p_this )
     }
     p_sys->di.frame_duration = 1;
 
-    if( !p_enc->fmt_in.video.i_frame_rate ||
-        !p_enc->fmt_in.video.i_frame_rate_base )
+    if( !p_enc->fmt_in.video.frame_rate.num ||
+        !p_enc->fmt_in.video.frame_rate.den )
     {
         p_sys->di.timebase_numerator = 25;
         p_sys->di.timebase_denominator = 1;
     }
     else
     {
-        p_sys->di.timebase_numerator = p_enc->fmt_in.video.i_frame_rate;
-        p_sys->di.timebase_denominator = p_enc->fmt_in.video.i_frame_rate_base;
+        p_sys->di.timebase_numerator = p_enc->fmt_in.video.frame_rate.num;
+        p_sys->di.timebase_denominator = p_enc->fmt_in.video.frame_rate.den;
     }
 
     if( p_enc->fmt_in.video.i_sar_num > 0 && p_enc->fmt_in.video.i_sar_den > 0 )
diff --git a/modules/codec/gstreamer/gstdecode.c b/modules/codec/gstreamer/gstdecode.c
index dbaddcee41..d6e86844db 100644
--- a/modules/codec/gstreamer/gstdecode.c
+++ b/modules/codec/gstreamer/gstdecode.c
@@ -404,10 +404,10 @@ static GstStructure* vlc_to_gst_fmt( const es_format_t *p_fmt )
                 "width", G_TYPE_INT, p_vfmt->i_width,
                 "height", G_TYPE_INT, p_vfmt->i_height, NULL );
 
-    if( p_vfmt->i_frame_rate && p_vfmt->i_frame_rate_base )
+    if( p_vfmt->frame_rate.num && p_vfmt->frame_rate.den )
         gst_structure_set( p_str, "framerate", GST_TYPE_FRACTION,
-                p_vfmt->i_frame_rate,
-                p_vfmt->i_frame_rate_base, NULL );
+                p_vfmt->frame_rate.num,
+                p_vfmt->frame_rate.den, NULL );
 
     if( p_vfmt->i_sar_num && p_vfmt->i_sar_den )
         gst_structure_set( p_str, "pixel-aspect-ratio", GST_TYPE_FRACTION,
@@ -698,11 +698,11 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
             GST_BUFFER_DURATION( p_buf ) = gst_util_uint64_scale(
                     p_block->i_length, GST_SECOND, GST_MSECOND );
 
-        if( p_dec->fmt_in.video.i_frame_rate  &&
-                p_dec->fmt_in.video.i_frame_rate_base )
+        if( p_dec->fmt_in.video.frame_rate.num  &&
+                p_dec->fmt_in.video.frame_rate.den )
             GST_BUFFER_DURATION( p_buf ) = gst_util_uint64_scale( GST_SECOND,
-                    p_dec->fmt_in.video.i_frame_rate_base,
-                    p_dec->fmt_in.video.i_frame_rate );
+                    p_dec->fmt_in.video.frame_rate.den,
+                    p_dec->fmt_in.video.frame_rate.num );
 
         /* Give the input buffer to GStreamer Bin.
          *
diff --git a/modules/codec/gstreamer/gstvlcpictureplaneallocator.c b/modules/codec/gstreamer/gstvlcpictureplaneallocator.c
index 2029eb47a4..6282b8dc7f 100644
--- a/modules/codec/gstreamer/gstvlcpictureplaneallocator.c
+++ b/modules/codec/gstreamer/gstvlcpictureplaneallocator.c
@@ -243,8 +243,8 @@ bool gst_vlc_set_vout_fmt( GstVideoInfo *p_info, GstVideoAlignment *p_align,
     p_voutfmt->i_x_offset = p_align->padding_left;
     p_voutfmt->i_y_offset = p_align->padding_top;
 
-    p_voutfmt->i_frame_rate = GST_VIDEO_INFO_FPS_N( p_info );
-    p_voutfmt->i_frame_rate_base = GST_VIDEO_INFO_FPS_D( p_info );
+    p_voutfmt->frame_rate.num = GST_VIDEO_INFO_FPS_N( p_info );
+    p_voutfmt->frame_rate.den = GST_VIDEO_INFO_FPS_D( p_info );
 
     return true;
 }
diff --git a/modules/codec/libmpeg2.c b/modules/codec/libmpeg2.c
index 1f128995c4..1d99ad03c5 100644
--- a/modules/codec/libmpeg2.c
+++ b/modules/codec/libmpeg2.c
@@ -677,10 +677,10 @@ static picture_t *GetNewPicture( decoder_t *p_dec )
 
     if( p_sys->p_info->sequence->frame_period > 0 )
     {
-        p_dec->fmt_out.video.i_frame_rate =
+        p_dec->fmt_out.video.frame_rate.num =
             (uint32_t)( (uint64_t)1001000000 * 27 /
                         p_sys->p_info->sequence->frame_period );
-        p_dec->fmt_out.video.i_frame_rate_base = 1001;
+        p_dec->fmt_out.video.frame_rate.den = 1001;
     }
 
     p_dec->fmt_out.i_codec =
diff --git a/modules/codec/oggspots.c b/modules/codec/oggspots.c
index 9db89c40e3..213c46a054 100644
--- a/modules/codec/oggspots.c
+++ b/modules/codec/oggspots.c
@@ -238,8 +238,8 @@ static int ProcessHeader(decoder_t* p_dec)
     }
 
     /* Normalize granulerate */
-    vlc_ureduce(&p_dec->fmt_in.video.i_frame_rate,
-                &p_dec->fmt_in.video.i_frame_rate_base,
+    vlc_ureduce(&p_dec->fmt_in.video.frame_rate.num,
+                &p_dec->fmt_in.video.frame_rate.den,
                 i_granulerate_numerator, i_granulerate_denominator, 0);
 
     /* Image format */
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 2ae9bb1874..ba52fdca53 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -262,10 +262,10 @@ static OMX_ERRORTYPE SetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
         def->format.video.nFrameHeight = p_fmt->video.i_height;
         if(def->format.video.eCompressionFormat == OMX_VIDEO_CodingUnused)
             def->format.video.nStride = def->format.video.nFrameWidth;
-        if( p_fmt->video.i_frame_rate > 0 &&
-            p_fmt->video.i_frame_rate_base > 0 )
-            def->format.video.xFramerate = (p_fmt->video.i_frame_rate << 16) /
-                p_fmt->video.i_frame_rate_base;
+        if( p_fmt->video.frame_rate.num > 0 &&
+            p_fmt->video.frame_rate.den > 0 )
+            def->format.video.xFramerate = (p_fmt->video.frame_rate.num << 16) /
+                p_fmt->video.frame_rate.den;
 
         if(def->eDir == OMX_DirInput || p_dec->p_sys->b_enc)
         {
@@ -595,8 +595,8 @@ static OMX_ERRORTYPE GetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
         p_fmt->video.i_visible_width = def->format.video.nFrameWidth;
         p_fmt->video.i_height = def->format.video.nFrameHeight;
         p_fmt->video.i_visible_height = def->format.video.nFrameHeight;
-        p_fmt->video.i_frame_rate = p_dec->fmt_in.video.i_frame_rate;
-        p_fmt->video.i_frame_rate_base = p_dec->fmt_in.video.i_frame_rate_base;
+        p_fmt->video.frame_rate.num = p_dec->fmt_in.video.frame_rate.num;
+        p_fmt->video.frame_rate.den = p_dec->fmt_in.video.frame_rate.den;
 
         OMX_INIT_STRUCTURE(crop_rect);
         crop_rect.nPortIndex = def->nPortIndex;
diff --git a/modules/codec/qsv.c b/modules/codec/qsv.c
index e0c9121fc4..f85750b045 100644
--- a/modules/codec/qsv.c
+++ b/modules/codec/qsv.c
@@ -414,7 +414,7 @@ static int Open(vlc_object_t *this)
         return VLC_EGENERIC;
 
     if (!enc->fmt_in.video.i_visible_height || !enc->fmt_in.video.i_visible_width ||
-        !enc->fmt_in.video.i_frame_rate || !enc->fmt_in.video.i_frame_rate_base) {
+        !enc->fmt_in.video.frame_rate.num || !enc->fmt_in.video.frame_rate.den) {
         msg_Err(enc, "Framerate and picture dimensions must be non-zero");
         return VLC_EGENERIC;
     }
@@ -452,8 +452,8 @@ static int Open(vlc_object_t *this)
     enc->fmt_in.video.i_bits_per_pixel = 12;
 
     /* Input picture format description */
-    sys->params.mfx.FrameInfo.FrameRateExtN = enc->fmt_in.video.i_frame_rate;
-    sys->params.mfx.FrameInfo.FrameRateExtD = enc->fmt_in.video.i_frame_rate_base;
+    sys->params.mfx.FrameInfo.FrameRateExtN = enc->fmt_in.video.frame_rate.num;
+    sys->params.mfx.FrameInfo.FrameRateExtD = enc->fmt_in.video.frame_rate.den;
     sys->params.mfx.FrameInfo.FourCC        = MFX_FOURCC_NV12;
     sys->params.mfx.FrameInfo.ChromaFormat  = MFX_CHROMAFORMAT_YUV420;
     sys->params.mfx.FrameInfo.Width         = QSV_ALIGN(16, enc->fmt_in.video.i_width);
@@ -698,8 +698,8 @@ static block_t *Encode(encoder_t *this, picture_t *pic)
 
             /* Copied from x264.c: This isn't really valid for streams with B-frames */
             block->i_length = CLOCK_FREQ *
-                enc->fmt_in.video.i_frame_rate_base /
-                enc->fmt_in.video.i_frame_rate;
+                enc->fmt_in.video.frame_rate.den /
+                enc->fmt_in.video.frame_rate.num;
 
             // Buggy DTS (value comes from experiments)
             if (task->bs.DecodeTimeStamp < -10000)
diff --git a/modules/codec/rawvideo.c b/modules/codec/rawvideo.c
index 7500d7afb4..1711be13e3 100644
--- a/modules/codec/rawvideo.c
+++ b/modules/codec/rawvideo.c
@@ -102,14 +102,14 @@ static int OpenCommon( decoder_t *p_dec )
 
     es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
 
-    date_Init( &p_sys->pts, p_dec->fmt_out.video.i_frame_rate,
-               p_dec->fmt_out.video.i_frame_rate_base );
-    if( p_dec->fmt_out.video.i_frame_rate == 0 ||
-        p_dec->fmt_out.video.i_frame_rate_base == 0)
+    date_Init( &p_sys->pts, p_dec->fmt_out.video.frame_rate.num,
+               p_dec->fmt_out.video.frame_rate.den );
+    if( p_dec->fmt_out.video.frame_rate.num == 0 ||
+        p_dec->fmt_out.video.frame_rate.den == 0)
     {
         msg_Warn( p_dec, "invalid frame rate %d/%d, using 25 fps instead",
-                  p_dec->fmt_out.video.i_frame_rate,
-                  p_dec->fmt_out.video.i_frame_rate_base);
+                  p_dec->fmt_out.video.frame_rate.num,
+                  p_dec->fmt_out.video.frame_rate.den);
         date_Init( &p_sys->pts, 25, 1 );
     }
 
diff --git a/modules/codec/schroedinger.c b/modules/codec/schroedinger.c
index e83240fbf8..a14d3915d9 100644
--- a/modules/codec/schroedinger.c
+++ b/modules/codec/schroedinger.c
@@ -630,9 +630,9 @@ static void SetVideoFormat( decoder_t *p_dec )
     p_dec->fmt_out.video.i_sar_num = p_sys->p_format->aspect_ratio_numerator;
     p_dec->fmt_out.video.i_sar_den = p_sys->p_format->aspect_ratio_denominator;
 
-    p_dec->fmt_out.video.i_frame_rate =
+    p_dec->fmt_out.video.frame_rate.num =
         p_sys->p_format->frame_rate_numerator;
-    p_dec->fmt_out.video.i_frame_rate_base =
+    p_dec->fmt_out.video.frame_rate.den =
         p_sys->p_format->frame_rate_denominator;
 }
 
@@ -1081,7 +1081,7 @@ static int OpenEncoder( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    if( !p_enc->fmt_in.video.i_frame_rate || !p_enc->fmt_in.video.i_frame_rate_base ||
+    if( !p_enc->fmt_in.video.frame_rate.num || !p_enc->fmt_in.video.frame_rate.den ||
         !p_enc->fmt_in.video.i_visible_height || !p_enc->fmt_in.video.i_visible_width )
     {
         msg_Err( p_enc, "Framerate and picture dimensions must be non-zero" );
@@ -1121,7 +1121,7 @@ static int OpenEncoder( vlc_object_t *p_this )
         }
         if( schro_format_guess[i].i_height != p_enc->fmt_in.video.i_height )
             continue;
-        int src_fps = p_enc->fmt_in.video.i_frame_rate / p_enc->fmt_in.video.i_frame_rate_base;
+        int src_fps = p_enc->fmt_in.video.frame_rate.num / p_enc->fmt_in.video.frame_rate.den;
         int delta_fps = abs( schro_format_guess[i].i_approx_fps - src_fps );
         if( delta_fps > 2 )
             continue;
@@ -1150,8 +1150,8 @@ static int OpenEncoder( vlc_object_t *p_this )
     /* constants set from the input video format */
     p_sys->p_format->width                  = p_enc->fmt_in.video.i_visible_width;
     p_sys->p_format->height                 = p_enc->fmt_in.video.i_visible_height;
-    p_sys->p_format->frame_rate_numerator   = p_enc->fmt_in.video.i_frame_rate;
-    p_sys->p_format->frame_rate_denominator = p_enc->fmt_in.video.i_frame_rate_base;
+    p_sys->p_format->frame_rate_numerator   = p_enc->fmt_in.video.frame_rate.num;
+    p_sys->p_format->frame_rate_denominator = p_enc->fmt_in.video.frame_rate.den;
     unsigned u_asr_num, u_asr_den;
     vlc_ureduce( &u_asr_num, &u_asr_den,
                  p_enc->fmt_in.video.i_sar_num,
@@ -1456,7 +1456,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
             }
         }
 
-        date_Init( &date, p_enc->fmt_in.video.i_frame_rate, p_enc->fmt_in.video.i_frame_rate_base );
+        date_Init( &date, p_enc->fmt_in.video.frame_rate.num, p_enc->fmt_in.video.frame_rate.den );
         /* FIXME - Unlike dirac-research codec Schro doesn't have a function that returns the delay in pics yet.
          *   Use a default of 1
          */
diff --git a/modules/codec/theora.c b/modules/codec/theora.c
index 31dfd612a0..268f33642a 100644
--- a/modules/codec/theora.c
+++ b/modules/codec/theora.c
@@ -329,8 +329,8 @@ static int ProcessHeaders( decoder_t *p_dec )
 
     if( p_sys->ti.fps_numerator > 0 && p_sys->ti.fps_denominator > 0 )
     {
-        p_dec->fmt_out.video.i_frame_rate = p_sys->ti.fps_numerator;
-        p_dec->fmt_out.video.i_frame_rate_base = p_sys->ti.fps_denominator;
+        p_dec->fmt_out.video.frame_rate.num = p_sys->ti.fps_numerator;
+        p_dec->fmt_out.video.frame_rate.den = p_sys->ti.fps_denominator;
     }
 
     msg_Dbg( p_dec, "%dx%d %.02f fps video, frame content "
@@ -731,16 +731,16 @@ static int OpenEncoder( vlc_object_t *p_this )
     p_sys->ti.pic_x = 0 /*frame_x_offset*/;
     p_sys->ti.pic_y = 0 /*frame_y_offset*/;
 
-    if( !p_enc->fmt_in.video.i_frame_rate ||
-        !p_enc->fmt_in.video.i_frame_rate_base )
+    if( !p_enc->fmt_in.video.frame_rate.num ||
+        !p_enc->fmt_in.video.frame_rate.den )
     {
         p_sys->ti.fps_numerator = 25;
         p_sys->ti.fps_denominator = 1;
     }
     else
     {
-        p_sys->ti.fps_numerator = p_enc->fmt_in.video.i_frame_rate;
-        p_sys->ti.fps_denominator = p_enc->fmt_in.video.i_frame_rate_base;
+        p_sys->ti.fps_numerator = p_enc->fmt_in.video.frame_rate.num;
+        p_sys->ti.fps_denominator = p_enc->fmt_in.video.frame_rate.den;
     }
 
     if( p_enc->fmt_in.video.i_sar_num > 0 && p_enc->fmt_in.video.i_sar_den > 0 )
diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 48db054c12..3fb56525bb 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -616,7 +616,7 @@ static int StartVideoToolbox(decoder_t *p_dec)
     const unsigned i_sar_den = p_dec->fmt_out.video.i_sar_den;
 
 
-    date_Init( &p_sys->pts, p_dec->fmt_in.video.i_frame_rate * 2, p_dec->fmt_in.video.i_frame_rate_base );
+    date_Init( &p_sys->pts, p_dec->fmt_in.video.frame_rate.num * 2, p_dec->fmt_in.video.frame_rate.den );
 
     VTDictionarySetInt32(pixelaspectratio,
                          kCVImageBufferPixelAspectRatioHorizontalSpacingKey,
diff --git a/modules/codec/x264.c b/modules/codec/x264.c
index 27d9bc0319..65b973a2a8 100644
--- a/modules/codec/x264.c
+++ b/modules/codec/x264.c
@@ -1334,10 +1334,10 @@ static int  Open ( vlc_object_t *p_this )
     p_sys->param.i_timebase_num = 1;
     p_sys->param.i_timebase_den = CLOCK_FREQ;
 
-    if( p_enc->fmt_in.video.i_frame_rate_base > 0 )
+    if( p_enc->fmt_in.video.frame_rate.den > 0 )
     {
-        p_sys->param.i_fps_num = p_enc->fmt_in.video.i_frame_rate;
-        p_sys->param.i_fps_den = p_enc->fmt_in.video.i_frame_rate_base;
+        p_sys->param.i_fps_num = p_enc->fmt_in.video.frame_rate.num;
+        p_sys->param.i_fps_den = p_enc->fmt_in.video.frame_rate.den;
         p_sys->param.b_vfr_input = 0;
     }
 
@@ -1593,8 +1593,8 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
     {
         /* This isn't really valid for streams with B-frames */
         p_block->i_length = CLOCK_FREQ *
-            p_enc->fmt_in.video.i_frame_rate_base /
-                p_enc->fmt_in.video.i_frame_rate;
+            p_enc->fmt_in.video.frame_rate.den /
+                p_enc->fmt_in.video.frame_rate.num;
     }
 
     /* scale pts-values back*/
diff --git a/modules/codec/x265.c b/modules/codec/x265.c
index c35cf4c6ca..5a994a4a8b 100644
--- a/modules/codec/x265.c
+++ b/modules/codec/x265.c
@@ -107,8 +107,8 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
 
     /* This isn't really valid for streams with B-frames */
     p_block->i_length = CLOCK_FREQ *
-        p_enc->fmt_in.video.i_frame_rate_base /
-            p_enc->fmt_in.video.i_frame_rate;
+        p_enc->fmt_in.video.frame_rate.den /
+            p_enc->fmt_in.video.frame_rate.num;
 
     p_block->i_pts = p_sys->initial_date + pic.poc * p_block->i_length;
     p_block->i_dts = p_sys->initial_date + p_sys->dts++ * p_block->i_length;
@@ -160,16 +160,16 @@ static int  Open (vlc_object_t *p_this)
     param->maxCUSize = 16; /* use smaller macroblock */
 
 #if X265_BUILD >= 6
-    param->fpsNum = p_enc->fmt_in.video.i_frame_rate;
-    param->fpsDenom = p_enc->fmt_in.video.i_frame_rate_base;
+    param->fpsNum = p_enc->fmt_in.video.frame_rate.num;
+    param->fpsDenom = p_enc->fmt_in.video.frame_rate.den;
     if (!param->fpsNum) {
         param->fpsNum = 25;
         param->fpsDenom = 1;
     }
 #else
-    if (p_enc->fmt_in.video.i_frame_rate_base) {
-        param->frameRate = p_enc->fmt_in.video.i_frame_rate /
-            p_enc->fmt_in.video.i_frame_rate_base;
+    if (p_enc->fmt_in.video.frame_rate.den) {
+        param->frameRate = p_enc->fmt_in.video.frame_rate.num /
+            p_enc->fmt_in.video.frame_rate.den;
     } else {
         param->frameRate = 25;
     }
diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c
index 64ab6f8014..0034eab21e 100644
--- a/modules/demux/asf/asf.c
+++ b/modules/demux/asf/asf.c
@@ -985,8 +985,8 @@ static int DemuxInit( demux_t *p_demux )
 
             if( p_esp && p_esp->i_average_time_per_frame > 0 )
             {
-                fmt.video.i_frame_rate = 10000000;
-                GET_CHECKED( fmt.video.i_frame_rate_base,
+                fmt.video.frame_rate.num = 10000000;
+                GET_CHECKED( fmt.video.frame_rate.den,
                              p_esp->i_average_time_per_frame,
                              UINT_MAX, uint64_t );
             }
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 4824215c02..3aed520bbe 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -445,8 +445,8 @@ int OpenDemux( vlc_object_t *p_this )
 
 # warning FIXME: implement palette transmission
             psz_type = "video";
-            fmt.video.i_frame_rate = s->codec->time_base.num;
-            fmt.video.i_frame_rate_base = s->codec->time_base.den * __MAX( s->codec->ticks_per_frame, 1 );
+            fmt.video.frame_rate.num = s->codec->time_base.num;
+            fmt.video.frame_rate.den = s->codec->time_base.den * __MAX( s->codec->ticks_per_frame, 1 );
             fmt.video.i_sar_num = s->sample_aspect_ratio.num;
             if (s->sample_aspect_ratio.num > 0)
                 fmt.video.i_sar_den = s->sample_aspect_ratio.den;
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index 20c5e2495b..691fcf0ce7 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -253,15 +253,15 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         break;
 
     case VIDEO_ES:
-        if( !fmt->video.i_frame_rate || !fmt->video.i_frame_rate_base ) {
+        if( !fmt->video.frame_rate.num || !fmt->video.frame_rate.den ) {
             msg_Warn( p_mux, "Missing frame rate, assuming 25fps" );
-            fmt->video.i_frame_rate = 25;
-            fmt->video.i_frame_rate_base = 1;
+            fmt->video.frame_rate.num = 25;
+            fmt->video.frame_rate.den = 1;
         } else
             msg_Dbg( p_mux, "Muxing framerate will be %d/%d = %.2f fps",
-                    fmt->video.i_frame_rate,
-                    fmt->video.i_frame_rate_base,
-                    (double)fmt->video.i_frame_rate/(double)fmt->video.i_frame_rate_base );
+                    fmt->video.frame_rate.num,
+                    fmt->video.frame_rate.den,
+                    (double)fmt->video.frame_rate.num/(double)fmt->video.frame_rate.den );
 
         codec->codec_type = AVMEDIA_TYPE_VIDEO;
         codec->width = fmt->video.i_visible_width;
@@ -273,8 +273,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         msg_Dbg(p_mux, "Muxing aspect ratio will be %d/%d",
                 fmt->video.i_sar_num, fmt->video.i_sar_den);
         stream->sample_aspect_ratio = codec->sample_aspect_ratio;
-        stream->time_base.den = fmt->video.i_frame_rate;
-        stream->time_base.num = fmt->video.i_frame_rate_base;
+        stream->time_base.den = fmt->video.frame_rate.num;
+        stream->time_base.num = fmt->video.frame_rate.den;
         if (fmt->i_bitrate == 0) {
             msg_Warn( p_mux, "Missing video bitrate, assuming 512k" );
             fmt->i_bitrate = 512000;
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index ddde3b1576..e6cc3dea9d 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -617,8 +617,8 @@ static int Open( vlc_object_t * p_this )
                 fmt.video.i_visible_width = fmt.video.i_width;
                 fmt.video.i_visible_height = fmt.video.i_height;
                 fmt.video.i_bits_per_pixel = p_vids->p_bih->biBitCount;
-                fmt.video.i_frame_rate = tk->i_rate;
-                fmt.video.i_frame_rate_base = tk->i_scale;
+                fmt.video.frame_rate.num = tk->i_rate;
+                fmt.video.frame_rate.den = tk->i_scale;
 
                  /* Uncompresse Bitmap or YUV, YUV being always topdown */
                 if ( fmt.video.i_height > INT32_MAX )
diff --git a/modules/demux/dirac.c b/modules/demux/dirac.c
index f7c0668bcd..82ea764be8 100644
--- a/modules/demux/dirac.c
+++ b/modules/demux/dirac.c
@@ -229,13 +229,13 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
     }
     else if( DEMUX_GET_FPS == i_query )
     {
-        if( !p_sys->p_packetizer->fmt_out.video.i_frame_rate )
+        if( !p_sys->p_packetizer->fmt_out.video.frame_rate.num )
         {
             return VLC_EGENERIC;
         }
         double *pd = (double*)va_arg( args, double * );
-        *pd = (float) p_sys->p_packetizer->fmt_out.video.i_frame_rate
-            / p_sys->p_packetizer->fmt_out.video.i_frame_rate_base;
+        *pd = (float) p_sys->p_packetizer->fmt_out.video.frame_rate.num
+            / p_sys->p_packetizer->fmt_out.video.frame_rate.den;
         return VLC_SUCCESS;
     }
     else
diff --git a/modules/demux/image.c b/modules/demux/image.c
index 1904d20119..d19a5f06f6 100644
--- a/modules/demux/image.c
+++ b/modules/demux/image.c
@@ -672,8 +672,8 @@ static int Open(vlc_object_t *object)
         fps.num      = 10;
         fps.den      = 1;
     }
-    fmt.video.i_frame_rate      = fps.num;
-    fmt.video.i_frame_rate_base = fps.den;
+    fmt.video.frame_rate.num = fps.num;
+    fmt.video.frame_rate.den = fps.den;
 
     /* If loadind failed, we still continue to avoid mis-detection
      * by other demuxers. */
@@ -695,7 +695,7 @@ static int Open(vlc_object_t *object)
     sys->is_realtime = var_InheritBool(demux, "image-realtime");
     sys->pts_origin  = sys->is_realtime ? mdate() : 0;
     sys->pts_next    = VLC_TS_INVALID;
-    date_Init(&sys->pts, fmt.video.i_frame_rate, fmt.video.i_frame_rate_base);
+    date_Init(&sys->pts, fmt.video.frame_rate.num, fmt.video.frame_rate.den);
     date_Set(&sys->pts, 0);
 
     es_format_Clean(&fmt);
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index e6debbab43..410354f922 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -491,8 +491,8 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
             mkv_track_t *tk = vars.tk;
 
             tk->f_fps = 0.0;
-            tk->fmt.video.i_frame_rate_base = static_cast<unsigned>( tk->i_default_duration );
-            tk->fmt.video.i_frame_rate = 1000000;
+            tk->fmt.video.frame_rate.den = static_cast<unsigned>( tk->i_default_duration );
+            tk->fmt.video.frame_rate.num = 1000000;
 
             vars.level += 1;
             dispatcher.iterate (tkv.begin (), tkv.end (), Payload( vars ) );
@@ -1374,8 +1374,8 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk )
             if (
                 vars.p_tk->i_extra_data >= 26 && !memcmp(p+4, "VIDORV", 6) && strchr("34", p[10]) && p[11] == '0')
             {
-                vars.p_tk->fmt.video.i_frame_rate      = p[22] << 24 | p[23] << 16 | p[24] << 8 | p[25] << 0;
-                vars.p_tk->fmt.video.i_frame_rate_base = 65536;
+                vars.p_tk->fmt.video.frame_rate.num = p[22] << 24 | p[23] << 16 | p[24] << 8 | p[25] << 0;
+                vars.p_tk->fmt.video.frame_rate.den = 65536;
             }
 
             fill_extra_data( vars.p_tk, 26 );
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 8fc2132bf9..32f51f6974 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -422,9 +422,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 {
                     tracks_map_t::mapped_type const& track = it->second;
 
-                    if( track.fmt.i_cat == VIDEO_ES && track.fmt.video.i_frame_rate_base > 0 )
+                    if( track.fmt.i_cat == VIDEO_ES && track.fmt.video.frame_rate.den > 0 )
                     {
-                        *pf = (double)track.fmt.video.i_frame_rate / track.fmt.video.i_frame_rate_base;
+                        *pf = (double)track.fmt.video.frame_rate.num / track.fmt.video.frame_rate.den;
                         break;
                     }
                 }
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index de0d5d83df..d441faa577 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -2661,12 +2661,12 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
 
         /* Set frame rate */
         TrackGetESSampleRate( p_demux,
-                              &p_track->fmt.video.i_frame_rate,
-                              &p_track->fmt.video.i_frame_rate_base,
+                              &p_track->fmt.video.frame_rate.num,
+                              &p_track->fmt.video.frame_rate.den,
                               p_track, i_sample_description_index, i_chunk );
 
-        p_demux->p_sys->f_fps = (float)p_track->fmt.video.i_frame_rate /
-                                (float)p_track->fmt.video.i_frame_rate_base;
+        p_demux->p_sys->f_fps = (float)p_track->fmt.video.frame_rate.num /
+                                (float)p_track->fmt.video.frame_rate.den;
 
         break;
 
diff --git a/modules/demux/mpeg/h26x.c b/modules/demux/mpeg/h26x.c
index c5dd15582d..7abb8b184e 100644
--- a/modules/demux/mpeg/h26x.c
+++ b/modules/demux/mpeg/h26x.c
@@ -351,8 +351,8 @@ static int GenericOpen( demux_t *p_demux, const char *psz_module,
 
     /* Load the mpegvideo packetizer */
     es_format_Init( &fmt, VIDEO_ES, i_codec );
-    fmt.video.i_frame_rate = p_sys->dts.i_divider_num;
-    fmt.video.i_frame_rate_base = p_sys->dts.i_divider_den;
+    fmt.video.frame_rate.num = p_sys->dts.i_divider_num;
+    fmt.video.frame_rate.den = p_sys->dts.i_divider_den;
     p_sys->p_packetizer = demux_PacketizerNew( p_demux, &fmt, psz_module );
     if( !p_sys->p_packetizer )
     {
@@ -451,11 +451,11 @@ static int Demux( demux_t *p_demux)
                 if( !p_sys->frame_rate.den )
                 {
                     /* Use packetizer's one */
-                    if( p_sys->p_packetizer->fmt_out.video.i_frame_rate_base &&
-                        p_sys->p_packetizer->fmt_out.video.i_frame_rate )
+                    if( p_sys->p_packetizer->fmt_out.video.frame_rate.den &&
+                        p_sys->p_packetizer->fmt_out.video.frame_rate.num )
                     {
-                        p_sys->frame_rate.num = p_sys->p_packetizer->fmt_out.video.i_frame_rate;
-                        p_sys->frame_rate.den = p_sys->p_packetizer->fmt_out.video.i_frame_rate_base;
+                        p_sys->frame_rate.num = p_sys->p_packetizer->fmt_out.video.frame_rate.num;
+                        p_sys->frame_rate.den = p_sys->p_packetizer->fmt_out.video.frame_rate.den;
                     }
                     else
                     {
diff --git a/modules/demux/mpeg/ts_psi.c b/modules/demux/mpeg/ts_psi.c
index d1c81fd2ac..cd79ee1e83 100644
--- a/modules/demux/mpeg/ts_psi.c
+++ b/modules/demux/mpeg/ts_psi.c
@@ -525,8 +525,8 @@ static void SetupJ2KDescriptors( demux_t *p_demux, ts_pes_es_t *p_es, const dvbp
         p_es->fmt.i_level = p_dr->p_data[1];
         p_es->fmt.video.i_width = GetDWBE(&p_dr->p_data[2]);
         p_es->fmt.video.i_height = GetDWBE(&p_dr->p_data[6]);
-        p_es->fmt.video.i_frame_rate_base = GetWBE(&p_dr->p_data[18]);
-        p_es->fmt.video.i_frame_rate = GetWBE(&p_dr->p_data[20]);
+        p_es->fmt.video.frame_rate.den = GetWBE(&p_dr->p_data[18]);
+        p_es->fmt.video.frame_rate.num = GetWBE(&p_dr->p_data[20]);
         p_es->b_interlaced = p_dr->p_data[23] & 0x40;
         if( p_dr->i_length > 24 )
         {
diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 4b2b955fba..69d910970e 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -1765,13 +1765,13 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                         msg_Dbg( p_demux, "found video header of type: %.4s",
                                  (char *)&p_stream->fmt.i_codec );
 
-                        p_stream->fmt.video.i_frame_rate = 10000000;
-                        p_stream->fmt.video.i_frame_rate_base =
+                        p_stream->fmt.video.frame_rate.num = 10000000;
+                        p_stream->fmt.video.frame_rate.den =
                             GetQWLE((oggpacket.packet+164));
-                        p_stream->fmt.video.i_frame_rate_base =
-                            __MAX( p_stream->fmt.video.i_frame_rate_base, 1 );
+                        p_stream->fmt.video.frame_rate.den =
+                            __MAX( p_stream->fmt.video.frame_rate.den, 1 );
                         p_stream->f_rate = 10000000.0 /
-                            p_stream->fmt.video.i_frame_rate_base;
+                            p_stream->fmt.video.frame_rate.den;
                         p_stream->fmt.video.i_bits_per_pixel =
                             GetWLE((oggpacket.packet+182));
                         if( !p_stream->fmt.video.i_bits_per_pixel )
@@ -1899,8 +1899,8 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                         msg_Dbg( p_demux, "found video header of type: %.4s",
                                  (char *)&p_stream->fmt.i_codec );
 
-                        p_stream->fmt.video.i_frame_rate = 10000000;
-                        p_stream->fmt.video.i_frame_rate_base = st->time_unit;
+                        p_stream->fmt.video.frame_rate.num = 10000000;
+                        p_stream->fmt.video.frame_rate.den = st->time_unit;
                         if( st->time_unit <= 0 )
                             st->time_unit = 400000;
                         p_stream->f_rate = 10000000.0 / st->time_unit;
@@ -2576,8 +2576,8 @@ static bool Ogg_ReadTheoraHeader( logical_stream_t *p_stream,
     bs_read( &bitstream, 24 ); /* aspect_numerator */
     bs_read( &bitstream, 24 ); /* aspect_denominator */
 
-    p_stream->fmt.video.i_frame_rate = fps.num;
-    p_stream->fmt.video.i_frame_rate_base = fps.den;
+    p_stream->fmt.video.frame_rate.num = fps.num;
+    p_stream->fmt.video.frame_rate.den = fps.den;
 
     bs_read( &bitstream, 8 ); /* colorspace */
     p_stream->fmt.i_bitrate = bs_read( &bitstream, 24 );
@@ -2644,8 +2644,8 @@ static bool Ogg_ReadDaalaHeader( logical_stream_t *p_stream,
     i_timebase_denominator = oggpack_read( &opb, 32 );
     i_timebase_denominator = __MAX( i_timebase_denominator, 1 );
 
-    p_stream->fmt.video.i_frame_rate = i_timebase_numerator;
-    p_stream->fmt.video.i_frame_rate_base = i_timebase_denominator;
+    p_stream->fmt.video.frame_rate.num = i_timebase_numerator;
+    p_stream->fmt.video.frame_rate.den = i_timebase_denominator;
 
     oggpack_adv( &opb, 32 ); /* frame duration */
 
@@ -2919,11 +2919,11 @@ static bool Ogg_ReadVP8Header( demux_t *p_demux, logical_stream_t *p_stream,
         p_stream->fmt.video.i_visible_height = p_stream->fmt.video.i_height;
         p_stream->fmt.video.i_sar_num = GetDWBE( &p_oggpacket->packet[12 - 1] ) & 0x0FFF;
         p_stream->fmt.video.i_sar_den = GetDWBE( &p_oggpacket->packet[15 - 1] ) & 0x0FFF;
-        p_stream->fmt.video.i_frame_rate = GetDWBE( &p_oggpacket->packet[18] );
-        p_stream->fmt.video.i_frame_rate_base = GetDWBE( &p_oggpacket->packet[22] );
-        p_stream->fmt.video.i_frame_rate_base =
-            __MAX( p_stream->fmt.video.i_frame_rate_base, 1 );
-        p_stream->f_rate = (double) p_stream->fmt.video.i_frame_rate / p_stream->fmt.video.i_frame_rate_base;
+        p_stream->fmt.video.frame_rate.num = GetDWBE( &p_oggpacket->packet[18] );
+        p_stream->fmt.video.frame_rate.den = GetDWBE( &p_oggpacket->packet[22] );
+        p_stream->fmt.video.frame_rate.den =
+            __MAX( p_stream->fmt.video.frame_rate.den, 1 );
+        p_stream->f_rate = (double) p_stream->fmt.video.frame_rate.num / p_stream->fmt.video.frame_rate.den;
         if ( p_stream->f_rate == 0 ) return false;
         return true;
     /* METADATA */
@@ -3465,8 +3465,8 @@ static bool Ogg_ReadOggSpotsHeader( logical_stream_t *p_stream,
     }
 
     /* Normalize granulerate */
-    vlc_ureduce(&p_stream->fmt.video.i_frame_rate,
-                &p_stream->fmt.video.i_frame_rate_base,
+    vlc_ureduce(&p_stream->fmt.video.frame_rate.num,
+                &p_stream->fmt.video.frame_rate.den,
                 i_granulerate_numerator, i_granulerate_denominator, 0);
 
     p_stream->i_granule_shift = p_oggpacket->packet[28];
diff --git a/modules/demux/rawvid.c b/modules/demux/rawvid.c
index d92fd9e842..3772076931 100644
--- a/modules/demux/rawvid.c
+++ b/modules/demux/rawvid.c
@@ -332,11 +332,11 @@ valid:
                         i_width, i_height, i_width, i_height,
                         sar.num, sar.den );
 
-    vlc_ureduce( &p_sys->fmt_video.video.i_frame_rate,
-                 &p_sys->fmt_video.video.i_frame_rate_base,
+    vlc_ureduce( &p_sys->fmt_video.video.frame_rate.num,
+                 &p_sys->fmt_video.video.frame_rate.den,
                  fps.num, fps.den, 0);
-    date_Init( &p_sys->pcr, p_sys->fmt_video.video.i_frame_rate,
-               p_sys->fmt_video.video.i_frame_rate_base );
+    date_Init( &p_sys->pcr, p_sys->fmt_video.video.frame_rate.num,
+               p_sys->fmt_video.video.frame_rate.den );
     date_Set( &p_sys->pcr, 0 );
 
     if( !p_sys->fmt_video.video.i_bits_per_pixel )
diff --git a/modules/demux/real.c b/modules/demux/real.c
index fec8beb885..480baf239c 100644
--- a/modules/demux/real.c
+++ b/modules/demux/real.c
@@ -1393,8 +1393,8 @@ static int CodecVideoParse( demux_t *p_demux, int i_tk_id, const uint8_t *p_data
     fmt.video.i_height= GetWBE( &p_data[14] );
     fmt.video.i_visible_width = fmt.video.i_width;
     fmt.video.i_visible_height = fmt.video.i_height;
-    fmt.video.i_frame_rate = (GetWBE( &p_data[22] ) << 16) | GetWBE( &p_data[24] );
-    fmt.video.i_frame_rate_base = 1 << 16;
+    fmt.video.frame_rate.num = (GetWBE( &p_data[22] ) << 16) | GetWBE( &p_data[24] );
+    fmt.video.frame_rate.den = 1 << 16;
 
     fmt.i_extra = i_data - 26;
     fmt.p_extra = malloc( fmt.i_extra );
diff --git a/modules/demux/vc1.c b/modules/demux/vc1.c
index 57c85c1de9..b1967bcbec 100644
--- a/modules/demux/vc1.c
+++ b/modules/demux/vc1.c
@@ -178,11 +178,11 @@ static int Demux( demux_t *p_demux)
 
             p_block_out = p_next;
 
-            if( p_sys->p_packetizer->fmt_out.video.i_frame_rate > 0 &&
-                p_sys->p_packetizer->fmt_out.video.i_frame_rate_base > 0 )
+            if( p_sys->p_packetizer->fmt_out.video.frame_rate.num > 0 &&
+                p_sys->p_packetizer->fmt_out.video.frame_rate.den > 0 )
                 p_sys->i_dts += CLOCK_FREQ *
-                    p_sys->p_packetizer->fmt_out.video.i_frame_rate_base /
-                    p_sys->p_packetizer->fmt_out.video.i_frame_rate;
+                    p_sys->p_packetizer->fmt_out.video.frame_rate.den /
+                    p_sys->p_packetizer->fmt_out.video.frame_rate.num;
             else if( p_sys->f_fps > 0.001f )
                 p_sys->i_dts += (int64_t)((float) CLOCK_FREQ / p_sys->f_fps);
             else
diff --git a/modules/hw/mmal/codec.c b/modules/hw/mmal/codec.c
index c01d1e4635..b76eb47609 100644
--- a/modules/hw/mmal/codec.c
+++ b/modules/hw/mmal/codec.c
@@ -394,8 +394,8 @@ apply_fmt:
     dec->fmt_out.video.i_visible_height = sys->output->format->es->video.crop.height;
     dec->fmt_out.video.i_sar_num = sys->output->format->es->video.par.num;
     dec->fmt_out.video.i_sar_den = sys->output->format->es->video.par.den;
-    dec->fmt_out.video.i_frame_rate = sys->output->format->es->video.frame_rate.num;
-    dec->fmt_out.video.i_frame_rate_base = sys->output->format->es->video.frame_rate.den;
+    dec->fmt_out.video.frame_rate.num = sys->output->format->es->video.frame_rate.num;
+    dec->fmt_out.video.frame_rate.den = sys->output->format->es->video.frame_rate.den;
 
     /* Query interlaced type */
     interlace_type.hdr.id = MMAL_PARAMETER_VIDEO_INTERLACE_TYPE;
diff --git a/modules/hw/mmal/deinterlace.c b/modules/hw/mmal/deinterlace.c
index cb3148398a..74e2d84732 100644
--- a/modules/hw/mmal/deinterlace.c
+++ b/modules/hw/mmal/deinterlace.c
@@ -81,9 +81,9 @@ static void flush(filter_t *filter);
 
 static int Open(filter_t *filter)
 {
-    int32_t frame_duration = filter->fmt_in.video.i_frame_rate != 0 ?
-            (int64_t)1000000 * filter->fmt_in.video.i_frame_rate_base /
-            filter->fmt_in.video.i_frame_rate : 0;
+    int32_t frame_duration = filter->fmt_in.video.frame_rate.num != 0 ?
+            (int64_t)1000000 * filter->fmt_in.video.frame_rate.den /
+            filter->fmt_in.video.frame_rate.num : 0;
 
     MMAL_PARAMETER_IMAGEFX_PARAMETERS_T imfx_param = {
             { MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, sizeof(imfx_param) },
@@ -150,7 +150,7 @@ static int Open(filter_t *filter)
     sys->input->format->es->video.par.den = filter->fmt_in.video.i_sar_den;
 
     es_format_Copy(&filter->fmt_out, &filter->fmt_in);
-    filter->fmt_out.video.i_frame_rate *= 2;
+    filter->fmt_out.video.frame_rate.num *= 2;
 
     status = mmal_port_format_commit(sys->input);
     if (status != MMAL_SUCCESS) {
@@ -301,8 +301,8 @@ static int send_output_buffer(filter_t *filter)
         ret = -1;
         goto out;
     }
-    picture->format.i_frame_rate = filter->fmt_out.video.i_frame_rate;
-    picture->format.i_frame_rate_base = filter->fmt_out.video.i_frame_rate_base;
+    picture->format.frame_rate.num = filter->fmt_out.video.frame_rate.num;
+    picture->format.frame_rate.den = filter->fmt_out.video.frame_rate.den;
 
     buffer = picture->p_sys->buffer;
     buffer->user_data = picture;
diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index 761b55a0e5..f87990019a 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -557,14 +557,14 @@ static void vd_display(vout_display_t *vd, picture_t *picture,
     MMAL_BUFFER_HEADER_T *buffer = pic_sys->buffer;
     MMAL_STATUS_T status;
 
-    if (picture->format.i_frame_rate != sys->frame_rate.num ||
-        picture->format.i_frame_rate_base != sys->frame_rate.den ||
+    if (picture->format.frame_rate.num != sys->frame_rate.num ||
+        picture->format.frame_rate.den != sys->frame_rate.den ||
         picture->b_progressive != sys->b_progressive ||
         picture->b_top_field_first != sys->b_top_field_first) {
         sys->b_top_field_first = picture->b_top_field_first;
         sys->b_progressive = picture->b_progressive;
-        sys->frame_rate.num = picture->format.i_frame_rate;
-        sys->frame_rate.den = picture->format.i_frame_rate_base;
+        sys->frame_rate.num = picture->format.frame_rate.num;
+        sys->frame_rate.den = picture->format.frame_rate.den;
         configure_display(vd, NULL, &picture->format);
     }
 
@@ -772,7 +772,7 @@ static void adjust_refresh_rate(vout_display_t *vd, const video_format_t *fmt)
     TV_SUPPORTED_MODE_NEW_T supported_modes[VC_TV_MAX_MODE_IDS];
     char response[20]; /* answer is hvs_update_fields=%1d */
     int num_modes;
-    double frame_rate = (double)fmt->i_frame_rate / fmt->i_frame_rate_base;
+    double frame_rate = (double)fmt->frame_rate.num / fmt->frame_rate.den;
     int best_id = -1;
     double best_score, score;
     int i;
diff --git a/modules/hw/vdpau/deinterlace.c b/modules/hw/vdpau/deinterlace.c
index a1370a7560..43497234cf 100644
--- a/modules/hw/vdpau/deinterlace.c
+++ b/modules/hw/vdpau/deinterlace.c
@@ -70,9 +70,9 @@ static picture_t *Deinterlace(filter_t *filter, picture_t *src)
     if (last_pts != VLC_TS_INVALID)
         dst->date = (3 * src->date - last_pts) / 2;
     else
-    if (filter->fmt_in.video.i_frame_rate != 0)
-        dst->date = src->date + ((filter->fmt_in.video.i_frame_rate_base
-                            * CLOCK_FREQ) / filter->fmt_in.video.i_frame_rate);
+    if (filter->fmt_in.video.frame_rate.num != 0)
+        dst->date = src->date + ((filter->fmt_in.video.frame_rate.den
+                            * CLOCK_FREQ) / filter->fmt_in.video.frame_rate.num);
     dst->b_top_field_first = !src->b_top_field_first;
     dst->i_nb_fields = 1;
     src->i_nb_fields = 1;
@@ -118,7 +118,7 @@ static int Open(vlc_object_t *obj)
 
     filter->pf_video_filter = Deinterlace;
     filter->p_sys = sys;
-    filter->fmt_out.video.i_frame_rate *= 2;
+    filter->fmt_out.video.frame_rate.num *= 2;
     return VLC_SUCCESS;
 }
 
diff --git a/modules/mux/asf.c b/modules/mux/asf.c
index f30c1ab77f..ca5d172567 100644
--- a/modules/mux/asf.c
+++ b/modules/mux/asf.c
@@ -961,9 +961,9 @@ static block_t *asf_header_create( sout_mux_t *p_mux, bool b_broadcast )
 
         uint64_t i_avg_duration = 0;
         if( p_fmt->i_cat == VIDEO_ES &&
-            p_fmt->video.i_frame_rate > 0 && p_fmt->video.i_frame_rate_base > 0 )
-            i_avg_duration = ( INT64_C(10000000) * p_fmt->video.i_frame_rate_base +
-                               p_fmt->video.i_frame_rate/2 ) / p_fmt->video.i_frame_rate;
+            p_fmt->video.frame_rate.num > 0 && p_fmt->video.frame_rate.den > 0 )
+            i_avg_duration = ( INT64_C(10000000) * p_fmt->video.frame_rate.den +
+                               p_fmt->video.frame_rate.num/2 ) / p_fmt->video.frame_rate.num;
 
         bo_add_guid ( &bo, &asf_object_extended_stream_properties_guid );
         bo_addle_u64( &bo, 88 );
diff --git a/modules/mux/mp4/mp4.c b/modules/mux/mp4/mp4.c
index d9f2068851..f1019b79b3 100644
--- a/modules/mux/mp4/mp4.c
+++ b/modules/mux/mp4/mp4.c
@@ -425,17 +425,17 @@ static int AddStream(sout_mux_t *p_mux, sout_input_t *p_input)
         p_stream->mux.i_timescale = p_stream->mux.fmt.audio.i_rate;
         break;
     case VIDEO_ES:
-        if( !p_stream->mux.fmt.video.i_frame_rate ||
-            !p_stream->mux.fmt.video.i_frame_rate_base )
+        if( !p_stream->mux.fmt.video.frame_rate.num ||
+            !p_stream->mux.fmt.video.frame_rate.den )
         {
             msg_Warn( p_mux, "Missing frame rate for stream %d, assuming 25fps",
                       p_sys->i_nb_streams );
-            p_stream->mux.fmt.video.i_frame_rate = 25;
-            p_stream->mux.fmt.video.i_frame_rate_base = 1;
+            p_stream->mux.fmt.video.frame_rate.num = 25;
+            p_stream->mux.fmt.video.frame_rate.den = 1;
         }
 
-        p_stream->mux.i_timescale = p_stream->mux.fmt.video.i_frame_rate *
-                                    p_stream->mux.fmt.video.i_frame_rate_base;
+        p_stream->mux.i_timescale = p_stream->mux.fmt.video.frame_rate.num *
+                                    p_stream->mux.fmt.video.frame_rate.den;
 
         if( p_stream->mux.i_timescale > CLOCK_FREQ )
             p_stream->mux.i_timescale = CLOCK_FREQ;
@@ -633,8 +633,8 @@ static int Mux(sout_mux_t *p_mux)
                     if ( p_stream->mux.fmt.i_cat == VIDEO_ES )
                     {
                         p_data->i_length = CLOCK_FREQ *
-                                           p_stream->mux.fmt.video.i_frame_rate_base /
-                                           p_stream->mux.fmt.video.i_frame_rate;
+                                           p_stream->mux.fmt.video.frame_rate.den /
+                                           p_stream->mux.fmt.video.frame_rate.num;
                         msg_Dbg( p_mux, "video track %u fixup to %"PRId64" for sample %u",
                                  p_stream->mux.i_track_id, p_data->i_length, p_stream->mux.i_entry_count );
                     }
@@ -1276,11 +1276,11 @@ static void WriteFragments(sout_mux_t *p_mux, bool b_flush)
  * This is the end boundary case. */
 static void LengthLocalFixup(sout_mux_t *p_mux, const mp4_stream_t *p_stream, block_t *p_entrydata)
 {
-    if ( p_stream->mux.fmt.i_cat == VIDEO_ES && p_stream->mux.fmt.video.i_frame_rate )
+    if ( p_stream->mux.fmt.i_cat == VIDEO_ES && p_stream->mux.fmt.video.frame_rate.num )
     {
         p_entrydata->i_length = CLOCK_FREQ *
-                p_stream->mux.fmt.video.i_frame_rate_base /
-                p_stream->mux.fmt.video.i_frame_rate;
+                p_stream->mux.fmt.video.frame_rate.den /
+                p_stream->mux.fmt.video.frame_rate.num;
         msg_Dbg(p_mux, "video track %d fixup to %"PRId64" for sample %u",
                 p_stream->mux.i_track_id, p_entrydata->i_length, p_stream->mux.i_entry_count - 1);
     }
diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index 5fa30de39e..e38de3a54c 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -1147,12 +1147,12 @@ static void SetBlockDuration( sout_input_t *p_input, block_t *p_data )
         {
             /* Try rates */
             if( p_input->p_fmt->i_cat == VIDEO_ES &&
-                p_input->p_fmt->video.i_frame_rate &&
-                p_input->p_fmt->video.i_frame_rate_base )
+                p_input->p_fmt->video.frame_rate.num &&
+                p_input->p_fmt->video.frame_rate.den )
             {
                 p_data->i_length = CLOCK_FREQ *
-                                   p_input->p_fmt->video.i_frame_rate /
-                                   p_input->p_fmt->video.i_frame_rate_base;
+                                   p_input->p_fmt->video.frame_rate.num /
+                                   p_input->p_fmt->video.frame_rate.den;
             }
             else if( p_input->p_fmt->i_cat == AUDIO_ES &&
                      p_input->p_fmt->audio.i_bytes_per_frame &&
diff --git a/modules/mux/ogg.c b/modules/mux/ogg.c
index 03789b7054..31adf532d6 100644
--- a/modules/mux/ogg.c
+++ b/modules/mux/ogg.c
@@ -377,13 +377,13 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
     switch( p_input->p_fmt->i_cat )
     {
     case VIDEO_ES:
-        if( !p_input->p_fmt->video.i_frame_rate ||
-            !p_input->p_fmt->video.i_frame_rate_base )
+        if( !p_input->p_fmt->video.frame_rate.num ||
+            !p_input->p_fmt->video.frame_rate.den )
         {
             msg_Warn( p_mux, "Missing frame rate, assuming 25fps" );
             assert(p_input->p_fmt == &p_input->fmt);
-            p_input->fmt.video.i_frame_rate = 25;
-            p_input->fmt.video.i_frame_rate_base = 1;
+            p_input->fmt.video.frame_rate.num = 25;
+            p_input->fmt.video.frame_rate.den = 1;
         }
 
         switch( p_stream->i_fourcc )
@@ -421,8 +421,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             }
             p_stream->p_oggds_header->i_size = 0 ;
             p_stream->p_oggds_header->i_time_unit =
-                     INT64_C(10000000) * p_input->p_fmt->video.i_frame_rate_base /
-                     (int64_t)p_input->p_fmt->video.i_frame_rate;
+                     INT64_C(10000000) * p_input->p_fmt->video.frame_rate.den /
+                     (int64_t)p_input->p_fmt->video.frame_rate.num;
             p_stream->p_oggds_header->i_samples_per_unit = 1;
             p_stream->p_oggds_header->i_default_len = 1 ; /* ??? */
             p_stream->p_oggds_header->i_buffer_size = 1024*1024;
@@ -827,8 +827,8 @@ static void OggGetSkeletonFisbone( uint8_t **pp_buffer, long *pi_size,
     switch ( p_input->p_fmt->i_cat )
     {
         case VIDEO_ES:
-            SetQWLE( &(*pp_buffer)[20], p_input->p_fmt->video.i_frame_rate );
-            SetQWLE( &(*pp_buffer)[28], p_input->p_fmt->video.i_frame_rate_base );
+            SetQWLE( &(*pp_buffer)[20], p_input->p_fmt->video.frame_rate.num );
+            SetQWLE( &(*pp_buffer)[28], p_input->p_fmt->video.frame_rate.den );
         break;
         case AUDIO_ES:
             SetQWLE( &(*pp_buffer)[20], p_input->p_fmt->audio.i_rate );
@@ -929,8 +929,8 @@ static void OggFillVP8Header( uint8_t *p_buffer, sout_input_t *p_input )
     SetDWBE( &p_buffer[14], p_input->p_fmt->video.i_sar_den );/* 24 bits, 15~ */
     SetDWBE( &p_buffer[11], p_input->p_fmt->video.i_sar_num );/* 24 bits, 12~ */
     SetWBE( &p_buffer[10], p_input->p_fmt->video.i_height );
-    SetDWBE( &p_buffer[18], p_input->p_fmt->video.i_frame_rate );
-    SetDWBE( &p_buffer[22], p_input->p_fmt->video.i_frame_rate_base );
+    SetDWBE( &p_buffer[18], p_input->p_fmt->video.frame_rate.num );
+    SetDWBE( &p_buffer[22], p_input->p_fmt->video.frame_rate.den );
 }
 
 static bool OggCreateHeaders( sout_mux_t *p_mux )
@@ -1431,13 +1431,13 @@ static bool AllocateIndex( sout_mux_t *p_mux, sout_input_t *p_input )
         uint64_t i;
 
         if( p_input->p_fmt->i_cat == VIDEO_ES &&
-                p_input->p_fmt->video.i_frame_rate )
+                p_input->p_fmt->video.frame_rate.num )
         {
             /* optimize for fps < 1 */
             i_interval= __MAX( p_mux->p_sys->skeleton.i_index_intvl * 1000,
                        INT64_C(10000000) *
-                       p_input->p_fmt->video.i_frame_rate_base /
-                       p_input->p_fmt->video.i_frame_rate );
+                       p_input->p_fmt->video.frame_rate.den /
+                       p_input->p_fmt->video.frame_rate.num );
         }
 
         size_t i_tuple_size = 0;
@@ -1642,7 +1642,7 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
 
                 /* presentation time */
                 i_time = CLOCK_FREQ * ( p_stream->i_num_frames - 1 ) *
-                         p_input->p_fmt->video.i_frame_rate_base /  p_input->p_fmt->video.i_frame_rate;
+                         p_input->p_fmt->video.frame_rate.den /  p_input->p_fmt->video.frame_rate.num;
                 AddIndexEntry( p_mux, i_time, p_input );
             }
 
@@ -1657,10 +1657,10 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
         a += 5000;\
     a /= CLOCK_FREQ;
 
-            mtime_t dt = (p_data->i_dts - p_sys->i_start_dts) * p_input->p_fmt->video.i_frame_rate / p_input->p_fmt->video.i_frame_rate_base;
+            mtime_t dt = (p_data->i_dts - p_sys->i_start_dts) * p_input->p_fmt->video.frame_rate.num / p_input->p_fmt->video.frame_rate.den;
             FRAME_ROUND( dt );
 
-            mtime_t pt = (p_data->i_pts - p_sys->i_start_dts - p_stream->i_baseptsdelay ) * p_input->p_fmt->video.i_frame_rate / p_input->p_fmt->video.i_frame_rate_base;
+            mtime_t pt = (p_data->i_pts - p_sys->i_start_dts - p_stream->i_baseptsdelay ) * p_input->p_fmt->video.frame_rate.num / p_input->p_fmt->video.frame_rate.den;
             FRAME_ROUND( pt );
 
             /* (shro) some PTS could be repeated within 1st frames */
@@ -1710,7 +1710,7 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
 
                 /* presentation time */
                 i_time = CLOCK_FREQ * ( p_stream->i_num_frames - 1 ) *
-                         p_input->p_fmt->video.i_frame_rate_base /  p_input->p_fmt->video.i_frame_rate;
+                         p_input->p_fmt->video.frame_rate.den /  p_input->p_fmt->video.frame_rate.num;
                 AddIndexEntry( p_mux, i_time, p_input );
             }
             op.granulepos = ( ((int64_t)p_stream->i_num_frames) << 32 ) |
diff --git a/modules/packetizer/dirac.c b/modules/packetizer/dirac.c
index 359a046739..e6f1acdc92 100644
--- a/modules/packetizer/dirac.c
+++ b/modules/packetizer/dirac.c
@@ -904,7 +904,7 @@ static int dirac_InspectDataUnit( decoder_t *p_dec, block_t **pp_block, block_t
         p_es->video.i_width  = p_sys->seq_hdr.u_width;
         p_es->video.i_height = p_sys->seq_hdr.u_height;
 
-        vlc_ureduce( &p_es->video.i_frame_rate, &p_es->video.i_frame_rate_base
+        vlc_ureduce( &p_es->video.frame_rate.num, &p_es->video.frame_rate.den
                    , p_sys->seq_hdr.u_fps_num, p_sys->seq_hdr.u_fps_den, 0 );
 
         /* when field coding, dts needs to be incremented in terms of field periods */
@@ -918,7 +918,7 @@ static int dirac_InspectDataUnit( decoder_t *p_dec, block_t **pp_block, block_t
         /* TODO: set p_sys->reorder_buf.u_size_max */
         p_sys->i_pts_offset = p_sys->reorder_buf.u_size_max
                             * 1000000
-                            * p_es->video.i_frame_rate_base / p_es->video.i_frame_rate + 1;
+                            * p_es->video.frame_rate.den / p_es->video.frame_rate.num + 1;
 
         /* stash a copy of the seqhdr
          *  - required for ogg muxing
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index 84044b5366..fcc2206fd1 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -207,16 +207,16 @@ static void ActivateSets( decoder_t *p_dec, const h264_sequence_parameter_set_t
 
         if( p_sps->vui.b_valid )
         {
-            if( !p_dec->fmt_in.video.i_frame_rate_base &&
+            if( !p_dec->fmt_in.video.frame_rate.den &&
                  p_sps->vui.b_fixed_frame_rate && p_sps->vui.i_num_units_in_tick > 0 )
             {
                 const unsigned i_rate_base = p_sps->vui.i_num_units_in_tick;
                 const unsigned i_rate = p_sps->vui.i_time_scale >> 1; /* num_clock_ts == 2 */
-                if( i_rate_base != p_dec->fmt_out.video.i_frame_rate_base ||
-                    i_rate != p_dec->fmt_out.video.i_frame_rate )
+                if( i_rate_base != p_dec->fmt_out.video.frame_rate.den ||
+                    i_rate != p_dec->fmt_out.video.frame_rate.num )
                 {
-                    p_dec->fmt_out.video.i_frame_rate_base = i_rate_base;
-                    p_dec->fmt_out.video.i_frame_rate = i_rate;
+                    p_dec->fmt_out.video.frame_rate.den = i_rate_base;
+                    p_dec->fmt_out.video.frame_rate.num = i_rate;
                     date_Change( &p_sys->dts, p_sps->vui.i_time_scale, p_sps->vui.i_num_units_in_tick );
                 }
             }
@@ -350,10 +350,10 @@ static int Open( vlc_object_t *p_this )
     p_dec->fmt_out.i_codec = VLC_CODEC_H264;
     p_dec->fmt_out.b_packetized = true;
 
-    if( p_dec->fmt_in.video.i_frame_rate_base > 0 )
+    if( p_dec->fmt_in.video.frame_rate.den > 0 )
     {
-        date_Change( &p_sys->dts, p_dec->fmt_in.video.i_frame_rate * 2,
-                                  p_dec->fmt_in.video.i_frame_rate_base );
+        date_Change( &p_sys->dts, p_dec->fmt_in.video.frame_rate.num * 2,
+                                  p_dec->fmt_in.video.frame_rate.den );
     }
 
     if( b_avc )
diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index 21ed17451d..451d3183bb 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -438,11 +438,11 @@ static void ActivateSets(decoder_t *p_dec,
     p_sys->p_active_vps = p_vps;
     if(p_sps)
     {
-        if(!p_dec->fmt_in.video.i_frame_rate)
+        if(!p_dec->fmt_in.video.frame_rate.num)
         {
             (void) hevc_get_frame_rate( p_sps, p_dec->p_sys->rgi_p_decvps,
-                                        &p_dec->fmt_out.video.i_frame_rate,
-                                        &p_dec->fmt_out.video.i_frame_rate_base );
+                                        &p_dec->fmt_out.video.frame_rate.num,
+                                        &p_dec->fmt_out.video.frame_rate.den );
         }
 
         if(p_dec->fmt_in.video.primaries == COLOR_PRIMARIES_UNDEF)
diff --git a/modules/packetizer/mpeg4video.c b/modules/packetizer/mpeg4video.c
index 9a9e8441a2..f002d7a860 100644
--- a/modules/packetizer/mpeg4video.c
+++ b/modules/packetizer/mpeg4video.c
@@ -544,12 +544,12 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
 #endif
 
     if( p_dec->p_sys->fps.num < 5 && /* Work-around buggy streams */
-        p_dec->fmt_in.video.i_frame_rate > 0 &&
-        p_dec->fmt_in.video.i_frame_rate_base > 0 )
+        p_dec->fmt_in.video.frame_rate.num > 0 &&
+        p_dec->fmt_in.video.frame_rate.den > 0 )
     {
         p_sys->i_interpolated_pts += CLOCK_FREQ *
-        p_dec->fmt_in.video.i_frame_rate_base /
-        p_dec->fmt_in.video.i_frame_rate;
+        p_dec->fmt_in.video.frame_rate.den /
+        p_dec->fmt_in.video.frame_rate.num;
     }
     else if( p_dec->p_sys->fps.num )
         p_sys->i_interpolated_pts +=
diff --git a/modules/packetizer/mpegvideo.c b/modules/packetizer/mpegvideo.c
index 5540b96801..074df99a16 100644
--- a/modules/packetizer/mpegvideo.c
+++ b/modules/packetizer/mpegvideo.c
@@ -660,14 +660,14 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
         p_sys->frame_rate.den =
             code_to_frame_rate[p_frag->p_buffer[7]&0x0f][1];
 
-        if( p_sys->frame_rate.num != p_dec->fmt_out.video.i_frame_rate ||
-            p_dec->fmt_out.video.i_frame_rate_base != p_sys->frame_rate.den )
+        if( p_sys->frame_rate.num != p_dec->fmt_out.video.frame_rate.num ||
+            p_dec->fmt_out.video.frame_rate.den != p_sys->frame_rate.den )
         {
             date_Change( &p_sys->dts, 2 * p_sys->frame_rate.num, p_sys->frame_rate.den );
             date_Change( &p_sys->prev_iframe_dts, 2 * p_sys->frame_rate.num, p_sys->frame_rate.den );
         }
-        p_dec->fmt_out.video.i_frame_rate = p_sys->frame_rate.num;
-        p_dec->fmt_out.video.i_frame_rate_base = p_sys->frame_rate.den;
+        p_dec->fmt_out.video.frame_rate.num = p_sys->frame_rate.num;
+        p_dec->fmt_out.video.frame_rate.den = p_sys->frame_rate.den;
 
         p_sys->b_seq_progressive = true;
         p_sys->b_low_delay = true;
diff --git a/modules/packetizer/vc1.c b/modules/packetizer/vc1.c
index fab961b199..19c1fbdcee 100644
--- a/modules/packetizer/vc1.c
+++ b/modules/packetizer/vc1.c
@@ -380,12 +380,12 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
             p_sys->i_interpolated_dts = p_pic->i_dts;
 
         /* We can interpolate dts/pts only if we have a frame rate */
-        if( p_dec->fmt_out.video.i_frame_rate != 0 && p_dec->fmt_out.video.i_frame_rate_base != 0 )
+        if( p_dec->fmt_out.video.frame_rate.num != 0 && p_dec->fmt_out.video.frame_rate.den != 0 )
         {
             if( p_sys->i_interpolated_dts > VLC_TS_INVALID )
                 p_sys->i_interpolated_dts += INT64_C(1000000) *
-                                             p_dec->fmt_out.video.i_frame_rate_base /
-                                             p_dec->fmt_out.video.i_frame_rate;
+                                             p_dec->fmt_out.video.frame_rate.den /
+                                             p_dec->fmt_out.video.frame_rate.num;
 
             //msg_Dbg( p_dec, "-------------- XXX0 dts=%"PRId64" pts=%"PRId64" interpolated=%"PRId64,
             //         p_pic->i_dts, p_pic->i_pts, p_sys->i_interpolated_dts );
@@ -570,10 +570,10 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
                     }
                 }
                 if( i_fps_num != 0 && i_fps_den != 0 )
-                    vlc_ureduce( &p_es->video.i_frame_rate, &p_es->video.i_frame_rate_base, i_fps_num, i_fps_den, 0 );
+                    vlc_ureduce( &p_es->video.frame_rate.num, &p_es->video.frame_rate.den, i_fps_num, i_fps_den, 0 );
 
                 if( !p_sys->b_sequence_header )
-                    msg_Dbg( p_dec, "frame rate %d/%d", p_es->video.i_frame_rate, p_es->video.i_frame_rate_base );
+                    msg_Dbg( p_dec, "frame rate %d/%d", p_es->video.frame_rate.num, p_es->video.frame_rate.den );
             }
             if( bs_read1( &s ) ) /* Color Format */
             {
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index bd282007d3..d48cddb818 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -404,40 +404,40 @@ static void transcode_video_framerate_init( sout_stream_t *p_stream,
                                             const es_format_t *p_fmt_out )
 {
     /* Handle frame rate conversion */
-    if( !id->p_encoder->fmt_out.video.i_frame_rate ||
-        !id->p_encoder->fmt_out.video.i_frame_rate_base )
+    if( !id->p_encoder->fmt_out.video.frame_rate.num ||
+        !id->p_encoder->fmt_out.video.frame_rate.den )
     {
-        if( p_fmt_out->video.i_frame_rate &&
-            p_fmt_out->video.i_frame_rate_base )
+        if( p_fmt_out->video.frame_rate.num &&
+            p_fmt_out->video.frame_rate.den )
         {
-            id->p_encoder->fmt_out.video.i_frame_rate =
-                p_fmt_out->video.i_frame_rate;
-            id->p_encoder->fmt_out.video.i_frame_rate_base =
-                p_fmt_out->video.i_frame_rate_base;
+            id->p_encoder->fmt_out.video.frame_rate.num =
+                p_fmt_out->video.frame_rate.num;
+            id->p_encoder->fmt_out.video.frame_rate.den =
+                p_fmt_out->video.frame_rate.den;
         }
         else
         {
             /* Pick a sensible default value */
-            id->p_encoder->fmt_out.video.i_frame_rate = ENC_FRAMERATE;
-            id->p_encoder->fmt_out.video.i_frame_rate_base = ENC_FRAMERATE_BASE;
+            id->p_encoder->fmt_out.video.frame_rate.num = ENC_FRAMERATE;
+            id->p_encoder->fmt_out.video.frame_rate.den = ENC_FRAMERATE_BASE;
         }
     }
 
-    id->p_encoder->fmt_in.video.i_frame_rate =
-        id->p_encoder->fmt_out.video.i_frame_rate;
-    id->p_encoder->fmt_in.video.i_frame_rate_base =
-        id->p_encoder->fmt_out.video.i_frame_rate_base;
+    id->p_encoder->fmt_in.video.frame_rate.num =
+        id->p_encoder->fmt_out.video.frame_rate.num;
+    id->p_encoder->fmt_in.video.frame_rate.den =
+        id->p_encoder->fmt_out.video.frame_rate.den;
 
-    vlc_ureduce( &id->p_encoder->fmt_in.video.i_frame_rate,
-        &id->p_encoder->fmt_in.video.i_frame_rate_base,
-        id->p_encoder->fmt_in.video.i_frame_rate,
-        id->p_encoder->fmt_in.video.i_frame_rate_base,
+    vlc_ureduce( &id->p_encoder->fmt_in.video.frame_rate.num,
+        &id->p_encoder->fmt_in.video.frame_rate.den,
+        id->p_encoder->fmt_in.video.frame_rate.num,
+        id->p_encoder->fmt_in.video.frame_rate.den,
         0 );
      msg_Dbg( p_stream, "source fps %u/%u, destination %u/%u",
-        id->p_decoder->fmt_out.video.i_frame_rate,
-        id->p_decoder->fmt_out.video.i_frame_rate_base,
-        id->p_encoder->fmt_in.video.i_frame_rate,
-        id->p_encoder->fmt_in.video.i_frame_rate_base );
+        id->p_decoder->fmt_out.video.frame_rate.num,
+        id->p_decoder->fmt_out.video.frame_rate.den,
+        id->p_encoder->fmt_in.video.frame_rate.num,
+        id->p_encoder->fmt_in.video.frame_rate.den );
 
 }
 
@@ -956,8 +956,8 @@ bool transcode_video_add( sout_stream_t *p_stream, const es_format_t *p_fmt,
 
     if( p_sys->fps.num )
     {
-        id->p_encoder->fmt_in.video.i_frame_rate = id->p_encoder->fmt_out.video.i_frame_rate = p_sys->fps.num;
-        id->p_encoder->fmt_in.video.i_frame_rate_base = id->p_encoder->fmt_out.video.i_frame_rate_base = (p_sys->fps.den ? p_sys->fps.den : 1);
+        id->p_encoder->fmt_in.video.frame_rate.num = id->p_encoder->fmt_out.video.frame_rate.num = p_sys->fps.num;
+        id->p_encoder->fmt_in.video.frame_rate.den = id->p_encoder->fmt_out.video.frame_rate.den = (p_sys->fps.den ? p_sys->fps.den : 1);
     }
 
     return true;
diff --git a/modules/video_filter/deinterlace/deinterlace.c b/modules/video_filter/deinterlace/deinterlace.c
index 5e56eb88e0..d260491921 100644
--- a/modules/video_filter/deinterlace/deinterlace.c
+++ b/modules/video_filter/deinterlace/deinterlace.c
@@ -251,7 +251,7 @@ static void GetOutputFormat( filter_t *p_filter,
 
     if( p_sys->b_double_rate )
     {
-        p_dst->i_frame_rate *= 2;
+        p_dst->frame_rate.num *= 2;
     }
 
     if( p_sys->i_mode == DEINTERLACE_PHOSPHOR  &&
diff --git a/modules/video_filter/fps.c b/modules/video_filter/fps.c
index 146c870e72..1a528ae424 100644
--- a/modules/video_filter/fps.c
+++ b/modules/video_filter/fps.c
@@ -80,8 +80,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_picture)
         return NULL;
     }
 
-    p_picture->format.i_frame_rate = p_filter->fmt_out.video.i_frame_rate;
-    p_picture->format.i_frame_rate_base = p_filter->fmt_out.video.i_frame_rate_base;
+    p_picture->format.frame_rate.num = p_filter->fmt_out.video.frame_rate.num;
+    p_picture->format.frame_rate.den = p_filter->fmt_out.video.frame_rate.den;
 
     /* First time we get some valid timestamp, we'll take it as base for output
         later on we retake new timestamp if it has jumped too much */
@@ -153,20 +153,20 @@ static int Open( vlc_object_t *p_this)
     /* If we don't have fps option, use filter output values */
     if( var_InheritURational( p_filter, &fps, CFG_PREFIX "fps" ) )
     {
-        fps.num = p_filter->fmt_in.video.i_frame_rate;
-        fps.den = p_filter->fmt_in.video.i_frame_rate_base;
+        fps.num = p_filter->fmt_in.video.frame_rate.num;
+        fps.den = p_filter->fmt_in.video.frame_rate.den;
     }
-    p_filter->fmt_out.video.i_frame_rate      = fps.num;
-    p_filter->fmt_out.video.i_frame_rate_base = fps.den;
+    p_filter->fmt_out.video.frame_rate.num      = fps.num;
+    p_filter->fmt_out.video.frame_rate.den = fps.den;
 
     msg_Dbg( p_filter, "Converting fps from %d/%d -> %d/%d",
-            p_filter->fmt_in.video.i_frame_rate, p_filter->fmt_in.video.i_frame_rate_base,
-            p_filter->fmt_out.video.i_frame_rate, p_filter->fmt_out.video.i_frame_rate_base );
+            p_filter->fmt_in.video.frame_rate.num, p_filter->fmt_in.video.frame_rate.den,
+            p_filter->fmt_out.video.frame_rate.num, p_filter->fmt_out.video.frame_rate.den );
 
-    p_sys->i_output_frame_interval = p_filter->fmt_out.video.i_frame_rate_base * CLOCK_FREQ / p_filter->fmt_out.video.i_frame_rate;
+    p_sys->i_output_frame_interval = p_filter->fmt_out.video.frame_rate.den * CLOCK_FREQ / p_filter->fmt_out.video.frame_rate.num;
 
     date_Init( &p_sys->next_output_pts,
-               p_filter->fmt_out.video.i_frame_rate, p_filter->fmt_out.video.i_frame_rate_base );
+               p_filter->fmt_out.video.frame_rate.num, p_filter->fmt_out.video.frame_rate.den );
 
     date_Set( &p_sys->next_output_pts, VLC_TS_INVALID );
     p_sys->p_previous_pic = NULL;
diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp
index 35cb1ada38..cdd87ad83b 100644
--- a/modules/video_output/decklink.cpp
+++ b/modules/video_output/decklink.cpp
@@ -529,7 +529,7 @@ static IDeckLinkDisplayMode * MatchDisplayMode(vout_display_t *vd,
                         unsigned int num_stream, den_stream;
                         vlc_ureduce(&num_deck, &den_deck, timescale, frameduration, 0);
                         vlc_ureduce(&num_stream, &den_stream,
-                                    fmt->i_frame_rate, fmt->i_frame_rate_base, 0);
+                                    fmt->frame_rate.num, fmt->frame_rate.den, 0);
 
                         if (num_deck == num_stream && den_deck == den_stream)
                         {
@@ -707,8 +707,8 @@ static int OpenDecklink(vout_display_t *vd, decklink_sys_t *sys)
         fmt->i_sar_num = 0;
         fmt->i_sar_den = 0;
         fmt->i_chroma = !sys->video.tenbits ? VLC_CODEC_UYVY : VLC_CODEC_I422_10L; /* we will convert to v210 */
-        fmt->i_frame_rate = (unsigned) sys->frameduration;
-        fmt->i_frame_rate_base = (unsigned) sys->timescale;
+        fmt->frame_rate.num = (unsigned) sys->frameduration;
+        fmt->frame_rate.den = (unsigned) sys->timescale;
     }
 
     if (/*decklink_sys->i_channels > 0 &&*/ sys->i_rate > 0)
diff --git a/modules/video_output/yuv.c b/modules/video_output/yuv.c
index 1fcc9e9f05..fe61a7c93b 100644
--- a/modules/video_output/yuv.c
+++ b/modules/video_output/yuv.c
@@ -243,7 +243,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
         fprintf(sys->f, "%s W%d H%d F%d:%d I%c A%d:%d\n",
                 header,
                 fmt.i_visible_width, fmt.i_visible_height,
-                fmt.i_frame_rate, fmt.i_frame_rate_base,
+                fmt.frame_rate.num, fmt.frame_rate.den,
                 type,
                 fmt.i_sar_num, fmt.i_sar_den);
         sys->is_first = true;
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 384c09ae04..6a95939dae 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -1593,11 +1593,11 @@ static es_out_id_t *EsOutAddSlave( es_out_t *out, const es_format_t *fmt, es_out
             es->fmt.video.i_visible_height = es->fmt.video.i_height;
         }
 
-        if( es->fmt.video.i_frame_rate && es->fmt.video.i_frame_rate_base )
-            vlc_ureduce( &es->fmt.video.i_frame_rate,
-                         &es->fmt.video.i_frame_rate_base,
-                         es->fmt.video.i_frame_rate,
-                         es->fmt.video.i_frame_rate_base, 0 );
+        if( es->fmt.video.frame_rate.num && es->fmt.video.frame_rate.den )
+            vlc_ureduce( &es->fmt.video.frame_rate.num,
+                         &es->fmt.video.frame_rate.den,
+                         es->fmt.video.frame_rate.num,
+                         es->fmt.video.frame_rate.den, 0 );
         break;
 
     case SPU_ES:
@@ -3069,11 +3069,11 @@ static void EsOutUpdateInfo( es_out_t *out, es_out_id_t *es, const es_format_t *
             info_category_AddInfo( p_cat, _("Buffer dimensions"), "%ux%u",
                                    fmt->video.i_width, fmt->video.i_height );
 
-       if( fmt->video.i_frame_rate > 0 &&
-           fmt->video.i_frame_rate_base > 0 )
+       if( fmt->video.frame_rate.num > 0 &&
+           fmt->video.frame_rate.den > 0 )
        {
-           div = lldiv( (float)fmt->video.i_frame_rate /
-                               fmt->video.i_frame_rate_base * 1000000,
+           div = lldiv( (float)fmt->video.frame_rate.num /
+                               fmt->video.frame_rate.den * 1000000,
                                1000000 );
            if( div.rem > 0 )
                info_category_AddInfo( p_cat, _("Frame rate"), "%"PRId64".%06u",
diff --git a/src/misc/image.c b/src/misc/image.c
index 313d21386e..735801fcf2 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -729,8 +729,8 @@ static encoder_t *CreateEncoder( vlc_object_t *p_this, video_format_t *fmt_in,
             fmt_in->i_visible_width / fmt_in->i_sar_den / fmt_out->i_sar_num;
     }
 
-    p_enc->fmt_in.video.i_frame_rate = 25;
-    p_enc->fmt_in.video.i_frame_rate_base = 1;
+    p_enc->fmt_in.video.frame_rate.num = 25;
+    p_enc->fmt_in.video.frame_rate.den = 1;
 
     es_format_Init( &p_enc->fmt_out, VIDEO_ES, fmt_out->i_chroma );
     p_enc->fmt_out.video = *fmt_out;
-- 
2.11.1




More information about the vlc-devel mailing list