Skip to content

Commit a114502

Browse files
committed
Rename core decoding function
1 parent 84b73d4 commit a114502

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ void VideoDecoder::maybeSeekToBeforeDesiredPts() {
803803
}
804804
}
805805

806-
VideoDecoder::AVFrameStream VideoDecoder::getAVFrameUsingFilterFunction(
806+
VideoDecoder::AVFrameStream VideoDecoder::filteredDecode(
807807
std::function<bool(int, AVFrame*)> filter) {
808808
if (activeStreamIndices_.size() == 0) {
809809
throw std::runtime_error("No active streams configured.");
@@ -1103,8 +1103,8 @@ VideoDecoder::FrameOutput VideoDecoder::getFramePlayedAtNoDemux(
11031103
}
11041104

11051105
setCursorPtsInSeconds(seconds);
1106-
AVFrameStream avFrameStream = getAVFrameUsingFilterFunction(
1107-
[seconds, this](int frameStreamIndex, AVFrame* avFrame) {
1106+
AVFrameStream avFrameStream =
1107+
filteredDecode([seconds, this](int frameStreamIndex, AVFrame* avFrame) {
11081108
StreamInfo& streamInfo = streamInfos_[frameStreamIndex];
11091109
double frameStartTime = ptsToSeconds(avFrame->pts, streamInfo.timeBase);
11101110
double frameEndTime = ptsToSeconds(
@@ -1504,8 +1504,8 @@ VideoDecoder::FrameOutput VideoDecoder::getNextFrameNoDemux() {
15041504

15051505
VideoDecoder::FrameOutput VideoDecoder::getNextFrameNoDemuxInternal(
15061506
std::optional<torch::Tensor> preAllocatedOutputTensor) {
1507-
AVFrameStream avFrameStream = getAVFrameUsingFilterFunction(
1508-
[this](int frameStreamIndex, AVFrame* avFrame) {
1507+
AVFrameStream avFrameStream =
1508+
filteredDecode([this](int frameStreamIndex, AVFrame* avFrame) {
15091509
StreamInfo& activeStreamInfo = streamInfos_[frameStreamIndex];
15101510
return avFrame->pts >= activeStreamInfo.discardFramesBeforePts;
15111511
});

src/torchcodec/decoders/_core/VideoDecoder.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,7 @@ class VideoDecoder {
404404
const enum AVColorSpace colorspace);
405405

406406
void maybeSeekToBeforeDesiredPts();
407-
AVFrameStream getAVFrameUsingFilterFunction(
408-
std::function<bool(int, AVFrame*)>);
407+
AVFrameStream filteredDecode(std::function<bool(int, AVFrame*)>);
409408
// Once we create a decoder can update the metadata with the codec context.
410409
// For example, for video streams, we can add the height and width of the
411410
// decoded stream.

0 commit comments

Comments
 (0)