コード例 #1
0
ファイル: box_manager.c プロジェクト: barmintor/openjpeg
void delete_box_in_list_by_type( const char type[], boxlist_param_t *boxlist)
{
  box_param_t *box;

  box = search_box( type, boxlist);
  delete_box_in_list( &box, boxlist);
}
コード例 #2
0
ファイル: metadata_manager.c プロジェクト: adriancuzman/nbis
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;
}