summaryrefslogtreecommitdiff
path: root/applications
diff options
context:
space:
mode:
authorKaori Hagihara <khagihara@users.noreply.github.com>2012-02-28 11:15:11 +0000
committerKaori Hagihara <khagihara@users.noreply.github.com>2012-02-28 11:15:11 +0000
commit8336ace29a9560c7dbfa72f3dbaf778e992ff565 (patch)
tree19864f67e166b2414050e55fe9747fa1ef6c36d7 /applications
parenta794ee233d988ea7f2c48a835d2eecff791a2913 (diff)
[1.5][JPIP] enabled the opj_server to reply the first query consisting with len request from kakadu client
Diffstat (limited to 'applications')
-rw-r--r--applications/jpip/CHANGES3
-rw-r--r--applications/jpip/libopenjpip/comMakefile.mk2
-rw-r--r--applications/jpip/libopenjpip/jpip_parser.c31
-rw-r--r--applications/jpip/libopenjpip/metadata_manager.c4
-rw-r--r--applications/jpip/libopenjpip/openjpip.c26
-rw-r--r--applications/jpip/libopenjpip/query_parser.c7
-rw-r--r--applications/jpip/util/opj_server.c4
7 files changed, 50 insertions, 27 deletions
diff --git a/applications/jpip/CHANGES b/applications/jpip/CHANGES
index 33570d16..0a88697e 100644
--- a/applications/jpip/CHANGES
+++ b/applications/jpip/CHANGES
@@ -5,6 +5,9 @@ What's New for OpenJPIP
! : changed
+ : added
+Feburary 28, 2012
++ [kaori] enabled the opj_server to reply the first query consisting with len request from kakadu client
+
February 9, 2012
* [kaori] fixed Doxygen configuration file to document the utilities
+ [kaori] added execution argument to set port number for opj_dec_server, opj_viewer*
diff --git a/applications/jpip/libopenjpip/comMakefile.mk b/applications/jpip/libopenjpip/comMakefile.mk
index e913c771..da479f47 100644
--- a/applications/jpip/libopenjpip/comMakefile.mk
+++ b/applications/jpip/libopenjpip/comMakefile.mk
@@ -2,7 +2,7 @@ ifdef jpipserver
CFLAGS = -O3 -Wall -m32 -DSERVER
LIBNAME = libopenjpip_server.a
else
-J2KINCDIR = ../../../libopenjpeg
+J2KINCDIR = ../../../bin
CFLAGS = -O3 -Wall -I$(J2KINCDIR)
LIBNAME = libopenjpip_local.a
endif
diff --git a/applications/jpip/libopenjpip/jpip_parser.c b/applications/jpip/libopenjpip/jpip_parser.c
index 7697297d..2215fd8f 100644
--- a/applications/jpip/libopenjpip/jpip_parser.c
+++ b/applications/jpip/libopenjpip/jpip_parser.c
@@ -181,8 +181,9 @@ void enqueue_imagedata( query_param_t query_param, msgqueue_param_t *msgqueue);
* @param[in] query_param structured query
* @param[in] metadatalist pointer to metadata bin list
* @param[in,out] msgqueue message queue pointer
+ * @return if succeeded (true) or failed (false)
*/
-void enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue);
+bool enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue);
bool gene_JPIPstream( query_param_t query_param,
@@ -223,14 +224,20 @@ bool gene_JPIPstream( query_param_t query_param,
//meta
if( query_param.box_type[0][0] != 0 && query_param.len != 0)
- enqueue_metabins( query_param, codeidx->metadatalist, *msgqueue);
+ if( !enqueue_metabins( query_param, codeidx->metadatalist, *msgqueue))
+ return false;
+
+ if( query_param.metadata_only)
+ return true;
- // image codestream
- if( query_param.fx > 0 && query_param.fy > 0){
- if( !cachemodel->mhead_model && query_param.len != 0)
+ // main header
+ if( !cachemodel->mhead_model && query_param.len != 0)
enqueue_mainheader( *msgqueue);
+
+ // image codestream
+ if( (query_param.fx > 0 && query_param.fy > 0))
enqueue_imagedata( query_param, *msgqueue);
- }
+
return true;
}
@@ -419,18 +426,26 @@ void enqueue_allprecincts( int tile_id, int level, int lastcomp, bool *comps, in
}
}
-void enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue)
+bool enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue)
{
int i;
for( i=0; query_param.box_type[i][0]!=0 && i<MAX_NUMOFBOX; i++){
if( query_param.box_type[i][0] == '*'){
- // not implemented
+ fprintf( FCGI_stdout, "Status: 501\r\n");
+ fprintf( FCGI_stdout, "Reason: metareq with all box-property * not implemented\r\n");
+ return false;
}
else{
int idx = search_metadataidx( query_param.box_type[i], metadatalist);
if( idx != -1)
enqueue_metadata( idx, msgqueue);
+ else{
+ fprintf( FCGI_stdout, "Status: 400\r\n");
+ fprintf( FCGI_stdout, "Reason: box-type %.4s not found\r\n", query_param.box_type[i]);
+ return false;
+ }
}
}
+ return true;
}
diff --git a/applications/jpip/libopenjpip/metadata_manager.c b/applications/jpip/libopenjpip/metadata_manager.c
index 5a831cee..09a753ba 100644
--- a/applications/jpip/libopenjpip/metadata_manager.c
+++ b/applications/jpip/libopenjpip/metadata_manager.c
@@ -77,10 +77,6 @@ metadatalist_param_t * const_metadatalist( int fd)
phldlist = gene_placeholderlist();
metadatalist = gene_metadatalist();
- delete_box_in_list_by_type( "iptr", toplev_boxlist);
- delete_box_in_list_by_type( "cidx", toplev_boxlist);
- delete_box_in_list_by_type( "fidx", toplev_boxlist);
-
box = toplev_boxlist->first;
idx = 0;
while( box){
diff --git a/applications/jpip/libopenjpip/openjpip.c b/applications/jpip/libopenjpip/openjpip.c
index ba0f5a7f..e51402a9 100644
--- a/applications/jpip/libopenjpip/openjpip.c
+++ b/applications/jpip/libopenjpip/openjpip.c
@@ -115,7 +115,7 @@ bool process_JPIPrequest( server_record_t *rec, QR_t *qr)
if( !close_channel( *(qr->query), rec->sessionlist, &cursession, &curchannel))
return false;
- if( (qr->query->fx > 0 && qr->query->fy > 0) || qr->query->box_type[0][0] != 0)
+ if( (qr->query->fx > 0 && qr->query->fy > 0) || qr->query->box_type[0][0] != 0 || qr->query->len > 0)
if( !gene_JPIPstream( *(qr->query), target, cursession, curchannel, &qr->msgqueue))
return false;
@@ -141,25 +141,29 @@ void send_responsedata( server_record_t *rec, QR_t *qr)
recons_stream_from_msgqueue( qr->msgqueue, fd);
add_EORmsg( fd, qr); /* needed at least for tcp and udp */
-
+
len_of_jpipstream = get_filesize( fd);
jpipstream = fetch_bytes( fd, 0, len_of_jpipstream);
-
+
close( fd);
remove( tmpfname);
fprintf( FCGI_stdout, "\r\n");
- if( qr->channel)
- if( qr->channel->aux == tcp || qr->channel->aux == udp){
- send_responsedata_on_aux( qr->channel->aux==tcp, rec->auxtrans, qr->channel->cid, jpipstream, len_of_jpipstream, 1000); /* 1KB per frame*/
- return;
- }
-
- if( fwrite( jpipstream, len_of_jpipstream, 1, FCGI_stdout) != 1)
- fprintf( FCGI_stderr, "Error: failed to write jpipstream\n");
+ if( len_of_jpipstream){
+
+ if( qr->channel)
+ if( qr->channel->aux == tcp || qr->channel->aux == udp){
+ send_responsedata_on_aux( qr->channel->aux==tcp, rec->auxtrans, qr->channel->cid, jpipstream, len_of_jpipstream, 1000); /* 1KB per frame*/
+ return;
+ }
+
+ if( fwrite( jpipstream, len_of_jpipstream, 1, FCGI_stdout) != 1)
+ fprintf( FCGI_stderr, "Error: failed to write jpipstream\n");
+ }
free( jpipstream);
+
return;
}
diff --git a/applications/jpip/libopenjpip/query_parser.c b/applications/jpip/libopenjpip/query_parser.c
index 093f4955..1e8c657e 100644
--- a/applications/jpip/libopenjpip/query_parser.c
+++ b/applications/jpip/libopenjpip/query_parser.c
@@ -141,8 +141,11 @@ query_param_t * parse_query( char *query_string)
query_param->return_type = JPTstream;
}
- else if( strcasecmp( fieldname, "len") == 0)
+ else if( strcasecmp( fieldname, "len") == 0){
sscanf( fieldval, "%d", &query_param->len);
+ if( query_param->len = 2000) /* for kakadu client*/
+ strncpy( query_param->box_type[0], "ftyp", 4);
+ }
}
}
return query_param;
@@ -330,7 +333,7 @@ void parse_req_box_prop( char *req_box_prop, int idx, query_param_t *query_param
query_param->box_type[idx][0]='*';
else
strncpy( query_param->box_type[idx], req_box_prop, 4);
-
+
if(( ptr = strchr( req_box_prop, ':'))){
if( *(ptr+1)=='r')
query_param->limit[idx] = -1;
diff --git a/applications/jpip/util/opj_server.c b/applications/jpip/util/opj_server.c
index d66a2c65..bed1be35 100644
--- a/applications/jpip/util/opj_server.c
+++ b/applications/jpip/util/opj_server.c
@@ -103,8 +103,10 @@ int main(void)
if( parse_status)
send_responsedata( server_record, qr);
- else
+ else{
fprintf( FCGI_stderr, "Error: JPIP request failed\n");
+ fprintf( FCGI_stdout, "\r\n");
+ }
end_QRprocess( server_record, &qr);
}