Commit 2b980c5aec05c8f9175d623fee4d059943b084c8
1 parent
6fc86385
优化代码
Showing
3 changed files
with
11 additions
and
8 deletions
src/FFNvDecoder.cpp
@@ -233,13 +233,13 @@ void FFNvDecoder::decode_thread() | @@ -233,13 +233,13 @@ void FFNvDecoder::decode_thread() | ||
233 | if (stream_index == pkt->stream_index){ | 233 | if (stream_index == pkt->stream_index){ |
234 | result = avcodec_send_packet(avctx, pkt); | 234 | result = avcodec_send_packet(avctx, pkt); |
235 | if (result < 0){ | 235 | if (result < 0){ |
236 | - av_log(nullptr, AV_LOG_ERROR, "%s - Failed to send pkt: %d \n",name,result); | 236 | + av_log(nullptr, AV_LOG_ERROR, "%s - Failed to send pkt: %d \n",name.c_str(),result); |
237 | continue; | 237 | continue; |
238 | } | 238 | } |
239 | 239 | ||
240 | result = avcodec_receive_frame(avctx, gpuFrame); | 240 | result = avcodec_receive_frame(avctx, gpuFrame); |
241 | if ((result == AVERROR(EAGAIN) || result == AVERROR_EOF) || result < 0){ | 241 | if ((result == AVERROR(EAGAIN) || result == AVERROR_EOF) || result < 0){ |
242 | - av_log(nullptr, AV_LOG_ERROR, "%s - Failed to receive frame: %d \n",name,result); | 242 | + av_log(nullptr, AV_LOG_ERROR, "%s - Failed to receive frame: %d \n",name.c_str(),result); |
243 | continue; | 243 | continue; |
244 | } | 244 | } |
245 | 245 | ||
@@ -271,7 +271,7 @@ void FFNvDecoder::decode_thread() | @@ -271,7 +271,7 @@ void FFNvDecoder::decode_thread() | ||
271 | 271 | ||
272 | decode_finished(); | 272 | decode_finished(); |
273 | 273 | ||
274 | - av_log(nullptr, AV_LOG_INFO, "%s - decode thread exited. \n",name); | 274 | + av_log(nullptr, AV_LOG_INFO, "%s - decode thread exited. \n",name.c_str()); |
275 | } | 275 | } |
276 | 276 | ||
277 | void FFNvDecoder::decode_finished() | 277 | void FFNvDecoder::decode_finished() |
src/Makefile
@@ -2,11 +2,12 @@ | @@ -2,11 +2,12 @@ | ||
2 | XX = g++ | 2 | XX = g++ |
3 | NVCC = nvcc | 3 | NVCC = nvcc |
4 | 4 | ||
5 | -PROJECT_ROOT= /mnt/e/fiss/FFNvDecoder | 5 | + |
6 | +PROJECT_ROOT= /mnt/data/cmhu/FFNvDecoder | ||
6 | 7 | ||
7 | DEPEND_DIR = $(PROJECT_ROOT)/bin | 8 | DEPEND_DIR = $(PROJECT_ROOT)/bin |
8 | SRC_ROOT = $(PROJECT_ROOT)/src | 9 | SRC_ROOT = $(PROJECT_ROOT)/src |
9 | -CUDA_ROOT = /usr/local/cuda | 10 | +CUDA_ROOT = /usr/local/cuda-11.1 |
10 | 11 | ||
11 | TARGET= $(DEPEND_DIR)/lib/test | 12 | TARGET= $(DEPEND_DIR)/lib/test |
12 | 13 | ||
@@ -18,8 +19,7 @@ INCLUDE= -I $(DEPEND_DIR)/include \ | @@ -18,8 +19,7 @@ INCLUDE= -I $(DEPEND_DIR)/include \ | ||
18 | -I $(SRC_ROOT)\ | 19 | -I $(SRC_ROOT)\ |
19 | 20 | ||
20 | LIBSPATH= -L $(DEPEND_DIR)/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice \ | 21 | LIBSPATH= -L $(DEPEND_DIR)/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice \ |
21 | - -L $(CUDA_ROOT)/lib64 -lcudart -lcurand -lcublas -lnvjpeg \ | ||
22 | - -L /usr/lib/wsl/lib -lcuda -lnvcuvid\ | 22 | + -L $(CUDA_ROOT)/lib64 -lcuda -lcudart -lnvcuvid -lcurand -lcublas -lnvjpeg \ |
23 | 23 | ||
24 | CFLAGS= -g -fPIC -O0 $(INCLUDE) -pthread -lrt -lz -std=c++11 -fvisibility=hidden -Wl,-Bsymbolic -ldl | 24 | CFLAGS= -g -fPIC -O0 $(INCLUDE) -pthread -lrt -lz -std=c++11 -fvisibility=hidden -Wl,-Bsymbolic -ldl |
25 | # -DUNICODE -D_UNICODE | 25 | # -DUNICODE -D_UNICODE |
src/main.cpp
@@ -236,7 +236,10 @@ void logFF(void *, int level, const char *fmt, va_list ap) | @@ -236,7 +236,10 @@ void logFF(void *, int level, const char *fmt, va_list ap) | ||
236 | } | 236 | } |
237 | 237 | ||
238 | 238 | ||
239 | -int main(){ | 239 | +int main(int argc, char* argv[]){ |
240 | + | ||
241 | + test_uri = argv[1]; | ||
242 | + cout << test_uri << endl; | ||
240 | 243 | ||
241 | // av_log_set_callback(&logFF); | 244 | // av_log_set_callback(&logFF); |
242 | 245 |