mirror of
https://github.com/sipeed/LicheeRV-Nano-Build.git
synced 2026-09-10 20:59:59 -05:00
Merge branch 'feat_uvc_gadget'
1. fix: ensure mjpg and yuyv formats both exist. 2. feat: add support for mjpeg streaming with mask 0x80. 3. feat: add support for auto config formats and set resolution limit.
This commit is contained in:
Binary file not shown.
@@ -6,7 +6,7 @@ supported_formats="yuyv mjpg"
|
||||
|
||||
# 支持的分辨率,可以通过修改这个变量自定义支持的分辨率
|
||||
# Supported resolutions, you can customize the list by modifying this variable
|
||||
supported_resolutions="640x360 1280x720 1920x1080"
|
||||
supported_resolutions="480x320 640x360 640x480 1280x720 1920x1080"
|
||||
|
||||
|
||||
parse_uvc_config() {
|
||||
@@ -72,17 +72,27 @@ parse_uvc_config() {
|
||||
' "$input_file")
|
||||
fi
|
||||
|
||||
# 确保至少包含 'mjpg' 和 'yuyv' 格式 / Ensure at least one 'mjpg' and 'yuyv' format exists
|
||||
has_mjpg=$(echo "$parsed_data" | grep -w "mjpg")
|
||||
has_yuyv=$(echo "$parsed_data" | grep -w "yuyv")
|
||||
|
||||
if [ -z "$has_mjpg" ]; then
|
||||
echo "Warn: No 'mjpg' config found, adding default 'mjpg 640 360'." 1>&2
|
||||
parsed_data="$parsed_data"$'\n'"mjpg 640 360"
|
||||
fi
|
||||
|
||||
if [ -z "$has_yuyv" ]; then
|
||||
echo "Warn: No 'yuyv' config found, adding default 'yuyv 640 360'." 1>&2
|
||||
parsed_data="$parsed_data"$'\n'"yuyv 640 360"
|
||||
fi
|
||||
|
||||
# 如果没有解析到任何数据,或者文件不可读取,则返回默认值 / If no data is parsed or file is unreadable, return default values
|
||||
if [ -z "$parsed_data" ]; then
|
||||
echo "Warn: No valid config, using default instead." 1>&2 # 输出到标准错误 / Output to stderr
|
||||
parsed_data=$(
|
||||
echo "mjpg 640 360" # 默认值 / Default value
|
||||
echo "yuyv 640 360" # 默认值 / Default value
|
||||
)
|
||||
parsed_data="mjpg 640 360"$'\n'"yuyv 640 360"
|
||||
fi
|
||||
|
||||
echo "$parsed_data" # 返回解析的数据 / Return the parsed data
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user