mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-02-27 04:06:30 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb07444b70 | ||
|
|
a8ba2f7364 | ||
|
|
171bcb315a | ||
|
|
911df1af15 | ||
|
|
a165ff4523 |
@@ -1,7 +1,7 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
commit = True
|
commit = True
|
||||||
tag = True
|
tag = True
|
||||||
current_version = 3.14
|
current_version = 3.16
|
||||||
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}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
.\" Manpage for ustreamer-dump.
|
.\" Manpage for ustreamer-dump.
|
||||||
.\" Open an issue or pull request to https://github.com/pikvm/ustreamer to correct errors or typos
|
.\" Open an issue or pull request to https://github.com/pikvm/ustreamer to correct errors or typos
|
||||||
.TH USTREAMER-DUMP 1 "version 3.14" "January 2021"
|
.TH USTREAMER-DUMP 1 "version 3.16" "January 2021"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
ustreamer-dump \- Dump uStreamer's memory sink to file
|
ustreamer-dump \- Dump uStreamer's memory sink to file
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
.\" Manpage for ustreamer.
|
.\" Manpage for ustreamer.
|
||||||
.\" Open an issue or pull request to https://github.com/pikvm/ustreamer to correct errors or typos
|
.\" Open an issue or pull request to https://github.com/pikvm/ustreamer to correct errors or typos
|
||||||
.TH USTREAMER 1 "version 3.14" "November 2020"
|
.TH USTREAMER 1 "version 3.16" "November 2020"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
ustreamer \- stream MJPG video from any V4L2 device to the network
|
ustreamer \- stream MJPG video from any V4L2 device to the network
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
pkgname=ustreamer
|
pkgname=ustreamer
|
||||||
pkgver=3.14
|
pkgver=3.16
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Lightweight and fast MJPG-HTTP streamer"
|
pkgdesc="Lightweight and fast MJPG-HTTP streamer"
|
||||||
url="https://github.com/pikvm/ustreamer"
|
url="https://github.com/pikvm/ustreamer"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=ustreamer
|
PKG_NAME:=ustreamer
|
||||||
PKG_VERSION:=3.14
|
PKG_VERSION:=3.16
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
PKG_MAINTAINER:=Maxim Devaev <mdevaev@gmail.com>
|
PKG_MAINTAINER:=Maxim Devaev <mdevaev@gmail.com>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from distutils.core import setup
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
setup(
|
setup(
|
||||||
name="ustreamer",
|
name="ustreamer",
|
||||||
version="3.14",
|
version="3.16",
|
||||||
description="uStreamer tools",
|
description="uStreamer tools",
|
||||||
author="Maxim Devaev",
|
author="Maxim Devaev",
|
||||||
author_email="mdevaev@gmail.com",
|
author_email="mdevaev@gmail.com",
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ typedef struct {
|
|||||||
unsigned stride;
|
unsigned stride;
|
||||||
|
|
||||||
bool online;
|
bool online;
|
||||||
|
bool key;
|
||||||
|
|
||||||
long double grab_ts;
|
long double grab_ts;
|
||||||
long double encode_begin_ts;
|
long double encode_begin_ts;
|
||||||
@@ -195,6 +196,7 @@ static int wait_frame(MemsinkObject *self) {
|
|||||||
&& CMP(format)
|
&& CMP(format)
|
||||||
&& CMP(stride)
|
&& CMP(stride)
|
||||||
&& CMP(online)
|
&& CMP(online)
|
||||||
|
&& CMP(key)
|
||||||
&& (TMP(ts) + self->drop_same_frames > now)
|
&& (TMP(ts) + self->drop_same_frames > now)
|
||||||
&& !memcmp(TMP(data), MEM(data), MEM(used))
|
&& !memcmp(TMP(data), MEM(data), MEM(used))
|
||||||
) {
|
) {
|
||||||
@@ -249,6 +251,7 @@ static PyObject *MemsinkObject_wait_frame(MemsinkObject *self, PyObject *Py_UNUS
|
|||||||
COPY(format);
|
COPY(format);
|
||||||
COPY(stride);
|
COPY(stride);
|
||||||
COPY(online);
|
COPY(online);
|
||||||
|
COPY(key);
|
||||||
COPY(grab_ts);
|
COPY(grab_ts);
|
||||||
COPY(encode_begin_ts);
|
COPY(encode_begin_ts);
|
||||||
COPY(encode_end_ts);
|
COPY(encode_end_ts);
|
||||||
@@ -291,6 +294,7 @@ static PyObject *MemsinkObject_wait_frame(MemsinkObject *self, PyObject *Py_UNUS
|
|||||||
SET_NUMBER(format, Long, Long);
|
SET_NUMBER(format, Long, Long);
|
||||||
SET_NUMBER(stride, Long, Long);
|
SET_NUMBER(stride, Long, Long);
|
||||||
SET_NUMBER(online, Long, Bool);
|
SET_NUMBER(online, Long, Bool);
|
||||||
|
SET_NUMBER(key, Long, Bool);
|
||||||
SET_NUMBER(grab_ts, Double, Float);
|
SET_NUMBER(grab_ts, Double, Float);
|
||||||
SET_NUMBER(encode_begin_ts, Double, Float);
|
SET_NUMBER(encode_begin_ts, Double, Float);
|
||||||
SET_NUMBER(encode_end_ts, Double, Float);
|
SET_NUMBER(encode_end_ts, Double, Float);
|
||||||
|
|||||||
@@ -213,6 +213,8 @@ static int _dump_sink(const char *sink_name, unsigned sink_timeout, _output_cont
|
|||||||
unsigned fps_accum = 0;
|
unsigned fps_accum = 0;
|
||||||
long long fps_second = 0;
|
long long fps_second = 0;
|
||||||
|
|
||||||
|
long double last_ts = 0;
|
||||||
|
|
||||||
while (!global_stop) {
|
while (!global_stop) {
|
||||||
int error = memsink_client_get(sink, frame);
|
int error = memsink_client_get(sink, frame);
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
@@ -220,11 +222,12 @@ static int _dump_sink(const char *sink_name, unsigned sink_timeout, _output_cont
|
|||||||
const long long now_second = floor_ms(now);
|
const long long now_second = floor_ms(now);
|
||||||
|
|
||||||
char fourcc_str[8];
|
char fourcc_str[8];
|
||||||
LOG_VERBOSE("Frame: size=%zu, resolution=%ux%u, fourcc=%s, stride=%u, online=%d, latency=%.3Lf",
|
LOG_VERBOSE("Frame: size=%zu, res=%ux%u, fourcc=%s, stride=%u, online=%d, key=%d, latency=%.3Lf, diff=%.3Lf",
|
||||||
frame->used, frame->width, frame->height,
|
frame->used, frame->width, frame->height,
|
||||||
fourcc_to_string(frame->format, fourcc_str, 8),
|
fourcc_to_string(frame->format, fourcc_str, 8),
|
||||||
frame->stride, frame->online,
|
frame->stride, frame->online, frame->key,
|
||||||
now - frame->grab_ts);
|
now - frame->grab_ts, (last_ts ? now - last_ts : 0));
|
||||||
|
last_ts = now;
|
||||||
|
|
||||||
LOG_DEBUG(" grab_ts=%.3Lf, encode_begin_ts=%.3Lf, encode_end_ts=%.3Lf",
|
LOG_DEBUG(" grab_ts=%.3Lf, encode_begin_ts=%.3Lf, encode_end_ts=%.3Lf",
|
||||||
frame->grab_ts, frame->encode_begin_ts, frame->encode_end_ts);
|
frame->grab_ts, frame->encode_begin_ts, frame->encode_end_ts);
|
||||||
|
|||||||
@@ -23,5 +23,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef VERSION
|
#ifndef VERSION
|
||||||
# define VERSION "3.14"
|
# define VERSION "3.16"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ void frame_copy_meta(const frame_s *src, frame_s *dest) {
|
|||||||
COPY(format);
|
COPY(format);
|
||||||
COPY(stride);
|
COPY(stride);
|
||||||
COPY(online);
|
COPY(online);
|
||||||
|
COPY(key);
|
||||||
COPY(grab_ts);
|
COPY(grab_ts);
|
||||||
COPY(encode_begin_ts);
|
COPY(encode_begin_ts);
|
||||||
COPY(encode_end_ts);
|
COPY(encode_end_ts);
|
||||||
@@ -98,6 +99,7 @@ bool frame_compare(const frame_s *a, const frame_s *b) {
|
|||||||
&& CMP(format)
|
&& CMP(format)
|
||||||
&& CMP(stride)
|
&& CMP(stride)
|
||||||
&& CMP(online)
|
&& CMP(online)
|
||||||
|
&& CMP(key)
|
||||||
&& !memcmp(a->data, b->data, b->used)
|
&& !memcmp(a->data, b->data, b->used)
|
||||||
);
|
);
|
||||||
# undef CMP
|
# undef CMP
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ typedef struct {
|
|||||||
// https://medium.com/@oleg.shipitko/what-does-stride-mean-in-image-processing-bba158a72bcd
|
// https://medium.com/@oleg.shipitko/what-does-stride-mean-in-image-processing-bba158a72bcd
|
||||||
|
|
||||||
bool online;
|
bool online;
|
||||||
|
bool key;
|
||||||
|
|
||||||
long double grab_ts;
|
long double grab_ts;
|
||||||
long double encode_begin_ts;
|
long double encode_begin_ts;
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ bool memsink_server_check(memsink_s *sink, const frame_s *frame) {
|
|||||||
sink->has_clients = (sink->mem->last_client_ts + sink->client_ttl > get_now_monotonic());
|
sink->has_clients = (sink->mem->last_client_ts + sink->client_ttl > get_now_monotonic());
|
||||||
|
|
||||||
# define NEQ(_field) (sink->mem->_field != frame->_field)
|
# define NEQ(_field) (sink->mem->_field != frame->_field)
|
||||||
bool retval = (sink->has_clients || NEQ(width) || NEQ(height) || NEQ(format) || NEQ(stride) || NEQ(online));
|
bool retval = (sink->has_clients || NEQ(width) || NEQ(height) || NEQ(format) || NEQ(stride) || NEQ(online) || NEQ(key));
|
||||||
# undef NEQ
|
# undef NEQ
|
||||||
|
|
||||||
if (flock(sink->fd, LOCK_UN) < 0) {
|
if (flock(sink->fd, LOCK_UN) < 0) {
|
||||||
@@ -142,6 +142,7 @@ int memsink_server_put(memsink_s *sink, const frame_s *frame) {
|
|||||||
COPY(format);
|
COPY(format);
|
||||||
COPY(stride);
|
COPY(stride);
|
||||||
COPY(online);
|
COPY(online);
|
||||||
|
COPY(key);
|
||||||
COPY(grab_ts);
|
COPY(grab_ts);
|
||||||
COPY(encode_begin_ts);
|
COPY(encode_begin_ts);
|
||||||
COPY(encode_end_ts);
|
COPY(encode_end_ts);
|
||||||
@@ -195,6 +196,7 @@ int memsink_client_get(memsink_s *sink, frame_s *frame) { // cppcheck-suppress u
|
|||||||
COPY(format);
|
COPY(format);
|
||||||
COPY(stride);
|
COPY(stride);
|
||||||
COPY(online);
|
COPY(online);
|
||||||
|
COPY(key);
|
||||||
COPY(grab_ts);
|
COPY(grab_ts);
|
||||||
COPY(encode_begin_ts);
|
COPY(encode_begin_ts);
|
||||||
COPY(encode_end_ts);
|
COPY(encode_end_ts);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define MEMSINK_MAGIC ((uint64_t)0xCAFEBABECAFEBABE)
|
#define MEMSINK_MAGIC ((uint64_t)0xCAFEBABECAFEBABE)
|
||||||
#define MEMSINK_VERSION ((uint32_t)1)
|
#define MEMSINK_VERSION ((uint32_t)2)
|
||||||
|
|
||||||
#ifndef CFG_MEMSINK_MAX_DATA
|
#ifndef CFG_MEMSINK_MAX_DATA
|
||||||
# define CFG_MEMSINK_MAX_DATA 33554432
|
# define CFG_MEMSINK_MAX_DATA 33554432
|
||||||
@@ -49,6 +49,7 @@ typedef struct {
|
|||||||
unsigned format;
|
unsigned format;
|
||||||
unsigned stride;
|
unsigned stride;
|
||||||
bool online;
|
bool online;
|
||||||
|
bool key;
|
||||||
|
|
||||||
long double grab_ts;
|
long double grab_ts;
|
||||||
long double encode_begin_ts;
|
long double encode_begin_ts;
|
||||||
|
|||||||
@@ -212,7 +212,8 @@ int h264_encoder_prepare(h264_encoder_s *enc, const frame_s *frame, bool zero_co
|
|||||||
SET_PORT_PARAM(output, uint32, VIDEO_ENCODE_PEAK_RATE, enc->bitrate * 1000);
|
SET_PORT_PARAM(output, uint32, VIDEO_ENCODE_PEAK_RATE, enc->bitrate * 1000);
|
||||||
SET_PORT_PARAM(output, uint32, VIDEO_ENCODE_MIN_QUANT, 16);
|
SET_PORT_PARAM(output, uint32, VIDEO_ENCODE_MIN_QUANT, 16);
|
||||||
SET_PORT_PARAM(output, uint32, VIDEO_ENCODE_MAX_QUANT, 34);
|
SET_PORT_PARAM(output, uint32, VIDEO_ENCODE_MAX_QUANT, 34);
|
||||||
SET_PORT_PARAM(output, uint32, VIDEO_ENCODE_FRAME_LIMIT_BITS, 1000000);
|
// Этот параметр с этим значением фризит кодирование изображения из черно-белой консоли
|
||||||
|
// SET_PORT_PARAM(output, uint32, VIDEO_ENCODE_FRAME_LIMIT_BITS, 1000000);
|
||||||
SET_PORT_PARAM(output, uint32, VIDEO_ENCODE_H264_AU_DELIMITERS, MMAL_FALSE);
|
SET_PORT_PARAM(output, uint32, VIDEO_ENCODE_H264_AU_DELIMITERS, MMAL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,6 +348,7 @@ static int _h264_encoder_compress_raw(h264_encoder_s *enc, const frame_s *src, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
frame_append_data(dest, out->data, out->length);
|
frame_append_data(dest, out->data, out->length);
|
||||||
|
dest->key = out->flags & MMAL_BUFFER_HEADER_FLAG_KEYFRAME;
|
||||||
|
|
||||||
eos = out->flags & MMAL_BUFFER_HEADER_FLAG_EOS;
|
eos = out->flags & MMAL_BUFFER_HEADER_FLAG_EOS;
|
||||||
mmal_buffer_header_release(out);
|
mmal_buffer_header_release(out);
|
||||||
|
|||||||
Reference in New Issue
Block a user