|
From: Yann <ya...@3i...> - 2003-03-19 22:22:53
|
Hello everybody,
I've got a question regarding the old caching of the current audio chunk we
did in the previous code of OQT.
It seems that somebody (Jozeph?) removed it , ... well, to be precise, the
field is still in the track structure, but all the seeking functions don't
update it anymore ... I saw that external movie references have been added,
and it's way cool, but I don't see why it should require removing current
chunk caching ???
I'm asking that cause I'm updating the Directshow 3ivx Media Splitter with a
new version of OQT and it used those informations ... especially when
seeking, it's very important to be able to set a sample position and
retrieve the corresponding chunk...
For example, the old :
OPENQUICKTIMELIB_API int OQT_STDCALL oqt_set_audio_position(oqt_t *file, int
track, oqt_int64 sample)
{
oqt_int64 offset, chunk_sample;
oqt_int32 chunk;
oqt_trak_t *trak;
if(track>=0 && track < file->total_atracks)
{
trak = file->atracks[track].track;
file->atracks[track].current_position = sample;
// printf("BEFORE oqt_chunk_of_sample track %d sample %li\n", track,
sample);
oqt_chunk_of_sample(&chunk_sample, &chunk, trak, sample);
file->atracks[track].current_chunk = chunk;
// printf("AFTER oqt_chunk_of_sample chunk %d chunk_sample %d\n", chunk,
chunk_sample);
offset = oqt_sample_to_offset(trak, sample);
// printf("AFTER oqt_sample_to_offset offset %li\n", offset);
oqt_set_position(file, offset);
}
return 0;
}
has been replaced by
OPENQUICKTIMELIB_API int OQT_STDCALL oqt_set_audio_position(oqt_t *file, int
track, oqt_int64_t sample)
{
oqt_int64_t offset, chunk_sample;
oqt_int32_t chunk;
oqt_trak_t *trak;
oqt_int32_t sd_id;
if(track>=0 && track < file->total_atracks)
{
trak = file->atracks[track].track;
file->atracks[track].current_sample = sample;
// printf("BEFORE oqt_chunk_of_sample track %d sample %li\n", track,
sample);
oqt_chunk_of_sample(&chunk_sample, &chunk, trak, &sd_id, sample);
// atrack->current_chunk is the chunk currently in the buffers,
// don't change it until we really update the buffers
// printf("AFTER oqt_chunk_of_sample chunk %d chunk_sample %d\n", chunk,
chunk_sample);
offset = oqt_sample_to_offset(trak, &sd_id, sample);
// printf("AFTER oqt_sample_to_offset offset %li\n", offset);
file->data_file = oqt_file_from_sd_id(file, trak, sd_id);
oqt_set_position(file->data_file, offset);
}
return 0;
}
Comments and explanations welcome :)
Yann.
|