initial commit
[goodguy/history.git] / cinelerra-5.0 / cinelerra / filetiff.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * 
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  * 
20  */
21
22 #ifndef FILETIFF_H
23 #define FILETIFF_H
24
25 #include <stdlib.h>
26
27 #include "file.inc"
28 #include "filelist.h"
29 #include "mutex.inc"
30 #include <tiffio.h>
31 #include "vframe.inc"
32
33 // This header file is representative of any single frame file format.
34
35 class FileTIFF : public FileList
36 {
37 public:
38         FileTIFF(Asset *asset, File *file);
39         ~FileTIFF();
40
41         static void get_parameters(BC_WindowBase *parent_window, 
42                 Asset *asset, 
43                 BC_WindowBase* &format_window,
44                 int audio_options,
45                 int video_options);
46         static int check_sig(Asset *asset);
47         static const char* compression_to_str(int value);
48         static const char* cmodel_to_str(int value);
49         int can_copy_from(Asset *asset, int64_t position);
50         int colormodel_supported(int colormodel);
51         int get_best_colormodel(Asset *asset, int driver);
52         int read_frame_header(char *path);
53         int read_frame(VFrame *output, VFrame *input);
54         int write_frame(VFrame *frame, VFrame *data, FrameWriterUnit *unit);
55         FrameWriterUnit* new_writer_unit(FrameWriter *writer);
56
57         enum
58         {
59                 NONE,
60 // values stored in Asset::tiff_cmodel
61 // Data types
62                 RGB_888,
63                 RGB_161616,
64                 RGBA_8888,
65                 RGBA_16161616,
66                 RGB_FLOAT,
67                 RGBA_FLOAT,
68                 GREYSCALE,
69 // values stored in Asset::tiff_compression
70 // Compression types
71                 LZW,
72                 PACK_BITS,
73                 DEFLATE,
74                 JPEG
75         };
76
77         Mutex *unit_lock;
78 };
79
80
81 // For each write frame call, since multiple write_frames are running concurrently.
82 class FileTIFFUnit : public FrameWriterUnit
83 {
84 public:
85         FileTIFFUnit(FileTIFF *file, FrameWriter *writer);
86         ~FileTIFFUnit();
87
88         int offset;
89         VFrame *data;
90         VFrame *temp;
91         FileTIFF *file;
92 };
93
94
95
96
97 class TIFFConfigVideo : public  BC_Window
98 {
99 public:
100         TIFFConfigVideo(BC_WindowBase *parent_window, Asset *asset);
101         ~TIFFConfigVideo();
102
103
104         void create_objects();
105         int close_event();
106         static char* alpha_to_codec(int use_alpha);
107         static int codec_to_alpha(char *codec);
108         BC_WindowBase *parent_window;
109         Asset *asset;
110 };
111
112
113 class TIFFColorspace : public BC_PopupMenu
114 {
115 public:
116         TIFFColorspace(TIFFConfigVideo *gui, int x, int y, int w);
117         void create_objects();
118         int handle_event();
119         TIFFConfigVideo *gui;
120 };
121
122 class TIFFColorspaceItem : public BC_MenuItem
123 {
124 public:
125         TIFFColorspaceItem(TIFFConfigVideo *gui, int value);
126         int handle_event();
127         TIFFConfigVideo *gui;
128         int value;
129 };
130
131
132
133
134 class TIFFCompression : public BC_PopupMenu
135 {
136 public:
137         TIFFCompression(TIFFConfigVideo *gui, int x, int y, int w);
138         void create_objects();
139         int handle_event();
140         TIFFConfigVideo *gui;
141 };
142
143 class TIFFCompressionItem : public BC_MenuItem
144 {
145 public:
146         TIFFCompressionItem(TIFFConfigVideo *gui, int value);
147         int handle_event();
148         TIFFConfigVideo *gui;
149         int value;
150 };
151
152
153
154
155
156 #endif