"Fossies" - the Fresh Open Source Software Archive

Member "quicktime4linux-2.3/minf.c" (9 Jan 2007, 3636 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 
    4 
    5 
    6 void quicktime_minf_init(quicktime_minf_t *minf)
    7 {
    8     minf->is_video = minf->is_audio = 0;
    9     quicktime_vmhd_init(&(minf->vmhd));
   10     quicktime_smhd_init(&(minf->smhd));
   11     quicktime_hdlr_init(&(minf->hdlr));
   12     quicktime_dinf_init(&(minf->dinf));
   13     quicktime_stbl_init(&(minf->stbl));
   14 }
   15 
   16 void quicktime_minf_init_video(quicktime_t *file, 
   17                                 quicktime_minf_t *minf, 
   18                                 int frame_w,
   19                                 int frame_h, 
   20                                 int time_scale, 
   21                                 float frame_rate,
   22                                 char *compressor)
   23 {
   24     minf->is_video = 1;
   25 //printf("quicktime_minf_init_video 1\n");
   26     quicktime_vmhd_init_video(file, &(minf->vmhd), frame_w, frame_h, frame_rate);
   27 //printf("quicktime_minf_init_video 1 %d %f\n", time_scale, frame_rate);
   28     quicktime_stbl_init_video(file, &(minf->stbl), frame_w, frame_h, time_scale, frame_rate, compressor);
   29 //printf("quicktime_minf_init_video 2\n");
   30     quicktime_hdlr_init_data(&(minf->hdlr));
   31 //printf("quicktime_minf_init_video 1\n");
   32     quicktime_dinf_init_all(&(minf->dinf));
   33 //printf("quicktime_minf_init_video 2\n");
   34 }
   35 
   36 void quicktime_minf_init_audio(quicktime_t *file, 
   37                             quicktime_minf_t *minf, 
   38                             int channels, 
   39                             int sample_rate, 
   40                             int bits, 
   41                             char *compressor)
   42 {
   43     minf->is_audio = 1;
   44 /* smhd doesn't store anything worth initializing */
   45     quicktime_stbl_init_audio(file, 
   46         &(minf->stbl), 
   47         channels, 
   48         sample_rate, 
   49         bits, 
   50         compressor);
   51     quicktime_hdlr_init_data(&(minf->hdlr));
   52     quicktime_dinf_init_all(&(minf->dinf));
   53 }
   54 
   55 void quicktime_minf_delete(quicktime_minf_t *minf)
   56 {
   57     quicktime_vmhd_delete(&(minf->vmhd));
   58     quicktime_smhd_delete(&(minf->smhd));
   59     quicktime_dinf_delete(&(minf->dinf));
   60     quicktime_stbl_delete(&(minf->stbl));
   61     quicktime_hdlr_delete(&(minf->hdlr));
   62 }
   63 
   64 void quicktime_minf_dump(quicktime_minf_t *minf)
   65 {
   66     printf("   media info\n");
   67     printf("    is_audio %d\n", minf->is_audio);
   68     printf("    is_video %d\n", minf->is_video);
   69     if(minf->is_audio) quicktime_smhd_dump(&(minf->smhd));
   70     if(minf->is_video) quicktime_vmhd_dump(&(minf->vmhd));
   71     quicktime_hdlr_dump(&(minf->hdlr));
   72     quicktime_dinf_dump(&(minf->dinf));
   73     quicktime_stbl_dump(minf, &(minf->stbl));
   74 }
   75 
   76 int quicktime_read_minf(quicktime_t *file, quicktime_minf_t *minf, quicktime_atom_t *parent_atom)
   77 {
   78     quicktime_atom_t leaf_atom;
   79 
   80     do
   81     {
   82         quicktime_atom_read_header(file, &leaf_atom);
   83 //printf("quicktime_read_minf 1\n");
   84 
   85 /* mandatory */
   86         if(quicktime_atom_is(&leaf_atom, "vmhd"))
   87             { minf->is_video = 1; quicktime_read_vmhd(file, &(minf->vmhd)); }
   88         else
   89         if(quicktime_atom_is(&leaf_atom, "smhd"))
   90             { minf->is_audio = 1; quicktime_read_smhd(file, &(minf->smhd)); }
   91         else
   92         if(quicktime_atom_is(&leaf_atom, "hdlr"))
   93             { 
   94                 quicktime_read_hdlr(file, &(minf->hdlr)); 
   95 /* Main Actor doesn't write component name */
   96                 quicktime_atom_skip(file, &leaf_atom);
   97             }
   98         else
   99         if(quicktime_atom_is(&leaf_atom, "dinf"))
  100             { quicktime_read_dinf(file, &(minf->dinf), &leaf_atom); }
  101         else
  102         if(quicktime_atom_is(&leaf_atom, "stbl"))
  103             { quicktime_read_stbl(file, minf, &(minf->stbl), &leaf_atom); }
  104         else
  105             quicktime_atom_skip(file, &leaf_atom);
  106     }while(quicktime_position(file) < parent_atom->end);
  107 
  108     return 0;
  109 }
  110 
  111 void quicktime_write_minf(quicktime_t *file, quicktime_minf_t *minf)
  112 {
  113     quicktime_atom_t atom;
  114     quicktime_atom_write_header(file, &atom, "minf");
  115 
  116     if(minf->is_video) quicktime_write_vmhd(file, &(minf->vmhd));
  117     if(minf->is_audio) quicktime_write_smhd(file, &(minf->smhd));
  118     quicktime_write_hdlr(file, &(minf->hdlr));
  119     quicktime_write_dinf(file, &(minf->dinf));
  120     quicktime_write_stbl(file, minf, &(minf->stbl));
  121 
  122     quicktime_atom_write_footer(file, &atom);
  123 }