[vlc-commits] transcode: take fps also as rational syntas, so 30000/1001 works

Ilkka Ollakka git at videolan.org
Sat Feb 15 15:32:13 CET 2014


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Fri Feb 14 21:55:42 2014 +0200| [0ea07e076caf5edda8de5657052479e37970ebbd] | committer: Ilkka Ollakka

transcode: take fps also as rational syntas, so 30000/1001 works

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

 modules/stream_out/transcode/transcode.c |    7 +++----
 modules/stream_out/transcode/transcode.h |    2 +-
 modules/stream_out/transcode/video.c     |    6 +++---
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/modules/stream_out/transcode/transcode.c b/modules/stream_out/transcode/transcode.c
index a78f61d..dab9edb 100644
--- a/modules/stream_out/transcode/transcode.c
+++ b/modules/stream_out/transcode/transcode.c
@@ -168,7 +168,7 @@ vlc_module_begin ()
                  VB_LONGTEXT, false )
     add_float( SOUT_CFG_PREFIX "scale", 0, SCALE_TEXT,
                SCALE_LONGTEXT, false )
-    add_float( SOUT_CFG_PREFIX "fps", 0, FPS_TEXT,
+    add_string( SOUT_CFG_PREFIX "fps", NULL, FPS_TEXT,
                FPS_LONGTEXT, false )
     add_bool( SOUT_CFG_PREFIX "hurry-up", false, HURRYUP_TEXT,
                HURRYUP_LONGTEXT, false )
@@ -349,7 +349,7 @@ static int Open( vlc_object_t *p_this )
 
     p_sys->f_scale = var_GetFloat( p_stream, SOUT_CFG_PREFIX "scale" );
 
-    p_sys->f_fps = var_GetFloat( p_stream, SOUT_CFG_PREFIX "fps" );
+    p_sys->b_master_sync = var_InheritURational( p_stream, &p_sys->fps_num, &p_sys->fps_den, SOUT_CFG_PREFIX "fps" );
 
     p_sys->b_hurry_up = var_GetBool( p_stream, SOUT_CFG_PREFIX "hurry-up" );
 
@@ -467,8 +467,7 @@ static int Open( vlc_object_t *p_this )
     }
 
     /* Audio settings */
-    p_sys->b_master_sync = var_GetBool( p_stream, SOUT_CFG_PREFIX "audio-sync" );
-    if( p_sys->f_fps > 0 ) p_sys->b_master_sync = true;
+    p_sys->b_master_sync = __MAX( p_sys->b_master_sync == VLC_SUCCESS, var_GetBool( p_stream, SOUT_CFG_PREFIX "audio-sync" ) );
 
     p_stream->pf_add    = Add;
     p_stream->pf_del    = Del;
diff --git a/modules/stream_out/transcode/transcode.h b/modules/stream_out/transcode/transcode.h
index 75ecc23..3f11b95 100644
--- a/modules/stream_out/transcode/transcode.h
+++ b/modules/stream_out/transcode/transcode.h
@@ -43,7 +43,6 @@ struct sout_stream_sys_t
     config_chain_t  *p_video_cfg;
     int             i_vbitrate;
     double          f_scale;
-    double          f_fps;
     unsigned int    i_width, i_maxwidth;
     unsigned int    i_height, i_maxheight;
     bool            b_deinterlace;
@@ -52,6 +51,7 @@ struct sout_stream_sys_t
     int             i_threads;
     bool            b_high_priority;
     bool            b_hurry_up;
+    unsigned int    fps_num,fps_den;
 
     char            *psz_vf2;
 
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index b2ea479..9d37ca1 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -992,10 +992,10 @@ bool transcode_video_add( sout_stream_t *p_stream, es_format_t *p_fmt,
      * all the characteristics of the decoded stream yet */
     id->b_transcode = true;
 
-    if( p_sys->f_fps > 0 )
+    if( p_sys->fps_num )
     {
-        id->p_encoder->fmt_out.video.i_frame_rate = (p_sys->f_fps * ENC_FRAMERATE_BASE);
-        id->p_encoder->fmt_out.video.i_frame_rate_base = ENC_FRAMERATE_BASE;
+        id->p_encoder->fmt_out.video.i_frame_rate = (p_sys->fps_num );
+        id->p_encoder->fmt_out.video.i_frame_rate_base = (p_sys->fps_den ? p_sys->fps_den : 1);
     }
 
     return true;



More information about the vlc-commits mailing list