kodi
IDecoder.h
1 /*
2  * Copyright (C) 2014 Team Kodi
3  * http://kodi.tv
4  *
5  * This Program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2, or (at your option)
8  * any later version.
9  *
10  * This Program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with XBMC; see the file COPYING. If not, see
17  * <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #pragma once
22 
23 #include <cstdint>
24 #include <string>
25 #include <vector>
26 
27 /* forward declarations */
28 
29 class DecodedFrame;
30 class DecodedFrames;
31 
32 class IDecoder
33 {
34  public:
35  virtual ~IDecoder() = default;
36  virtual bool CanDecode(const std::string &filename) = 0;
37  virtual bool LoadFile(const std::string& filename, DecodedFrames& frames) = 0;
38  virtual const char* GetImageFormatName() = 0;
39  virtual const char* GetDecoderName() = 0;
40 
41  const std::vector<std::string>& GetSupportedExtensions() const { return m_extensions; }
42 
43  protected:
44  std::vector<std::string> m_extensions;
45 };
46 
47 class RGBAImage
48 {
49 public:
50  RGBAImage() = default;
51 
52  std::vector<uint8_t> pixels;
53  int width = 0; // width
54  int height = 0; // height
55  int bbp = 0; // bits per pixel
56  int pitch = 0; // rowsize in bytes
57 };
58 
60 {
61 public:
62  DecodedFrame() = default;
63  RGBAImage rgbaImage; /* rgbaimage for this frame */
64  int delay = 0; /* Frame delay in ms */
65 };
66 
68 {
69  public:
70  DecodedFrames() = default;
71  std::vector<DecodedFrame> frameList;
72 };
Definition: IDecoder.h:32
Definition: IDecoder.h:59
Definition: IDecoder.h:47
Definition: IDecoder.h:67