OpenJPEG 2.1.0

msgqueue_manager.h

Go to the documentation of this file.
00001 /*
00002  * $Id: msgqueue_manager.h 2835 2014-04-03 15:30:57Z antonin $
00003  *
00004  * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
00005  * Copyright (c) 2002-2014, Professor Benoit Macq
00006  * Copyright (c) 2010-2011, Kaori Hagihara 
00007  * Copyright (c) 2011,      Lucian Corlaciu, GSoC
00008  * All rights reserved.
00009  *
00010  * Redistribution and use in source and binary forms, with or without
00011  * modification, are permitted provided that the following conditions
00012  * are met:
00013  * 1. Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
00020  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00023  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00024  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00025  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00026  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00027  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00028  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00029  * POSSIBILITY OF SUCH DAMAGE.
00030  */
00031 
00032 #ifndef         MSGQUEUE_MANAGER_H_
00033 # define        MSGQUEUE_MANAGER_H_
00034 
00035 #include "byte_manager.h"
00036 #include "cachemodel_manager.h"
00037 #include "placeholder_manager.h"
00038 
00039 #define PRECINCT_MSG 0
00040 #define EXT_PRECINCT_MSG 1
00041 #define TILE_HEADER_MSG 2
00042 #define TILE_MSG 4
00043 #define EXT_TILE_MSG 5
00044 #define MAINHEADER_MSG 6
00045 #define METADATA_MSG 8
00046 
00048 typedef struct message_param{
00049   OPJ_BOOL    last_byte;          
00050   Byte8_t in_class_id;        
00051   Byte8_t class_id;           
00052   Byte8_t csn;                
00053   Byte8_t bin_offset;         
00054   Byte8_t length;             
00055   Byte8_t aux;                
00056   OPJ_OFF_T res_offset;         
00057   placeholder_param_t *phld;  
00058   struct message_param *next; 
00059 } message_param_t;
00060 
00062 typedef struct msgqueue_param{
00063   message_param_t *first;         
00064   message_param_t *last;          
00065   OPJ_BOOL stateless;                 
00066   cachemodel_param_t *cachemodel; 
00067 } msgqueue_param_t;
00068 
00076 msgqueue_param_t * gene_msgqueue( OPJ_BOOL stateless, cachemodel_param_t *cachemodel);
00077 
00083 void delete_msgqueue( msgqueue_param_t **msgqueue);
00084 
00091 void delete_message_in_msgqueue( message_param_t **message, msgqueue_param_t *msgqueue);
00092 
00098 void print_msgqueue( msgqueue_param_t *msgqueue);
00099 
00100 
00106 void enqueue_mainheader( msgqueue_param_t *msgqueue);
00107 
00114 void enqueue_tileheader( int tile_id, msgqueue_param_t *msgqueue);
00115 
00123 void enqueue_tile( Byte4_t tile_id, int level, msgqueue_param_t *msgqueue);
00124 
00134 void enqueue_precinct( int seq_id, int tile_id, int comp_id, int layers, msgqueue_param_t *msgqueue);
00135 
00136 
00143 void enqueue_metadata( Byte8_t meta_id, msgqueue_param_t *msgqueue);
00144 
00145 
00152 void recons_stream_from_msgqueue( msgqueue_param_t *msgqueue, int tmpfd);
00153 
00154 
00163 void parse_JPIPstream( Byte_t *JPIPstream, Byte8_t streamlen, OPJ_OFF_T offset, msgqueue_param_t *msgqueue);
00164 
00173 void parse_metamsg( msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t streamlen, metadatalist_param_t *metadatalist);
00174 
00185 Byte8_t comp_precinct_id( int t, int c, int s, int num_components, int num_tiles);
00186 
00187 #endif      /* !MSGQUEUE_MANAGER_H_ */