xref: /aosp_15_r20/external/pdfium/core/fxcodec/progressive_decoder_iface.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2018 The PDFium Authors
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_PROGRESSIVE_DECODER_IFACE_H_
8 #define CORE_FXCODEC_PROGRESSIVE_DECODER_IFACE_H_
9 
10 #include "core/fxcrt/fx_types.h"
11 #include "core/fxcrt/retain_ptr.h"
12 
13 #ifndef PDF_ENABLE_XFA
14 #error "XFA Only"
15 #endif
16 
17 class CFX_CodecMemory;
18 
19 namespace fxcodec {
20 
21 class ProgressiveDecoderIface {
22  public:
23   class Context {
24    public:
25     virtual ~Context() = default;
26   };
27 
28   virtual ~ProgressiveDecoderIface() = default;
29 
30   // Returns the number of unprocessed bytes remaining in the input buffer.
31   virtual FX_FILESIZE GetAvailInput(Context* pContext) const = 0;
32 
33   // Provides a new input buffer to the codec. Returns true on success.
34   virtual bool Input(Context* pContext,
35                      RetainPtr<CFX_CodecMemory> codec_memory) = 0;
36 };
37 
38 }  // namespace fxcodec
39 
40 using fxcodec::ProgressiveDecoderIface;
41 
42 #endif  // CORE_FXCODEC_PROGRESSIVE_DECODER_IFACE_H_
43