diff --git a/applications/jpip/CHANGES b/applications/jpip/CHANGES index c3d5178d..479fdf2e 100644 --- a/applications/jpip/CHANGES +++ b/applications/jpip/CHANGES @@ -6,7 +6,7 @@ What's New for OpenJPIP + : added July 5, 2011 -! [kaori] changed parameter and file names regarding JPT-stream to JPIP-stream, which handles also JPP-stream +! [kaori] changed parameter, file names, message 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. diff --git a/applications/jpip/opj_client/opj_dec_server/imgsock_manager.c b/applications/jpip/opj_client/opj_dec_server/imgsock_manager.c index 1eea46e9..567b81ca 100644 --- a/applications/jpip/opj_client/opj_dec_server/imgsock_manager.c +++ b/applications/jpip/opj_client/opj_dec_server/imgsock_manager.c @@ -94,7 +94,7 @@ msgtype_t identify_clientmsg( SOCKET connected_socket) { int receive_size; char buf[BUF_LEN]; - char *magicid[] = { "JPT-stream", "JPP-stream", "PNM request", "XML request", "CID request", "CID destroy", "JP2 save", "QUIT"}; + char *magicid[] = { "JPIP-stream", "PNM request", "XML request", "CID request", "CID destroy", "JP2 save", "QUIT"}; int i; receive_size = receive_line( connected_socket, buf); @@ -111,14 +111,14 @@ msgtype_t identify_clientmsg( SOCKET connected_socket) } } - fprintf( stderr, "Cannot identify client message type\n"); + fprintf( stderr, "Cannot identify client message type %s\n", buf); return MSGERROR; } Byte_t * receive_JPIPstream( SOCKET connected_socket, char *target, char *cid, int *streamlen) { Byte_t *jpipstream=NULL, *ptr; - char buf[BUF_LEN], versionstring[] = "version 1.0"; + char buf[BUF_LEN], versionstring[] = "version 1.1"; int linelen, redlen, remlen; target[0] = 0; diff --git a/applications/jpip/opj_client/opj_dec_server/imgsock_manager.h b/applications/jpip/opj_client/opj_dec_server/imgsock_manager.h index 02183444..df0085e6 100644 --- a/applications/jpip/opj_client/opj_dec_server/imgsock_manager.h +++ b/applications/jpip/opj_client/opj_dec_server/imgsock_manager.h @@ -48,8 +48,8 @@ typedef int SOCKET; */ SOCKET open_listeningsocket(); -#define NUM_OF_MSGTYPES 8 -typedef enum eMSGTYPE{ JPTSTREAM, JPPSTREAM, PNMREQ, XMLREQ, CIDREQ, CIDDST, JP2SAVE, QUIT, MSGERROR} msgtype_t; +#define NUM_OF_MSGTYPES 7 +typedef enum eMSGTYPE{ JPIPSTREAM, PNMREQ, XMLREQ, CIDREQ, CIDDST, JP2SAVE, QUIT, MSGERROR} msgtype_t; /** * indeitify client message type @@ -122,10 +122,10 @@ int receive_line(SOCKET connected_socket, char *buf); /*! \file * PROTOCOL specification to communicate with opj_dec_server * - *\section sec1 JPT-stream - * Cache JPT-stream in server + *\section sec1 JPIP-stream + * Cache JPT- JPP- stream in server * - * client -> server: JPT-stream\\n version 1.0\\n (optional for cid registration: targetnamestring\\n cidstring\\n) bytelengthvalue\\n data \n + * client -> server: JPIP-stream\\n version 1.1\\n (optional for cid registration: targetnamestring\\n cidstring\\n) bytelengthvalue\\n data \n * server -> client: 1 or 0 (of 1Byte response signal) * *\section sec2 PNM request diff --git a/applications/jpip/opj_client/opj_dec_server/opj_dec_server.c b/applications/jpip/opj_client/opj_dec_server/opj_dec_server.c index c314fac8..e2709797 100644 --- a/applications/jpip/opj_client/opj_dec_server/opj_dec_server.c +++ b/applications/jpip/opj_client/opj_dec_server/opj_dec_server.c @@ -152,8 +152,7 @@ int main(int argc, char *argv[]){ msgtype_t msgtype = identify_clientmsg( connected_socket); switch( msgtype){ - case JPTSTREAM: - case JPPSTREAM: + case JPIPSTREAM: handle_JPIPstreamMSG( connected_socket, cachelist, &jpipstream, &jpipstreamlen, msgqueue); break; diff --git a/applications/jpip/opj_client/opj_viewer/dist/opj_viewer.jar b/applications/jpip/opj_client/opj_viewer/dist/opj_viewer.jar index 3f6bf194..f9bb720b 120000 --- a/applications/jpip/opj_client/opj_viewer/dist/opj_viewer.jar +++ b/applications/jpip/opj_client/opj_viewer/dist/opj_viewer.jar @@ -1 +1 @@ -opj_viewer-20110510.jar \ No newline at end of file +opj_viewer-20110705.jar \ No newline at end of file diff --git a/applications/jpip/opj_client/opj_viewer/src/ImageManager.java b/applications/jpip/opj_client/opj_viewer/src/ImageManager.java index f3d01bef..a0eb625a 100644 --- a/applications/jpip/opj_client/opj_viewer/src/ImageManager.java +++ b/applications/jpip/opj_client/opj_viewer/src/ImageManager.java @@ -48,15 +48,15 @@ public class ImageManager extends JPIPHttpClient System.err.println(); String refcid = ImgdecClient.query_cid( j2kfilename); - byte[] jptstream; + byte[] jpipstream; if( refcid == null) - jptstream = super.requestViewWindow( j2kfilename, reqfw, reqfh, true); + jpipstream = super.requestViewWindow( j2kfilename, reqfw, reqfh, true); else - jptstream = super.requestViewWindow( reqfw, reqfh, refcid, true); + jpipstream = super.requestViewWindow( reqfw, reqfh, refcid, true); System.err.println( "decoding to PNM image"); - pnmimage = ImgdecClient.decode_jptstream( jptstream, j2kfilename, cid, fw, fh); + pnmimage = ImgdecClient.decode_jpipstream( jpipstream, j2kfilename, cid, fw, fh); System.err.println( " done"); // System.out.println( "fw: " + fw + " fh: " + fh + "pnm w: "); @@ -68,10 +68,10 @@ public class ImageManager extends JPIPHttpClient { System.err.println(); - byte[] jptstream = super.requestViewWindow( reqfw, reqfh, reqrx, reqry, reqrw, reqrh); + byte[] jpipstream = super.requestViewWindow( reqfw, reqfh, reqrx, reqry, reqrw, reqrh); System.err.println( "decoding to PNM image"); - pnmimage = ImgdecClient.decode_jptstream( jptstream, cid, fw, fh); + pnmimage = ImgdecClient.decode_jpipstream( jpipstream, cid, fw, fh); System.err.println( " done"); return pnmimage.createROIImage( rx, ry, rw, rh); @@ -82,10 +82,10 @@ public class ImageManager extends JPIPHttpClient System.err.println(); byte []xmldata = null; - byte[] jptstream = super.requestXML(); + byte[] jpipstream = super.requestXML(); - if( jptstream != null){ - ImgdecClient.send_JPTstream( jptstream); + if( jpipstream != null){ + ImgdecClient.send_JPIPstream( jpipstream); xmldata = ImgdecClient.get_XMLstream( cid); } diff --git a/applications/jpip/opj_client/opj_viewer/src/ImgdecClient.java b/applications/jpip/opj_client/opj_viewer/src/ImgdecClient.java index 80e8f8ba..7466aa86 100644 --- a/applications/jpip/opj_client/opj_viewer/src/ImgdecClient.java +++ b/applications/jpip/opj_client/opj_viewer/src/ImgdecClient.java @@ -33,32 +33,32 @@ import java.net.*; public class ImgdecClient{ - public static PnmImage decode_jptstream( byte[] jptstream, String cid, int fw, int fh) + public static PnmImage decode_jpipstream( byte[] jpipstream, String cid, int fw, int fh) { - if( jptstream != null) - send_JPTstream( jptstream); + if( jpipstream != null) + send_JPIPstream( jpipstream); return get_PNMstream( cid, fw, fh); } - public static PnmImage decode_jptstream( byte[] jptstream, String j2kfilename, String cid, int fw, int fh) + public static PnmImage decode_jpipstream( byte[] jpipstream, String j2kfilename, String cid, int fw, int fh) { - send_JPTstream( jptstream, j2kfilename, cid); + send_JPIPstream( jpipstream, j2kfilename, cid); return get_PNMstream( cid, fw, fh); } - public static void send_JPTstream( byte[] jptstream) + public static void send_JPIPstream( byte[] jpipstream) { try{ Socket imgdecSocket = new Socket( "localhost", 5000); DataOutputStream os = new DataOutputStream( imgdecSocket.getOutputStream()); DataInputStream is = new DataInputStream( imgdecSocket.getInputStream()); - System.err.println("Sending " + jptstream.length + "Data Bytes to decodingServer"); + System.err.println("Sending " + jpipstream.length + "Data Bytes to decodingServer"); - os.writeBytes("JPT-stream\n"); - os.writeBytes("version 1.0\n"); - os.writeBytes( jptstream.length + "\n"); - os.write( jptstream, 0, jptstream.length); + os.writeBytes("JPIP-stream\n"); + os.writeBytes("version 1.1\n"); + os.writeBytes( jpipstream.length + "\n"); + os.write( jpipstream, 0, jpipstream.length); byte signal = is.readByte(); @@ -71,7 +71,7 @@ public class ImgdecClient{ } } - public static void send_JPTstream( byte[] jptstream, String j2kfilename, String cid) + public static void send_JPIPstream( byte[] jpipstream, String j2kfilename, String cid) { try{ Socket imgdecSocket = new Socket( "localhost", 5000); @@ -79,17 +79,17 @@ public class ImgdecClient{ DataInputStream is = new DataInputStream( imgdecSocket.getInputStream()); int length = 0; - if( jptstream != null) - length = jptstream.length; + if( jpipstream != null) + length = jpipstream.length; System.err.println("Sending " + length + "Data Bytes to decodingServer"); - os.writeBytes("JPT-stream\n"); - os.writeBytes("version 1.0\n"); + os.writeBytes("JPIP-stream\n"); + os.writeBytes("version 1.1\n"); os.writeBytes( j2kfilename + "\n"); os.writeBytes( cid + "\n"); os.writeBytes( length + "\n"); - os.write( jptstream, 0, length); + os.write( jpipstream, 0, length); byte signal = is.readByte(); diff --git a/applications/jpip/opj_client/opj_viewer/src/JPIPHttpClient.java b/applications/jpip/opj_client/opj_viewer/src/JPIPHttpClient.java index c8f04714..3b8781af 100644 --- a/applications/jpip/opj_client/opj_viewer/src/JPIPHttpClient.java +++ b/applications/jpip/opj_client/opj_viewer/src/JPIPHttpClient.java @@ -135,7 +135,7 @@ public class JPIPHttpClient int buflen = 0; URL url = null; HttpURLConnection urlconn = null; - byte[] jptstream = null; + byte[] jpipstream = null; try{ url = new URL( urlstring); @@ -185,7 +185,7 @@ public class JPIPHttpClient ByteArrayOutputStream tmpstream = new ByteArrayOutputStream(); byte[] buf = new byte[ 1024]; - System.err.println("reading jptstream..."); + System.err.println("reading jpipstream..."); int redlen; do{ @@ -198,15 +198,15 @@ public class JPIPHttpClient buflen = tmpstream.size(); - jptstream = tmpstream.toByteArray(); + jpipstream = tmpstream.toByteArray(); tmpstream = null; - System.err.println("jptlen: " + buflen); + System.err.println("jpiplen: " + buflen); System.err.println(" succeeded"); } else{ - System.err.println("No new jptstream"); + System.err.println("No new jpipstream"); } input.close(); } @@ -231,7 +231,7 @@ public class JPIPHttpClient urlconn.disconnect(); - return jptstream; + return jpipstream; } private String const_urlstring( String target, @@ -242,6 +242,9 @@ public class JPIPHttpClient { String urlstring = comURL; + // C.7.3 Image Return Type + // add type=jpp-stream(;ptype=ext) or type=jpt-stream;ttype=ext + if( target != null){ if( !urlstring.endsWith("?")) urlstring = urlstring.concat( "&");