1 /****************************************************************************** 2 * * 3 * Copyright (C) 2023 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ***************************************************************************** 18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore 19 */ 20 21 #pragma once 22 #define IA_MAX_ERROR_SUB_CODE (70) 23 24 /* these definitions are used by error handling function */ 25 /* the error handler will work on a structure which identifies a */ 26 /* particular error with a module, context and error_code */ 27 /* within error_code, MSB identifies FATAL (1), NONFATAL (0) */ 28 /* next 4 ms_bs identify a class of error */ 29 30 typedef struct { 31 pWORD8 pb_module_name; 32 pWORD8 ppb_class_names[16]; 33 WORD8 **ppppb_error_msg_pointers[2][7][20]; 34 } ia_error_info_struct; 35 36 /* this error handler maps the code generated by a module to a error string */ 37 /* pb_context is a string to specify where the module broke */ 38 IA_ERRORCODE ia_error_handler(ia_error_info_struct *p_mod_err_info, WORD8 *pb_context, 39 IA_ERRORCODE code); 40 41 /* the following macro does a line job of returning back to the parent */ 42 /* in case a fatal error occurs after calling the errorhandler */ 43 #define _IA_HANDLE_ERROR(p_mod_err_info, context, e, pv_output) \ 44 if ((e) != IA_NO_ERROR) { \ 45 ia_error_handler((p_mod_err_info), (context), (e)); \ 46 if ((e)&IA_FATAL_ERROR) { \ 47 IA_ERRORCODE err = IA_NO_ERROR; \ 48 err = ixheaace_delete((pVOID)pv_output); \ 49 if (pstr_in_cfg->pv_drc_cfg) { \ 50 pv_output->free_xheaace(pstr_in_cfg->pv_drc_cfg); \ 51 } \ 52 if (pstr_drc_cfg_user) { \ 53 free_global(pstr_drc_cfg_user); \ 54 pstr_drc_cfg_user = NULL; \ 55 } \ 56 if (ia_stsz_size != NULL) { \ 57 pv_output->free_xheaace(ia_stsz_size); \ 58 ia_stsz_size = NULL; \ 59 } \ 60 if ((err)&IA_FATAL_ERROR) { \ 61 return (err); \ 62 } else { \ 63 return (e); \ 64 } \ 65 } \ 66 } 67