| 5859 | |
| 5860 | |
| 5861 | static int ParseEXRHeader(HeaderInfo *info, bool *empty_header, |
| 5862 | const EXRVersion *version, std::string *err, |
| 5863 | const unsigned char *buf, size_t size) { |
| 5864 | const char *marker = reinterpret_cast<const char *>(&buf[0]); |
| 5865 | |
| 5866 | if (empty_header) { |
| 5867 | (*empty_header) = false; |
| 5868 | } |
| 5869 | |
| 5870 | if (version->multipart) { |
| 5871 | if (size > 0 && marker[0] == '\0') { |
| 5872 | // End of header list. |
| 5873 | if (empty_header) { |
| 5874 | (*empty_header) = true; |
| 5875 | } |
| 5876 | return TINYEXR_SUCCESS; |
| 5877 | } |
| 5878 | } |
| 5879 | |
| 5880 | // According to the spec, the header of every OpenEXR file must contain at |
| 5881 | // least the following attributes: |
| 5882 | // |
| 5883 | // channels chlist |
| 5884 | // compression compression |
| 5885 | // dataWindow box2i |
| 5886 | // displayWindow box2i |
| 5887 | // lineOrder lineOrder |
| 5888 | // pixelAspectRatio float |
| 5889 | // screenWindowCenter v2f |
| 5890 | // screenWindowWidth float |
| 5891 | bool has_channels = false; |
| 5892 | bool has_compression = false; |
| 5893 | bool has_data_window = false; |
| 5894 | bool has_display_window = false; |
| 5895 | bool has_line_order = false; |
| 5896 | bool has_pixel_aspect_ratio = false; |
| 5897 | bool has_screen_window_center = false; |
| 5898 | bool has_screen_window_width = false; |
| 5899 | bool has_name = false; |
| 5900 | bool has_type = false; |
| 5901 | |
| 5902 | info->name.clear(); |
| 5903 | info->type.clear(); |
| 5904 | |
| 5905 | info->data_window.min_x = 0; |
| 5906 | info->data_window.min_y = 0; |
| 5907 | info->data_window.max_x = 0; |
| 5908 | info->data_window.max_y = 0; |
| 5909 | info->line_order = 0; // @fixme |
| 5910 | info->display_window.min_x = 0; |
| 5911 | info->display_window.min_y = 0; |
| 5912 | info->display_window.max_x = 0; |
| 5913 | info->display_window.max_y = 0; |
| 5914 | info->screen_window_center[0] = 0.0f; |
| 5915 | info->screen_window_center[1] = 0.0f; |
| 5916 | info->screen_window_width = -1.0f; |
| 5917 | info->pixel_aspect_ratio = -1.0f; |
| 5918 |
no test coverage detected