1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef CORE_FXCODEC_JPX_JPX_DECODE_UTILS_H_
8 #define CORE_FXCODEC_JPX_JPX_DECODE_UTILS_H_
9 
10 #include <stdint.h>
11 
12 #if defined(USE_SYSTEM_LIBOPENJPEG2)
13 #include <openjpeg.h>
14 #else
15 #include "third_party/libopenjpeg20/openjpeg.h"
16 #endif
17 
18 namespace fxcodec {
19 
20 struct DecodeData {
DecodeDataDecodeData21   DecodeData(const uint8_t* data, OPJ_SIZE_T size)
22       : src_data(data), src_size(size), offset(0) {}
23 
24   const uint8_t* src_data;
25   OPJ_SIZE_T src_size;
26   OPJ_SIZE_T offset;
27 };
28 
29 /* Wrappers for C-style callbacks. */
30 OPJ_SIZE_T opj_read_from_memory(void* p_buffer,
31                                 OPJ_SIZE_T nb_bytes,
32                                 void* p_user_data);
33 OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data);
34 OPJ_BOOL opj_seek_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data);
35 
36 }  // namespace fxcodec
37 
38 #endif  // CORE_FXCODEC_JPX_JPX_DECODE_UTILS_H_
39