Пример #1
0
int quicktime_read_elst_table(quicktime_t *file, quicktime_elst_table_t *table)
{
    table->duration = quicktime_read_int32(file);
    table->time = quicktime_read_int32(file);
    table->rate = quicktime_read_fixed32(file);

    return 0;
}
Пример #2
0
int quicktime_read_matrix(quicktime_t *file, quicktime_matrix_t *matrix)
{
	int i = 0;
	for(i = 0; i < 9; i++)
	{
		matrix->values[i] = quicktime_read_fixed32(file);
	}
}
Пример #3
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);
}
Пример #4
0
void quicktime_read_stsd_audio(quicktime_t *file, 
	quicktime_stsd_table_t *table, 
	quicktime_atom_t *parent_atom)
{
	quicktime_atom_t leaf_atom;

	table->version = quicktime_read_int16(file);
	table->revision = quicktime_read_int16(file);
	quicktime_read_data(file, table->vendor, 4);
	table->channels = quicktime_read_int16(file);
	table->sample_size = quicktime_read_int16(file);
	table->compression_id = quicktime_read_int16(file);
	table->packet_size = quicktime_read_int16(file);
	table->sample_rate = quicktime_read_fixed32(file);

// Kluge for fixed32 limitation
if(table->sample_rate + 65536 == 96000 ||
	table->sample_rate + 65536 == 88200) table->sample_rate += 65536;


// Version 1 fields
	if(table->version > 0)
	{
		table->samples_per_packet = quicktime_read_int32(file);
		table->bytes_per_packet = quicktime_read_int32(file);
		table->bytes_per_frame = quicktime_read_int32(file);
		table->bytes_per_sample = quicktime_read_int32(file);

// Skip another 20 bytes
		if(table->version == 2)
		{
			quicktime_set_position(file, quicktime_position(file) + 0x14);
		}

		while(quicktime_position(file) < parent_atom->end)
		{
			quicktime_atom_read_header(file, &leaf_atom);

			if(quicktime_atom_is(&leaf_atom, "wave"))
			{
				read_wave(file, table, &leaf_atom);
			}
			else
			{
				quicktime_atom_skip(file, &leaf_atom);
			}
		}
	}

// FFMPEG says the esds sometimes contains a sample rate that overrides
// the sample table.
	quicktime_esds_samplerate(table, &table->esds);
}
Пример #5
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;
}
Пример #6
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");
}
Пример #7
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);

    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");
}