Skip to content

Issue integrating new decoder #865

Closed Answered by mackron
dgrisham asked this question in Q&A
Jun 27, 2024 · 3 comments · 8 replies
Discussion options

You must be logged in to vote

OK, I see what you're saying. I thought you were talking about the implementation of miniaudio's onSeek callback, not the FFmpeg seek callback. I don't think there will be an elegant way to solve this. It's messy, but one thing you could do is calculate the size of the file yourself in terms of onRead (that's miniaudio's ma_read_proc, not FFmpeg's callback). Run that in a loop, with the output buffer just being a temp buffer on the stack (you'll ignore that data) and then accumulate the number of bytes read from each call to onRead. Then terminate the loop when onRead returns MA_AT_END, or the output byte count is less than what you requested. Then seek back to the start with onSeek. Then…

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dgrisham
Comment options

Comment options

You must be logged in to vote
7 replies
@dgrisham
Comment options

@mackron
Comment options

@dgrisham
Comment options

@mackron
Comment options

Answer selected by dgrisham
@dgrisham
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants