digiKam
image-io.h
Go to the documentation of this file.
1 /*
2  * H.265 video codec.
3  * Copyright (c) 2013-2014 struktur AG, Dirk Farin <farin@struktur.de>
4  *
5  * Authors: struktur AG, Dirk Farin <farin@struktur.de>
6  *
7  * This file is part of libde265.
8  *
9  * libde265 is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU Lesser General Public License as
11  * published by the Free Software Foundation, either version 3 of
12  * the License, or (at your option) any later version.
13  *
14  * libde265 is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with libde265. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef IMAGE_IO_H
24 #define IMAGE_IO_H
25 
26 #include "libde265/image.h"
27 #include <deque>
28 
29 
31 {
32  public:
34  virtual LIBDE265_API ~ImageSource() { }
35 
36  //enum ImageStatus { Available, Waiting, EndOfVideo };
37 
38  //virtual ImageStatus get_status() = 0;
39  virtual LIBDE265_API de265_image* get_image(bool block=true) = 0;
40  virtual LIBDE265_API void skip_frames(int n) = 0;
41 
42  virtual LIBDE265_API int get_width() const = 0;
43  virtual LIBDE265_API int get_height() const = 0;
44 };
45 
46 
47 
49 {
50  public:
53 
54  bool LIBDE265_API set_input_file(const char* filename, int w,int h);
55 
56  //virtual ImageStatus get_status();
57  virtual LIBDE265_API de265_image* get_image(bool block=true);
58  virtual LIBDE265_API void skip_frames(int n);
59 
60  virtual LIBDE265_API int get_width() const { return width; }
61  virtual LIBDE265_API int get_height() const { return height; }
62 
63  private:
64  FILE* mFH;
65  bool mReachedEndOfFile;
66 
67  int width,height;
68 
69  de265_image* read_next_image();
70 };
71 
72 
73 
74 class ImageSink
75 {
76  public:
77  virtual LIBDE265_API ~ImageSink() { }
78 
79  virtual LIBDE265_API void send_image(const de265_image* img) = 0;
80 };
81 
82 class ImageSink_YUV : public ImageSink
83 {
84  public:
85  LIBDE265_API ImageSink_YUV() : mFH(NULL) { }
87 
88  bool LIBDE265_API set_filename(const char* filename);
89 
90  virtual LIBDE265_API void send_image(const de265_image* img);
91 
92  private:
93  FILE* mFH;
94 };
95 
96 
97 
99 {
100  public:
101  virtual LIBDE265_API ~PacketSink() { }
102 
103  virtual LIBDE265_API void send_packet(const uint8_t* data, int n) = 0;
104 };
105 
106 
108 {
109  public:
112 
113  LIBDE265_API void set_filename(const char* filename);
114 
115  virtual LIBDE265_API void send_packet(const uint8_t* data, int n);
116 
117  private:
118  FILE* mFH;
119 };
120 
121 #endif
Definition: image-io.h:83
LIBDE265_API ~ImageSink_YUV()
virtual LIBDE265_API void send_image(const de265_image *img)
LIBDE265_API ImageSink_YUV()
Definition: image-io.h:85
bool LIBDE265_API set_filename(const char *filename)
Definition: image-io.h:75
virtual LIBDE265_API ~ImageSink()
Definition: image-io.h:77
virtual LIBDE265_API void send_image(const de265_image *img)=0
Definition: image-io.h:49
bool LIBDE265_API set_input_file(const char *filename, int w, int h)
virtual LIBDE265_API void skip_frames(int n)
virtual LIBDE265_API int get_height() const
Definition: image-io.h:61
virtual LIBDE265_API int get_width() const
Definition: image-io.h:60
virtual LIBDE265_API de265_image * get_image(bool block=true)
virtual LIBDE265_API ~ImageSource_YUV()
LIBDE265_API ImageSource_YUV()
Definition: image-io.h:31
virtual LIBDE265_API int get_height() const =0
LIBDE265_API ImageSource()
virtual LIBDE265_API de265_image * get_image(bool block=true)=0
virtual LIBDE265_API int get_width() const =0
virtual LIBDE265_API void skip_frames(int n)=0
virtual LIBDE265_API ~ImageSource()
Definition: image-io.h:34
Definition: image-io.h:108
virtual LIBDE265_API ~PacketSink_File()
virtual LIBDE265_API void send_packet(const uint8_t *data, int n)
LIBDE265_API void set_filename(const char *filename)
LIBDE265_API PacketSink_File()
Definition: image-io.h:99
virtual LIBDE265_API ~PacketSink()
Definition: image-io.h:101
virtual LIBDE265_API void send_packet(const uint8_t *data, int n)=0
#define LIBDE265_API
Definition: de265.h:52
Definition: image.h:222