Skip to content

Commit

Permalink
Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHug committed Jun 25, 2024
1 parent d4a24fc commit 8aa6d04
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/torchcodec/decoders/_simple_video_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ def __init__(self, source: Union[str, bytes, torch.Tensor]):

core.add_video_stream(self._decoder)

self.metadata = _get_and_validate_simple_video_metadata(self._decoder)
self.stream_metadata = _get_and_validate_stream_metadata(self._decoder)
# Note: these fields exist and are not None, as validated in _get_and_validate_simple_video_metadata().
self._num_frames = self.metadata.num_frames_computed
self._stream_index = self.metadata.stream_index
self._num_frames = self.stream_metadata.num_frames_computed
self._stream_index = self.stream_metadata.stream_index

def __len__(self) -> int:
return self._num_frames
Expand Down Expand Up @@ -61,9 +61,7 @@ def __next__(self) -> torch.Tensor:
raise StopIteration()


def _get_and_validate_simple_video_metadata(
decoder: torch.Tensor,
) -> core.StreamMetadata:
def _get_and_validate_stream_metadata(decoder: torch.Tensor) -> core.StreamMetadata:
video_metadata = core.get_video_metadata(decoder)

if video_metadata.best_video_stream_index is None:
Expand All @@ -72,7 +70,9 @@ def _get_and_validate_simple_video_metadata(
"Please report an issue following the steps in <TODO>"
)

best_stream_metadata = video_metadata.streams[video_metadata.best_video_stream_index]
best_stream_metadata = video_metadata.streams[
video_metadata.best_video_stream_index
]
if best_stream_metadata.num_frames_computed is None:
raise ValueError(
"The number of frames is unknown. This should never happen. "
Expand Down

0 comments on commit 8aa6d04

Please sign in to comment.