MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / find_chunk_frame

Method find_chunk_frame

src/ChunkReader.cpp:120–133  ·  view source on GitHub ↗

Find the location of a frame in a chunk

Source from the content-addressed store, hash-verified

118
119// Find the location of a frame in a chunk
120ChunkLocation ChunkReader::find_chunk_frame(int64_t requested_frame)
121{
122 // Determine which chunk contains this frame.
123 int64_t chunk_number = (requested_frame / chunk_size) + 1;
124
125 // Determine which frame in this chunk
126 int64_t start_frame_of_chunk = (chunk_number - 1) * chunk_size;
127 int64_t chunk_frame_number = (requested_frame - start_frame_of_chunk) + 1; // Add 1 to adjust for the 1st frame of every chunk is just there to "stoke" the audio samples from the previous chunk.
128
129 // Prepare chunk location struct
130 ChunkLocation location = {chunk_number, chunk_frame_number};
131
132 return location;
133}
134
135// Open chunk folder or file
136void ChunkReader::Open()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected