OpenJPEG 2.5.4

Data Structures | Macros | Typedefs | Functions
openjpip.h File Reference
`#include "session_manager.h"`
`#include "target_manager.h"`
`#include "query_parser.h"`
`#include "msgqueue_manager.h"`
`#include "sock_manager.h"`
`#include "auxtrans_manager.h"`
`#include "cache_manager.h"`
`#include "byte_manager.h"`
`#include "imgsock_manager.h"`
`#include "metadata_manager.h"`
`#include "ihdrbox_manager.h"`
`#include "index_manager.h"`

Go to the source code of this file.

## Data Structures
struct | dec_server_record
| Decoding server static records. More...
struct | jpip_dec_param
| JPIP decoding parameters. More...

## Macros
#define | FCGI_stdout stdout
#define | FCGI_stderr stderr
#define | logstream stderr

## Typedefs
typedef struct dec_server_record | dec_server_record_t
| Decoding server static records.
typedef SOCKET | client_t
| Client socket identifier.
typedef struct jpip_dec_param | jpip_dec_param_t
| JPIP decoding parameters.
typedef index_param_t | index_t
| Redefinition of index parameters.

## Functions
OPJ_API dec_server_record_t *OPJ_CALLCONV | init_dec_server (int port)
| Initialize the image decoding server.
OPJ_API void OPJ_CALLCONV | terminate_dec_server (dec_server_record_t **rec)
| Terminate the image decoding server.
OPJ_API client_t OPJ_CALLCONV | accept_connection (dec_server_record_t *rec)
| Accept client connection.
OPJ_API OPJ_BOOL OPJ_CALLCONV | handle_clientreq (client_t client, dec_server_record_t *rec)
| Handle client request.
OPJ_API jpip_dec_param_t *OPJ_CALLCONV | init_jpipdecoder (OPJ_BOOL jp2)
| Initialize jpip decoder.
OPJ_API void OPJ_CALLCONV | destroy_jpipdecoder (jpip_dec_param_t **dec)
| Destroy jpip decoding parameters.
OPJ_API OPJ_BOOL OPJ_CALLCONV | fread_jpip (const char fname[], jpip_dec_param_t *dec)
| Read jpip codestream from a file.
OPJ_API void OPJ_CALLCONV | decode_jpip (jpip_dec_param_t *dec)
| Decode jpip codestream.
OPJ_API OPJ_BOOL OPJ_CALLCONV | fwrite_jp2k (const char fname[], jpip_dec_param_t *dec)
| Write J2K/JP2 codestream to a file.
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.
OPJ_API index_t *OPJ_CALLCONV | get_index_from_JP2file (int fd)
| Parse JP2 file and get index information from cidx box inside.
OPJ_API void OPJ_CALLCONV | destroy_index (index_t **idx)
| Destroy index parameters.
OPJ_API void OPJ_CALLCONV | output_index (index_t *index)
| print index parameters

## Macro Definition Documentation

## ◆ FCGI_stderr

#define FCGI_stderr stderr

## ◆ FCGI_stdout

#define FCGI_stdout stdout

## ◆ logstream

#define logstream stderr

## Typedef Documentation

## ◆ client_t

typedef SOCKET client_t

Client socket identifier.

## ◆ dec_server_record_t

typedef struct dec_server_record dec_server_record_t

Decoding server static records.

## ◆ index_t

typedef index_param_t index_t

Redefinition of index parameters.

## ◆ jpip_dec_param_t

typedef struct jpip_dec_param jpip_dec_param_t

JPIP decoding parameters.

## Function Documentation

## ◆ accept_connection()

OPJ_API client_t OPJ_CALLCONV accept_connection | ( | dec_server_record_t * | rec | ) |

Accept client connection.

Parameters

  [in] | rec | decoding server static record pointer

Returns
  client socket ID, -1 if failed

References accept_socket(), dec_server_record::listening_socket, and OPJ_CALLCONV.

## ◆ decode_jpip()

OPJ_API void OPJ_CALLCONV decode_jpip | ( | jpip_dec_param_t * | dec | ) |

Decode jpip codestream.

Parameters

  [in] | dec | JPIP decoding parameters pointer

References message_param::csn, msgqueue_param::first, gene_ihdrbox(), jpip_dec_param::ihdrbox, jpip_dec_param::jp2klen, jpip_dec_param::jp2kstream, jpip_dec_param::jpiplen, jpip_dec_param::jpipstream, jpip_dec_param::metadatalist, jpip_dec_param::msgqueue, OPJ_CALLCONV, parse_JPIPstream(), parse_metamsg(), recons_j2k(), and recons_jp2().

## ◆ destroy_index()

OPJ_API void OPJ_CALLCONV destroy_index | ( | index_t ** | idx | ) |

Destroy index parameters.

Parameters

  [in,out] | idx | addressof the index pointer

References delete_index(), and OPJ_CALLCONV.

## ◆ destroy_jpipdecoder()

OPJ_API void OPJ_CALLCONV destroy_jpipdecoder | ( | jpip_dec_param_t ** | dec | ) |

Destroy jpip decoding parameters.

Parameters

  [in] | dec | address of JPIP decoding parameters pointer

References delete_metadatalist(), delete_msgqueue(), OPJ_CALLCONV, and opj_free().

## ◆ fread_jpip()

OPJ_API OPJ_BOOL OPJ_CALLCONV fread_jpip | ( | const char | fname[],
|  | jpip_dec_param_t * | dec )

Read jpip codestream from a file.

Parameters

  [in] | fname | file name
  [in] | dec | JPIP decoding parameters pointer

Returns
  true if succeed

References get_filesize(), jpip_dec_param::jpiplen, jpip_dec_param::jpipstream, OPJ_CALLCONV, OPJ_FALSE, opj_free(), opj_malloc(), and OPJ_TRUE.

## ◆ 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.

Parameters

  [in] | fname | file name
  [in] | dec | JPIP decoding parameters pointer

Returns
  true if succeed

References jpip_dec_param::jp2klen, jpip_dec_param::jp2kstream, OPJ_CALLCONV, OPJ_FALSE, and OPJ_TRUE.

## ◆ 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.

Parameters

  [in] | fd | file descriptor of the JP2 file

Returns
  pointer to the generated structure of index parameters

References OPJ_CALLCONV, opj_free(), opj_malloc(), and parse_jp2file().

## ◆ handle_clientreq()

OPJ_API OPJ_BOOL OPJ_CALLCONV handle_clientreq | ( | client_t | client,
|  | dec_server_record_t * | rec )

Handle client request.

Parameters

  [in] | client | client socket ID
  [in] | rec | decoding server static record pointer

Returns
  true if succeed

References dec_server_record::cachelist, CIDDST, CIDREQ, close_socket(), handle_CIDreqMSG(), handle_dstCIDreqMSG(), handle_JP2saveMSG(), handle_JPIPstreamMSG(), handle_PNMreqMSG(), handle_SIZreqMSG(), handle_TIDreqMSG(), handle_XMLreqMSG(), identify_clientmsg(), JP2SAVE, JPIPSTREAM, dec_server_record::jpipstream, dec_server_record::jpipstreamlen, MSGERROR, dec_server_record::msgqueue, OPJ_CALLCONV, OPJ_FALSE, OPJ_TRUE, PNMREQ, QUIT, save_codestream(), SIZREQ, TIDREQ, and XMLREQ.

## ◆ init_dec_server()

OPJ_API dec_server_record_t *OPJ_CALLCONV init_dec_server | ( | int | port | ) |

Initialize the image decoding server.

Parameters

  [in] | port | opening tcp port (valid No. 49152-65535)

Returns
  initialized decoding server record pointer

References dec_server_record::cachelist, gene_cachelist(), gene_msgqueue(), dec_server_record::jpipstream, dec_server_record::jpipstreamlen, dec_server_record::listening_socket, dec_server_record::msgqueue, open_listeningsocket(), OPJ_CALLCONV, opj_malloc(), and OPJ_TRUE.

## ◆ init_jpipdecoder()

OPJ_API jpip_dec_param_t *OPJ_CALLCONV init_jpipdecoder | ( | OPJ_BOOL | jp2 | ) |

Initialize jpip decoder.

Parameters

  [in] | jp2 | true in case of jp2 file encoding, else j2k file encoding

Returns
  JPIP decoding parameters pointer

References gene_metadatalist(), gene_msgqueue(), jpip_dec_param::metadatalist, jpip_dec_param::msgqueue, OPJ_CALLCONV, opj_calloc(), and OPJ_TRUE.

## ◆ output_index()

OPJ_API void OPJ_CALLCONV output_index | ( | index_t * | index | ) |

print index parameters

Parameters

  [in] | index | index parameters

References OPJ_CALLCONV, and print_index().

## ◆ 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.

Parameters

  [in] | messages | true if queue of messages is to be printed out
  [in] | metadata | true if metadata is to be printed out
  [in] | ihdrbox | true if image header data is to be printed out
  [in] | dec | JPIP decoding parameters pointer

References ihdrbox_param::bpc, ihdrbox_param::height, jpip_dec_param::ihdrbox, jpip_dec_param::metadatalist, jpip_dec_param::msgqueue, ihdrbox_param::nc, OPJ_CALLCONV, print_allmetadata(), print_msgqueue(), and ihdrbox_param::width.

## ◆ terminate_dec_server()

OPJ_API void OPJ_CALLCONV terminate_dec_server | ( | dec_server_record_t ** | rec | ) |

Terminate the image decoding server.

Parameters

  [in] | rec | address of deleting decoding server static record pointer

References close_socket(), delete_cachelist(), delete_msgqueue(), OPJ_CALLCONV, and opj_free().