//======================================================================== // // DCTStream.h // // This file is licensed under the GPLv2 or later // // Copyright 2005 Jeff Muizelaar // Copyright 2005 Martin Kretzschmar // Copyright 2005-2007, 2009-2011, 2017, 2019 Albert Astals Cid // Copyright 2010 Carlos Garcia Campos // Copyright 2011 Daiki Ueno // Copyright 2013 Thomas Freitag // //======================================================================== #ifndef DCTSTREAM_H #define DCTSTREAM_H #include "poppler-config.h" #include #include #include #include #ifdef HAVE_UNISTD_H # include #endif #include #include #include "goo/gmem.h" #include "goo/gfile.h" #include "Error.h" #include "Object.h" #include "Decrypt.h" #include "Stream.h" extern "C" { #include #include } struct str_src_mgr { struct jpeg_source_mgr pub; JOCTET buffer; Stream *str; int index; }; struct str_error_mgr { struct jpeg_error_mgr pub; jmp_buf setjmp_buffer; int width; int height; }; class DCTStream : public FilterStream { public: DCTStream(Stream *strA, int colorXformA, Dict *dict, int recursion); ~DCTStream() override; StreamKind getKind() const override { return strDCT; } void reset() override; int getChar() override; int lookChar() override; GooString *getPSFilter(int psLevel, const char *indent) override; bool isBinary(bool last = true) override; private: void init(); bool hasGetChars() override { return true; } int getChars(int nChars, unsigned char *buffer) override; int colorXform; JSAMPLE *current; JSAMPLE *limit; struct jpeg_decompress_struct cinfo; struct str_error_mgr err; struct str_src_mgr src; JSAMPARRAY row_buffer; }; #endif