jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( OPJ_BOOL jp2) { jpip_dec_param_t *dec; dec = (jpip_dec_param_t *)opj_calloc( 1, sizeof(jpip_dec_param_t)); dec->msgqueue = gene_msgqueue( OPJ_TRUE, NULL); if( jp2) dec->metadatalist = gene_metadatalist(); return dec; }
metadatalist_param_t * const_metadatalist( int fd) { metadatalist_param_t *metadatalist; metadata_param_t *metabin; boxlist_param_t *toplev_boxlist; box_param_t *box, *next; placeholderlist_param_t *phldlist; placeholder_param_t *phld; Byte8_t idx; Byte8_t filesize; if(!(filesize = (Byte8_t)get_filesize( fd))) return NULL; if( !(toplev_boxlist = get_boxstructure( fd, 0, filesize))){ fprintf( FCGI_stderr, "Error: Not correctl JP2 format\n"); return NULL; } phldlist = gene_placeholderlist(); metadatalist = gene_metadatalist(); box = toplev_boxlist->first; idx = 0; while( box){ next = box->next; if( strncmp( box->type, "jP ",4)!=0 && strncmp( box->type, "ftyp",4)!=0 && strncmp( box->type, "jp2h",4)!=0){ boxlist_param_t *boxlist = NULL; boxcontents_param_t *boxcontents = NULL; phld = gene_placeholder( box, ++idx); insert_placeholder_into_list( phld, phldlist); boxlist = get_boxstructure( box->fd, get_DBoxoff( box), get_DBoxlen(box)); if( !boxlist) boxcontents = gene_boxcontents( get_DBoxoff( box), get_DBoxlen(box)); delete_box_in_list( &box, toplev_boxlist); metabin = gene_metadata( idx, boxlist, NULL, boxcontents); insert_metadata_into_list( metabin, metadatalist); } box = next; } metabin = gene_metadata( 0, toplev_boxlist, phldlist, NULL); insert_metadata_into_list( metabin, metadatalist); return metadatalist; }
cache_param_t * gene_cache( const char *targetname, int csn, char *tid, char *cid) { cache_param_t *cache; cache = (cache_param_t *)malloc( sizeof(cache_param_t)); cache->filename = strdup( targetname); cache->tid = strdup( tid); cache->csn = csn; cache->cid = (char **)malloc( sizeof(char *)); *cache->cid = strdup( cid); cache->numOfcid = 1; #if 1 cache->metadatalist = NULL; #else cache->metadatalist = gene_metadatalist(); #endif cache->ihdrbox = NULL; cache->next = NULL; return cache; }
cache_param_t * gene_cache( char *targetname, int csn, char *cid) { cache_param_t *cache; cache = (cache_param_t *)malloc( sizeof(cache_param_t)); strcpy( cache->filename, targetname); cache->csn = csn; cache->cid = (char **)malloc( sizeof(char *)); *cache->cid = (char *)malloc( MAX_LENOFCID); strcpy( *cache->cid, cid); cache->numOfcid = 1; #if 1 cache->metadatalist = NULL; #else cache->metadatalist = gene_metadatalist(); #endif cache->ihdrbox = NULL; cache->next = NULL; return cache; }