Skip to content

Commit 7b3be11

Browse files
committed
Make the type name even uglier
1 parent 4ccb307 commit 7b3be11

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/torchcodec/decoders/_core/FFMPEGCommon.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
namespace facebook::torchcodec {
1212

13-
AVCodecPtrBestStream makeAVCodecPtrBestStream(const AVCodec* codec) {
13+
AVCodecOnlyUseForCallingAVFindBestStream
14+
makeAVCodecOnlyUseForCallingAVFindBestStream(const AVCodec* codec) {
1415
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59, 18, 100)
1516
return const_cast<AVCodec*>(codec);
1617
#else

src/torchcodec/decoders/_core/FFMPEGCommon.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,13 @@ using UniqueSwsContext =
7878
// Note that the alias is so-named so that it is only used when interacting with
7979
// av_find_best_stream(). It is not needed elsewhere.
8080
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59, 18, 100)
81-
using AVCodecPtrBestStream = AVCodec*;
81+
using AVCodecOnlyUseForCallingAVFindBestStream = AVCodec*;
8282
#else
83-
using AVCodecPtrBestStream = const AVCodec*;
83+
using AVCodecOnlyUseForCallingAVFindBestStream = const AVCodec*;
8484
#endif
8585

86-
AVCodecPtrBestStream makeAVCodecPtrBestStream(const AVCodec* codec);
86+
AVCodecOnlyUseForCallingAVFindBestStream
87+
makeAVCodecOnlyUseForCallingAVFindBestStream(const AVCodec* codec);
8788

8889
// Success code from FFMPEG is just a 0. We define it to make the code more
8990
// readable.

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ void VideoDecoder::createFilterGraph(
426426
}
427427

428428
int VideoDecoder::getBestStreamIndex(AVMediaType mediaType) {
429-
AVCodecPtrBestStream codec = nullptr;
429+
AVCodecOnlyUseForCallingAVFindBestStream codec = nullptr;
430430
int streamNumber =
431431
av_find_best_stream(formatContext_.get(), mediaType, -1, -1, &codec, 0);
432432
return streamNumber;
@@ -441,7 +441,7 @@ void VideoDecoder::addVideoStreamDecoder(
441441
" is already active.");
442442
}
443443
TORCH_CHECK(formatContext_.get() != nullptr);
444-
AVCodecPtrBestStream codec = nullptr;
444+
AVCodecOnlyUseForCallingAVFindBestStream codec = nullptr;
445445
int streamNumber = av_find_best_stream(
446446
formatContext_.get(),
447447
AVMEDIA_TYPE_VIDEO,
@@ -464,7 +464,7 @@ void VideoDecoder::addVideoStreamDecoder(
464464
}
465465

466466
if (options.device.type() == torch::kCUDA) {
467-
codec = makeAVCodecPtrBestStream(
467+
codec = makeAVCodecOnlyUseForCallingAVFindBestStream(
468468
findCudaCodec(options.device, streamInfo.stream->codecpar->codec_id)
469469
.value_or(codec));
470470
}

0 commit comments

Comments
 (0)