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' )
HRESULT result;
i_card_index = var_InheritInteger( p_demux, "decklink-card-index" );
+ if( i_card_index < 0 )
+ {
+ msg_Err( p_demux, "Invalid card index %d", i_card_index );
+ goto finish;
+ }
+
for( int i = 0; i <= i_card_index; ++i )
{
if( p_sys->p_card )
goto finish;
}
- psz_display_mode = var_InheritString( p_demux, "decklink-mode" );
- if( !psz_display_mode || strlen( psz_display_mode ) == 0 || strlen( psz_display_mode ) > 4 ) {
+ psz_display_mode = var_CreateGetNonEmptyString( p_demux, "decklink-mode" );
+ if( !psz_display_mode || strlen( psz_display_mode ) > 4 ) {
msg_Err( p_demux, "Missing or invalid --decklink-mode string" );
goto finish;
}
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",