Skip to content

Commit b7f8e0c

Browse files
authored
Align DecodedOutput with BatchDecodedOutput (#458)
1 parent b1719e7 commit b7f8e0c

File tree

3 files changed

+0
-8
lines changed

3 files changed

+0
-8
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,10 +872,8 @@ VideoDecoder::DecodedOutput VideoDecoder::convertAVFrameToDecodedOutput(
872872
output.streamIndex = streamIndex;
873873
auto& streamInfo = streams_[streamIndex];
874874
TORCH_CHECK(streamInfo.stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO);
875-
output.pts = frame->pts;
876875
output.ptsSeconds =
877876
ptsToSeconds(frame->pts, formatContext_->streams[streamIndex]->time_base);
878-
output.duration = getDuration(frame);
879877
output.durationSeconds = ptsToSeconds(
880878
getDuration(frame), formatContext_->streams[streamIndex]->time_base);
881879
// TODO: we should fold preAllocatedOutputTensor into RawDecodedOutput.

src/torchcodec/decoders/_core/VideoDecoder.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,8 @@ class VideoDecoder {
174174
// The stream index of the decoded frame. Used to distinguish
175175
// between streams that are of the same type.
176176
int streamIndex;
177-
// The presentation timestamp of the decoded frame in time base.
178-
int64_t pts;
179177
// The presentation timestamp of the decoded frame in seconds.
180178
double ptsSeconds;
181-
// The duration of the decoded frame in time base.
182-
int64_t duration;
183179
// The duration of the decoded frame in seconds.
184180
double durationSeconds;
185181
};

test/decoders/VideoDecoderTest.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,10 @@ TEST_P(VideoDecoderTest, ReturnsFirstTwoFramesOfVideo) {
172172
torch::Tensor tensor0FromOurDecoder = output.frame;
173173
EXPECT_EQ(tensor0FromOurDecoder.sizes(), std::vector<long>({3, 270, 480}));
174174
EXPECT_EQ(output.ptsSeconds, 0.0);
175-
EXPECT_EQ(output.pts, 0);
176175
output = ourDecoder->getNextFrameNoDemux();
177176
torch::Tensor tensor1FromOurDecoder = output.frame;
178177
EXPECT_EQ(tensor1FromOurDecoder.sizes(), std::vector<long>({3, 270, 480}));
179178
EXPECT_EQ(output.ptsSeconds, 1'001. / 30'000);
180-
EXPECT_EQ(output.pts, 1001);
181179

182180
torch::Tensor tensor0FromFFMPEG =
183181
readTensorFromDisk("nasa_13013.mp4.stream3.frame000000.pt");

0 commit comments

Comments
 (0)