r1007: Make configure detect and work on amd64.
[cinelerra_cv/mob.git] / quicktime / avcc.c
blobbf4c7f4d00c8609e502f324e45f74e7d3465a280
1 #include "funcprotos.h"
2 #include "quicktime.h"
3 #include <string.h>
6 void quicktime_delete_avcc(quicktime_avcc_t *avcc)
8 if(avcc->data) free(avcc->data);
11 // Set esds header to a copy of the argument
12 void quicktime_set_avcc_header(quicktime_avcc_t *avcc,
13 unsigned char *data,
14 int size)
16 if(avcc->data)
18 free(avcc->data);
21 avcc->data = calloc(1, size);
22 memcpy(avcc->data, data, size);
23 avcc->data_size = size;
26 void quicktime_write_avcc(quicktime_t *file,
27 quicktime_avcc_t *avcc)
29 quicktime_atom_t atom;
30 quicktime_atom_write_header(file, &atom, "avcC");
31 quicktime_write_data(file, avcc->data, avcc->data_size);
32 quicktime_atom_write_footer(file, &atom);
37 int quicktime_read_avcc(quicktime_t *file,
38 quicktime_atom_t *parent_atom,
39 quicktime_avcc_t *avcc)
41 avcc->data_size = parent_atom->size - 8;
42 avcc->data = calloc(1, avcc->data_size + 1024);
43 quicktime_read_data(file,
44 avcc->data,
45 avcc->data_size);
46 quicktime_atom_skip(file, parent_atom);
47 return 0;
50 void quicktime_avcc_dump(quicktime_avcc_t *avcc)
52 int i;
53 printf(" h264 description\n");
54 printf(" data_size=0x%x\n", avcc->data_size);
55 printf(" data=");
56 for(i = 0; i < avcc->data_size; i++)
58 printf("0x%02x ", (unsigned char)avcc->data[i]);
60 printf("\n");