additional changes of parameter names and message names for image_viewer and decoding_server from JPT to JPIP-stream
This commit is contained in:
parent
6230ec13b4
commit
9350a47153
|
@ -6,7 +6,7 @@ What's New for OpenJPIP
|
||||||
+ : added
|
+ : added
|
||||||
|
|
||||||
July 5, 2011
|
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
|
May 26, 2011
|
||||||
! [antonin] changed Makefile to Makefile.nix to avoid having autotools overwrite them.
|
! [antonin] changed Makefile to Makefile.nix to avoid having autotools overwrite them.
|
||||||
|
|
|
@ -94,7 +94,7 @@ msgtype_t identify_clientmsg( SOCKET connected_socket)
|
||||||
{
|
{
|
||||||
int receive_size;
|
int receive_size;
|
||||||
char buf[BUF_LEN];
|
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;
|
int i;
|
||||||
|
|
||||||
receive_size = receive_line( connected_socket, buf);
|
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;
|
return MSGERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Byte_t * receive_JPIPstream( SOCKET connected_socket, char *target, char *cid, int *streamlen)
|
Byte_t * receive_JPIPstream( SOCKET connected_socket, char *target, char *cid, int *streamlen)
|
||||||
{
|
{
|
||||||
Byte_t *jpipstream=NULL, *ptr;
|
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;
|
int linelen, redlen, remlen;
|
||||||
|
|
||||||
target[0] = 0;
|
target[0] = 0;
|
||||||
|
|
|
@ -48,8 +48,8 @@ typedef int SOCKET;
|
||||||
*/
|
*/
|
||||||
SOCKET open_listeningsocket();
|
SOCKET open_listeningsocket();
|
||||||
|
|
||||||
#define NUM_OF_MSGTYPES 8
|
#define NUM_OF_MSGTYPES 7
|
||||||
typedef enum eMSGTYPE{ JPTSTREAM, JPPSTREAM, PNMREQ, XMLREQ, CIDREQ, CIDDST, JP2SAVE, QUIT, MSGERROR} msgtype_t;
|
typedef enum eMSGTYPE{ JPIPSTREAM, PNMREQ, XMLREQ, CIDREQ, CIDDST, JP2SAVE, QUIT, MSGERROR} msgtype_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* indeitify client message type
|
* indeitify client message type
|
||||||
|
@ -122,10 +122,10 @@ int receive_line(SOCKET connected_socket, char *buf);
|
||||||
/*! \file
|
/*! \file
|
||||||
* PROTOCOL specification to communicate with opj_dec_server
|
* PROTOCOL specification to communicate with opj_dec_server
|
||||||
*
|
*
|
||||||
*\section sec1 JPT-stream
|
*\section sec1 JPIP-stream
|
||||||
* Cache JPT-stream in server
|
* 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)
|
* server -> client: 1 or 0 (of 1Byte response signal)
|
||||||
*
|
*
|
||||||
*\section sec2 PNM request
|
*\section sec2 PNM request
|
||||||
|
|
|
@ -152,8 +152,7 @@ int main(int argc, char *argv[]){
|
||||||
msgtype_t msgtype = identify_clientmsg( connected_socket);
|
msgtype_t msgtype = identify_clientmsg( connected_socket);
|
||||||
|
|
||||||
switch( msgtype){
|
switch( msgtype){
|
||||||
case JPTSTREAM:
|
case JPIPSTREAM:
|
||||||
case JPPSTREAM:
|
|
||||||
handle_JPIPstreamMSG( connected_socket, cachelist, &jpipstream, &jpipstreamlen, msgqueue);
|
handle_JPIPstreamMSG( connected_socket, cachelist, &jpipstream, &jpipstreamlen, msgqueue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
opj_viewer-20110510.jar
|
opj_viewer-20110705.jar
|
|
@ -48,15 +48,15 @@ public class ImageManager extends JPIPHttpClient
|
||||||
System.err.println();
|
System.err.println();
|
||||||
|
|
||||||
String refcid = ImgdecClient.query_cid( j2kfilename);
|
String refcid = ImgdecClient.query_cid( j2kfilename);
|
||||||
byte[] jptstream;
|
byte[] jpipstream;
|
||||||
|
|
||||||
if( refcid == null)
|
if( refcid == null)
|
||||||
jptstream = super.requestViewWindow( j2kfilename, reqfw, reqfh, true);
|
jpipstream = super.requestViewWindow( j2kfilename, reqfw, reqfh, true);
|
||||||
else
|
else
|
||||||
jptstream = super.requestViewWindow( reqfw, reqfh, refcid, true);
|
jpipstream = super.requestViewWindow( reqfw, reqfh, refcid, true);
|
||||||
|
|
||||||
System.err.println( "decoding to PNM image");
|
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.err.println( " done");
|
||||||
|
|
||||||
// System.out.println( "fw: " + fw + " fh: " + fh + "pnm w: ");
|
// System.out.println( "fw: " + fw + " fh: " + fh + "pnm w: ");
|
||||||
|
@ -68,10 +68,10 @@ public class ImageManager extends JPIPHttpClient
|
||||||
{
|
{
|
||||||
System.err.println();
|
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");
|
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");
|
System.err.println( " done");
|
||||||
|
|
||||||
return pnmimage.createROIImage( rx, ry, rw, rh);
|
return pnmimage.createROIImage( rx, ry, rw, rh);
|
||||||
|
@ -82,10 +82,10 @@ public class ImageManager extends JPIPHttpClient
|
||||||
System.err.println();
|
System.err.println();
|
||||||
|
|
||||||
byte []xmldata = null;
|
byte []xmldata = null;
|
||||||
byte[] jptstream = super.requestXML();
|
byte[] jpipstream = super.requestXML();
|
||||||
|
|
||||||
if( jptstream != null){
|
if( jpipstream != null){
|
||||||
ImgdecClient.send_JPTstream( jptstream);
|
ImgdecClient.send_JPIPstream( jpipstream);
|
||||||
|
|
||||||
xmldata = ImgdecClient.get_XMLstream( cid);
|
xmldata = ImgdecClient.get_XMLstream( cid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,32 +33,32 @@ import java.net.*;
|
||||||
|
|
||||||
public class ImgdecClient{
|
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)
|
if( jpipstream != null)
|
||||||
send_JPTstream( jptstream);
|
send_JPIPstream( jpipstream);
|
||||||
return get_PNMstream( cid, fw, fh);
|
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);
|
return get_PNMstream( cid, fw, fh);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void send_JPTstream( byte[] jptstream)
|
public static void send_JPIPstream( byte[] jpipstream)
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
Socket imgdecSocket = new Socket( "localhost", 5000);
|
Socket imgdecSocket = new Socket( "localhost", 5000);
|
||||||
DataOutputStream os = new DataOutputStream( imgdecSocket.getOutputStream());
|
DataOutputStream os = new DataOutputStream( imgdecSocket.getOutputStream());
|
||||||
DataInputStream is = new DataInputStream( imgdecSocket.getInputStream());
|
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("JPIP-stream\n");
|
||||||
os.writeBytes("version 1.0\n");
|
os.writeBytes("version 1.1\n");
|
||||||
os.writeBytes( jptstream.length + "\n");
|
os.writeBytes( jpipstream.length + "\n");
|
||||||
os.write( jptstream, 0, jptstream.length);
|
os.write( jpipstream, 0, jpipstream.length);
|
||||||
|
|
||||||
byte signal = is.readByte();
|
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{
|
try{
|
||||||
Socket imgdecSocket = new Socket( "localhost", 5000);
|
Socket imgdecSocket = new Socket( "localhost", 5000);
|
||||||
|
@ -79,17 +79,17 @@ public class ImgdecClient{
|
||||||
DataInputStream is = new DataInputStream( imgdecSocket.getInputStream());
|
DataInputStream is = new DataInputStream( imgdecSocket.getInputStream());
|
||||||
int length = 0;
|
int length = 0;
|
||||||
|
|
||||||
if( jptstream != null)
|
if( jpipstream != null)
|
||||||
length = jptstream.length;
|
length = jpipstream.length;
|
||||||
|
|
||||||
System.err.println("Sending " + length + "Data Bytes to decodingServer");
|
System.err.println("Sending " + length + "Data Bytes to decodingServer");
|
||||||
|
|
||||||
os.writeBytes("JPT-stream\n");
|
os.writeBytes("JPIP-stream\n");
|
||||||
os.writeBytes("version 1.0\n");
|
os.writeBytes("version 1.1\n");
|
||||||
os.writeBytes( j2kfilename + "\n");
|
os.writeBytes( j2kfilename + "\n");
|
||||||
os.writeBytes( cid + "\n");
|
os.writeBytes( cid + "\n");
|
||||||
os.writeBytes( length + "\n");
|
os.writeBytes( length + "\n");
|
||||||
os.write( jptstream, 0, length);
|
os.write( jpipstream, 0, length);
|
||||||
|
|
||||||
byte signal = is.readByte();
|
byte signal = is.readByte();
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class JPIPHttpClient
|
||||||
int buflen = 0;
|
int buflen = 0;
|
||||||
URL url = null;
|
URL url = null;
|
||||||
HttpURLConnection urlconn = null;
|
HttpURLConnection urlconn = null;
|
||||||
byte[] jptstream = null;
|
byte[] jpipstream = null;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
url = new URL( urlstring);
|
url = new URL( urlstring);
|
||||||
|
@ -185,7 +185,7 @@ public class JPIPHttpClient
|
||||||
ByteArrayOutputStream tmpstream = new ByteArrayOutputStream();
|
ByteArrayOutputStream tmpstream = new ByteArrayOutputStream();
|
||||||
byte[] buf = new byte[ 1024];
|
byte[] buf = new byte[ 1024];
|
||||||
|
|
||||||
System.err.println("reading jptstream...");
|
System.err.println("reading jpipstream...");
|
||||||
|
|
||||||
int redlen;
|
int redlen;
|
||||||
do{
|
do{
|
||||||
|
@ -198,15 +198,15 @@ public class JPIPHttpClient
|
||||||
|
|
||||||
buflen = tmpstream.size();
|
buflen = tmpstream.size();
|
||||||
|
|
||||||
jptstream = tmpstream.toByteArray();
|
jpipstream = tmpstream.toByteArray();
|
||||||
|
|
||||||
tmpstream = null;
|
tmpstream = null;
|
||||||
|
|
||||||
System.err.println("jptlen: " + buflen);
|
System.err.println("jpiplen: " + buflen);
|
||||||
System.err.println(" succeeded");
|
System.err.println(" succeeded");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
System.err.println("No new jptstream");
|
System.err.println("No new jpipstream");
|
||||||
}
|
}
|
||||||
input.close();
|
input.close();
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ public class JPIPHttpClient
|
||||||
|
|
||||||
urlconn.disconnect();
|
urlconn.disconnect();
|
||||||
|
|
||||||
return jptstream;
|
return jpipstream;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String const_urlstring( String target,
|
private String const_urlstring( String target,
|
||||||
|
@ -242,6 +242,9 @@ public class JPIPHttpClient
|
||||||
{
|
{
|
||||||
String urlstring = comURL;
|
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( target != null){
|
||||||
if( !urlstring.endsWith("?"))
|
if( !urlstring.endsWith("?"))
|
||||||
urlstring = urlstring.concat( "&");
|
urlstring = urlstring.concat( "&");
|
||||||
|
|
Loading…
Reference in New Issue