File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -598,8 +598,8 @@ void VideoEncoder::initializeEncoder(
598598 // TODO-VideoEncoder: Remove assumption that tensor in NCHW format
599599 auto sizes = frames_.sizes ();
600600 inPixelFormat_ = AV_PIX_FMT_GBRP;
601- inHeight_ = sizes[2 ];
602- inWidth_ = sizes[3 ];
601+ inHeight_ = static_cast < int >( sizes[2 ]) ;
602+ inWidth_ = static_cast < int >( sizes[3 ]) ;
603603
604604 // Use specified dimensions or input dimensions
605605 // TODO-VideoEncoder: Allow height and width to be set
@@ -664,7 +664,7 @@ void VideoEncoder::encode() {
664664 getFFMPEGErrorStringFromErrorCode (status));
665665
666666 AutoAVPacket autoAVPacket;
667- int numFrames = frames_.sizes ()[0 ];
667+ int numFrames = static_cast < int >( frames_.sizes ()[0 ]) ;
668668 for (int i = 0 ; i < numFrames; ++i) {
669669 torch::Tensor currFrame = frames_[i];
670670 UniqueAVFrame avFrame = convertTensorToAVFrame (currFrame, i);
Original file line number Diff line number Diff line change @@ -125,6 +125,16 @@ class VideoEncoder {
125125 public:
126126 ~VideoEncoder ();
127127
128+ // Rule of Five requires that we define copy and move
129+ // constructors and assignment operators.
130+ // Both are deleted because we have unique_ptr members
131+ VideoEncoder (const VideoEncoder&) = delete ;
132+ VideoEncoder& operator =(const VideoEncoder&) = delete ;
133+
134+ // Move assignment operator deleted since we have a const member
135+ VideoEncoder (VideoEncoder&&) = default ;
136+ VideoEncoder& operator =(VideoEncoder&&) = delete ;
137+
128138 VideoEncoder (
129139 const torch::Tensor& frames,
130140 int frameRate,
@@ -143,7 +153,7 @@ class VideoEncoder {
143153
144154 UniqueEncodingAVFormatContext avFormatContext_;
145155 UniqueAVCodecContext avCodecContext_;
146- int streamIndex_;
156+ int streamIndex_ = - 1 ;
147157 UniqueSwsContext swsContext_;
148158
149159 const torch::Tensor frames_;
You can’t perform that action at this time.
0 commit comments