From 522bb4b0acb30fbdbcfe514f234572d561ab2c73 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 12 Jun 2025 11:26:49 +0200 Subject: [PATCH] add returncode modification to external renderer in case of error --- apps/renderer.c | 310 ++++++++++++++++++++++++++++++++++++++++++++++ lib_com/options.h | 1 + 2 files changed, 311 insertions(+) diff --git a/apps/renderer.c b/apps/renderer.c index 1fb83acc5a..282b587eff 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -659,6 +659,9 @@ int main( int argc, char **argv ) { +#ifdef FIX_1335_EXTREND_RETCODE + int retcode = 0; +#endif IVAS_REND_HANDLE hIvasRend = NULL; RotFileReader *headRotReader = NULL; RotFileReader *externalOrientationFileReader = NULL; @@ -745,12 +748,18 @@ int main( ( args.inConfig.numAudioObjects > 0 && args.inConfig.audioObjects[0].audioConfig == IVAS_AUDIO_CONFIG_OBA && args.inConfig.numAudioObjects == 1 ) ) ) { fprintf( stderr, "\ninvalid configuration - non-diegetic panning requires mono or ISM1 input\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( args.nonDiegeticPan && args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_STEREO ) { fprintf( stderr, "\ninvalid configuration - non-diegetic panning requires stereo output\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -769,6 +778,9 @@ int main( if ( RotationFileReader_open( args.headRotationFilePath, &headRotReader ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError opening file: %s\n", args.headRotationFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -778,6 +790,9 @@ int main( if ( RotationFileReader_open( args.referenceRotationFilePath, &referenceRotReader ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError opening file: %s\n", args.referenceRotationFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -786,6 +801,9 @@ int main( if ( Vector3PairFileReader_open( args.referenceVectorFilePath, &referenceVectorReader ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError opening file: %s\n", args.referenceVectorFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -801,6 +819,9 @@ int main( if ( RotationFileReader_open( args.externalOrientationFilePath, &externalOrientationFileReader ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError opening file: %s\n", args.externalOrientationFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -811,6 +832,9 @@ int main( if ( RenderConfigReader_open( args.renderConfigFilePath, &renderConfigReader ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError opening file: %s\n", args.renderConfigFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -834,6 +858,9 @@ int main( { fprintf( stderr, "\nInvalid configuration - Merging to MASA output requires MASA input and at least one another input to be present\n" ); fprintf( stderr, "\nMASA input is missing\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -841,6 +868,9 @@ int main( { fprintf( stderr, "\nInvalid configuration - Merging to MASA output requires MASA input and at least one another input to be present\n" ); fprintf( stderr, "\nNo object, multi-channel, or Ambisonic input present.\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -848,6 +878,9 @@ int main( if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError opening file: %s\n", audioFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -865,6 +898,9 @@ int main( else if ( inFileSampleRate != args.sampleRate ) { fprintf( stderr, "\nSampling rate mismatch: %d Hz requested, but %d Hz found in file %s\n", args.sampleRate, inFileSampleRate, args.inputFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } break; @@ -872,11 +908,17 @@ int main( if ( args.sampleRate == 0 ) { fprintf( stderr, "\nSampling rate must be specified on command line when using raw PCM input\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } break; default: fprintf( stderr, "\nAudioFileReader_getSamplingRate failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -885,6 +927,9 @@ int main( if ( error != IVAS_ERR_OK && error != IVAS_ERR_NUM_CHANNELS_UNKNOWN ) { fprintf( stderr, "\nAudioFileReader_getNumChannels failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -893,6 +938,9 @@ int main( if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, args.nonDiegeticPanGain, args.Opt_Headrotation, args.Opt_ExternalOrientation, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError opening renderer handle: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -934,6 +982,9 @@ int main( if ( ( error = IVAS_REND_PrintConfig( hIvasRend ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\n IVAS_REND_PrintConfig failed: %s\n\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -942,6 +993,9 @@ int main( if ( hrtfFileReader_open( args.customHrtfFilePath, &hrtfFileReader ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError opening file: %s\n", args.customHrtfFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -950,6 +1004,9 @@ int main( if ( ( error = IVAS_REND_GetHrtfHandle( hIvasRend, &hHrtfTD ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_GetHrtfHandle failed: %s\n\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -958,6 +1015,9 @@ int main( if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) { fprintf( stderr, "\nError in loading HRTF binary file %s: %s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } else @@ -970,6 +1030,9 @@ int main( if ( ( error = IVAS_REND_GetHrtfCRendHandle( hIvasRend, &hHrtfCrend ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_Rend_GetHrtfCRendHandle failed: %s\n\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -984,6 +1047,9 @@ int main( if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) { fprintf( stderr, "\nError in loading HRTF binary file %s:%s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } else @@ -995,6 +1061,9 @@ int main( if ( ( error = IVAS_REND_GetHrtfFastConvHandle( hIvasRend, &hHrtfFastConv ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_GetHrtfFastConvHandle failed: %s\n\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -1003,6 +1072,9 @@ int main( if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) { fprintf( stderr, "\nError in loading HRTF binary file %s:%s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } else @@ -1014,6 +1086,9 @@ int main( if ( ( error = IVAS_REND_GetHrtfParamBinHandle( hIvasRend, &hHrtfParambin ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_GetHrtfParamBinHandle failed: %s\n\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -1022,6 +1097,9 @@ int main( if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) { fprintf( stderr, "\nError in loading HRTF binary file %s: %s \n\n", args.customHrtfFilePath, ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } else @@ -1033,6 +1111,9 @@ int main( if ( ( error = IVAS_REND_GetHrtfStatisticsHandle( hIvasRend, &hHrtfStatistics ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_GetHrtfStatisticsHandle failed\n\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = load_reverb_binary( *hHrtfStatistics, args.sampleRate, hrtfFileReader ) ) != IVAS_ERR_OK ) @@ -1040,6 +1121,9 @@ int main( if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) { fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", args.customHrtfFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } else @@ -1056,6 +1140,9 @@ int main( if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in Renderer Config Init: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -1066,18 +1153,27 @@ int main( if ( ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL ) && ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) && ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) && !is_split_pre_rend_mode( &args ) ) { fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split pre-rendering mode is enabled. Exiting. \n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = IVAS_REND_GetRenderConfig( hIvasRend, &renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( RenderConfigReader_read( renderConfigReader, args.renderConfigFilePath, &renderConfig ) != IVAS_ERR_OK ) { fprintf( stderr, "\nFailed to read renderer configuration from file %s\n", args.renderConfigFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -1089,12 +1185,18 @@ int main( if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { fprintf( stderr, "\nInvalid room acoustics configuration parameters\n\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } else { fprintf( stderr, "\nFailed to get acoustic environment with ID: %d\n\n", aeID ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1106,6 +1208,9 @@ int main( if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedRenderConfig failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -1116,6 +1221,9 @@ int main( if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientation_tracking ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_SetOrientationTrackingMode(): %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -1125,6 +1233,9 @@ int main( if ( ( error = IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( hIvasRend, args.outConfig.outSetupCustom ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_ConfigureCustomOutputLoudspeakerLayout(): %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1136,6 +1247,9 @@ int main( if ( masaWriter == NULL ) { fprintf( stderr, "\nCould not open MASA metadata file %s\n", args.outputFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1146,12 +1260,18 @@ int main( if ( ( error = IVAS_REND_SetTotalNumberOfObjects( hIvasRend, args.inConfig.numAudioObjects ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_SetTotalNumberOfObjects(): %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = IVAS_REND_SetIsmMetadataDelay( hIvasRend, args.syncMdDelay ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_SetIsmMetadataDelay(): %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1164,6 +1284,9 @@ int main( if ( ( error = parseLfePanMtxFile( args.inLfePanningMatrixFile, &lfePanMatrix ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1195,12 +1318,18 @@ int main( if ( ( error = IVAS_REND_AddInput( hIvasRend, args.inConfig.multiChannelBuses[i].audioConfig, &mcIds[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_AddInput failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = IVAS_REND_SetInputGain( hIvasRend, mcIds[i], args.inputGainGlobal * dBToLin( args.inConfig.multiChannelBuses[i].gain_dB ) ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_SetInputGain failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -1209,6 +1338,9 @@ int main( if ( ( error = IVAS_REND_ConfigureCustomInputLoudspeakerLayout( hIvasRend, mcIds[i], args.inConfig.inSetupCustom ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_ConfigureCustomInputLoudspeakerLayout(): %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1225,6 +1357,9 @@ int main( if ( ( error = IVAS_REND_SetInputLfeMtx( hIvasRend, mcIds[i], (const IVAS_REND_LfePanMtx *) &lfePanMatrix ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_SetInputLfeMtx failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1234,6 +1369,9 @@ int main( if ( ( error = IVAS_REND_SetInputLfePos( hIvasRend, mcIds[i], args.lfeConfigGain, args.lfeConfigAzimuth, args.lfeConfigElevation ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_SetInputLfePos failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1248,12 +1386,18 @@ int main( if ( ( error = parseLfePanMtxFile( lfeRoutingConfigs[i]->lfe_routing_mtx, &lfePanMatrix ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nparseLfePanMtxFile failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = IVAS_REND_SetInputLfeMtx( hIvasRend, mcIds[i], (const IVAS_REND_LfePanMtx *) &lfePanMatrix ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_SetInputLfeMtx failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1263,6 +1407,9 @@ int main( if ( ( error = IVAS_REND_SetInputLfePos( hIvasRend, mcIds[i], lfeRoutingConfigs[i]->lfe_gain_dB, lfeRoutingConfigs[i]->lfe_azi, lfeRoutingConfigs[i]->lfe_ele ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_SetInputLfePos failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1275,12 +1422,18 @@ int main( if ( ( error = IVAS_REND_AddInput( hIvasRend, IVAS_AUDIO_CONFIG_OBA, &ismIds[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_AddInput: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = IVAS_REND_SetInputGain( hIvasRend, ismIds[i], args.inputGainGlobal * dBToLin( args.inConfig.audioObjects[i].gain_dB ) ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_SetInputGain failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -1296,12 +1449,18 @@ int main( if ( ( error = IVAS_REND_AddInput( hIvasRend, args.inConfig.ambisonicsBuses[i].audioConfig, &sbaIds[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_AddInput failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = IVAS_REND_SetInputGain( hIvasRend, sbaIds[i], args.inputGainGlobal * dBToLin( args.inConfig.ambisonicsBuses[i].gain_dB ) ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_SetInputGain failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1311,12 +1470,18 @@ int main( if ( ( error = IVAS_REND_AddInput( hIvasRend, args.inConfig.masaBuses[i].audioConfig, &masaIds[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_AddInput failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = IVAS_REND_SetInputGain( hIvasRend, masaIds[i], args.inputGainGlobal * dBToLin( args.inConfig.masaBuses[i].gain_dB ) ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_SetInputGain failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1326,6 +1491,9 @@ int main( if ( inFileNumChannels != 0 /* inFileNumChannels is 0 with raw PCM input */ && totalNumInChannels != inFileNumChannels ) { fprintf( stderr, "\nNumber of channels in input file does not match selected configuration\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -1341,6 +1509,9 @@ int main( if ( ( error = IVAS_REND_NumOutChannels( hIvasRend, &numOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_NumOutChannels(): %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -1349,6 +1520,9 @@ int main( if ( ( error = IVAS_REND_openCldfb( cldfbAna, cldfbSyn, totalNumInChannels, numOutChannels, args.sampleRate ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_openCldfb(): %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1358,18 +1532,27 @@ int main( if ( ( error = IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms, &bitsBuffer.config.isar_frame_size_ms ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_GetSplitRendBitstreamHeader()!\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( IVAS_REND_GetDelay( hIvasRend, &delayNumSamples_temp, &delayTimeScale_temp ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of renderer!\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outputFilePath, delayNumSamples_temp, delayTimeScale_temp, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, bitsBuffer.config.codec_frame_size_ms, bitsBuffer.config.isar_frame_size_ms, args.sampleRate, bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nCould not open split rend metadata file %s\n", args.outputFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } audioWriter = NULL; @@ -1381,18 +1564,27 @@ int main( if ( ( error = IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms, &bitsBuffer.config.isar_frame_size_ms ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_GetSplitRendBitstreamHeader()!\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( IVAS_REND_GetDelay( hIvasRend, &delayNumSamples_temp, &delayTimeScale_temp ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of renderer!\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outMetadataFilePath, delayNumSamples_temp, delayTimeScale_temp, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, bitsBuffer.config.codec_frame_size_ms, bitsBuffer.config.isar_frame_size_ms, args.sampleRate, bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nCould not open split rend metadata file %s\n", args.outMetadataFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1400,6 +1592,9 @@ int main( if ( AudioFileWriter_open( &audioWriter, args.outputFilePath, args.sampleRate, numOutChannels ) != IVAS_ERR_OK ) { fprintf( stderr, "\nFailed to open file: %s\n", args.outputFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1495,17 +1690,26 @@ int main( if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { fprintf( stderr, "\nInvalid acoustic environment configuration parameters\n\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } else { fprintf( stderr, "\nFailed to get acoustic environment with ID %d\n\n", args.aeSequence.pID[args.aeSequence.selected] ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedRenderConfig failed: %s\n\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1516,6 +1720,9 @@ int main( if ( ( error = AudioFileReader_read( audioReader, inpInt16Buffer, (int16_t) inBufferSize, &numSamplesRead ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError reading from file %s\n", audioFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -1541,11 +1748,17 @@ int main( if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPos, &refPos ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nVector3PairFileReader_read failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = IVAS_REND_SetReferenceVector( hIvasRend, listenerPos, refPos ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_SetReferenceVector failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1558,12 +1771,18 @@ int main( if ( ( error = HeadRotationFileReading( referenceRotReader, &quaternions[sf_idx], NULL ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = IVAS_REND_SetReferenceRotation( hIvasRend, quaternions[sf_idx] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError setting Reference Rotation: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1581,12 +1800,18 @@ int main( if ( ( error = HeadRotationFileReading( headRotReader, &headRot, &Pos ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, headRot, Pos, DEFAULT_AXIS, sf_idx ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError setting Head Rotation: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1596,6 +1821,9 @@ int main( if ( ( error = IVAS_REND_DisableHeadRotation( hIvasRend ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError disabling head rotation: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1613,6 +1841,9 @@ int main( if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &quatBuffer[sf_idx], &enableHeadRotation[sf_idx], &enableExternalOrientation[sf_idx], &enableRotationInterpolation[sf_idx], &numFramesToTargetOrientation[sf_idx] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in External Orientation File Reading: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1621,6 +1852,9 @@ int main( if ( ( error = IVAS_REND_SetExternalOrientation( hIvasRend, &quatBuffer[sf_idx], enableHeadRotation[sf_idx], enableExternalOrientation[sf_idx], enableRotationInterpolation[sf_idx], numFramesToTargetOrientation[sf_idx], sf_idx ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError setting External Orientation: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1631,6 +1865,9 @@ int main( if ( ( error = IVAS_REND_CombineHeadAndExternalOrientation( hIvasRend ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError combining external and head orientations: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -1639,6 +1876,9 @@ int main( if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, mcIds[i], &numChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_GetInputNumChannels failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.multiChannelBuses[i].inputChannelIndex, numChannels ); @@ -1646,6 +1886,9 @@ int main( if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, mcIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1661,6 +1904,9 @@ int main( if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1668,6 +1914,9 @@ int main( if ( ( error = IVAS_REND_FeedInputObjectMetadataToOMasa( hIvasRend, i, mtdBuffer.positions[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputObjectMetadataToOMasa failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1678,12 +1927,18 @@ int main( if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = IVAS_REND_FeedInputObjectMetadata( hIvasRend, ismIds[i], mtdBuffer.positions[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputObjectMetadata failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1694,6 +1949,9 @@ int main( if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, sbaIds[i], &numChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_GetInputNumChannels failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.ambisonicsBuses[i].inputChannelIndex, numChannels ); @@ -1701,6 +1959,9 @@ int main( if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, sbaIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1710,6 +1971,9 @@ int main( if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, masaIds[i], &numChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "IVAS_REND_GetInputNumChannels failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } IVAS_REND_ReadOnlyAudioBuffer tmpBuffer = getReadOnlySubBuffer( inBuffer, (int16_t) args.inConfig.masaBuses[i].inputChannelIndex, numChannels ); @@ -1717,6 +1981,9 @@ int main( if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, masaIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) { fprintf( stderr, "IVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -1728,12 +1995,18 @@ int main( if ( ( error = MasaFileReader_readNextFrame( masaReaders[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in MASA Metadata File Reading: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } if ( ( error = IVAS_REND_FeedInputMasaMetadata( hIvasRend, masaIds[i], hMasaMetadata[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputMasaMetadata failed: %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1745,6 +2018,9 @@ int main( if ( ( error = IVAS_REND_GetSplitBinauralBitstream( hIvasRend, outBuffer, &bitsBuffer ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_GetSplitBinauralBitstream(): %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1753,6 +2029,9 @@ int main( if ( ( error = IVAS_REND_GetSamples( hIvasRend, outBuffer ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_GetSamples()%s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1771,6 +2050,9 @@ int main( if ( IVAS_REND_GetDelay( hIvasRend, &delayNumSamples, &delayTimeScale ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of renderer!\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } @@ -1789,6 +2071,9 @@ int main( &bitsBuffer.config.bitsWritten ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1800,6 +2085,9 @@ int main( if ( AudioFileWriter_write( audioWriter, &outInt16Buffer[delayNumSamples * num_out_channels], outBufferSize - ( delayNumSamples * num_out_channels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing audio file %s\n", args.outputFilePath ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } delayNumSamples = 0; @@ -1861,6 +2149,9 @@ int main( if ( ( error = IVAS_REND_GetMasaMetadata( hIvasRend, &hMetaOutput, inputType1 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_GetMasaMetadata(): %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1872,6 +2163,9 @@ int main( if ( ( error = IVAS_REND_MergeMasaMetadata( hIvasRend, &hMetaOutput, inputType1, inputType2 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_MergeMasaMetadata(): %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1882,6 +2176,9 @@ int main( if ( ( error = IVAS_REND_MergeMasaMetadata( hIvasRend, &hMetaOutput, inputType1, inputType2 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_MergeMasaMetadata(): %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1892,6 +2189,9 @@ int main( if ( ( error = IVAS_REND_MergeMasaMetadata( hIvasRend, &hMetaOutput, inputType1, inputType2 ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_MergeMasaMetadata(): %s\n", ivas_error_to_string( error ) ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1924,6 +2224,9 @@ int main( if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, outBufferSize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } } @@ -1932,6 +2235,9 @@ int main( if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPadToWrite * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); +#ifdef FIX_1335_EXTREND_RETCODE + retcode = 1; +#endif goto cleanup; } zeroPadToWrite = 0; @@ -2021,7 +2327,11 @@ cleanup: print_mem( NULL ); #endif +#ifdef FIX_1335_EXTREND_RETCODE + return retcode; +#else return 0; +#endif } diff --git a/lib_com/options.h b/lib_com/options.h index 80cd7a383b..388f70df4f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,6 +160,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ +#define FIX_1335_EXTREND_RETCODE /* FhG: Add modification of returncode for external renderer when an error occurs */ /* #################### End BE switches ################################## */ -- GitLab