summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/codec_module_iface.h
blob: e7faa892b2332b097a6bfbdce81d807cf7ffff74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2018 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef CORE_FXCODEC_CODEC_CODEC_MODULE_IFACE_H_
#define CORE_FXCODEC_CODEC_CODEC_MODULE_IFACE_H_

#include "core/fxcrt/fx_system.h"
#include "third_party/base/span.h"

class CFX_DIBAttribute;

class CodecModuleIface {
 public:
  class Context {
   public:
    virtual ~Context() = default;
  };

  virtual ~CodecModuleIface() = default;

  // Returns the number of unprocessed bytes remaining in the input buffer.
  virtual FX_FILESIZE GetAvailInput(Context* pContext) const = 0;

  // Provides a new input buffer to the codec. Returns true on success,
  // setting details about the image extracted from the buffer into |pAttribute|
  // (if provided and the codec is capable providing that information).
  virtual bool Input(Context* pContext,
                     pdfium::span<uint8_t> src_buf,
                     CFX_DIBAttribute* pAttribute) = 0;
};

#endif  // CORE_FXCODEC_CODEC_CODEC_MODULE_IFACE_H_