MCPcopy Create free account
hub / github.com/ml-explore/mlx-data / stream_seek_function

Function stream_seek_function

mlx/data/core/video/VideoFFMPEG.cpp:205–225  ·  view source on GitHub ↗

callback from AVIOContext

Source from the content-addressed store, hash-verified

203
204/// callback from AVIOContext
205static int64_t stream_seek_function(void* opaque, int64_t offset, int whence) {
206 auto& state = *reinterpret_cast<VideoReaderState*>(opaque);
207 switch (whence) {
208 case AVSEEK_SIZE:
209 return state.streamLength_;
210 case AVSEEK_FORCE:
211 state.streamPosition_ = offset;
212 break;
213 case SEEK_SET:
214 state.streamPosition_ = offset;
215 break;
216 case SEEK_CUR:
217 state.streamPosition_ += offset;
218 break;
219 case SEEK_END:
220 state.streamPosition_ = state.streamLength_ + offset;
221 break;
222 }
223
224 return state.streamPosition_;
225}
226
227VideoReaderState::VideoReaderState(
228 const std::shared_ptr<const Array>& contents) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected