@@ -41,12 +41,12 @@ TORCH_LIBRARY(torchcodec_ns, m) {
4141 " get_frame_at_index(Tensor(a!) decoder, *, int stream_index, int frame_index) -> (Tensor, Tensor, Tensor)" );
4242 m.def (
4343 " get_frames_at_indices(Tensor(a!) decoder, *, int stream_index, int[] frame_indices) -> (Tensor, Tensor, Tensor)" );
44- m.def (
45- " get_frames_at_ptss(Tensor(a!) decoder, *, int stream_index, float[] frame_ptss) -> (Tensor, Tensor, Tensor)" );
4644 m.def (
4745 " get_frames_in_range(Tensor(a!) decoder, *, int stream_index, int start, int stop, int? step=None) -> (Tensor, Tensor, Tensor)" );
4846 m.def (
4947 " get_frames_by_pts_in_range(Tensor(a!) decoder, *, int stream_index, float start_seconds, float stop_seconds) -> (Tensor, Tensor, Tensor)" );
48+ m.def (
49+ " get_frames_by_pts(Tensor(a!) decoder, *, int stream_index, float[] frame_ptss) -> (Tensor, Tensor, Tensor)" );
5050 m.def (" get_json_metadata(Tensor(a!) decoder) -> str" );
5151 m.def (" get_container_json_metadata(Tensor(a!) decoder) -> str" );
5252 m.def (
@@ -211,17 +211,6 @@ OpsDecodedOutput get_frame_at_pts(at::Tensor& decoder, double seconds) {
211211 return makeOpsDecodedOutput (result);
212212}
213213
214- OpsBatchDecodedOutput get_frames_at_ptss (
215- at::Tensor& decoder,
216- int64_t stream_index,
217- at::ArrayRef<double > frame_ptss) {
218- auto videoDecoder = unwrapTensorToGetDecoder (decoder);
219- std::vector<double > framePtssVec (frame_ptss.begin (), frame_ptss.end ());
220- auto result =
221- videoDecoder->getFramesAtPtss (stream_index, framePtssVec);
222- return makeOpsBatchDecodedOutput (result);
223- }
224-
225214OpsDecodedOutput get_frame_at_index (
226215 at::Tensor& decoder,
227216 int64_t stream_index,
@@ -253,6 +242,16 @@ OpsBatchDecodedOutput get_frames_in_range(
253242 stream_index, start, stop, step.value_or (1 ));
254243 return makeOpsBatchDecodedOutput (result);
255244}
245+ OpsBatchDecodedOutput get_frames_by_pts (
246+ at::Tensor& decoder,
247+ int64_t stream_index,
248+ at::ArrayRef<double > frame_ptss) {
249+ auto videoDecoder = unwrapTensorToGetDecoder (decoder);
250+ std::vector<double > framePtssVec (frame_ptss.begin (), frame_ptss.end ());
251+ auto result =
252+ videoDecoder->getFramesDisplayedByTimestamps (stream_index, framePtssVec);
253+ return makeOpsBatchDecodedOutput (result);
254+ }
256255
257256OpsBatchDecodedOutput get_frames_by_pts_in_range (
258257 at::Tensor& decoder,
@@ -496,9 +495,9 @@ TORCH_LIBRARY_IMPL(torchcodec_ns, CPU, m) {
496495 m.impl (" get_frame_at_pts" , &get_frame_at_pts);
497496 m.impl (" get_frame_at_index" , &get_frame_at_index);
498497 m.impl (" get_frames_at_indices" , &get_frames_at_indices);
499- m.impl (" get_frames_at_ptss" , &get_frames_at_ptss);
500498 m.impl (" get_frames_in_range" , &get_frames_in_range);
501499 m.impl (" get_frames_by_pts_in_range" , &get_frames_by_pts_in_range);
500+ m.impl (" get_frames_by_pts" , &get_frames_by_pts);
502501 m.impl (" _test_frame_pts_equality" , &_test_frame_pts_equality);
503502 m.impl (
504503 " scan_all_streams_to_update_metadata" ,
0 commit comments