Re: 2nd Post: Help: Sample accurate playhead positioning?
Re: 2nd Post: Help: Sample accurate playhead positioning?
- Subject: Re: 2nd Post: Help: Sample accurate playhead positioning?
- From: "David M. Cotter" <email@hidden>
- Date: Mon, 03 Jan 2005 11:58:04 -0800
are you returning noErr from the input proc and getting a paramErr
from AudioConverterFillComplexBuffer()?
correct. all i did was change the file offset of what bytes I return
from the callback passed into AudioConverterFillComplexBuffer()
2) how do I position it accurately, or, rather, how do I then
determine how many uncompressed samples *would have* played had I
not skipped forward?
timestamps don't get pushed thru AudioConverterFillComplexBuffer(),
so there's no way to tell where in the file I should start reading.
works fine if you just go begin to end, but I need to skip around
AND know exactly where I land (either before or after the fact is
fine)
These questions can't be answered except in the context of the methods
you're using for making a correlation between the audio device's
hardware times and your playback timeline...
The timestamps tell you what the hardware is doing.
You are in control of what packets/frames you read and convert from
the audio file, and where you place them on that timeline.
I'm trying to sync audio and video, where they are stored separately,
the audio is in an MP3 file, and the video is in another file. the
video is compressed in a manner that the absolute position from the
start of the file deterministically informs the time of that frame.
Not true with MP3. If I say "go to 20%", i can easily do that in the
video, but how can I possibly do that with audio when it's compressed
with VBR? must I decompress the whole song so I'm dealing with
uncompressed audio? it is exacerbated when the audio and video sizes
differ by a bit. when I play back straight thru, if audio finishes
first, I play silence 'till the video finishes. if the video finishes
first I hold the last frame until the audio finishes. if I say "go to
50%", I need to take the MAX(audio_len, video_len), and calculate 50%
of that to get my "timestamp". that "timestamp" is referring to
samples that are uncompressed, but my MP3 file is compressed. Can I
just take that "timestamp" and linear interpolate on the size of the
compressed MP3 file to get a "compressed" timestamp? I think you see
where this is going. an MP3 file may have ID3 tags at the end,
increasing the size of the file but NOT adding to the length of the
music. if it uses variable bit rate compression, then 50% of the
compressed file is NOT necessarily exactly 50% of the way thru the
song. Do you get what I'm asking? I need a way to seek to EXACTLY n%
of the way thru the song, counting in uncompressed samples. either
that or a way to say get me close to n%, but then have it tell me the
exact percent you're at, or better the exact sample you're at.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden