Skip to content

Commit 9c0266c

Browse files
committed
Limiting the output resolution based on the sensor capabilities on t31
1 parent d2af1c5 commit 9c0266c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

doc/endpoints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Configures text or image overlays by their ID (0-9 at the moment).
225225
| GET | `posy` | Y coordinate (write-only) |
226226
| GET | `outl` | Outline color (hex format, RGB555 format) |
227227
| GET | `thick` | Outline thickness (0 to disable) |
228-
| POST | file | Bitmap or PNG image to upload (replaces text) |
228+
| POST | `file` | Bitmap or PNG image to upload (replaces text) |
229229

230230
**Response**
231231
```json

src/hal/inge/t31_hal.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ int t31_channel_create(char index, short width, short height, char framerate, ch
157157
{
158158
int ret;
159159

160+
if (width > _t31_snr_dim.width || height > _t31_snr_dim.height) {
161+
HAL_WARNING("t31_hal", "Channel %d: requested %dx%d too large, using sensor %dx%d\n",
162+
index, width, height, _t31_snr_dim.width, _t31_snr_dim.height);
163+
width = _t31_snr_dim.width;
164+
height = _t31_snr_dim.height;
165+
}
166+
160167
{
161168
t31_fs_chn channel = {
162169
.dest = { .width = _t31_snr_dim.width, .height = _t31_snr_dim.height }, .pixFmt = T31_PIXFMT_NV12,
@@ -400,6 +407,10 @@ int t31_video_create(char index, hal_vidconfig *config)
400407
}
401408

402409
memset(&channel, 0, sizeof(channel));
410+
if (config->width > _t31_snr_dim.width || config->height > _t31_snr_dim.height) {
411+
config->width = _t31_snr_dim.width;
412+
config->height = _t31_snr_dim.height;
413+
}
403414
t31_venc.fnSetDefaults(&channel, profile, ratemode, config->width, config->height,
404415
config->framerate, 1, config->gop, config->gop / config->framerate, -1, 0);
405416

0 commit comments

Comments
 (0)