From 2b980c5aec05c8f9175d623fee4d059943b084c8 Mon Sep 17 00:00:00 2001 From: ming Date: Wed, 7 Dec 2022 15:04:28 +0800 Subject: [PATCH] 优化代码 --- src/FFNvDecoder.cpp | 6 +++--- src/Makefile | 8 ++++---- src/main.cpp | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/FFNvDecoder.cpp b/src/FFNvDecoder.cpp index b9885cc..67021f3 100644 --- a/src/FFNvDecoder.cpp +++ b/src/FFNvDecoder.cpp @@ -233,13 +233,13 @@ void FFNvDecoder::decode_thread() if (stream_index == pkt->stream_index){ result = avcodec_send_packet(avctx, pkt); if (result < 0){ - av_log(nullptr, AV_LOG_ERROR, "%s - Failed to send pkt: %d \n",name,result); + av_log(nullptr, AV_LOG_ERROR, "%s - Failed to send pkt: %d \n",name.c_str(),result); continue; } result = avcodec_receive_frame(avctx, gpuFrame); if ((result == AVERROR(EAGAIN) || result == AVERROR_EOF) || result < 0){ - av_log(nullptr, AV_LOG_ERROR, "%s - Failed to receive frame: %d \n",name,result); + av_log(nullptr, AV_LOG_ERROR, "%s - Failed to receive frame: %d \n",name.c_str(),result); continue; } @@ -271,7 +271,7 @@ void FFNvDecoder::decode_thread() decode_finished(); - av_log(nullptr, AV_LOG_INFO, "%s - decode thread exited. \n",name); + av_log(nullptr, AV_LOG_INFO, "%s - decode thread exited. \n",name.c_str()); } void FFNvDecoder::decode_finished() diff --git a/src/Makefile b/src/Makefile index f5ae7f7..7b7d066 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,11 +2,12 @@ XX = g++ NVCC = nvcc -PROJECT_ROOT= /mnt/e/fiss/FFNvDecoder + +PROJECT_ROOT= /mnt/data/cmhu/FFNvDecoder DEPEND_DIR = $(PROJECT_ROOT)/bin SRC_ROOT = $(PROJECT_ROOT)/src -CUDA_ROOT = /usr/local/cuda +CUDA_ROOT = /usr/local/cuda-11.1 TARGET= $(DEPEND_DIR)/lib/test @@ -18,8 +19,7 @@ INCLUDE= -I $(DEPEND_DIR)/include \ -I $(SRC_ROOT)\ LIBSPATH= -L $(DEPEND_DIR)/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice \ - -L $(CUDA_ROOT)/lib64 -lcudart -lcurand -lcublas -lnvjpeg \ - -L /usr/lib/wsl/lib -lcuda -lnvcuvid\ + -L $(CUDA_ROOT)/lib64 -lcuda -lcudart -lnvcuvid -lcurand -lcublas -lnvjpeg \ CFLAGS= -g -fPIC -O0 $(INCLUDE) -pthread -lrt -lz -std=c++11 -fvisibility=hidden -Wl,-Bsymbolic -ldl # -DUNICODE -D_UNICODE diff --git a/src/main.cpp b/src/main.cpp index 1df4833..c8b39b3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -236,7 +236,10 @@ void logFF(void *, int level, const char *fmt, va_list ap) } -int main(){ +int main(int argc, char* argv[]){ + + test_uri = argv[1]; + cout << test_uri << endl; // av_log_set_callback(&logFF); -- libgit2 0.21.4