! : changed
+ : added
+July 5, 2011
+! [kaori] changed parameter and file names regarding JPT-stream to JPIP-stream, which handles also JPP-stream
+
May 26, 2011
! [antonin] changed Makefile to Makefile.nix to avoid having autotools overwrite them.
Byte_t * parse_bin_id_vbas( Byte_t *streamptr, Byte_t *bb, Byte_t *c, Byte8_t *in_class_id);
Byte_t * parse_vbas( Byte_t *streamptr, Byte8_t *elem);
-void parse_stream( Byte_t *stream, Byte8_t jptlen, Byte8_t offset, msgqueue_param_t *msgqueue)
+void parse_JPIPstream( Byte_t *JPIPstream, Byte8_t streamlen, Byte8_t offset, msgqueue_param_t *msgqueue)
{
Byte_t *ptr; // stream pointer
message_param_t *msg;
class_id = -1; // dummy
csn = 0;
- ptr = stream;
- while( ptr-stream < jptlen){
+ ptr = JPIPstream;
+ while( ptr-JPIPstream < streamlen){
msg = (message_param_t *)malloc( sizeof(message_param_t));
ptr = parse_bin_id_vbas( ptr, &bb, &c, &msg->in_class_id);
else
msg->aux = 0;
- msg->res_offset = ptr-stream+offset;
+ msg->res_offset = ptr-JPIPstream+offset;
msg->phld = NULL;
msg->next = NULL;
void parse_metadata( metadata_param_t *metadata, message_param_t *msg, Byte_t *stream);
-void parse_metamsg( msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t jptlen, metadatalist_param_t *metadatalist)
+void parse_metamsg( msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t streamlen, metadatalist_param_t *metadatalist)
{
message_param_t *msg;
/**
- * parse JPT-stream to message queue
+ * parse JPT- JPP- stream to message queue
*
- * @param[in] stream JPT-stream data pointer
- * @param[in] jptlen JPT-stream length
- * @param[in] offset offset of the JPT-stream from the whole beginning
+ * @param[in] JPIPstream JPT- JPP- stream data pointer
+ * @param[in] streamlen JPIPstream length
+ * @param[in] offset offset of the stream from the whole beginning
* @param[in,out] msgqueue adding message queue pointer
*/
-void parse_stream( Byte_t *stream, Byte8_t jptlen, Byte8_t offset, msgqueue_param_t *msgqueue);
+void parse_JPIPstream( Byte_t *JPIPstream, Byte8_t streamlen, Byte8_t offset, msgqueue_param_t *msgqueue);
/**
- * parse JPT-stream to message queue
+ * parse JPT- JPP- stream to message queue
*
* @param[in] msgqueue reference message queue pointer
- * @param[in] stream JPT-stream data pointer
- * @param[in] jptlen JPT-stream length
+ * @param[in] stream stream data pointer
+ * @param[in] streamlen stream length
* @param[in] metadatalist adding metadata list pointer
*/
-void parse_metamsg( msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t jptlen, metadatalist_param_t *metadatalist);
+void parse_metamsg( msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t streamlen, metadatalist_param_t *metadatalist);
/**
all: $(ALL)
-opj_dec_server: opj_dec_server.o jp2k_decoder.o imgsock_manager.o jptstream_manager.o cache_manager.o $(LIBFNAME)
- $(CC) $(CFLAGS) $< jp2k_decoder.o imgsock_manager.o jptstream_manager.o cache_manager.o $(LDFLAGS) -o $@
+opj_dec_server: opj_dec_server.o jp2k_decoder.o imgsock_manager.o jpipstream_manager.o cache_manager.o $(LIBFNAME)
+ $(CC) $(CFLAGS) $< jp2k_decoder.o imgsock_manager.o jpipstream_manager.o cache_manager.o $(LDFLAGS) -o $@
clean:
rm -f $(ALL) *.o *~
{
int receive_size;
char buf[BUF_LEN];
- char *magicid[] = { "JPT-stream", "PNM request", "XML request", "CID request", "CID destroy", "JP2 save", "QUIT"};
+ char *magicid[] = { "JPT-stream", "JPP-stream", "PNM request", "XML request", "CID request", "CID destroy", "JP2 save", "QUIT"};
int i;
receive_size = receive_line( connected_socket, buf);
return MSGERROR;
}
-Byte_t * receive_JPTstream( SOCKET connected_socket, char *target, char *cid, int *streamlen)
+Byte_t * receive_JPIPstream( SOCKET connected_socket, char *target, char *cid, int *streamlen)
{
- Byte_t *jptstream=NULL, *ptr;
+ Byte_t *jpipstream=NULL, *ptr;
char buf[BUF_LEN], versionstring[] = "version 1.0";
int linelen, redlen, remlen;
fprintf( stderr, "Receiveing Data length: %d\n", *streamlen);
- jptstream = (unsigned char *)malloc( (*streamlen));
- ptr = jptstream;
+ jpipstream = (unsigned char *)malloc( (*streamlen));
+ ptr = jpipstream;
remlen = (*streamlen);
while( remlen > 0){
redlen = recv( connected_socket, ptr, remlen, 0);
if( redlen == -1){
- fprintf( stderr, "receive jptstream error\n");
+ fprintf( stderr, "receive JPT- JPP- stream error\n");
break;
}
remlen -= redlen;
}
fprintf( stderr, " done\n");
- return jptstream;
+ return jpipstream;
}
void send_stream( SOCKET connected_socket, void *stream, int length);
*/
SOCKET open_listeningsocket();
-#define NUM_OF_MSGTYPES 7
-typedef enum eMSGTYPE{ JPTSTREAM, PNMREQ, XMLREQ, CIDREQ, CIDDST, JP2SAVE, QUIT, MSGERROR} msgtype_t;
+#define NUM_OF_MSGTYPES 8
+typedef enum eMSGTYPE{ JPTSTREAM, JPPSTREAM, PNMREQ, XMLREQ, CIDREQ, CIDDST, JP2SAVE, QUIT, MSGERROR} msgtype_t;
/**
* indeitify client message type
msgtype_t identify_clientmsg( SOCKET connected_socket);
/**
- * receive JPT-stream from client
+ * receive a JPT- JPP- stream from client
*
* @param [in] connected_socket file descriptor of the connected socket
* @param [out] target received target file name (if not received, null string)
* @param [out] cid received channel identifier (if not received, null string)
* @param [out] streamlen length of the received codestream
- * @return codestream
+ * @return JPT- JPP- codestream
*/
-Byte_t * receive_JPTstream( SOCKET connected_socket, char *target, char *cid, int *streamlen);
+Byte_t * receive_JPIPstream( SOCKET connected_socket, char *target, char *cid, int *streamlen);
/**
* send PGM/PPM image stream to the client
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
+ * Copyright (c) 2002-2011, Professor Benoit Macq
+ * Copyright (c) 2010-2011, Kaori Hagihara
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include "jpipstream_manager.h"
+#include "jp2k_decoder.h"
+#include "imgreg_manager.h"
+
+Byte_t * update_JPIPstream( Byte_t *newstream, int newstreamlen, Byte_t *cache_stream, int *streamlen)
+{
+ Byte_t *stream = (Byte_t *)malloc( (*streamlen)+newstreamlen);
+ if( *streamlen > 0)
+ memcpy( stream, cache_stream, *streamlen);
+ memcpy( stream+(*streamlen), newstream, newstreamlen);
+ *streamlen += newstreamlen;
+
+ if(cache_stream)
+ free( cache_stream);
+
+ return stream;
+}
+
+void save_codestream( Byte_t *codestream, Byte8_t streamlen, char *fmt)
+{
+ time_t timer;
+ struct tm *t_st;
+ char filename[20];
+ FILE *fp;
+
+ time(&timer);
+ t_st = localtime( &timer);
+
+ sprintf( filename, "%4d%02d%02d%02d%02d%02d.%.3s", t_st->tm_year+1900, t_st->tm_mon+1, t_st->tm_mday, t_st->tm_hour, t_st->tm_min, t_st->tm_sec, fmt);
+
+ fp = fopen( filename, "wb");
+ fwrite( codestream, streamlen, 1, fp);
+ fclose( fp);
+}
+
+
+Byte_t * jpipstream_to_pnm( Byte_t *jpipstream, msgqueue_param_t *msgqueue, Byte8_t csn, int fw, int fh, ihdrbox_param_t **ihdrbox)
+{
+ Byte_t *pnmstream;
+ Byte_t *j2kstream; // j2k or jp2 codestream
+ Byte8_t j2klen;
+ int level = 0;
+
+ if( *ihdrbox){
+ // infinit value is set for maxmum level
+ int fx = fw, fy = fh;
+ int xmin = 0, ymin = 0;
+ int xmax = (*ihdrbox)->width, ymax = (*ihdrbox)->height;
+ find_level( 1000, &level, &fx, &fy, &xmin, &ymin, &xmax, &ymax);
+ }
+
+ j2kstream = recons_j2k( msgqueue, jpipstream, csn, level+1, &j2klen);
+
+ pnmstream = j2k_to_pnm( j2kstream, j2klen, ihdrbox);
+ free( j2kstream);
+
+ return pnmstream;
+}
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
+ * Copyright (c) 2002-2011, Professor Benoit Macq
+ * Copyright (c) 2010-2011, Kaori Hagihara
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "byte_manager.h"
+#include "msgqueue_manager.h"
+#include "ihdrbox_manager.h"
+
+Byte_t * update_JPIPstream( Byte_t *newstream, int newstreamlen, Byte_t *cache_stream, int *streamlen);
+
+void save_codestream( Byte_t *codestream, Byte8_t streamlen, char *fmt);
+
+Byte_t * jpipstream_to_pnm( Byte_t *jpipstream, msgqueue_param_t *msgqueue, Byte8_t csn, int fw, int fh, ihdrbox_param_t **ihdrbox);
+++ /dev/null
-/*
- * $Id: jptstream_manager.c 44 2011-02-15 12:32:29Z kaori $
- *
- * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
- * Copyright (c) 2002-2011, Professor Benoit Macq
- * Copyright (c) 2010-2011, Kaori Hagihara
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include "jptstream_manager.h"
-#include "jp2k_decoder.h"
-#include "imgreg_manager.h"
-
-Byte_t * update_JPTstream( Byte_t *newjptstream, int newjptlen, Byte_t *cache_jptstream, int *jptlen)
-{
- Byte_t *jptstream = (Byte_t *)malloc( (*jptlen)+newjptlen);
- if( *jptlen > 0)
- memcpy( jptstream, cache_jptstream, *jptlen);
- memcpy( jptstream+(*jptlen), newjptstream, newjptlen);
- *jptlen += newjptlen;
-
- if(cache_jptstream)
- free( cache_jptstream);
-
- return jptstream;
-}
-
-Byte_t * jpt_to_pnm( Byte_t *jptstream, msgqueue_param_t *msgqueue, Byte8_t csn, int fw, int fh, ihdrbox_param_t **ihdrbox)
-{
- Byte_t *pnmstream;
- Byte_t *j2kstream; // j2k or jp2 codestream
- Byte8_t j2klen;
- int level = 0;
-
- if( *ihdrbox){
- // infinit value is set for maxmum level
- int fx = fw, fy = fh;
- int xmin = 0, ymin = 0;
- int xmax = (*ihdrbox)->width, ymax = (*ihdrbox)->height;
- find_level( 1000, &level, &fx, &fy, &xmin, &ymin, &xmax, &ymax);
- }
-
- j2kstream = recons_j2k( msgqueue, jptstream, csn, level+1, &j2klen);
-
- pnmstream = j2k_to_pnm( j2kstream, j2klen, ihdrbox);
- free( j2kstream);
-
- return pnmstream;
-}
-
-void save_codestream( Byte_t *codestream, Byte8_t streamlen, char *fmt)
-{
- time_t timer;
- struct tm *t_st;
- char filename[20];
- FILE *fp;
-
- time(&timer);
- t_st = localtime( &timer);
-
- sprintf( filename, "%4d%02d%02d%02d%02d%02d.%.3s", t_st->tm_year+1900, t_st->tm_mon+1, t_st->tm_mday, t_st->tm_hour, t_st->tm_min, t_st->tm_sec, fmt);
-
- fp = fopen( filename, "wb");
- fwrite( codestream, streamlen, 1, fp);
- fclose( fp);
-}
+++ /dev/null
-/*
- * $Id: jptstream_manager.h 44 2011-02-15 12:32:29Z kaori $
- *
- * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
- * Copyright (c) 2002-2011, Professor Benoit Macq
- * Copyright (c) 2010-2011, Kaori Hagihara
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "byte_manager.h"
-#include "msgqueue_manager.h"
-#include "ihdrbox_manager.h"
-
-Byte_t * update_JPTstream( Byte_t *newjptstream, int newjptlen, Byte_t *cache_jptstream, int *jptlen);
-
-Byte_t * jpt_to_pnm( Byte_t *jptstream, msgqueue_param_t *msgqueue, Byte8_t csn, int fw, int fh, ihdrbox_param_t **ihdrbox);
-
-void save_codestream( Byte_t *codestream, Byte8_t streamlen, char *fmt);
#include "msgqueue_manager.h"
#include "ihdrbox_manager.h"
#include "imgsock_manager.h"
-#include "jptstream_manager.h"
+#include "jpipstream_manager.h"
#include "cache_manager.h"
#ifdef _WIN32
#define MAX_LENOFCID 30
/**
- * handle JPTstream message
+ * handle JPT- JPP- stream message
*
* @param[in] connected_socket socket descriptor
* @param[in] cachelist cache list pointer
- * @param[in,out] jptstream address of jptstream pointer
- * @param[in,out] jptlen address of jptstream length
+ * @param[in,out] jpipstream address of JPT- JPP- stream pointer
+ * @param[in,out] streamlen address of stream length
* @param[in,out] msgqueue message queue pointer
*/
-void handle_JPTstreamMSG( SOCKET connected_socket, cachelist_param_t *cachelist, Byte_t **jptstream, int *jptlen, msgqueue_param_t *msgqueue);
+void handle_JPIPstreamMSG( SOCKET connected_socket, cachelist_param_t *cachelist, Byte_t **jpipstream, int *streamlen, msgqueue_param_t *msgqueue);
/**
* handle PNM request message
*
* @param[in] connected_socket socket descriptor
- * @param[in] jptstream jptstream pointer
+ * @param[in] jpipstream jpipstream pointer
* @param[in] msgqueue message queue pointer
* @param[in] cachelist cache list pointer
*/
-void handle_PNMreqMSG( SOCKET connected_socket, Byte_t *jptstream, msgqueue_param_t *msgqueue, cachelist_param_t *cachelist);
+void handle_PNMreqMSG( SOCKET connected_socket, Byte_t *jpipstream, msgqueue_param_t *msgqueue, cachelist_param_t *cachelist);
/**
* handle XML request message
*
* @param[in] connected_socket socket descriptor
- * @param[in] jptstream address of caching jptstream pointer
+ * @param[in] jpipstream address of caching jpipstream pointer
* @param[in] cachelist cache list pointer
*/
-void handle_XMLreqMSG( SOCKET connected_socket, Byte_t *jptstream, cachelist_param_t *cachelist);
+void handle_XMLreqMSG( SOCKET connected_socket, Byte_t *jpipstream, cachelist_param_t *cachelist);
/**
* handle ChannelID request message
* @param[in] connected_socket socket descriptor
* @param[in] cachelist cache list pointer
* @param[in] msgqueue message queue pointer
- * @param[in] jptstream address of caching jptstream pointer
+ * @param[in] jpipstream address of caching jpipstream pointer
*/
-void handle_JP2saveMSG( SOCKET connected_socket, cachelist_param_t *cachelist, msgqueue_param_t *msgqueue, Byte_t *jptstream);
+void handle_JP2saveMSG( SOCKET connected_socket, cachelist_param_t *cachelist, msgqueue_param_t *msgqueue, Byte_t *jpipstream);
int main(int argc, char *argv[]){
SOCKET connected_socket;
struct sockaddr_in peer_sin;
- Byte_t *jptstream = NULL;
- int jptlen = 0;
+ Byte_t *jpipstream = NULL;
+ int jpipstreamlen = 0;
msgqueue_param_t *msgqueue = gene_msgqueue( true, NULL);
bool quit = false;
switch( msgtype){
case JPTSTREAM:
- handle_JPTstreamMSG( connected_socket, cachelist, &jptstream, &jptlen, msgqueue);
+ case JPPSTREAM:
+ handle_JPIPstreamMSG( connected_socket, cachelist, &jpipstream, &jpipstreamlen, msgqueue);
break;
case PNMREQ:
- handle_PNMreqMSG( connected_socket, jptstream, msgqueue, cachelist);
+ handle_PNMreqMSG( connected_socket, jpipstream, msgqueue, cachelist);
break;
case XMLREQ:
- handle_XMLreqMSG( connected_socket, jptstream, cachelist);
+ handle_XMLreqMSG( connected_socket, jpipstream, cachelist);
break;
case CIDREQ:
break;
case JP2SAVE:
- handle_JP2saveMSG( connected_socket, cachelist, msgqueue, jptstream);
+ handle_JP2saveMSG( connected_socket, cachelist, msgqueue, jpipstream);
break;
case QUIT:
if( msgqueue)
delete_msgqueue( &msgqueue);
- save_codestream( jptstream, jptlen, "jpt");
- free( jptstream);
+ // save_codestream( jpipstream, jpipstreamlen, "jpt");
+ free( jpipstream);
#ifdef _WIN32
if( WSACleanup() != 0){
return 0;
}
-void handle_JPTstreamMSG( SOCKET connected_socket, cachelist_param_t *cachelist,
- Byte_t **jptstream, int *jptlen, msgqueue_param_t *msgqueue)
+void handle_JPIPstreamMSG( SOCKET connected_socket, cachelist_param_t *cachelist,
+ Byte_t **jpipstream, int *streamlen, msgqueue_param_t *msgqueue)
{
- Byte_t *newjptstream;
- int newjptlen = 0;
+ Byte_t *newjpipstream;
+ int newstreamlen = 0;
cache_param_t *cache;
char target[MAX_LENOFTARGET], cid[MAX_LENOFCID];
metadatalist_param_t *metadatalist;
-
- newjptstream = receive_JPTstream( connected_socket, target, cid, &newjptlen);
- parse_stream( newjptstream, newjptlen, *jptlen, msgqueue);
+ newjpipstream = receive_JPIPstream( connected_socket, target, cid, &newstreamlen);
+
+ parse_JPIPstream( newjpipstream, newstreamlen, *streamlen, msgqueue);
- *jptstream = update_JPTstream( newjptstream, newjptlen, *jptstream, jptlen);
- free( newjptstream);
+ *jpipstream = update_JPIPstream( newjpipstream, newstreamlen, *jpipstream, streamlen);
+ free( newjpipstream);
metadatalist = gene_metadatalist();
- parse_metamsg( msgqueue, *jptstream, *jptlen, metadatalist);
+ parse_metamsg( msgqueue, *jpipstream, *streamlen, metadatalist);
// cid registration
if( target[0] != 0 && cid[0] != 0){
response_signal( connected_socket, true);
}
-void handle_PNMreqMSG( SOCKET connected_socket, Byte_t *jptstream, msgqueue_param_t *msgqueue, cachelist_param_t *cachelist)
+void handle_PNMreqMSG( SOCKET connected_socket, Byte_t *jpipstream, msgqueue_param_t *msgqueue, cachelist_param_t *cachelist)
{
Byte_t *pnmstream;
ihdrbox_param_t *ihdrbox;
receive_line( connected_socket, tmp);
fh = atoi( tmp);
- pnmstream = jpt_to_pnm( jptstream, msgqueue, cache->csn, fw, fh, &cache->ihdrbox);
+ pnmstream = jpipstream_to_pnm( jpipstream, msgqueue, cache->csn, fw, fh, &cache->ihdrbox);
ihdrbox = cache->ihdrbox;
send_PNMstream( connected_socket, pnmstream, ihdrbox->width, ihdrbox->height, ihdrbox->nc, ihdrbox->bpc > 8 ? 255 : (1 << ihdrbox->bpc) - 1);
free( pnmstream);
}
-void handle_XMLreqMSG( SOCKET connected_socket, Byte_t *jptstream, cachelist_param_t *cachelist)
+void handle_XMLreqMSG( SOCKET connected_socket, Byte_t *jpipstream, cachelist_param_t *cachelist)
{
char cid[MAX_LENOFCID];
cache_param_t *cache;
boxcontents_param_t *boxcontents = cache->metadatalist->last->boxcontents;
Byte_t *xmlstream = (Byte_t *)malloc( boxcontents->length);
- memcpy( xmlstream, jptstream+boxcontents->offset, boxcontents->length);
+ memcpy( xmlstream, jpipstream+boxcontents->offset, boxcontents->length);
send_XMLstream( connected_socket, xmlstream, boxcontents->length);
free( xmlstream);
}
response_signal( connected_socket, true);
}
-void handle_JP2saveMSG( SOCKET connected_socket, cachelist_param_t *cachelist, msgqueue_param_t *msgqueue, Byte_t *jptstream)
+void handle_JP2saveMSG( SOCKET connected_socket, cachelist_param_t *cachelist, msgqueue_param_t *msgqueue, Byte_t *jpipstream)
{
char cid[MAX_LENOFCID];
cache_param_t *cache;
if(!(cache = search_cacheBycid( cid, cachelist)))
return;
- jp2stream = recons_jp2( msgqueue, jptstream, cache->csn, &jp2len);
+ jp2stream = recons_jp2( msgqueue, jpipstream, cache->csn, &jp2len);
if( jp2stream){
save_codestream( jp2stream, jp2len, "jp2");