"Fossies" - the Fresh Open Source Software Archive

Member "quicktime4linux-2.3/mdia.c" (9 Jan 2007, 2695 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 void quicktime_mdia_init(quicktime_mdia_t *mdia)
    6 {
    7     quicktime_mdhd_init(&(mdia->mdhd));
    8     quicktime_hdlr_init(&(mdia->hdlr));
    9     quicktime_minf_init(&(mdia->minf));
   10 }
   11 
   12 void quicktime_mdia_init_video(quicktime_t *file, 
   13                                 quicktime_mdia_t *mdia,
   14                                 int frame_w,
   15                                 int frame_h, 
   16                                 float frame_rate,
   17                                 char *compressor)
   18 {
   19 //printf("quicktime_mdia_init_video 1\n");
   20     quicktime_mdhd_init_video(file, &(mdia->mdhd), frame_w, frame_h, frame_rate);
   21 //printf("quicktime_mdia_init_video 1 %d %f\n", mdia->mdhd.time_scale, frame_rate);
   22     quicktime_minf_init_video(file, &(mdia->minf), frame_w, frame_h, mdia->mdhd.time_scale, frame_rate, compressor);
   23 //printf("quicktime_mdia_init_video 1\n");
   24     quicktime_hdlr_init_video(&(mdia->hdlr));
   25 //printf("quicktime_mdia_init_video 2\n");
   26 }
   27 
   28 void quicktime_mdia_init_audio(quicktime_t *file, 
   29                             quicktime_mdia_t *mdia, 
   30                             int channels,
   31                             int sample_rate, 
   32                             int bits, 
   33                             char *compressor)
   34 {
   35     quicktime_mdhd_init_audio(&(mdia->mdhd), 
   36         sample_rate);
   37     quicktime_minf_init_audio(file, 
   38         &(mdia->minf), 
   39         channels, 
   40         sample_rate, 
   41         bits, 
   42         compressor);
   43     quicktime_hdlr_init_audio(&(mdia->hdlr));
   44 }
   45 
   46 void quicktime_mdia_delete(quicktime_mdia_t *mdia)
   47 {
   48     quicktime_mdhd_delete(&(mdia->mdhd));
   49     quicktime_hdlr_delete(&(mdia->hdlr));
   50     quicktime_minf_delete(&(mdia->minf));
   51 }
   52 
   53 void quicktime_mdia_dump(quicktime_mdia_t *mdia)
   54 {
   55     printf("  media\n");
   56     quicktime_mdhd_dump(&(mdia->mdhd));
   57     quicktime_hdlr_dump(&(mdia->hdlr));
   58     quicktime_minf_dump(&(mdia->minf));
   59 }
   60 
   61 int quicktime_read_mdia(quicktime_t *file, quicktime_mdia_t *mdia, quicktime_atom_t *trak_atom)
   62 {
   63     quicktime_atom_t leaf_atom;
   64 
   65     do
   66     {
   67         quicktime_atom_read_header(file, &leaf_atom);
   68 //printf("quicktime_read_mdia %llx\n", quicktime_position(file));
   69 
   70 /* mandatory */
   71         if(quicktime_atom_is(&leaf_atom, "mdhd"))
   72             { quicktime_read_mdhd(file, &(mdia->mdhd)); }
   73         else
   74         if(quicktime_atom_is(&leaf_atom, "hdlr"))
   75         {
   76             quicktime_read_hdlr(file, &(mdia->hdlr)); 
   77 /* Main Actor doesn't write component name */
   78             quicktime_atom_skip(file, &leaf_atom);
   79         }
   80         else
   81         if(quicktime_atom_is(&leaf_atom, "minf"))
   82             { quicktime_read_minf(file, &(mdia->minf), &leaf_atom); }
   83         else
   84             quicktime_atom_skip(file, &leaf_atom);
   85     }while(quicktime_position(file) < trak_atom->end);
   86 
   87     return 0;
   88 }
   89 
   90 void quicktime_write_mdia(quicktime_t *file, quicktime_mdia_t *mdia)
   91 {
   92     quicktime_atom_t atom;
   93     quicktime_atom_write_header(file, &atom, "mdia");
   94 
   95     quicktime_write_mdhd(file, &(mdia->mdhd));
   96     quicktime_write_hdlr(file, &(mdia->hdlr));
   97     quicktime_write_minf(file, &(mdia->minf));
   98 
   99     quicktime_atom_write_footer(file, &atom);
  100 }