OpenJPEG  2.2.0
Functions
openjpip.c File Reference
#include <stdlib.h>
#include "openjpip.h"
#include "jpip_parser.h"
#include "channel_manager.h"
#include "byte_manager.h"
#include <unistd.h>
#include <stdio.h>
#include "dec_clientmsg_handler.h"
#include "jpipstream_manager.h"
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "jp2k_encoder.h"

Functions

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

Function Documentation

client_t OPJ_CALLCONV accept_connection ( dec_server_record_t rec)

Accept client connection.

Parameters
[in]recdecoding server static record pointer
Returns
client socket ID, -1 if failed

References accept_socket(), and dec_server_record::listening_socket.

void OPJ_CALLCONV decode_jpip ( jpip_dec_param_t dec)
void OPJ_CALLCONV destroy_index ( index_t **  idx)

Destroy index parameters.

Parameters
[in,out]idxaddressof the index pointer

References delete_index().

void OPJ_CALLCONV destroy_jpipdecoder ( jpip_dec_param_t **  dec)

Destroy jpip decoding parameters.

Parameters
[in]decaddress of JPIP decoding parameters pointer

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

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

Read jpip codestream from a file.

Parameters
[in]fnamefile name
[in]decJPIP decoding parameters pointer
Returns
true if succeed

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

OPJ_BOOL OPJ_CALLCONV fwrite_jp2k ( const char  fname[],
jpip_dec_param_t dec 
)

Write J2K/JP2 codestream to a file.

Parameters
[in]fnamefile name
[in]decJPIP decoding parameters pointer
Returns
true if succeed

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

index_t* OPJ_CALLCONV get_index_from_JP2file ( int  fd)

Parse JP2 file and get index information from cidx box inside.

Parameters
[in]fdfile descriptor of the JP2 file
Returns
pointer to the generated structure of index parameters

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

OPJ_BOOL OPJ_CALLCONV handle_clientreq ( client_t  client,
dec_server_record_t rec 
)
dec_server_record_t* OPJ_CALLCONV init_dec_server ( int  port)

Initialize the image decoding server.

Parameters
[in]portopening 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_malloc(), and OPJ_TRUE.

jpip_dec_param_t* OPJ_CALLCONV init_jpipdecoder ( OPJ_BOOL  jp2)

Initialize jpip decoder.

Parameters
[in]jp2true 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_calloc(), and OPJ_TRUE.

void OPJ_CALLCONV output_index ( index_t index)

print index parameters

Parameters
[in]indexindex parameters

References print_index().

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]messagestrue if queue of messages is to be printed out
[in]metadatatrue if metadata is to be printed out
[in]ihdrboxtrue if image header data is to be printed out
[in]decJPIP 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, print_allmetadata(), print_msgqueue(), and ihdrbox_param::width.

void OPJ_CALLCONV terminate_dec_server ( dec_server_record_t **  rec)

Terminate the image decoding server.

Parameters
[in]recaddress of deleting decoding server static record pointer

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