"Fossies" - the Fresh Open Source Software Archive

Member "quicktime4linux-2.3/avcc.c" (9 Jan 2007, 1321 Bytes) of package /linux/privat/old/quicktime4linux-2.3-src.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #include "funcprotos.h"
    2 #include "quicktime.h"
    3 #include <string.h>
    4 
    5 
    6 void quicktime_delete_avcc(quicktime_avcc_t *avcc)
    7 {
    8     if(avcc->data) free(avcc->data);
    9 }
   10 
   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)
   15 {
   16     if(avcc->data)
   17     {
   18         free(avcc->data);
   19     }
   20 
   21     avcc->data = calloc(1, size);
   22     memcpy(avcc->data, data, size);
   23     avcc->data_size = size;
   24 }
   25 
   26 void quicktime_write_avcc(quicktime_t *file, 
   27     quicktime_avcc_t *avcc)
   28 {
   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);
   33 }
   34 
   35 
   36 
   37 int quicktime_read_avcc(quicktime_t *file, 
   38     quicktime_atom_t *parent_atom,
   39     quicktime_avcc_t *avcc)
   40 {
   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;
   48 }
   49 
   50 void quicktime_avcc_dump(quicktime_avcc_t *avcc)
   51 {
   52     if(avcc->data_size)
   53     {
   54         int i;
   55         printf("       h264 description\n");
   56         printf("        data_size=0x%x\n", avcc->data_size);
   57         printf("        data=");
   58         for(i = 0; i < avcc->data_size; i++)
   59         {
   60             printf("0x%02x ", (unsigned char)avcc->data[i]);
   61         }
   62         printf("\n");
   63     }
   64 }