@@ -913,19 +913,19 @@ VideoDecoder::getAVFrameUsingFilterFunction(
913913 StreamInfo& activeStreamInfo = streamInfos_[frameStreamIndex];
914914 activeStreamInfo.currentPts = avFrame->pts ;
915915 activeStreamInfo.currentDuration = getDuration (avFrame);
916- AVFrameWithStreamIndex rawOutput ;
917- rawOutput .streamIndex = frameStreamIndex;
918- rawOutput .avFrame = std::move (avFrame);
919- return rawOutput ;
916+ AVFrameWithStreamIndex avFrameWithStreamIndex ;
917+ avFrameWithStreamIndex .streamIndex = frameStreamIndex;
918+ avFrameWithStreamIndex .avFrame = std::move (avFrame);
919+ return avFrameWithStreamIndex ;
920920}
921921
922922VideoDecoder::FrameOutput VideoDecoder::convertAVFrameToFrameOutput (
923- VideoDecoder::AVFrameWithStreamIndex& rawOutput ,
923+ VideoDecoder::AVFrameWithStreamIndex& avFrameWithStreamIndex ,
924924 std::optional<torch::Tensor> preAllocatedOutputTensor) {
925925 // Convert the frame to tensor.
926926 FrameOutput frameOutput;
927- int streamIndex = rawOutput .streamIndex ;
928- AVFrame* avFrame = rawOutput .avFrame .get ();
927+ int streamIndex = avFrameWithStreamIndex .streamIndex ;
928+ AVFrame* avFrame = avFrameWithStreamIndex .avFrame .get ();
929929 frameOutput.streamIndex = streamIndex;
930930 auto & streamInfo = streamInfos_[streamIndex];
931931 TORCH_CHECK (streamInfo.stream ->codecpar ->codec_type == AVMEDIA_TYPE_VIDEO);
@@ -936,12 +936,12 @@ VideoDecoder::FrameOutput VideoDecoder::convertAVFrameToFrameOutput(
936936 // TODO: we should fold preAllocatedOutputTensor into AVFrameWithStreamIndex.
937937 if (streamInfo.videoStreamOptions .device .type () == torch::kCPU ) {
938938 convertAVFrameToFrameOutputOnCPU (
939- rawOutput , frameOutput, preAllocatedOutputTensor);
939+ avFrameWithStreamIndex , frameOutput, preAllocatedOutputTensor);
940940 } else if (streamInfo.videoStreamOptions .device .type () == torch::kCUDA ) {
941941 convertAVFrameToFrameOutputOnCuda (
942942 streamInfo.videoStreamOptions .device ,
943943 streamInfo.videoStreamOptions ,
944- rawOutput ,
944+ avFrameWithStreamIndex ,
945945 frameOutput,
946946 preAllocatedOutputTensor);
947947 } else {
@@ -962,11 +962,11 @@ VideoDecoder::FrameOutput VideoDecoder::convertAVFrameToFrameOutput(
962962// Dimension order of the preAllocatedOutputTensor must be HWC, regardless of
963963// `dimension_order` parameter. It's up to callers to re-shape it if needed.
964964void VideoDecoder::convertAVFrameToFrameOutputOnCPU (
965- VideoDecoder::AVFrameWithStreamIndex& rawOutput ,
965+ VideoDecoder::AVFrameWithStreamIndex& avFrameWithStreamIndex ,
966966 FrameOutput& output,
967967 std::optional<torch::Tensor> preAllocatedOutputTensor) {
968- int streamIndex = rawOutput .streamIndex ;
969- AVFrame* avFrame = rawOutput .avFrame .get ();
968+ int streamIndex = avFrameWithStreamIndex .streamIndex ;
969+ AVFrame* avFrame = avFrameWithStreamIndex .avFrame .get ();
970970 auto & streamInfo = streamInfos_[streamIndex];
971971
972972 auto frameDims = getHeightAndWidthFromOptionsOrAVFrame (
@@ -1080,7 +1080,7 @@ VideoDecoder::FrameOutput VideoDecoder::getFramePlayedAtTimestampNoDemux(
10801080 }
10811081
10821082 setCursorPtsInSeconds (seconds);
1083- AVFrameWithStreamIndex rawOutput = getAVFrameUsingFilterFunction (
1083+ AVFrameWithStreamIndex avFrameWithStreamIndex = getAVFrameUsingFilterFunction (
10841084 [seconds, this ](int frameStreamIndex, AVFrame* avFrame) {
10851085 StreamInfo& streamInfo = streamInfos_[frameStreamIndex];
10861086 double frameStartTime = ptsToSeconds (avFrame->pts , streamInfo.timeBase );
@@ -1100,7 +1100,7 @@ VideoDecoder::FrameOutput VideoDecoder::getFramePlayedAtTimestampNoDemux(
11001100 });
11011101
11021102 // Convert the frame to tensor.
1103- FrameOutput frameOutput = convertAVFrameToFrameOutput (rawOutput );
1103+ FrameOutput frameOutput = convertAVFrameToFrameOutput (avFrameWithStreamIndex );
11041104 frameOutput.data =
11051105 maybePermuteHWC2CHW (frameOutput.streamIndex , frameOutput.data );
11061106 return frameOutput;
@@ -1473,14 +1473,13 @@ VideoDecoder::FrameBatchOutput VideoDecoder::getFramesPlayedByTimestampInRange(
14731473 return frameBatchOutput;
14741474}
14751475
1476- VideoDecoder::AVFrameWithStreamIndex
1477- VideoDecoder::getNextAVFrameNoDemux () {
1478- auto rawOutput = getAVFrameUsingFilterFunction (
1476+ VideoDecoder::AVFrameWithStreamIndex VideoDecoder::getNextAVFrameNoDemux () {
1477+ auto avFrameWithStreamIndex = getAVFrameUsingFilterFunction (
14791478 [this ](int frameStreamIndex, AVFrame* avFrame) {
14801479 StreamInfo& activeStreamInfo = streamInfos_[frameStreamIndex];
14811480 return avFrame->pts >= activeStreamInfo.discardFramesBeforePts ;
14821481 });
1483- return rawOutput ;
1482+ return avFrameWithStreamIndex ;
14841483}
14851484
14861485VideoDecoder::FrameOutput VideoDecoder::getNextFrameNoDemux () {
@@ -1491,8 +1490,9 @@ VideoDecoder::FrameOutput VideoDecoder::getNextFrameNoDemux() {
14911490
14921491VideoDecoder::FrameOutput VideoDecoder::getNextFrameNoDemuxInternal (
14931492 std::optional<torch::Tensor> preAllocatedOutputTensor) {
1494- auto rawOutput = getNextAVFrameNoDemux ();
1495- return convertAVFrameToFrameOutput (rawOutput, preAllocatedOutputTensor);
1493+ auto avFrameWithStreamIndex = getNextAVFrameNoDemux ();
1494+ return convertAVFrameToFrameOutput (
1495+ avFrameWithStreamIndex, preAllocatedOutputTensor);
14961496}
14971497
14981498void VideoDecoder::setCursorPtsInSeconds (double seconds) {
0 commit comments