-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
122 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# This is a patch file for decord https://github.com/dmlc/decord | ||
# needed to build decord against ffmpeg6, taken from | ||
# https://github.com/dmlc/decord/issues/186#issuecomment-1171882325 | ||
# This needs to be removed once decord natively supports latest ffmpeg versions. | ||
diff --git a/src/video/ffmpeg/ffmpeg_common.h b/src/video/ffmpeg/ffmpeg_common.h | ||
index b0b973f..f0f7316 100644 | ||
--- a/src/video/ffmpeg/ffmpeg_common.h | ||
+++ b/src/video/ffmpeg/ffmpeg_common.h | ||
@@ -21,6 +21,7 @@ | ||
extern "C" { | ||
#endif | ||
#include <libavcodec/avcodec.h> | ||
+#include <libavcodec/bsf.h> | ||
#include <libavformat/avformat.h> | ||
#include <libavformat/avio.h> | ||
#include <libavfilter/avfilter.h> | ||
diff --git a/src/video/nvcodec/cuda_threaded_decoder.cc b/src/video/nvcodec/cuda_threaded_decoder.cc | ||
index 62bc7ee..957a90d 100644 | ||
--- a/src/video/nvcodec/cuda_threaded_decoder.cc | ||
+++ b/src/video/nvcodec/cuda_threaded_decoder.cc | ||
@@ -17,7 +17,7 @@ namespace decord { | ||
namespace cuda { | ||
using namespace runtime; | ||
|
||
-CUThreadedDecoder::CUThreadedDecoder(int device_id, AVCodecParameters *codecpar, AVInputFormat *iformat) | ||
+CUThreadedDecoder::CUThreadedDecoder(int device_id, AVCodecParameters *codecpar, const AVInputFormat *iformat) | ||
: device_id_(device_id), stream_({device_id, false}), device_{}, ctx_{}, parser_{}, decoder_{}, | ||
pkt_queue_{}, frame_queue_{}, | ||
run_(false), frame_count_(0), draining_(false), | ||
@@ -70,7 +70,7 @@ CUThreadedDecoder::CUThreadedDecoder(int device_id, AVCodecParameters *codecpar, | ||
} | ||
} | ||
|
||
-void CUThreadedDecoder::InitBitStreamFilter(AVCodecParameters *codecpar, AVInputFormat *iformat) { | ||
+void CUThreadedDecoder::InitBitStreamFilter(AVCodecParameters *codecpar, const AVInputFormat *iformat) { | ||
const char* bsf_name = nullptr; | ||
if (AV_CODEC_ID_H264 == codecpar->codec_id) { | ||
// H.264 | ||
diff --git a/src/video/nvcodec/cuda_threaded_decoder.h b/src/video/nvcodec/cuda_threaded_decoder.h | ||
index d7e6fcd..61958a1 100644 | ||
--- a/src/video/nvcodec/cuda_threaded_decoder.h | ||
+++ b/src/video/nvcodec/cuda_threaded_decoder.h | ||
@@ -46,7 +46,7 @@ class CUThreadedDecoder final : public ThreadedDecoderInterface { | ||
using FrameOrderQueuePtr = std::unique_ptr<FrameOrderQueue>; | ||
|
||
public: | ||
- CUThreadedDecoder(int device_id, AVCodecParameters *codecpar, AVInputFormat *iformat); | ||
+ CUThreadedDecoder(int device_id, AVCodecParameters *codecpar, const AVInputFormat *iformat); | ||
void SetCodecContext(AVCodecContext *dec_ctx, int width = -1, int height = -1, int rotation = 0); | ||
bool Initialized() const; | ||
void Start(); | ||
@@ -70,7 +70,7 @@ class CUThreadedDecoder final : public ThreadedDecoderInterface { | ||
void LaunchThreadImpl(); | ||
void RecordInternalError(std::string message); | ||
void CheckErrorStatus(); | ||
- void InitBitStreamFilter(AVCodecParameters *codecpar, AVInputFormat *iformat); | ||
+ void InitBitStreamFilter(AVCodecParameters *codecpar, const AVInputFormat *iformat); | ||
|
||
int device_id_; | ||
CUStream stream_; | ||
diff --git a/src/video/video_reader.cc b/src/video/video_reader.cc | ||
index af4858d..99c9635 100644 | ||
--- a/src/video/video_reader.cc | ||
+++ b/src/video/video_reader.cc | ||
@@ -145,7 +145,7 @@ VideoReader::~VideoReader(){ | ||
|
||
void VideoReader::SetVideoStream(int stream_nb) { | ||
if (!fmt_ctx_) return; | ||
- AVCodec *dec; | ||
+ const AVCodec *dec; | ||
int st_nb = av_find_best_stream(fmt_ctx_.get(), AVMEDIA_TYPE_VIDEO, stream_nb, -1, &dec, 0); | ||
// LOG(INFO) << "find best stream: " << st_nb; | ||
CHECK_GE(st_nb, 0) << "ERROR cannot find video stream with wanted index: " << stream_nb; |