|
Definition at line 65 of file jpegSize.cpp.
References first_marker(), height, infile, M_EOI, M_SOF0, M_SOF1, M_SOF10, M_SOF11, M_SOF13, M_SOF14, M_SOF15, M_SOF2, M_SOF3, M_SOF5, M_SOF6, M_SOF7, M_SOF9, M_SOS, next_marker(), process_SOFn(), READ_BINARY, skip_variable(), and width.
Referenced by getImageSize(), and isJpeg().
00066 {
00067
00068 if (( infile = fopen(filename, READ_BINARY)) == NULL)
00069 return false;
00070
00071
00072
00073 int marker;
00074
00075
00076 if (! first_marker(&marker))
00077 {
00078 fclose(infile);
00079 return false;
00080 }
00081
00082
00083 for (;;)
00084 {
00085 if(! next_marker(&marker))
00086 {
00087 fclose(infile);
00088 return false;
00089 }
00090
00091 switch (marker)
00092 {
00093
00094
00095
00096 case M_SOF0:
00097 case M_SOF1:
00098 case M_SOF2:
00099 case M_SOF3:
00100 case M_SOF5:
00101 case M_SOF6:
00102 case M_SOF7:
00103 case M_SOF9:
00104 case M_SOF10:
00105 case M_SOF11:
00106 case M_SOF13:
00107 case M_SOF14:
00108 case M_SOF15:
00109 if(! process_SOFn(width, height))
00110 {
00111 fclose(infile);
00112 return false;
00113 }
00114 else
00115 {
00116 fclose(infile);
00117 return true;
00118 }
00119 case M_SOS:
00120 {
00121 fclose(infile);
00122 return false;
00123 }
00124 case M_EOI:
00125 {
00126 fclose(infile);
00127 return false;
00128 }
00129 default:
00130 skip_variable();
00131 break;
00132 }
00133 }
00134
00135
00136
00137 return false;
00138
00139 }
|