fix: 编译视频程序使警告消失

This commit is contained in:
2026-04-02 16:59:08 +08:00
parent 21e7c17aff
commit 7b4a508c46
2 changed files with 10 additions and 2 deletions

View File

@@ -4,6 +4,10 @@ CPPFLAGS ?= -Iinclude -Ithird_party/cjson -Ithird_party/kcp
LDFLAGS ?= -pthread LDFLAGS ?= -pthread
PYTHON ?= python3 PYTHON ?= python3
ifeq ($(QUIET_FFMPEG_LOGS),1)
CFLAGS += -DQUIET_FFMPEG_LOGS
endif
BIN_DIR := bin BIN_DIR := bin
SRC_DIR := src SRC_DIR := src
CMD_DIR := cmd CMD_DIR := cmd

View File

@@ -268,7 +268,7 @@ AVCodecContext *create_mjpeg_decoder()
AVCodecContext *ctx = avcodec_alloc_context3(decoder); AVCodecContext *ctx = avcodec_alloc_context3(decoder);
ctx->width = WIDTH; ctx->width = WIDTH;
ctx->height = HEIGHT; ctx->height = HEIGHT;
ctx->pix_fmt = AV_PIX_FMT_YUVJ420P; // 使用YUVJ420P ctx->pix_fmt = AV_PIX_FMT_YUVJ420P; // Use YUVJ420P for MJPEG compatibility.
ctx->color_range = AVCOL_RANGE_JPEG; // JPEG范围 ctx->color_range = AVCOL_RANGE_JPEG; // JPEG范围
ctx->thread_count = 1; ctx->thread_count = 1;
@@ -299,7 +299,7 @@ AVCodecContext *create_mjpeg_encoder()
AVCodecContext *ctx = avcodec_alloc_context3(encoder); AVCodecContext *ctx = avcodec_alloc_context3(encoder);
ctx->width = OUTPUT_WIDTH; ctx->width = OUTPUT_WIDTH;
ctx->height = OUTPUT_HEIGHT; ctx->height = OUTPUT_HEIGHT;
ctx->pix_fmt = AV_PIX_FMT_YUVJ420P; // 使用YUVJ420P ctx->pix_fmt = AV_PIX_FMT_YUVJ420P; // Use YUVJ420P for MJPEG compatibility.
ctx->time_base = (AVRational){1, 30}; ctx->time_base = (AVRational){1, 30};
ctx->qmin = 8; ctx->qmin = 8;
ctx->qmax = 31; ctx->qmax = 31;
@@ -432,6 +432,10 @@ int main()
memset(&sender, 0, sizeof(sender)); memset(&sender, 0, sizeof(sender));
#ifdef QUIET_FFMPEG_LOGS
av_log_set_level(AV_LOG_ERROR);
#endif
PRINT_TIME("=== V4L2 Direct Capture + FFmpeg Processing ===\n"); PRINT_TIME("=== V4L2 Direct Capture + FFmpeg Processing ===\n");
// 1. Open V4L2 device // 1. Open V4L2 device