OpenJPEG 2.3.0

openjpip.h
Go to the documentation of this file.
1 /*
2 * $Id$
3 *
4 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
5 * Copyright (c) 2002-2014, Professor Benoit Macq
6 * Copyright (c) 2010-2011, Kaori Hagihara
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #ifndef OPENJPIP_H_
32 # define OPENJPIP_H_
33
34 #include "session_manager.h"
35 #include "target_manager.h"
36 #include "query_parser.h"
37 #include "msgqueue_manager.h"
38 #include "sock_manager.h"
39 #include "auxtrans_manager.h"
40
41 #ifdef SERVER
42
43 #include "fcgi_stdio.h"
44 #define logstream FCGI_stdout
45
46 #else
47
48 #define FCGI_stdout stdout
49 #define FCGI_stderr stderr
50 #define logstream stderr
51
52 #include "cache_manager.h"
53 #include "byte_manager.h"
54 #include "imgsock_manager.h"
55
56 #include "metadata_manager.h"
57 #include "ihdrbox_manager.h"
58 #include "index_manager.h"
59
60 #endif /*SERVER*/
61
62 /*
63 *==========================================================
64 * JPIP server API
65 *==========================================================
66 */
67
68 #ifdef SERVER
69
71 typedef struct server_record {
72 sessionlist_param_t *sessionlist;
73 targetlist_param_t *targetlist;
74 auxtrans_param_t auxtrans;
75 } server_record_t;
76
78 typedef struct QR {
79 query_param_t *query;
80 msgqueue_param_t *msgqueue;
81 channel_param_t *channel;
82 } QR_t;
83
91 server_record_t * init_JPIPserver(int tcp_auxport, int udp_auxport);
92
98 void terminate_JPIPserver(server_record_t **rec);
99
106 QR_t * parse_querystring(const char *query_string);
107
115 OPJ_BOOL process_JPIPrequest(server_record_t *rec, QR_t *qr);
116
123 void send_responsedata(server_record_t *rec, QR_t *qr);
124
131 void end_QRprocess(server_record_t *rec, QR_t **qr);
132
143 void local_log(OPJ_BOOL query, OPJ_BOOL messages, OPJ_BOOL sessions,
144 OPJ_BOOL targets, QR_t *qr, server_record_t *rec);
145
146 #endif /*SERVER*/
147
148 /*
149 *==========================================================
150 * JPIP decoding server API
151 *==========================================================
152 */
153
154 #ifndef SERVER
155
157 typedef struct dec_server_record {
158 cachelist_param_t *cachelist;
159 Byte_t *jpipstream;
160 OPJ_SIZE_T jpipstreamlen;
161 msgqueue_param_t *msgqueue;
162 SOCKET listening_socket;
163 } dec_server_record_t;
164
165
167 typedef SOCKET client_t;
168
175 OPJ_API dec_server_record_t * OPJ_CALLCONV init_dec_server(int port);
176
182 OPJ_API void OPJ_CALLCONV terminate_dec_server(dec_server_record_t **rec);
183
190 OPJ_API client_t OPJ_CALLCONV accept_connection(dec_server_record_t *rec);
191
199 OPJ_API OPJ_BOOL OPJ_CALLCONV handle_clientreq(client_t client,
200 dec_server_record_t *rec);
201
202 #endif /*SERVER*/
203
204 /*
205 *==========================================================
206 * JPIP tool API
207 *==========================================================
208 */
209
210 #ifndef SERVER
211
212 /*
213 * jpip to JP2 or J2K
214 */
215
217 typedef struct jpip_dec_param {
218 Byte_t *jpipstream;
219 Byte8_t jpiplen;
220 msgqueue_param_t *msgqueue;
221 metadatalist_param_t *metadatalist;
222 ihdrbox_param_t *ihdrbox;
223 Byte_t *jp2kstream;
224 Byte8_t jp2klen;
225 } jpip_dec_param_t;
226
233 OPJ_API jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder(OPJ_BOOL jp2);
234
240 OPJ_API void OPJ_CALLCONV destroy_jpipdecoder(jpip_dec_param_t **dec);
241
249 OPJ_API OPJ_BOOL OPJ_CALLCONV fread_jpip(const char fname[],
250 jpip_dec_param_t *dec);
251
257 OPJ_API void OPJ_CALLCONV decode_jpip(jpip_dec_param_t *dec);
258
266 OPJ_API OPJ_BOOL OPJ_CALLCONV fwrite_jp2k(const char fname[],
267 jpip_dec_param_t *dec);
268
277 OPJ_API void OPJ_CALLCONV output_log(OPJ_BOOL messages, OPJ_BOOL metadata,
278 OPJ_BOOL ihdrbox, jpip_dec_param_t *dec);
279
280 /*
281 * test the format of index (cidx) box in JP2 file
282 */
283
285 typedef index_param_t index_t;
286
293 OPJ_API index_t * OPJ_CALLCONV get_index_from_JP2file(int fd);
294
300 OPJ_API void OPJ_CALLCONV destroy_index(index_t **idx);
301
302
308 OPJ_API void OPJ_CALLCONV output_index(index_t *index);
309
310 #endif /*SERVER*/
311
312 #endif /* !OPENJPIP_H_ */
query_parser.h
jpip_dec_param::metadatalist
metadatalist_param_t * metadatalist
metadata list going into JP2 file
Definition: openjpip.h:221
index_t
index_param_t index_t
Redefinition of index parameters.
Definition: openjpip.h:285
Byte_t
uint8_t Byte_t
Definition: byte_manager.h:37
msgqueue_param
message queue parameters
Definition: msgqueue_manager.h:63
jpip_dec_param::jpiplen
Byte8_t jpiplen
length of jpipstream
Definition: openjpip.h:219
dec_server_record::jpipstreamlen
OPJ_SIZE_T jpipstreamlen
length of jpipstream
Definition: openjpip.h:160
ihdrbox_manager.h
dec_server_record
Decoding server static records.
Definition: openjpip.h:157
accept_connection
OPJ_API client_t OPJ_CALLCONV accept_connection(dec_server_record_t *rec)
Accept client connection.
Definition: openjpip.c:260
OPJ_BOOL
int OPJ_BOOL
Definition: openjpeg.h:110
handle_clientreq
OPJ_API OPJ_BOOL OPJ_CALLCONV handle_clientreq(client_t client, dec_server_record_t *rec)
Handle client request.
Definition: openjpip.c:272
destroy_jpipdecoder
OPJ_API void OPJ_CALLCONV destroy_jpipdecoder(jpip_dec_param_t **dec)
Destroy jpip decoding parameters.
Definition: openjpip.c:433
output_log
OPJ_API void OPJ_CALLCONV output_log(OPJ_BOOL messages, OPJ_BOOL metadata, OPJ_BOOL ihdrbox, jpip_dec_param_t *dec)
Option; print out parameter values to stderr.
Definition: openjpip.c:416
jpip_dec_param::jp2klen
Byte8_t jp2klen
length of j2kstream or JP2 file
Definition: openjpip.h:224
index_manager.h
output_index
OPJ_API void OPJ_CALLCONV output_index(index_t *index)
print index parameters
Definition: openjpip.c:479
jpip_dec_param::ihdrbox
ihdrbox_param_t * ihdrbox
ihdr box going into JP2 file
Definition: openjpip.h:222
cachelist_param
Definition: cache_manager.h:50
metadata_manager.h
dec_server_record::cachelist
cachelist_param_t * cachelist
cache list
Definition: openjpip.h:158
get_index_from_JP2file
OPJ_API index_t *OPJ_CALLCONV get_index_from_JP2file(int fd)
Parse JP2 file and get index information from cidx box inside.
Definition: openjpip.c:446
OPJ_SIZE_T
size_t OPJ_SIZE_T
Definition: openjpeg.h:133
dec_server_record::msgqueue
msgqueue_param_t * msgqueue
parsed message queue of jpipstream
Definition: openjpip.h:161
jpip_dec_param::jp2kstream
Byte_t * jp2kstream
J2K codestream or JP2 file codestream.
Definition: openjpip.h:223
targetlist_param
Target list parameters.
Definition: target_manager.h:59
destroy_index
OPJ_API void OPJ_CALLCONV destroy_index(index_t **idx)
Destroy index parameters.
Definition: openjpip.c:474
dec_server_record::jpipstream
Byte_t * jpipstream
JPT/JPP stream.
Definition: openjpip.h:159
SOCKET
int SOCKET
Definition: sock_manager.h:40
auxtrans_param
auxiliary transport setting parameters
Definition: auxtrans_manager.h:38
msgqueue_manager.h
target_manager.h
decode_jpip
OPJ_API void OPJ_CALLCONV decode_jpip(jpip_dec_param_t *dec)
Decode jpip codestream.
Definition: openjpip.c:376
index_param
index parameters
Definition: index_manager.h:86
imgsock_manager.h
terminate_dec_server
OPJ_API void OPJ_CALLCONV terminate_dec_server(dec_server_record_t **rec)
Terminate the image decoding server.
Definition: openjpip.c:244
jpip_dec_param::msgqueue
msgqueue_param_t * msgqueue
message queue
Definition: openjpip.h:220
query_param
Query parameters.
Definition: query_parser.h:47
dec_server_record::listening_socket
SOCKET listening_socket
listenning socket
Definition: openjpip.h:162
init_dec_server
OPJ_API dec_server_record_t *OPJ_CALLCONV init_dec_server(int port)
Initialize the image decoding server.
Definition: openjpip.c:230
jpip_dec_param::jpipstream
Byte_t * jpipstream
JPT/JPP-stream.
Definition: openjpip.h:218
jpip_dec_param
JPIP decoding parameters.
Definition: openjpip.h:217
sessionlist_param
Session list parameters.
Definition: session_manager.h:45
jpip_dec_param_t
struct jpip_dec_param jpip_dec_param_t
JPIP decoding parameters.
OPJ_CALLCONV
#define OPJ_CALLCONV
Definition: openjpeg.h:92
fread_jpip
OPJ_API OPJ_BOOL OPJ_CALLCONV fread_jpip(const char fname[], jpip_dec_param_t *dec)
Read jpip codestream from a file.
Definition: openjpip.c:350
ihdrbox_param
I.5.3.1 Image Header box.
Definition: ihdrbox_manager.h:39
sock_manager.h
auxtrans_manager.h
byte_manager.h
OPJ_API
#define OPJ_API
Definition: openjpeg.h:89
init_jpipdecoder
OPJ_API jpip_dec_param_t *OPJ_CALLCONV init_jpipdecoder(OPJ_BOOL jp2)
Initialize jpip decoder.
Definition: openjpip.c:334
fwrite_jp2k
OPJ_API OPJ_BOOL OPJ_CALLCONV fwrite_jp2k(const char fname[], jpip_dec_param_t *dec)
Write J2K/JP2 codestream to a file.
Definition: openjpip.c:394
client_t
SOCKET client_t
Client socket identifier.
Definition: openjpip.h:167
dec_server_record_t
struct dec_server_record dec_server_record_t
Decoding server static records.
cache_manager.h
Byte8_t
uint64_t Byte8_t
Definition: byte_manager.h:40
channel_param
Channel parameters.
Definition: channel_manager.h:43
session_manager.h
metadatalist_param
metadata-bin list parameters
Definition: metadata_manager.h:54