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(
598
598
// TODO-VideoEncoder: Remove assumption that tensor in NCHW format
599
599
auto sizes = frames_.sizes ();
600
600
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 ]) ;
603
603
604
604
// Use specified dimensions or input dimensions
605
605
// TODO-VideoEncoder: Allow height and width to be set
@@ -664,7 +664,7 @@ void VideoEncoder::encode() {
664
664
getFFMPEGErrorStringFromErrorCode (status));
665
665
666
666
AutoAVPacket autoAVPacket;
667
- int numFrames = frames_.sizes ()[0 ];
667
+ int numFrames = static_cast < int >( frames_.sizes ()[0 ]) ;
668
668
for (int i = 0 ; i < numFrames; ++i) {
669
669
torch::Tensor currFrame = frames_[i];
670
670
UniqueAVFrame avFrame = convertTensorToAVFrame (currFrame, i);
Original file line number Diff line number Diff line change @@ -125,6 +125,16 @@ class VideoEncoder {
125
125
public:
126
126
~VideoEncoder ();
127
127
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
+
128
138
VideoEncoder (
129
139
const torch::Tensor& frames,
130
140
int frameRate,
@@ -143,7 +153,7 @@ class VideoEncoder {
143
153
144
154
UniqueEncodingAVFormatContext avFormatContext_;
145
155
UniqueAVCodecContext avCodecContext_;
146
- int streamIndex_;
156
+ int streamIndex_ = - 1 ;
147
157
UniqueSwsContext swsContext_;
148
158
149
159
const torch::Tensor frames_;
You can’t perform that action at this time.
0 commit comments