Commit b10c0a89 authored by Malenovsky, Vladimir's avatar Malenovsky, Vladimir
Browse files

simplification of inMetadataFile string

parent 25ff405c
Loading
Loading
Loading
Loading
Loading
+25 −19
Original line number Diff line number Diff line
@@ -106,8 +106,7 @@ typedef struct
    int32_t sampleRate;
    InputConfig inConfig;
    OutputConfig outConfig;
    char inMetadataFilePaths[RENDERER_MAX_ISAR_MD_INPUTS][POST_REND_MAX_CLI_ARG_LENGTH];
    int16_t numInMetadataFiles;
    char inMetadataFilePath[POST_REND_MAX_CLI_ARG_LENGTH];
    char headRotationFilePath[POST_REND_MAX_CLI_ARG_LENGTH];
    char splitRendBFIFilePath[POST_REND_MAX_CLI_ARG_LENGTH];
    ISAR_POST_REND_COMPLEXITY_LEVEL complexityLevel;
@@ -451,12 +450,7 @@ static CmdlnArgs defaultArgs(
    args.inConfig.binBuses[0].gain_dB = 0;

    args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_INVALID;

    for ( int32_t i = 0; i < RENDERER_MAX_ISAR_MD_INPUTS; ++i )
    {
        clearString( args.inMetadataFilePaths[i] );
    }
    args.numInMetadataFiles = 0;
    clearString( args.inMetadataFilePath );

    clearString( args.headRotationFilePath );
    clearString( args.splitRendBFIFilePath );
@@ -485,19 +479,30 @@ static int16_t parseOption(
            printSupportedAudioConfigs();
            exit( 0 );
        case CmdLnOptionId_inputFile:
            if ( numOptionValues != 1 )
            if ( numOptionValues == 0 )
            {
                fprintf( stderr, "Error: No input file has been provided!\n" );
                return -1;
            }
            else if (numOptionValues > 1)
            {
                fprintf( stderr, "Error: The program expects a single input file, but %d have been provided!\n", numOptionValues );
                return -1;
            }
            strncpy( args->inputFilePath, optionValues[0], POST_REND_MAX_CLI_ARG_LENGTH - 1 );
            break;
        case CmdLnOptionId_inputFormat:
            if ( numOptionValues != 1 )
            if ( numOptionValues == 0 )
            {
                fprintf( stderr, "Error: No input file format has been provided!\n" );
                return -1;
            }
            else if ( numOptionValues > 1 )
            {
                fprintf( stderr, "Error: The program expects a single input file format, but %d have been provided!\n", numOptionValues );
                return -1;
            }

            if ( !parseInConfig( optionValues[0], &args->inConfig ) )
            {
                /* Error printout handled by failing function */
@@ -505,16 +510,17 @@ static int16_t parseOption(
            }
            break;
        case CmdLnOptionId_inputMetadata:
            if ( numOptionValues < 1 || numOptionValues > RENDERER_MAX_ISAR_MD_INPUTS )
            if ( numOptionValues == 0 )
            {
                fprintf( stderr, "Error: No paths to metadata files for BINAURAL_SPLIT_PCM input mode has been provided!\n" );
                fprintf( stderr, "Error: No input metadata file for BINAURAL_SPLIT_PCM mode has been provided!\n" );
                return -1;
            }
            for ( int16_t i = 0; i < numOptionValues; ++i )
            else if (numOptionValues > 1)
            {
                strncpy( args->inMetadataFilePaths[i], optionValues[i], POST_REND_MAX_CLI_ARG_LENGTH - 1 );
                fprintf( stderr, "Error: The program expects a single input metadata file, but %d have been provided!\n", numOptionValues );
                return -1;
            }
            args->numInMetadataFiles = numOptionValues;
            strncpy( args->inMetadataFilePath, optionValues[0], POST_REND_MAX_CLI_ARG_LENGTH - 1 );
            break;
        case CmdLnOptionId_outputFile:
            if ( numOptionValues != 1 )
@@ -527,7 +533,7 @@ static int16_t parseOption(
        case CmdLnOptionId_sampleRate:
            if ( numOptionValues != 1 )
            {
                fprintf( stderr, "Error: No input sampling rate has been provided!\n" );
                fprintf( stderr, "Error: Incorrect input sampling rate has been provided!\n" );
                return -1;
            }
            args->sampleRate = (int32_t) ( strtol( optionValues[0], NULL, 10 ) * 1000 );
@@ -955,7 +961,7 @@ int main(
    if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
    {
        error = split_rend_reader_open( &hSplitRendFileReadWrite,
                                        args.inMetadataFilePaths[0],
                                        args.inMetadataFilePath,
                                        &bitsBuffer.config.codec,
                                        &bitsBuffer.config.poseCorrection,
                                        &bitsBuffer.config.codec_frame_size_ms,
@@ -964,14 +970,14 @@ int main(
                                        &bitsBuffer.config.lc3plusHighRes );
        if ( error != IVAS_ERR_OK )
        {
            if ( isEmptyString( args.inMetadataFilePaths[0] ) )
            if ( isEmptyString( args.inMetadataFilePath ) )
            {
                const CmdLnParser_Option *listOption = findOptionById( CmdLnOptionId_inputMetadata );
                fprintf( stderr, "\nError: Split rendering metadata file not specified, use option -%s/--%s.\n", listOption->matchShort, listOption->match );
            }
            else
            {
                fprintf( stderr, "\nError: Could not open split rendering metadata file %s!\n", args.inMetadataFilePaths[0] );
                fprintf( stderr, "\nError: Could not open split rendering metadata file %s!\n", args.inMetadataFilePath );
            }
            goto cleanup;
        }
+0 −1
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@
 * ISAR post-renderer constants
 *---------------------------------------------------------------------*/

#define RENDERER_MAX_ISAR_MD_INPUTS 1
#define RENDERER_MAX_BIN_INPUTS     1

/*---------------------------------------------------------------------*