changed parameter and file names regarding JPT-stream to JPIP-stream, which handles...
authorKaori Hagihara <khagihara@users.noreply.github.com>
Mon, 4 Jul 2011 23:00:21 +0000 (23:00 +0000)
committerKaori Hagihara <khagihara@users.noreply.github.com>
Mon, 4 Jul 2011 23:00:21 +0000 (23:00 +0000)
applications/jpip/CHANGES
applications/jpip/libopenjpip/msgqueue_manager.c
applications/jpip/libopenjpip/msgqueue_manager.h
applications/jpip/opj_client/opj_dec_server/Makefile.nix
applications/jpip/opj_client/opj_dec_server/imgsock_manager.c
applications/jpip/opj_client/opj_dec_server/imgsock_manager.h
applications/jpip/opj_client/opj_dec_server/jpipstream_manager.c [new file with mode: 0644]
applications/jpip/opj_client/opj_dec_server/jpipstream_manager.h [new file with mode: 0644]
applications/jpip/opj_client/opj_dec_server/jptstream_manager.c [deleted file]
applications/jpip/opj_client/opj_dec_server/jptstream_manager.h [deleted file]
applications/jpip/opj_client/opj_dec_server/opj_dec_server.c

index fef2748c59d7825635ef94ffbfc5a131aefee9a3..c3d5178d390f175cc369bde08505eca2891887e0 100644 (file)
@@ -5,6 +5,9 @@ What's New for OpenJPIP
 ! : 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.
 
index dd7f2838f5a1ca36b8fae7be2881e2d729049197..88d4740503d8889be1801c324ada1912987bdb6e 100644 (file)
@@ -487,7 +487,7 @@ void print_binarycode( Byte8_t n, int segmentlen)
 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;
@@ -496,8 +496,8 @@ void parse_stream( Byte_t *stream, Byte8_t jptlen, Byte8_t offset, msgqueue_para
 
   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);
@@ -522,7 +522,7 @@ void parse_stream( Byte_t *stream, Byte8_t jptlen, Byte8_t offset, msgqueue_para
     else
       msg->aux = 0;
     
-    msg->res_offset = ptr-stream+offset;   
+    msg->res_offset = ptr-JPIPstream+offset;   
     msg->phld = NULL;
     msg->next = NULL;
 
@@ -538,7 +538,7 @@ void parse_stream( Byte_t *stream, Byte8_t jptlen, Byte8_t offset, msgqueue_para
 
 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;
 
index bb305a2c9c59503624f7b77e62ef0d52cfa4da20..026df28e76eca71981f5626eb183db80b064c626 100644 (file)
@@ -119,24 +119,24 @@ void emit_stream_from_msgqueue( msgqueue_param_t *msgqueue);
 
 
 /**
- * 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);
 
 
 /**
index 0c0772830fd094c48934cd37d5e1028bebfa7042..bfd41e4410adec083b80d6b1369edc1838eaad85 100644 (file)
@@ -8,7 +8,7 @@ ALL = opj_dec_server
 
 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 *~
index a7471a11959e710a5e11c25b032110888ab597dd..1eea46e95c00222ba3424c1de939b0e78b55005b 100644 (file)
@@ -94,7 +94,7 @@ msgtype_t identify_clientmsg( SOCKET connected_socket)
 {
   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);
@@ -115,9 +115,9 @@ msgtype_t identify_clientmsg( SOCKET connected_socket)
   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;
   
@@ -150,13 +150,13 @@ Byte_t * receive_JPTstream( SOCKET connected_socket, char *target, char *cid, in
   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;
@@ -164,7 +164,7 @@ Byte_t * receive_JPTstream( SOCKET connected_socket, char *target, char *cid, in
   }
   fprintf( stderr, "    done\n");
     
-  return jptstream;
+  return jpipstream;
 }
 
 void send_stream( SOCKET connected_socket, void *stream, int length);
index 6032392ff8f1966d8a73092e90a2af1d5c592707..02183444791c8ef3e0b8fece10d8dfff88ff4485 100644 (file)
@@ -48,8 +48,8 @@ typedef int SOCKET;
  */
 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
@@ -60,15 +60,15 @@ typedef enum eMSGTYPE{ JPTSTREAM, PNMREQ, XMLREQ, CIDREQ, CIDDST, JP2SAVE, QUIT,
 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
diff --git a/applications/jpip/opj_client/opj_dec_server/jpipstream_manager.c b/applications/jpip/opj_client/opj_dec_server/jpipstream_manager.c
new file mode 100644 (file)
index 0000000..6b9613c
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * $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;
+}
diff --git a/applications/jpip/opj_client/opj_dec_server/jpipstream_manager.h b/applications/jpip/opj_client/opj_dec_server/jpipstream_manager.h
new file mode 100644 (file)
index 0000000..d9e7702
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * $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);
diff --git a/applications/jpip/opj_client/opj_dec_server/jptstream_manager.c b/applications/jpip/opj_client/opj_dec_server/jptstream_manager.c
deleted file mode 100644 (file)
index 4d84078..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * $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);
-}
diff --git a/applications/jpip/opj_client/opj_dec_server/jptstream_manager.h b/applications/jpip/opj_client/opj_dec_server/jptstream_manager.h
deleted file mode 100644 (file)
index 7411955..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * $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);
index 3d95ceeccf1bff7fe8e22ddad09104208f4a1a15..c314fac83144f7c6626b89f96e457dda71a57d05 100644 (file)
@@ -52,7 +52,7 @@
 #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
@@ -70,34 +70,34 @@ WSADATA initialisation_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
@@ -121,16 +121,16 @@ void handle_dstCIDreqMSG( SOCKET connected_socket, cachelist_param_t *cachelist)
  * @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;
 
@@ -153,15 +153,16 @@ int main(int argc, char *argv[]){
     
     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:
@@ -173,7 +174,7 @@ int main(int argc, char *argv[]){
       break;
 
     case JP2SAVE:
-      handle_JP2saveMSG( connected_socket, cachelist, msgqueue, jptstream);
+      handle_JP2saveMSG( connected_socket, cachelist, msgqueue, jpipstream);
       break;
 
     case QUIT:
@@ -201,8 +202,8 @@ int main(int argc, char *argv[]){
   if( msgqueue)
     delete_msgqueue( &msgqueue);
   
-  save_codestream( jptstream, jptlen, "jpt");
-  free( jptstream);
+  //  save_codestream( jpipstream, jpipstreamlen, "jpt");
+  free( jpipstream);
 
 #ifdef _WIN32
   if( WSACleanup() != 0){
@@ -215,24 +216,24 @@ int main(int argc, char *argv[]){
   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){
@@ -253,7 +254,7 @@ void handle_JPTstreamMSG( SOCKET connected_socket, cachelist_param_t *cachelist,
   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;
@@ -271,14 +272,14 @@ void handle_PNMreqMSG( SOCKET connected_socket, Byte_t *jptstream, msgqueue_para
   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;
@@ -289,7 +290,7 @@ void handle_XMLreqMSG( SOCKET connected_socket, Byte_t *jptstream, cachelist_par
   
   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);
 }
@@ -321,7 +322,7 @@ void handle_dstCIDreqMSG( SOCKET connected_socket, cachelist_param_t *cachelist)
   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;
@@ -332,7 +333,7 @@ void handle_JP2saveMSG( SOCKET connected_socket, cachelist_param_t *cachelist, m
   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");