4 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
5 * Copyright (c) 2002-2014, Professor Benoit Macq
6 * Copyright (c) 2010-2011, Kaori Hagihara
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
34 #include "placeholder_manager.h"
35 #include "opj_inttypes.h"
38 #include "fcgi_stdio.h"
39 #define logstream FCGI_stdout
41 #define FCGI_stdout stdout
42 #define FCGI_stderr stderr
43 #define logstream stderr
48 placeholderlist_param_t * gene_placeholderlist(void)
50 placeholderlist_param_t *list;
52 list = (placeholderlist_param_t *)malloc(sizeof(placeholderlist_param_t));
60 void delete_placeholderlist(placeholderlist_param_t **list)
62 placeholder_param_t *ptr, *next;
72 delete_placeholder(&ptr);
78 placeholder_param_t * gene_placeholder(box_param_t *box, Byte8_t origID)
80 placeholder_param_t *placeholder;
82 placeholder = (placeholder_param_t *)malloc(sizeof(placeholder_param_t));
84 strncpy(placeholder->TBox, "phld", 4);
86 1; /* only the access to the original contents of this box, for now */
87 placeholder->OrigID = origID;
88 placeholder->OrigBH = fetch_headbytes(box);
89 placeholder->OrigBHlen = box->headlen;
90 placeholder->LBox = 20 + (Byte4_t)box->headlen;
91 placeholder->next = NULL;
96 void delete_placeholder(placeholder_param_t **placeholder)
98 if ((*placeholder)->OrigBH) {
99 free((*placeholder)->OrigBH);
104 void insert_placeholder_into_list(placeholder_param_t *phld,
105 placeholderlist_param_t *phldlist)
107 if (phldlist->first) {
108 phldlist->last->next = phld;
110 phldlist->first = phld;
112 phldlist->last = phld;
115 void print_placeholder(placeholder_param_t *phld)
119 fprintf(logstream, "placeholder info:\n");
120 fprintf(logstream, "\t LBox: %d %#x\n", phld->LBox, phld->LBox);
121 fprintf(logstream, "\t TBox: %.4s\n", phld->TBox);
122 fprintf(logstream, "\t Flags: %#x %#x\n", phld->Flags, phld->Flags);
123 fprintf(logstream, "\t OrigID: %" PRId64 "\n", phld->OrigID);
124 fprintf(logstream, "\t OrigBH: ");
126 for (i = 0; i < phld->OrigBHlen; i++) {
127 fprintf(logstream, "%02x ", phld->OrigBH[i]);
129 fprintf(logstream, "\t");
131 for (i = 0; i < phld->OrigBHlen; i++) {
132 fprintf(logstream, "%c", phld->OrigBH[i]);
134 fprintf(logstream, "\n");
137 void print_allplaceholder(placeholderlist_param_t *list)
139 placeholder_param_t *ptr;
145 fprintf(logstream, "all placeholder info: \n");
147 while (ptr != NULL) {
148 print_placeholder(ptr);