mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-02-28 20:56:33 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
142c8c84ac | ||
|
|
383075d323 | ||
|
|
e2922aa820 | ||
|
|
dc9667cf0c | ||
|
|
bbbfda0b5c | ||
|
|
aa3f079ee9 |
@@ -1,7 +1,7 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
commit = True
|
commit = True
|
||||||
tag = True
|
tag = True
|
||||||
current_version = 0.48
|
current_version = 0.50
|
||||||
parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?)?
|
parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?)?
|
||||||
serialize =
|
serialize =
|
||||||
{major}.{minor}
|
{major}.{minor}
|
||||||
|
|||||||
2
PKGBUILD
2
PKGBUILD
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
pkgname=ustreamer
|
pkgname=ustreamer
|
||||||
pkgver=0.48
|
pkgver=0.50
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Lightweight and fast MJPG-HTTP streamer"
|
pkgdesc="Lightweight and fast MJPG-HTTP streamer"
|
||||||
url="https://github.com/pi-kvm/ustreamer"
|
url="https://github.com/pi-kvm/ustreamer"
|
||||||
|
|||||||
@@ -22,4 +22,4 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION "0.48"
|
#define VERSION "0.50"
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ static int _device_apply_dv_timings(struct device_t *dev) {
|
|||||||
|
|
||||||
static int _device_open_format(struct device_t *dev) {
|
static int _device_open_format(struct device_t *dev) {
|
||||||
struct v4l2_format fmt;
|
struct v4l2_format fmt;
|
||||||
|
char format_str[8];
|
||||||
|
|
||||||
MEMSET_ZERO(fmt);
|
MEMSET_ZERO(fmt);
|
||||||
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
@@ -297,8 +298,6 @@ static int _device_open_format(struct device_t *dev) {
|
|||||||
// Set format
|
// Set format
|
||||||
LOG_DEBUG("Calling ioctl(VIDIOC_S_FMT) ...");
|
LOG_DEBUG("Calling ioctl(VIDIOC_S_FMT) ...");
|
||||||
if (xioctl(dev->run->fd, VIDIOC_S_FMT, &fmt) < 0) {
|
if (xioctl(dev->run->fd, VIDIOC_S_FMT, &fmt) < 0) {
|
||||||
char format_str[8];
|
|
||||||
|
|
||||||
LOG_PERROR(
|
LOG_PERROR(
|
||||||
"Unable to set format=%s; resolution=%ux%u",
|
"Unable to set format=%s; resolution=%ux%u",
|
||||||
_format_to_string_auto(format_str, 8, dev->format),
|
_format_to_string_auto(format_str, 8, dev->format),
|
||||||
@@ -319,13 +318,12 @@ static int _device_open_format(struct device_t *dev) {
|
|||||||
|
|
||||||
// Check format
|
// Check format
|
||||||
if (fmt.fmt.pix.pixelformat != dev->format) {
|
if (fmt.fmt.pix.pixelformat != dev->format) {
|
||||||
char format_requested_str[8];
|
|
||||||
char format_obtained_str[8];
|
char format_obtained_str[8];
|
||||||
char *format_str_nullable;
|
char *format_str_nullable;
|
||||||
|
|
||||||
LOG_ERROR(
|
LOG_ERROR(
|
||||||
"Could not obtain the requested pixelformat=%s; driver gave us %s",
|
"Could not obtain the requested pixelformat=%s; driver gave us %s",
|
||||||
_format_to_string_auto(format_requested_str, 8, dev->format),
|
_format_to_string_auto(format_str, 8, dev->format),
|
||||||
_format_to_string_auto(format_obtained_str, 8, fmt.fmt.pix.pixelformat)
|
_format_to_string_auto(format_obtained_str, 8, fmt.fmt.pix.pixelformat)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -340,7 +338,9 @@ static int _device_open_format(struct device_t *dev) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->run->format = fmt.fmt.pix.pixelformat;
|
dev->run->format = fmt.fmt.pix.pixelformat;
|
||||||
|
LOG_INFO("Using pixelformat: %s", _format_to_string_auto(format_str, 8, dev->run->format));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,6 +118,14 @@ void http_server_destroy(struct http_server_t *server) {
|
|||||||
event_base_free(server->run->base);
|
event_base_free(server->run->base);
|
||||||
libevent_global_shutdown();
|
libevent_global_shutdown();
|
||||||
|
|
||||||
|
for (struct stream_client_t *client = server->run->stream_clients; client != NULL;) {
|
||||||
|
struct stream_client_t *next = client->next;
|
||||||
|
|
||||||
|
free(client->key);
|
||||||
|
free(client);
|
||||||
|
client = next;
|
||||||
|
}
|
||||||
|
|
||||||
free(server->run->exposed->picture.data);
|
free(server->run->exposed->picture.data);
|
||||||
free(server->run->exposed);
|
free(server->run->exposed);
|
||||||
free(server->run);
|
free(server->run);
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ struct _mjpg_destination_mgr {
|
|||||||
static void _jpeg_set_dest_picture(j_compress_ptr jpeg, unsigned char *picture, unsigned long *written);
|
static void _jpeg_set_dest_picture(j_compress_ptr jpeg, unsigned char *picture, unsigned long *written);
|
||||||
|
|
||||||
static void _jpeg_write_scanlines_yuyv(struct jpeg_compress_struct *jpeg,
|
static void _jpeg_write_scanlines_yuyv(struct jpeg_compress_struct *jpeg,
|
||||||
unsigned char *line_buffer, const unsigned char *data,
|
unsigned char *line_buffer, const unsigned char *data,
|
||||||
const unsigned width, const unsigned height);
|
const unsigned width, const unsigned height);
|
||||||
|
|
||||||
static void _jpeg_write_scanlines_uyvy(struct jpeg_compress_struct *jpeg,
|
static void _jpeg_write_scanlines_uyvy(struct jpeg_compress_struct *jpeg,
|
||||||
unsigned char *line_buffer, const unsigned char *data,
|
unsigned char *line_buffer, const unsigned char *data,
|
||||||
@@ -93,6 +93,7 @@ void jpeg_encoder_compress_buffer(struct device_t *dev, const unsigned index, co
|
|||||||
|
|
||||||
# define WRITE_SCANLINES(_func) \
|
# define WRITE_SCANLINES(_func) \
|
||||||
_func(&jpeg, line_buffer, dev->run->hw_buffers[index].start, dev->run->width, dev->run->height)
|
_func(&jpeg, line_buffer, dev->run->hw_buffers[index].start, dev->run->width, dev->run->height)
|
||||||
|
|
||||||
switch (dev->run->format) {
|
switch (dev->run->format) {
|
||||||
// https://www.fourcc.org/yuv.php
|
// https://www.fourcc.org/yuv.php
|
||||||
case V4L2_PIX_FMT_YUYV: WRITE_SCANLINES(_jpeg_write_scanlines_yuyv); break;
|
case V4L2_PIX_FMT_YUYV: WRITE_SCANLINES(_jpeg_write_scanlines_yuyv); break;
|
||||||
@@ -100,6 +101,7 @@ void jpeg_encoder_compress_buffer(struct device_t *dev, const unsigned index, co
|
|||||||
case V4L2_PIX_FMT_RGB565: WRITE_SCANLINES(_jpeg_write_scanlines_rgb565); break;
|
case V4L2_PIX_FMT_RGB565: WRITE_SCANLINES(_jpeg_write_scanlines_rgb565); break;
|
||||||
default: assert(0 && "Unsupported input format for JPEG compressor");
|
default: assert(0 && "Unsupported input format for JPEG compressor");
|
||||||
}
|
}
|
||||||
|
|
||||||
# undef WRITE_SCANLINES
|
# undef WRITE_SCANLINES
|
||||||
|
|
||||||
// TODO: process jpeg errors:
|
// TODO: process jpeg errors:
|
||||||
@@ -128,6 +130,8 @@ static void _jpeg_set_dest_picture(j_compress_ptr jpeg, unsigned char *picture,
|
|||||||
dest->written = written;
|
dest->written = written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define NORM_COMPONENT(_x) (((_x) > 255) ? 255 : (((_x) < 0) ? 0 : (_x)))
|
||||||
|
|
||||||
static void _jpeg_write_scanlines_yuyv(struct jpeg_compress_struct *jpeg,
|
static void _jpeg_write_scanlines_yuyv(struct jpeg_compress_struct *jpeg,
|
||||||
unsigned char *line_buffer, const unsigned char *data,
|
unsigned char *line_buffer, const unsigned char *data,
|
||||||
const unsigned width, const unsigned height) {
|
const unsigned width, const unsigned height) {
|
||||||
@@ -147,9 +151,9 @@ static void _jpeg_write_scanlines_yuyv(struct jpeg_compress_struct *jpeg,
|
|||||||
int g = (y - (88 * u) - (183 * v)) >> 8;
|
int g = (y - (88 * u) - (183 * v)) >> 8;
|
||||||
int b = (y + (454 * u)) >> 8;
|
int b = (y + (454 * u)) >> 8;
|
||||||
|
|
||||||
*(ptr++) = (r > 255) ? 255 : ((r < 0) ? 0 : r);
|
*(ptr++) = NORM_COMPONENT(r);
|
||||||
*(ptr++) = (g > 255) ? 255 : ((g < 0) ? 0 : g);
|
*(ptr++) = NORM_COMPONENT(g);
|
||||||
*(ptr++) = (b > 255) ? 255 : ((b < 0) ? 0 : b);
|
*(ptr++) = NORM_COMPONENT(b);
|
||||||
|
|
||||||
if (z++) {
|
if (z++) {
|
||||||
z = 0;
|
z = 0;
|
||||||
@@ -181,9 +185,9 @@ static void _jpeg_write_scanlines_uyvy(struct jpeg_compress_struct *jpeg,
|
|||||||
int g = (y - (88 * u) - (183 * v)) >> 8;
|
int g = (y - (88 * u) - (183 * v)) >> 8;
|
||||||
int b = (y + (454 * u)) >> 8;
|
int b = (y + (454 * u)) >> 8;
|
||||||
|
|
||||||
*(ptr++) = (r > 255) ? 255 : ((r < 0) ? 0 : r);
|
*(ptr++) = NORM_COMPONENT(r);
|
||||||
*(ptr++) = (g > 255) ? 255 : ((g < 0) ? 0 : g);
|
*(ptr++) = NORM_COMPONENT(g);
|
||||||
*(ptr++) = (b > 255) ? 255 : ((b < 0) ? 0 : b);
|
*(ptr++) = NORM_COMPONENT(b);
|
||||||
|
|
||||||
if (z++) {
|
if (z++) {
|
||||||
z = 0;
|
z = 0;
|
||||||
@@ -196,6 +200,8 @@ static void _jpeg_write_scanlines_uyvy(struct jpeg_compress_struct *jpeg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef NORM_COMPONENT
|
||||||
|
|
||||||
static void _jpeg_write_scanlines_rgb565(struct jpeg_compress_struct *jpeg,
|
static void _jpeg_write_scanlines_rgb565(struct jpeg_compress_struct *jpeg,
|
||||||
unsigned char *line_buffer, const unsigned char *data,
|
unsigned char *line_buffer, const unsigned char *data,
|
||||||
const unsigned width, const unsigned height) {
|
const unsigned width, const unsigned height) {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
#include "http.h"
|
#include "http.h"
|
||||||
|
|
||||||
|
|
||||||
static const char _short_opts[] = "d:i:x:y:f:a:z:tn:w:q:c:s:p:u:ro:e:h";
|
static const char _short_opts[] = "d:i:x:y:m:a:f:z:tb:w:q:c:s:p:u:ro:e:h";
|
||||||
static const struct option _long_opts[] = {
|
static const struct option _long_opts[] = {
|
||||||
{"device", required_argument, NULL, 'd'},
|
{"device", required_argument, NULL, 'd'},
|
||||||
{"input", required_argument, NULL, 'i'},
|
{"input", required_argument, NULL, 'i'},
|
||||||
|
|||||||
Reference in New Issue
Block a user