@@ -615,7 +615,7 @@ FrameOutput SingleStreamDecoder::getFrameAtIndexInternal(
615615 const auto & streamMetadata =
616616 containerMetadata_.allStreamMetadata [activeStreamIndex_];
617617
618- std::optional<int64_t > numFrames = getNumFrames (streamMetadata );
618+ std::optional<int64_t > numFrames = streamMetadata. getNumFrames (seekMode_ );
619619 if (numFrames.has_value ()) {
620620 // If the frameIndex is negative, we convert it to a positive index
621621 frameIndex = frameIndex >= 0 ? frameIndex : frameIndex + numFrames.value ();
@@ -709,7 +709,7 @@ FrameBatchOutput SingleStreamDecoder::getFramesInRange(
709709
710710 // Note that if we do not have the number of frames available in our
711711 // metadata, then we assume that the upper part of the range is valid.
712- std::optional<int64_t > numFrames = getNumFrames (streamMetadata );
712+ std::optional<int64_t > numFrames = streamMetadata. getNumFrames (seekMode_ );
713713 if (numFrames.has_value ()) {
714714 TORCH_CHECK (
715715 stop <= numFrames.value (),
@@ -783,8 +783,9 @@ FrameBatchOutput SingleStreamDecoder::getFramesPlayedAt(
783783 const auto & streamMetadata =
784784 containerMetadata_.allStreamMetadata [activeStreamIndex_];
785785
786- double minSeconds = getMinSeconds (streamMetadata);
787- std::optional<double > maxSeconds = getMaxSeconds (streamMetadata);
786+ double minSeconds = streamMetadata.getBeginStreamSeconds (seekMode_);
787+ std::optional<double > maxSeconds =
788+ streamMetadata.getEndStreamSeconds (seekMode_);
788789
789790 // The frame played at timestamp t and the one played at timestamp `t +
790791 // eps` are probably the same frame, with the same index. The easiest way to
@@ -861,7 +862,7 @@ FrameBatchOutput SingleStreamDecoder::getFramesPlayedInRange(
861862 return frameBatchOutput;
862863 }
863864
864- double minSeconds = getMinSeconds ( streamMetadata);
865+ double minSeconds = streamMetadata. getBeginStreamSeconds (seekMode_ );
865866 TORCH_CHECK (
866867 startSeconds >= minSeconds,
867868 " Start seconds is " + std::to_string (startSeconds) +
@@ -870,7 +871,8 @@ FrameBatchOutput SingleStreamDecoder::getFramesPlayedInRange(
870871
871872 // Note that if we can't determine the maximum seconds from the metadata,
872873 // then we assume upper range is valid.
873- std::optional<double > maxSeconds = getMaxSeconds (streamMetadata);
874+ std::optional<double > maxSeconds =
875+ streamMetadata.getEndStreamSeconds (seekMode_);
874876 if (maxSeconds.has_value ()) {
875877 TORCH_CHECK (
876878 startSeconds < maxSeconds.value (),
@@ -1443,21 +1445,6 @@ int64_t SingleStreamDecoder::getPts(int64_t frameIndex) {
14431445// STREAM AND METADATA APIS
14441446// --------------------------------------------------------------------------
14451447
1446- std::optional<int64_t > SingleStreamDecoder::getNumFrames (
1447- const StreamMetadata& streamMetadata) {
1448- return streamMetadata.getNumFrames (seekMode_);
1449- }
1450-
1451- double SingleStreamDecoder::getMinSeconds (
1452- const StreamMetadata& streamMetadata) {
1453- return streamMetadata.getBeginStreamSeconds (seekMode_);
1454- }
1455-
1456- std::optional<double > SingleStreamDecoder::getMaxSeconds (
1457- const StreamMetadata& streamMetadata) {
1458- return streamMetadata.getEndStreamSeconds (seekMode_);
1459- }
1460-
14611448// --------------------------------------------------------------------------
14621449// VALIDATION UTILS
14631450// --------------------------------------------------------------------------
@@ -1507,7 +1494,7 @@ void SingleStreamDecoder::validateFrameIndex(
15071494
15081495 // Note that if we do not have the number of frames available in our
15091496 // metadata, then we assume that the frameIndex is valid.
1510- std::optional<int64_t > numFrames = getNumFrames (streamMetadata );
1497+ std::optional<int64_t > numFrames = streamMetadata. getNumFrames (seekMode_ );
15111498 if (numFrames.has_value ()) {
15121499 if (frameIndex >= numFrames.value ()) {
15131500 throw std::out_of_range (
0 commit comments