+
+ char *mode_string = var_CreateGetString( p_demux, "sdi-mode" );
+ if( !mode_string || strlen( mode_string ) == 0 || strlen( mode_string ) > 4 ) {
+ msg_Err( p_demux, "Missing or invalid --sdi-mode string" );
+ return VLC_EGENERIC;
+ }
+
+ // Pad the --sdi-mode string to four characters, so the user can specify e.g. "pal"
+ // without having to add the trailing space.
+ char mode_string_padded[5];
+ strcpy(mode_string_padded, " ");
+ for( int i = 0; i < strlen(mode_string); ++i )
+ mode_string_padded[i] = mode_string[i];
+
+ BMDDisplayMode wanted_mode_id;
+ memcpy( &wanted_mode_id, &mode_string_padded, sizeof(wanted_mode_id) );
+
+ bool b_found_mode = false;