]> git.sesse.net Git - vlc/blobdiff - modules/access/decklink.cpp
Don't create decklink-caching, just inherit it and it will get implicitly created.
[vlc] / modules / access / decklink.cpp
index fe7e580ef121c33847a8415e06384d4c8756d0cc..60e8b831a41532c87f71e973d10b19b005d87e2f 100644 (file)
@@ -270,6 +270,7 @@ static int Open( vlc_object_t *p_this )
     int         i_card_index;
     int         i_width, i_height, i_fps_num, i_fps_den;
     int         i_rate;
+    unsigned    u_aspect_num, u_aspect_den;
 
     /* Only when selected */
     if( *p_demux->psz_access == '\0' )
@@ -553,17 +554,10 @@ static int Open( vlc_object_t *p_this )
     video_fmt.video.i_frame_rate_base = i_fps_den;
     video_fmt.i_bitrate = video_fmt.video.i_width * video_fmt.video.i_height * video_fmt.video.i_frame_rate * 2 * 8;
 
-    psz_aspect = var_CreateGetNonEmptyString( p_demux, "decklink-aspect-ratio" );
-    if( psz_aspect )
-    {
-        char *psz_denominator = strchr( psz_aspect, ':' );
-        if( psz_denominator )
-        {
-            *psz_denominator++ = '\0';
-            video_fmt.video.i_sar_num = atoi( psz_aspect )      * video_fmt.video.i_height;
-            video_fmt.video.i_sar_den = atoi( psz_denominator ) * video_fmt.video.i_width;
-        }
-        free( psz_aspect );
+    if ( !var_InheritURational( p_demux, &u_aspect_num, &u_aspect_den, "decklink-aspect-ratio" ) &&
+         u_aspect_num > 0 && u_aspect_den > 0 ) {
+        video_fmt.video.i_sar_num = u_aspect_num * video_fmt.video.i_height;
+        video_fmt.video.i_sar_den = u_aspect_den * video_fmt.video.i_width;
     }
 
     msg_Dbg( p_demux, "added new video es %4.4s %dx%d",
@@ -582,9 +576,6 @@ static int Open( vlc_object_t *p_this )
              (char*)&audio_fmt.i_codec, audio_fmt.audio.i_rate, audio_fmt.audio.i_bitspersample, audio_fmt.audio.i_channels);
     p_sys->p_audio_es = es_out_Add( p_demux->out, &audio_fmt );
 
-    /* Update default_pts to a suitable value for access */
-    var_Create( p_demux, "decklink-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
-
     ret = VLC_SUCCESS;
 
 finish:
@@ -651,7 +642,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 
         case DEMUX_GET_PTS_DELAY:
             pi64 = (int64_t*)va_arg( args, int64_t * );
-            *pi64 = var_GetInteger( p_demux, "decklink-caching" ) * 1000;
+            *pi64 = var_InheritInteger( p_demux, "decklink-caching" ) * 1000;
             return VLC_SUCCESS;
 
         case DEMUX_GET_TIME: