- 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;