2 #include "funcprotos.h"
5 int quicktime_ctab_init(quicktime_ctab_t *ctab)
17 int quicktime_ctab_delete(quicktime_ctab_t *ctab)
19 if(ctab->alpha) free(ctab->alpha);
20 if(ctab->red) free(ctab->red);
21 if(ctab->green) free(ctab->green);
22 if(ctab->blue) free(ctab->blue);
26 void quicktime_ctab_dump(quicktime_ctab_t *ctab)
29 printf(" color table\n");
30 printf(" seed %ld\n", ctab->seed);
31 printf(" flags %ld\n", ctab->flags);
32 printf(" size %ld\n", ctab->size);
34 for(i = 0; i < ctab->size; i++)
36 printf("[%d %d %d %d]", ctab->red[i], ctab->green[i], ctab->blue[i], ctab->alpha[i]);
41 int quicktime_read_ctab(quicktime_t *file, quicktime_ctab_t *ctab)
45 ctab->seed = quicktime_read_int32(file);
46 ctab->flags = quicktime_read_int16(file);
47 ctab->size = quicktime_read_int16(file) + 1;
48 ctab->alpha = malloc(sizeof(int16_t) * ctab->size);
49 ctab->red = malloc(sizeof(int16_t) * ctab->size);
50 ctab->green = malloc(sizeof(int16_t) * ctab->size);
51 ctab->blue = malloc(sizeof(int16_t) * ctab->size);
53 for(i = 0; i < ctab->size; i++)
55 ctab->alpha[i] = quicktime_read_int16(file);
56 ctab->red[i] = quicktime_read_int16(file);
57 ctab->green[i] = quicktime_read_int16(file);
58 ctab->blue[i] = quicktime_read_int16(file);