codec/codec_msg.c
Go to the documentation of this file.00001 00008 /* Copyright (C) 2007-2011, Amlogic Inc. 00009 * All right reserved 00010 * 00011 */ 00012 #include <stdio.h> 00013 #include <stdio.h> 00014 00015 #include <sys/types.h> 00016 #include <sys/stat.h> 00017 #include <errno.h> 00018 #include <sys/ioctl.h> 00019 #include <fcntl.h> 00020 #include <codec_error.h> 00021 #include <codec.h> 00022 #include "codec_h_ctrl.h" 00023 00024 00025 /* --------------------------------------------------------------------------*/ 00033 /* --------------------------------------------------------------------------*/ 00034 int system_error_to_codec_error(int error) 00035 { 00036 switch (error) { 00037 case 0: 00038 return CODEC_ERROR_NONE; 00039 case EBUSY: 00040 return -CODEC_ERROR_BUSY; 00041 case ENOMEM: 00042 return -CODEC_ERROR_NOMEM; 00043 case ENODEV: 00044 return -CODEC_ERROR_IO; 00045 default: 00046 return -CODEC_ERROR_INVAL; 00047 } 00048 } 00049 00050 /* --------------------------------------------------------------------------*/ 00058 /* --------------------------------------------------------------------------*/ 00059 const char * codec_error_msg(int error) 00060 { 00061 switch (error) { 00062 case CODEC_ERROR_NONE: 00063 return "codec no errors"; 00064 case -CODEC_ERROR_INVAL: 00065 return "invalid handle or parameter"; 00066 case -CODEC_ERROR_BUSY: 00067 return "codec is busy"; 00068 case -CODEC_ERROR_NOMEM: 00069 return "no enough memory for codec"; 00070 case -CODEC_ERROR_IO: 00071 return "codec io error"; 00072 case -CODEC_ERROR_PARAMETER: 00073 return "Parameters error"; 00074 case -CODEC_ERROR_AUDIO_TYPE_UNKNOW: 00075 return "Audio Type error"; 00076 case -CODEC_ERROR_VIDEO_TYPE_UNKNOW: 00077 return "Video Type error"; 00078 case -CODEC_ERROR_STREAM_TYPE_UNKNOW: 00079 return "Stream Type error"; 00080 case -CODEC_ERROR_INIT_FAILED: 00081 return "Codec init failed"; 00082 case -CODEC_ERROR_SET_BUFSIZE_FAILED: 00083 return "Codec change buffer size failed"; 00084 default: 00085 return "invalid operate"; 00086 } 00087 } 00088 00089 /* --------------------------------------------------------------------------*/ 00097 /* --------------------------------------------------------------------------*/ 00098 void print_error_msg(int error, char *func, int line) 00099 { 00100 CODEC_PRINT("Error=%x,%s,func=%s,line=%d\n", error, codec_error_msg(error), func, line); 00101 } 00102 00103
Generated on Fri Feb 25 15:30:29 2011 for Amcodec by 1.6.1