int quicktime_read_moov(quicktime_t *file, quicktime_moov_t *moov, quicktime_atom_t *parent_atom) { /* mandatory mvhd */ quicktime_atom_t leaf_atom; do { quicktime_atom_read_header(file, &leaf_atom); if(quicktime_atom_is(&leaf_atom, "mvhd")) { quicktime_read_mvhd(file, &(moov->mvhd)); } else if(quicktime_atom_is(&leaf_atom, "iods")) { quicktime_read_iods(file, &(moov->iods)); quicktime_atom_skip(file, &leaf_atom); } else if(quicktime_atom_is(&leaf_atom, "clip")) { quicktime_atom_skip(file, &leaf_atom); } else if(quicktime_atom_is(&leaf_atom, "trak")) { quicktime_trak_t *trak = quicktime_add_trak(moov); quicktime_read_trak(file, trak, &leaf_atom); } else if(quicktime_atom_is(&leaf_atom, "udta")) { quicktime_read_udta(file, &(moov->udta), &leaf_atom); quicktime_atom_skip(file, &leaf_atom); } else if(quicktime_atom_is(&leaf_atom, "ctab")) { quicktime_read_ctab(file, &(moov->ctab)); } else { quicktime_atom_skip(file, &leaf_atom); } }while(quicktime_position(file) < parent_atom->end); return 0; }
void quicktime_read_stsd_video(quicktime_t *file, quicktime_stsd_table_t *table, quicktime_atom_t *parent_atom) { quicktime_atom_t leaf_atom; int len; table->version = quicktime_read_int16(file); table->revision = quicktime_read_int16(file); quicktime_read_data(file, table->vendor, 4); table->temporal_quality = quicktime_read_int32(file); table->spatial_quality = quicktime_read_int32(file); table->width = quicktime_read_int16(file); table->height = quicktime_read_int16(file); table->dpi_horizontal = quicktime_read_fixed32(file); table->dpi_vertical = quicktime_read_fixed32(file); table->data_size = quicktime_read_int32(file); table->frames_per_sample = quicktime_read_int16(file); len = quicktime_read_char(file); quicktime_read_data(file, table->compressor_name, 31); table->depth = quicktime_read_int16(file); table->ctab_id = quicktime_read_int16(file); /* The data needed for SVQ3 codec and maybe some others ? */ struct ImageDescription *id; int stsd_size,fourcc,c,d; stsd_size = parent_atom->end - parent_atom->start; table->extradata_size = stsd_size - 4; id = (struct ImageDescription *) malloc(table->extradata_size); // we do not include size table->extradata = (char *) id; memcpy(id->cType, table->format, 4); // Fourcc id->version = table->version; id->revisionLevel = table->revision; memcpy(id->vendor, table->vendor, 4); // I think mplayer screws up on this one, it turns bytes around! :) id->temporalQuality = table->temporal_quality; id->spatialQuality = table->spatial_quality; id->width = table->width; id->height = table->height; id->hRes = table->dpi_horizontal; id->vRes = table->dpi_vertical; id->dataSize = table->data_size; id->frameCount = table->frames_per_sample; id->name[0] = len; memcpy(&(id->name[1]), table->compressor_name, 31); id->depth = table->depth; id->clutID = table->ctab_id; if (quicktime_position(file) < parent_atom->end) { int position = quicktime_position(file); // remember position int datalen = parent_atom->end - position; quicktime_read_data(file, ((char*)&id->clutID)+2, datalen); quicktime_set_position(file, position); // return to previous position so parsing can go on } while(quicktime_position(file) < parent_atom->end) { quicktime_atom_read_header(file, &leaf_atom); /* * printf("quicktime_read_stsd_video 1 %llx %llx %llx %s\n", * leaf_atom.start, leaf_atom.end, quicktime_position(file), * leaf_atom.type); */ if(quicktime_atom_is(&leaf_atom, "esds")) { quicktime_read_esds(file, &leaf_atom, &table->esds); } else if(quicktime_atom_is(&leaf_atom, "avcC")) { quicktime_read_avcc(file, &leaf_atom, &table->avcc); } else if(quicktime_atom_is(&leaf_atom, "ctab")) { quicktime_read_ctab(file, &(table->ctab)); } else if(quicktime_atom_is(&leaf_atom, "gama")) { table->gamma = quicktime_read_fixed32(file); } else if(quicktime_atom_is(&leaf_atom, "fiel")) { table->fields = quicktime_read_char(file); table->field_dominance = quicktime_read_char(file); } else quicktime_atom_skip(file, &leaf_atom); /* if(quicktime_atom_is(&leaf_atom, "mjqt")) */ /* { */ /* quicktime_read_mjqt(file, &(table->mjqt)); */ /* } */ /* else */ /* if(quicktime_atom_is(&leaf_atom, "mjht")) */ /* { */ /* quicktime_read_mjht(file, &(table->mjht)); */ /* } */ /* else */ } //printf("quicktime_read_stsd_video 2\n"); }
void quicktime_read_stsd_video(quicktime_t *file, quicktime_stsd_table_t *table, quicktime_atom_t *parent_atom) { quicktime_atom_t leaf_atom; int len; table->version = quicktime_read_int16(file); table->revision = quicktime_read_int16(file); quicktime_read_data(file, table->vendor, 4); table->temporal_quality = quicktime_read_int32(file); table->spatial_quality = quicktime_read_int32(file); table->width = quicktime_read_int16(file); table->height = quicktime_read_int16(file); table->dpi_horizontal = quicktime_read_fixed32(file); table->dpi_vertical = quicktime_read_fixed32(file); table->data_size = quicktime_read_int32(file); table->frames_per_sample = quicktime_read_int16(file); len = quicktime_read_char(file); quicktime_read_data(file, table->compressor_name, 31); table->depth = quicktime_read_int16(file); table->ctab_id = quicktime_read_int16(file); while(quicktime_position(file) < parent_atom->end) { quicktime_atom_read_header(file, &leaf_atom); /* * printf("quicktime_read_stsd_video 1 %llx %llx %llx %s\n", * leaf_atom.start, leaf_atom.end, quicktime_position(file), * leaf_atom.type); */ if(quicktime_atom_is(&leaf_atom, "esds")) { quicktime_read_esds(file, &leaf_atom, &table->esds); } else if(quicktime_atom_is(&leaf_atom, "avcC")) { quicktime_read_avcc(file, &leaf_atom, &table->avcc); } else if(quicktime_atom_is(&leaf_atom, "ctab")) { quicktime_read_ctab(file, &(table->ctab)); } else if(quicktime_atom_is(&leaf_atom, "gama")) { table->gamma = quicktime_read_fixed32(file); } else if(quicktime_atom_is(&leaf_atom, "fiel")) { table->fields = quicktime_read_char(file); table->field_dominance = quicktime_read_char(file); } else quicktime_atom_skip(file, &leaf_atom); /* if(quicktime_atom_is(&leaf_atom, "mjqt")) */ /* { */ /* quicktime_read_mjqt(file, &(table->mjqt)); */ /* } */ /* else */ /* if(quicktime_atom_is(&leaf_atom, "mjht")) */ /* { */ /* quicktime_read_mjht(file, &(table->mjht)); */ /* } */ /* else */ } //printf("quicktime_read_stsd_video 2\n"); }