Пример #1
0
int quicktime_read_smhd(quicktime_t *file, quicktime_smhd_t *smhd)
{
	smhd->version = quicktime_read_char(file);
	smhd->flags = quicktime_read_int24(file);
	smhd->balance = quicktime_read_int16(file);
	smhd->reserved = quicktime_read_int16(file);
}
Пример #2
0
void quicktime_read_vmhd(quicktime_t *file, quicktime_vmhd_t *vmhd)
{
	int i;
	vmhd->version = quicktime_read_char(file);
	vmhd->flags = quicktime_read_int24(file);
	vmhd->graphics_mode = quicktime_read_int16(file);
	for(i = 0; i < 3; i++)
		vmhd->opcolor[i] = quicktime_read_int16(file);
}
Пример #3
0
int quicktime_read_esds(quicktime_t *file, quicktime_esds_t *esds)
{
    u_int8_t tag;
    u_int32_t length;

    esds->version = quicktime_read_char(file);
    esds->flags = quicktime_read_int24(file);

    /* get and verify ES_DescrTag */
    tag = quicktime_read_char(file);
    if (tag == 0x03) {
        /* read length */
        if (quicktime_read_mp4_descr_length(file) < 5 + 15) {
            return 1;
        }
        /* skip 3 bytes */
        quicktime_set_position(file, quicktime_position(file) + 3);
    } else {
        /* skip 2 bytes */
        quicktime_set_position(file, quicktime_position(file) + 2);
    }

    /* get and verify DecoderConfigDescrTab */
    if (quicktime_read_char(file) != 0x04) {
        return 1;
    }

    /* read length */
    if (quicktime_read_mp4_descr_length(file) < 15) {
        return 1;
    }

    /* skip 13 bytes */
    quicktime_set_position(file, quicktime_position(file) + 13);

    /* get and verify DecSpecificInfoTag */
    if (quicktime_read_char(file) != 0x05) {
        return 1;
    }

    /* read length */
    esds->decoderConfigLen = quicktime_read_mp4_descr_length(file);

    free(esds->decoderConfig);
    esds->decoderConfig = malloc(esds->decoderConfigLen);
    if (esds->decoderConfig) {
        quicktime_read_data(file, esds->decoderConfig, esds->decoderConfigLen);
    } else {
        esds->decoderConfigLen = 0;
    }

    /* will skip the remainder of the atom */
    return 0;
}
Пример #4
0
void quicktime_read_mdhd(quicktime_t *file, quicktime_mdhd_t *mdhd)
{
	mdhd->version = quicktime_read_char(file);
	mdhd->flags = quicktime_read_int24(file);
	mdhd->creation_time = quicktime_read_int32(file);
	mdhd->modification_time = quicktime_read_int32(file);
	mdhd->time_scale = quicktime_read_int32(file);
	mdhd->duration = quicktime_read_int32(file);
	mdhd->language = quicktime_read_int16(file);
	mdhd->quality = quicktime_read_int16(file);
}
Пример #5
0
void quicktime_read_hdlr(quicktime_t *file, quicktime_hdlr_t *hdlr)
{
	hdlr->version = quicktime_read_char(file);
	hdlr->flags = quicktime_read_int24(file);
	quicktime_read_char32(file, hdlr->component_type);
	quicktime_read_char32(file, hdlr->component_subtype);
	hdlr->component_manufacturer = quicktime_read_int32(file);
	hdlr->component_flags = quicktime_read_int32(file);
	hdlr->component_flag_mask = quicktime_read_int32(file);
	quicktime_read_pascal(file, hdlr->component_name);
}
Пример #6
0
int quicktime_read_hmhd(quicktime_t *file, quicktime_hmhd_t *hmhd)
{
    hmhd->version = quicktime_read_char(file);
    hmhd->flags = quicktime_read_int24(file);
    hmhd->maxPDUsize = quicktime_read_int16(file);
    hmhd->avgPDUsize = quicktime_read_int16(file);
    hmhd->maxbitrate = quicktime_read_int32(file);
    hmhd->avgbitrate = quicktime_read_int32(file);
    hmhd->slidingavgbitrate = quicktime_read_int32(file);

    return 0;
}
Пример #7
0
void quicktime_read_elst(quicktime_t *file, quicktime_elst_t *elst)
{
	int i;
	elst->version = quicktime_read_char(file);
	elst->flags = quicktime_read_int24(file);
	elst->total_entries = quicktime_read_int32(file);
	elst->table = (quicktime_elst_table_t*)calloc(1, sizeof(quicktime_elst_table_t) * elst->total_entries);
	for(i = 0; i < elst->total_entries; i++)
	{
		quicktime_elst_table_init(&(elst->table[i]));
		quicktime_read_elst_table(file, &(elst->table[i]));
	}
}
Пример #8
0
void quicktime_read_dref_table(quicktime_t *file, quicktime_dref_table_t *table)
{
	table->size = quicktime_read_int32(file);
	quicktime_read_char32(file, table->type);
	table->version = quicktime_read_char(file);
	table->flags = quicktime_read_int24(file);
	if(table->data_reference) free(table->data_reference);

	table->data_reference = malloc(table->size);
	if(table->size > 12)
		quicktime_read_data(file, table->data_reference, table->size - 12);
	table->data_reference[table->size - 12] = 0;
}
Пример #9
0
void quicktime_read_stts(quicktime_t *file, quicktime_stts_t *stts)
{
	int i;
	stts->version = quicktime_read_char(file);
	stts->flags = quicktime_read_int24(file);
	stts->total_entries = quicktime_read_int32(file);

	stts->table = (quicktime_stts_table_t*)malloc(sizeof(quicktime_stts_table_t) * stts->total_entries);
	for(i = 0; i < stts->total_entries; i++)
	{
		stts->table[i].sample_count = quicktime_read_int32(file);
		stts->table[i].sample_duration = quicktime_read_int32(file);
	}
}
Пример #10
0
void quicktime_read_dref(quicktime_t *file, quicktime_dref_t *dref)
{
	int i;

	dref->version = quicktime_read_char(file);
	dref->flags = quicktime_read_int24(file);
	dref->total_entries = quicktime_read_int32(file);
	dref->table = (quicktime_dref_table_t*)malloc(sizeof(quicktime_dref_table_t) * dref->total_entries);
	for(i = 0; i < dref->total_entries; i++)
	{
		quicktime_dref_table_init(&(dref->table[i]));
		quicktime_read_dref_table(file, &(dref->table[i]));
	}
}
Пример #11
0
int quicktime_read_hdlr(quicktime_t *file, quicktime_hdlr_t *hdlr)
{
	hdlr->version = quicktime_read_char(file);
	hdlr->flags = quicktime_read_int24(file);
	quicktime_read_char32(file, hdlr->component_type);
	quicktime_read_char32(file, hdlr->component_subtype);
	hdlr->component_manufacturer = quicktime_read_int32(file);
	hdlr->component_flags = quicktime_read_int32(file);
	hdlr->component_flag_mask = quicktime_read_int32(file);
	if (file->use_mp4) {
		// TBD read null terminated string
	} else {
		quicktime_read_pascal(file, hdlr->component_name);
	}
}
Пример #12
0
int quicktime_read_stsd(quicktime_t *file, quicktime_minf_t *minf, quicktime_stsd_t *stsd)
{
    int i;

    stsd->version = quicktime_read_char(file);
    stsd->flags = quicktime_read_int24(file);
    stsd->total_entries = quicktime_read_int32(file);
    stsd->table = (quicktime_stsd_table_t*)malloc(sizeof(quicktime_stsd_table_t) * stsd->total_entries);
    for(i = 0; i < stsd->total_entries; i++)
    {
        quicktime_stsd_table_init(&(stsd->table[i]));
        quicktime_read_stsd_table(file, minf, &(stsd->table[i]));
    }

    return 0;
}
Пример #13
0
int quicktime_read_stsc(quicktime_t *file, quicktime_stsc_t *stsc)
{
	int i;
	stsc->version = quicktime_read_char(file);
	stsc->flags = quicktime_read_int24(file);
	stsc->total_entries = quicktime_read_int32(file);
	
	stsc->entries_allocated = stsc->total_entries;
	stsc->table = (quicktime_stsc_table_t*)malloc(sizeof(quicktime_stsc_table_t) * stsc->total_entries);
	for(i = 0; i < stsc->total_entries; i++)
	{
		stsc->table[i].chunk = quicktime_read_int32(file);
		stsc->table[i].samples = quicktime_read_int32(file);
		stsc->table[i].id = quicktime_read_int32(file);
	}
}
Пример #14
0
int quicktime_read_stsz(quicktime_t *file, quicktime_stsz_t *stsz)
{
	int i;
	stsz->version = quicktime_read_char(file);
	stsz->flags = quicktime_read_int24(file);
	stsz->sample_size = quicktime_read_int32(file);
	stsz->total_entries = quicktime_read_int32(file);
	stsz->entries_allocated = stsz->total_entries;
	if(!stsz->sample_size)
	{
		stsz->table = (quicktime_stsz_table_t*)malloc(sizeof(quicktime_stsz_table_t) * stsz->entries_allocated);
		for(i = 0; i < stsz->total_entries; i++)
		{
			stsz->table[i].size = quicktime_read_int32(file);
		}
	}
}
Пример #15
0
int quicktime_read_tkhd(quicktime_t *file, quicktime_tkhd_t *tkhd)
{
	tkhd->version = quicktime_read_char(file);
	tkhd->flags = quicktime_read_int24(file);
	tkhd->creation_time = quicktime_read_int32(file);
	tkhd->modification_time = quicktime_read_int32(file);
	tkhd->track_id = quicktime_read_int32(file);
	tkhd->reserved1 = quicktime_read_int32(file);
	tkhd->duration = quicktime_read_int32(file);
	quicktime_read_data(file, tkhd->reserved2, 8);
	tkhd->layer = quicktime_read_int16(file);
	tkhd->alternate_group = quicktime_read_int16(file);
	tkhd->volume = quicktime_read_fixed16(file);
	tkhd->reserved3 = quicktime_read_int16(file);
	quicktime_read_matrix(file, &(tkhd->matrix));
	tkhd->track_width = quicktime_read_fixed32(file);
	tkhd->track_height = quicktime_read_fixed32(file);
}
Пример #16
0
int quicktime_read_mvhd(quicktime_t *file, quicktime_mvhd_t *mvhd)
{
    mvhd->version = quicktime_read_char(file);
    mvhd->flags = quicktime_read_int24(file);
    mvhd->creation_time = quicktime_read_int32(file);
    mvhd->modification_time = quicktime_read_int32(file);
    mvhd->time_scale = quicktime_read_int32(file);
    mvhd->duration = quicktime_read_int32(file);
    mvhd->preferred_rate = quicktime_read_fixed32(file);
    mvhd->preferred_volume = quicktime_read_fixed16(file);
    quicktime_read_data(file, mvhd->reserved, 10);
    quicktime_read_matrix(file, &(mvhd->matrix));
    mvhd->preview_time = quicktime_read_int32(file);
    mvhd->preview_duration = quicktime_read_int32(file);
    mvhd->poster_time = quicktime_read_int32(file);
    mvhd->selection_time = quicktime_read_int32(file);
    mvhd->selection_duration = quicktime_read_int32(file);
    mvhd->current_time = quicktime_read_int32(file);
    mvhd->next_track_id = quicktime_read_int32(file);

    return 0;
}