@@ -206,7 +206,8 @@ VideoDecoder::BatchDecodedOutput::BatchDecodedOutput(
206206
207207bool VideoDecoder::DecodedFrameContext::operator ==(
208208 const VideoDecoder::DecodedFrameContext& other) {
209- return decodedWidth == other.decodedWidth && decodedHeight == decodedHeight &&
209+ return decodedWidth == other.decodedWidth &&
210+ decodedHeight == other.decodedHeight &&
210211 decodedFormat == other.decodedFormat &&
211212 expectedWidth == other.expectedWidth &&
212213 expectedHeight == other.expectedHeight ;
@@ -249,12 +250,12 @@ void VideoDecoder::initializeDecoder() {
249250 getFFMPEGErrorStringFromErrorCode (ffmpegStatus));
250251 }
251252
252- for (int i = 0 ; i < formatContext_->nb_streams ; i++) {
253+ for (unsigned int i = 0 ; i < formatContext_->nb_streams ; i++) {
253254 AVStream* stream = formatContext_->streams [i];
254255 StreamMetadata meta;
255256
256257 TORCH_CHECK (
257- i == stream->index ,
258+ static_cast < int >(i) == stream->index ,
258259 " Our stream index, " + std::to_string (i) +
259260 " , does not match AVStream's index, " +
260261 std::to_string (stream->index ) + " ." );
@@ -577,7 +578,7 @@ void VideoDecoder::scanFileAndUpdateMetadataAndIndex() {
577578 }
578579 streams_[streamIndex].allFrames .push_back (frameInfo);
579580 }
580- for (int i = 0 ; i < containerMetadata_.streams .size (); ++i) {
581+ for (size_t i = 0 ; i < containerMetadata_.streams .size (); ++i) {
581582 auto & streamMetadata = containerMetadata_.streams [i];
582583 auto stream = formatContext_->streams [i];
583584 if (streamMetadata.minPtsFromScan .has_value ()) {
@@ -610,7 +611,7 @@ void VideoDecoder::scanFileAndUpdateMetadataAndIndex() {
610611 return frameInfo1.pts < frameInfo2.pts ;
611612 });
612613
613- for (int i = 0 ; i < stream.allFrames .size (); ++i) {
614+ for (size_t i = 0 ; i < stream.allFrames .size (); ++i) {
614615 if (i + 1 < stream.allFrames .size ()) {
615616 stream.allFrames [i].nextPts = stream.allFrames [i + 1 ].pts ;
616617 }
@@ -1050,8 +1051,8 @@ VideoDecoder::DecodedOutput VideoDecoder::getFramePlayedAtTimestampNoDemux(
10501051 return output;
10511052}
10521053
1053- void VideoDecoder::validateUserProvidedStreamIndex (uint64_t streamIndex) {
1054- size_t streamsSize = containerMetadata_.streams .size ();
1054+ void VideoDecoder::validateUserProvidedStreamIndex (int streamIndex) {
1055+ int streamsSize = static_cast < int >( containerMetadata_.streams .size () );
10551056 TORCH_CHECK (
10561057 streamIndex >= 0 && streamIndex < streamsSize,
10571058 " Invalid stream index=" + std::to_string (streamIndex) +
@@ -1074,7 +1075,7 @@ void VideoDecoder::validateFrameIndex(
10741075 const StreamInfo& stream,
10751076 int64_t frameIndex) {
10761077 TORCH_CHECK (
1077- frameIndex >= 0 && frameIndex < stream.allFrames .size (),
1078+ frameIndex >= 0 && frameIndex < static_cast < int >( stream.allFrames .size () ),
10781079 " Invalid frame index=" + std::to_string (frameIndex) +
10791080 " for streamIndex=" + std::to_string (stream.streamIndex ) +
10801081 " numFrames=" + std::to_string (stream.allFrames .size ()));
@@ -1134,10 +1135,11 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesAtIndices(
11341135 BatchDecodedOutput output (frameIndices.size (), options, streamMetadata);
11351136
11361137 auto previousIndexInVideo = -1 ;
1137- for (auto f = 0 ; f < frameIndices.size (); ++f) {
1138+ for (size_t f = 0 ; f < frameIndices.size (); ++f) {
11381139 auto indexInOutput = indicesAreSorted ? f : argsort[f];
11391140 auto indexInVideo = frameIndices[indexInOutput];
1140- if (indexInVideo < 0 || indexInVideo >= stream.allFrames .size ()) {
1141+ if (indexInVideo < 0 ||
1142+ indexInVideo >= static_cast <int >(stream.allFrames .size ())) {
11411143 throw std::runtime_error (
11421144 " Invalid frame index=" + std::to_string (indexInVideo));
11431145 }
@@ -1180,7 +1182,7 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesPlayedByTimestamps(
11801182 double maxSeconds = streamMetadata.maxPtsSecondsFromScan .value ();
11811183
11821184 std::vector<int64_t > frameIndices (timestamps.size ());
1183- for (auto i = 0 ; i < timestamps.size (); ++i) {
1185+ for (size_t i = 0 ; i < timestamps.size (); ++i) {
11841186 auto framePts = timestamps[i];
11851187 TORCH_CHECK (
11861188 framePts >= minSeconds && framePts < maxSeconds,
@@ -1215,7 +1217,7 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesInRange(
12151217 TORCH_CHECK (
12161218 start >= 0 , " Range start, " + std::to_string (start) + " is less than 0." );
12171219 TORCH_CHECK (
1218- stop <= stream.allFrames .size (),
1220+ stop <= static_cast < int64_t >( stream.allFrames .size () ),
12191221 " Range stop, " + std::to_string (stop) +
12201222 " , is more than the number of frames, " +
12211223 std::to_string (stream.allFrames .size ()));
0 commit comments