mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-18 05:23:43 +00:00
pass gop to memsink
This commit is contained in:
@@ -236,6 +236,7 @@ static PyObject *_MemsinkObject_wait_frame(_MemsinkObject *self, PyObject *args,
|
|||||||
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(key, Long, Bool);
|
||||||
|
SET_NUMBER(gop, Long, Long);
|
||||||
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);
|
||||||
|
|||||||
@@ -52,11 +52,11 @@ void us_output_file_write(void *v_output, const us_frame_s *frame) {
|
|||||||
us_base64_encode(frame->data, frame->used, &output->base64_data, &output->base64_allocated);
|
us_base64_encode(frame->data, frame->used, &output->base64_data, &output->base64_allocated);
|
||||||
fprintf(output->fp,
|
fprintf(output->fp,
|
||||||
"{\"size\": %zu, \"width\": %u, \"height\": %u,"
|
"{\"size\": %zu, \"width\": %u, \"height\": %u,"
|
||||||
" \"format\": %u, \"stride\": %u, \"online\": %u, \"key\": %u,"
|
" \"format\": %u, \"stride\": %u, \"online\": %u, \"key\": %u, \"gop\": %u,"
|
||||||
" \"grab_ts\": %.3Lf, \"encode_begin_ts\": %.3Lf, \"encode_end_ts\": %.3Lf,"
|
" \"grab_ts\": %.3Lf, \"encode_begin_ts\": %.3Lf, \"encode_end_ts\": %.3Lf,"
|
||||||
" \"data\": \"%s\"}\n",
|
" \"data\": \"%s\"}\n",
|
||||||
frame->used, frame->width, frame->height,
|
frame->used, frame->width, frame->height,
|
||||||
frame->format, frame->stride, frame->online, frame->key,
|
frame->format, frame->stride, frame->online, frame->key, frame->gop,
|
||||||
frame->grab_ts, frame->encode_begin_ts, frame->encode_end_ts,
|
frame->grab_ts, frame->encode_begin_ts, frame->encode_end_ts,
|
||||||
output->base64_data);
|
output->base64_data);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -260,16 +260,16 @@ static int _dump_sink(
|
|||||||
const long long now_second = us_floor_ms(now);
|
const long long now_second = us_floor_ms(now);
|
||||||
|
|
||||||
char fourcc_str[8];
|
char fourcc_str[8];
|
||||||
US_LOG_VERBOSE("Frame: res=%ux%u, fmt=%s, stride=%u, online=%d, key=%d, kr=%d, latency=%.3Lf, diff=%.3Lf, size=%zu",
|
US_LOG_VERBOSE("Frame: %s - %ux%u -- online=%d, key=%d, kr=%d, gop=%u, latency=%.3Lf, backlog=%.3Lf, size=%zu",
|
||||||
frame->width, frame->height,
|
|
||||||
us_fourcc_to_string(frame->format, fourcc_str, 8),
|
us_fourcc_to_string(frame->format, fourcc_str, 8),
|
||||||
frame->stride, frame->online, frame->key, key_requested,
|
frame->width, frame->height,
|
||||||
|
frame->online, frame->key, key_requested, frame->gop,
|
||||||
now - frame->grab_ts, (last_ts ? now - last_ts : 0),
|
now - frame->grab_ts, (last_ts ? now - last_ts : 0),
|
||||||
frame->used);
|
frame->used);
|
||||||
last_ts = now;
|
last_ts = now;
|
||||||
|
|
||||||
US_LOG_DEBUG(" grab_ts=%.3Lf, encode_begin_ts=%.3Lf, encode_end_ts=%.3Lf",
|
US_LOG_DEBUG(" stride=%u, grab_ts=%.3Lf, encode_begin_ts=%.3Lf, encode_end_ts=%.3Lf",
|
||||||
frame->grab_ts, frame->encode_begin_ts, frame->encode_end_ts);
|
frame->stride, frame->grab_ts, frame->encode_begin_ts, frame->encode_end_ts);
|
||||||
|
|
||||||
if (now_second != fps_second) {
|
if (now_second != fps_second) {
|
||||||
fps = fps_accum;
|
fps = fps_accum;
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ typedef struct {
|
|||||||
|
|
||||||
bool online;
|
bool online;
|
||||||
bool key;
|
bool key;
|
||||||
|
unsigned gop;
|
||||||
|
|
||||||
long double grab_ts;
|
long double grab_ts;
|
||||||
long double encode_begin_ts;
|
long double encode_begin_ts;
|
||||||
@@ -64,6 +65,7 @@ typedef struct {
|
|||||||
x_dest->stride = x_src->stride; \
|
x_dest->stride = x_src->stride; \
|
||||||
x_dest->online = x_src->online; \
|
x_dest->online = x_src->online; \
|
||||||
x_dest->key = x_src->key; \
|
x_dest->key = x_src->key; \
|
||||||
|
x_dest->gop = x_src->gop; \
|
||||||
x_dest->grab_ts = x_src->grab_ts; \
|
x_dest->grab_ts = x_src->grab_ts; \
|
||||||
x_dest->encode_begin_ts = x_src->encode_begin_ts; \
|
x_dest->encode_begin_ts = x_src->encode_begin_ts; \
|
||||||
x_dest->encode_end_ts = x_src->encode_end_ts; \
|
x_dest->encode_end_ts = x_src->encode_end_ts; \
|
||||||
@@ -81,6 +83,7 @@ static inline void us_frame_copy_meta(const us_frame_s *src, us_frame_s *dest) {
|
|||||||
&& x_a->stride == x_b->stride \
|
&& x_a->stride == x_b->stride \
|
||||||
&& x_a->online == x_b->online \
|
&& x_a->online == x_b->online \
|
||||||
&& x_a->key == x_b->key \
|
&& x_a->key == x_b->key \
|
||||||
|
&& x_a->gop == x_b->gop \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define US_MEMSINK_MAGIC ((uint64_t)0xCAFEBABECAFEBABE)
|
#define US_MEMSINK_MAGIC ((uint64_t)0xCAFEBABECAFEBABE)
|
||||||
#define US_MEMSINK_VERSION ((uint32_t)3)
|
#define US_MEMSINK_VERSION ((uint32_t)4)
|
||||||
|
|
||||||
#ifndef US_CFG_MEMSINK_MAX_DATA
|
#ifndef US_CFG_MEMSINK_MAX_DATA
|
||||||
# define US_CFG_MEMSINK_MAX_DATA 33554432
|
# define US_CFG_MEMSINK_MAX_DATA 33554432
|
||||||
@@ -51,6 +51,7 @@ typedef struct {
|
|||||||
unsigned stride;
|
unsigned stride;
|
||||||
bool online;
|
bool online;
|
||||||
bool key;
|
bool key;
|
||||||
|
unsigned gop;
|
||||||
|
|
||||||
long double grab_ts;
|
long double grab_ts;
|
||||||
long double encode_begin_ts;
|
long double encode_begin_ts;
|
||||||
|
|||||||
@@ -476,6 +476,7 @@ static int _m2m_encoder_compress_raw(us_m2m_encoder_s *enc, const us_frame_s *sr
|
|||||||
} else {
|
} else {
|
||||||
us_frame_set_data(dest, _RUN(output_bufs[output_buf.index].data), output_plane.bytesused);
|
us_frame_set_data(dest, _RUN(output_bufs[output_buf.index].data), output_plane.bytesused);
|
||||||
dest->key = output_buf.flags & V4L2_BUF_FLAG_KEYFRAME;
|
dest->key = output_buf.flags & V4L2_BUF_FLAG_KEYFRAME;
|
||||||
|
dest->gop = enc->gop;
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user