Lines Matching refs:box
108 void jp2_box_dump(jp2_box_t *box, FILE *out);
110 static int jp2_jp_getdata(jp2_box_t *box, jas_stream_t *in);
111 static int jp2_jp_putdata(jp2_box_t *box, jas_stream_t *out);
112 static int jp2_ftyp_getdata(jp2_box_t *box, jas_stream_t *in);
113 static int jp2_ftyp_putdata(jp2_box_t *box, jas_stream_t *out);
114 static int jp2_ihdr_getdata(jp2_box_t *box, jas_stream_t *in);
115 static int jp2_ihdr_putdata(jp2_box_t *box, jas_stream_t *out);
116 static void jp2_bpcc_destroy(jp2_box_t *box);
117 static int jp2_bpcc_getdata(jp2_box_t *box, jas_stream_t *in);
118 static int jp2_bpcc_putdata(jp2_box_t *box, jas_stream_t *out);
119 static int jp2_colr_getdata(jp2_box_t *box, jas_stream_t *in);
120 static int jp2_colr_putdata(jp2_box_t *box, jas_stream_t *out);
121 static void jp2_colr_dumpdata(jp2_box_t *box, FILE *out);
122 static void jp2_colr_destroy(jp2_box_t *box);
123 static void jp2_cdef_destroy(jp2_box_t *box);
124 static int jp2_cdef_getdata(jp2_box_t *box, jas_stream_t *in);
125 static int jp2_cdef_putdata(jp2_box_t *box, jas_stream_t *out);
126 static void jp2_cdef_dumpdata(jp2_box_t *box, FILE *out);
127 static void jp2_cmap_destroy(jp2_box_t *box);
128 static int jp2_cmap_getdata(jp2_box_t *box, jas_stream_t *in);
129 static int jp2_cmap_putdata(jp2_box_t *box, jas_stream_t *out);
130 static void jp2_cmap_dumpdata(jp2_box_t *box, FILE *out);
131 static void jp2_pclr_destroy(jp2_box_t *box);
132 static int jp2_pclr_getdata(jp2_box_t *box, jas_stream_t *in);
133 static int jp2_pclr_putdata(jp2_box_t *box, jas_stream_t *out);
134 static void jp2_pclr_dumpdata(jp2_box_t *box, FILE *out);
135 static void jp2_uuid_destroy(jp2_box_t *box);
136 static int jp2_uuid_getdata(jp2_box_t *box, jas_stream_t *in);
137 static int jp2_uuid_putdata(jp2_box_t *box, jas_stream_t *out);
195 jp2_box_t *box; in jp2_box_create() local
198 if (!(box = jas_malloc(sizeof(jp2_box_t)))) { in jp2_box_create()
201 memset(box, 0, sizeof(jp2_box_t)); in jp2_box_create()
202 box->type = type; in jp2_box_create()
203 box->len = 0; in jp2_box_create()
207 box->info = boxinfo; in jp2_box_create()
208 box->ops = &boxinfo->ops; in jp2_box_create()
209 return box; in jp2_box_create()
216 void jp2_box_destroy(jp2_box_t *box) in jp2_box_destroy() argument
218 if (box->ops->destroy) { in jp2_box_destroy()
219 (*box->ops->destroy)(box); in jp2_box_destroy()
221 jas_free(box); in jp2_box_destroy()
224 static void jp2_bpcc_destroy(jp2_box_t *box) in jp2_bpcc_destroy() argument
226 jp2_bpcc_t *bpcc = &box->data.bpcc; in jp2_bpcc_destroy()
233 static void jp2_cdef_destroy(jp2_box_t *box) in jp2_cdef_destroy() argument
235 jp2_cdef_t *cdef = &box->data.cdef; in jp2_cdef_destroy()
248 jp2_box_t *box; in jp2_box_get() local
255 box = 0; in jp2_box_get()
258 if (!(box = jas_malloc(sizeof(jp2_box_t)))) { in jp2_box_get()
261 box->ops = &jp2_boxinfo_unk.ops; in jp2_box_get()
262 if (jp2_getuint32(in, &len) || jp2_getuint32(in, &box->type)) { in jp2_box_get()
265 boxinfo = jp2_boxinfolookup(box->type); in jp2_box_get()
266 box->info = boxinfo; in jp2_box_get()
267 box->ops = &boxinfo->ops; in jp2_box_get()
268 box->len = len; in jp2_box_get()
269 if (box->len == 1) { in jp2_box_get()
277 box->len = extlen; in jp2_box_get()
278 box->datalen = extlen - JP2_BOX_HDRLEN(true); in jp2_box_get()
280 box->datalen = box->len - JP2_BOX_HDRLEN(false); in jp2_box_get()
282 if (box->len != 0 && box->len < 8) { in jp2_box_get()
286 dataflag = !(box->info->flags & (JP2_BOX_SUPER | JP2_BOX_NODATA)); in jp2_box_get()
292 if (jas_stream_copy(tmpstream, in, box->datalen)) { in jp2_box_get()
298 if (box->ops->getdata) { in jp2_box_get()
299 if ((*box->ops->getdata)(box, tmpstream)) { in jp2_box_get()
308 jp2_box_dump(box, stderr); in jp2_box_get()
311 return box; in jp2_box_get()
315 if (box) { in jp2_box_get()
316 jp2_box_destroy(box); in jp2_box_get()
324 void jp2_box_dump(jp2_box_t *box, FILE *out) in jp2_box_dump() argument
327 boxinfo = jp2_boxinfolookup(box->type); in jp2_box_dump()
332 '"', (unsigned)box->type, (int)box->len); in jp2_box_dump()
333 if (box->ops->dumpdata) { in jp2_box_dump()
334 (*box->ops->dumpdata)(box, out); in jp2_box_dump()
338 static int jp2_jp_getdata(jp2_box_t *box, jas_stream_t *in) in jp2_jp_getdata() argument
340 jp2_jp_t *jp = &box->data.jp; in jp2_jp_getdata()
347 static int jp2_ftyp_getdata(jp2_box_t *box, jas_stream_t *in) in jp2_ftyp_getdata() argument
349 jp2_ftyp_t *ftyp = &box->data.ftyp; in jp2_ftyp_getdata()
354 ftyp->numcompatcodes = (box->datalen - 8) / 4; in jp2_ftyp_getdata()
366 static int jp2_ihdr_getdata(jp2_box_t *box, jas_stream_t *in) in jp2_ihdr_getdata() argument
368 jp2_ihdr_t *ihdr = &box->data.ihdr; in jp2_ihdr_getdata()
378 static int jp2_bpcc_getdata(jp2_box_t *box, jas_stream_t *in) in jp2_bpcc_getdata() argument
380 jp2_bpcc_t *bpcc = &box->data.bpcc; in jp2_bpcc_getdata()
382 bpcc->numcmpts = box->datalen; in jp2_bpcc_getdata()
394 static void jp2_colr_dumpdata(jp2_box_t *box, FILE *out) in jp2_colr_dumpdata() argument
396 jp2_colr_t *colr = &box->data.colr; in jp2_colr_dumpdata()
408 static int jp2_colr_getdata(jp2_box_t *box, jas_stream_t *in) in jp2_colr_getdata() argument
410 jp2_colr_t *colr = &box->data.colr; in jp2_colr_getdata()
426 colr->iccplen = box->datalen - 3; in jp2_colr_getdata()
438 static void jp2_cdef_dumpdata(jp2_box_t *box, FILE *out) in jp2_cdef_dumpdata() argument
440 jp2_cdef_t *cdef = &box->data.cdef; in jp2_cdef_dumpdata()
448 static void jp2_colr_destroy(jp2_box_t *box) in jp2_colr_destroy() argument
450 jp2_colr_t *colr = &box->data.colr; in jp2_colr_destroy()
456 static int jp2_cdef_getdata(jp2_box_t *box, jas_stream_t *in) in jp2_cdef_getdata() argument
458 jp2_cdef_t *cdef = &box->data.cdef; in jp2_cdef_getdata()
481 int jp2_box_put(jp2_box_t *box, jas_stream_t *out) in jp2_box_put() argument
489 dataflag = !(box->info->flags & (JP2_BOX_SUPER | JP2_BOX_NODATA)); in jp2_box_put()
493 if (box->ops->putdata) { in jp2_box_put()
494 if ((*box->ops->putdata)(box, tmpstream)) { in jp2_box_put()
498 box->len = jas_stream_tell(tmpstream) + JP2_BOX_HDRLEN(false); in jp2_box_put()
502 if (jp2_putuint32(out, /*extlen ? 1 :*/ box->len)) { in jp2_box_put()
505 if (jp2_putuint32(out, box->type)) { in jp2_box_put()
515 if (jas_stream_copy(out, tmpstream, box->len - JP2_BOX_HDRLEN(false))) { in jp2_box_put()
532 static int jp2_jp_putdata(jp2_box_t *box, jas_stream_t *out) in jp2_jp_putdata() argument
534 jp2_jp_t *jp = &box->data.jp; in jp2_jp_putdata()
541 static int jp2_ftyp_putdata(jp2_box_t *box, jas_stream_t *out) in jp2_ftyp_putdata() argument
543 jp2_ftyp_t *ftyp = &box->data.ftyp; in jp2_ftyp_putdata()
556 static int jp2_ihdr_putdata(jp2_box_t *box, jas_stream_t *out) in jp2_ihdr_putdata() argument
558 jp2_ihdr_t *ihdr = &box->data.ihdr; in jp2_ihdr_putdata()
568 static int jp2_bpcc_putdata(jp2_box_t *box, jas_stream_t *out) in jp2_bpcc_putdata() argument
570 jp2_bpcc_t *bpcc = &box->data.bpcc; in jp2_bpcc_putdata()
580 static int jp2_colr_putdata(jp2_box_t *box, jas_stream_t *out) in jp2_colr_putdata() argument
582 jp2_colr_t *colr = &box->data.colr; in jp2_colr_putdata()
602 static int jp2_cdef_putdata(jp2_box_t *box, jas_stream_t *out) in jp2_cdef_putdata() argument
604 jp2_cdef_t *cdef = &box->data.cdef; in jp2_cdef_putdata()
762 static void jp2_cmap_destroy(jp2_box_t *box) in jp2_cmap_destroy() argument
764 jp2_cmap_t *cmap = &box->data.cmap; in jp2_cmap_destroy()
770 static int jp2_cmap_getdata(jp2_box_t *box, jas_stream_t *in) in jp2_cmap_getdata() argument
772 jp2_cmap_t *cmap = &box->data.cmap; in jp2_cmap_getdata()
776 cmap->numchans = (box->datalen) / 4; in jp2_cmap_getdata()
792 static int jp2_cmap_putdata(jp2_box_t *box, jas_stream_t *out) in jp2_cmap_putdata() argument
795 box = 0; in jp2_cmap_putdata()
801 static void jp2_cmap_dumpdata(jp2_box_t *box, FILE *out) in jp2_cmap_dumpdata() argument
803 jp2_cmap_t *cmap = &box->data.cmap; in jp2_cmap_dumpdata()
814 static void jp2_pclr_destroy(jp2_box_t *box) in jp2_pclr_destroy() argument
816 jp2_pclr_t *pclr = &box->data.pclr; in jp2_pclr_destroy()
824 static int jp2_pclr_getdata(jp2_box_t *box, jas_stream_t *in) in jp2_pclr_getdata() argument
826 jp2_pclr_t *pclr = &box->data.pclr; in jp2_pclr_getdata()
862 static int jp2_pclr_putdata(jp2_box_t *box, jas_stream_t *out) in jp2_pclr_putdata() argument
865 jp2_pclr_t *pclr = &box->data.pclr; in jp2_pclr_putdata()
868 box = 0; in jp2_pclr_putdata()
873 static void jp2_pclr_dumpdata(jp2_box_t *box, FILE *out) in jp2_pclr_dumpdata() argument
875 jp2_pclr_t *pclr = &box->data.pclr; in jp2_pclr_dumpdata()
887 static void jp2_uuid_destroy(jp2_box_t *box) in jp2_uuid_destroy() argument
889 jp2_uuid_t *uuid = &box->data.uuid; in jp2_uuid_destroy()
897 static int jp2_uuid_getdata(jp2_box_t *box, jas_stream_t *in) in jp2_uuid_getdata() argument
899 jp2_uuid_t *uuid = &box->data.uuid; in jp2_uuid_getdata()
908 uuid->datalen = box->datalen - 16; in jp2_uuid_getdata()
918 static int jp2_uuid_putdata(jp2_box_t *box, jas_stream_t *out) in jp2_uuid_putdata() argument
920 jp2_uuid_t *uuid = &box->data.uuid; in jp2_uuid_putdata()