Skip to content

Commit 2592888

Browse files
committed
Return int in callback instead of unsigned char
1 parent aad142e commit 2592888

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/torchcodec/_core/BetaCudaDeviceInterface.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static int CUDAAPI
3737
pfnSequenceCallback(void* pUserData, CUVIDEOFORMAT* videoFormat) {
3838
BetaCudaDeviceInterface* decoder =
3939
static_cast<BetaCudaDeviceInterface*>(pUserData);
40-
return static_cast<int>(decoder->streamPropertyChange(videoFormat));
40+
return decoder->streamPropertyChange(videoFormat);
4141
}
4242

4343
static int CUDAAPI
@@ -217,8 +217,7 @@ void BetaCudaDeviceInterface::initializeInterface(AVStream* avStream) {
217217
// TODONVDEC P1: Code below mostly assume this is called only once at the start,
218218
// we should handle the case of multiple calls. Probably need to flush buffers,
219219
// etc.
220-
unsigned char BetaCudaDeviceInterface::streamPropertyChange(
221-
CUVIDEOFORMAT* videoFormat) {
220+
int BetaCudaDeviceInterface::streamPropertyChange(CUVIDEOFORMAT* videoFormat) {
222221
TORCH_CHECK(videoFormat != nullptr, "Invalid video format");
223222

224223
videoFormat_ = *videoFormat;
@@ -243,7 +242,7 @@ unsigned char BetaCudaDeviceInterface::streamPropertyChange(
243242
// DALI also returns min_num_decode_surfaces from this function. This
244243
// instructs the parser to reset its ulMaxNumDecodeSurfaces field to this
245244
// value.
246-
return videoFormat_.min_num_decode_surfaces;
245+
return static_cast<int>(videoFormat_.min_num_decode_surfaces);
247246
}
248247

249248
// Moral equivalent of avcodec_send_packet(). Here, we pass the AVPacket down to

src/torchcodec/_core/BetaCudaDeviceInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class BetaCudaDeviceInterface : public DeviceInterface {
5656
void flush() override;
5757

5858
// NVDEC callback functions (must be public for C callbacks)
59-
unsigned char streamPropertyChange(CUVIDEOFORMAT* videoFormat);
59+
int streamPropertyChange(CUVIDEOFORMAT* videoFormat);
6060
int frameReadyForDecoding(CUVIDPICPARAMS* pPicParams);
6161

6262
private:

0 commit comments

Comments
 (0)