mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-20 14:40:10 +00:00
VRG: accept RenderPacket by ug_send_frame
This commit is contained in:
@@ -64,6 +64,7 @@ Changes
|
||||
### 2021-04-23
|
||||
- UltraGrid now honors `RenderPacket::dx_row_pitch` and `RenderPacket::dx_row_pitch_uv`
|
||||
for uncompressed stream (not for JPEG yet)
|
||||
- `ug_send_frame` now accepts and sends RenderPacket
|
||||
|
||||
### 2021-03-22
|
||||
- VRG now allocates buffers with cudaMallocHost, passed to library is with
|
||||
|
||||
@@ -132,17 +132,15 @@ struct ug_sender *ug_sender_init(const struct ug_sender_parameters *init_params)
|
||||
return s;
|
||||
}
|
||||
|
||||
void ug_send_frame(struct ug_sender *s, const char *data, libug_pixfmt_t codec, int width, int height, uint32_t seq)
|
||||
void ug_send_frame(struct ug_sender *s, const char *data, libug_pixfmt_t pixel_format, int width, int height, struct RenderPacket *pkt)
|
||||
{
|
||||
struct video_frame *f = vf_alloc(1);
|
||||
f->color_spec = (codec_t) codec;
|
||||
f->color_spec = (codec_t) pixel_format;
|
||||
f->tiles[0].width = width;
|
||||
f->tiles[0].height = height;
|
||||
f->fps = 120;
|
||||
f->interlacing = PROGRESSIVE;
|
||||
struct RenderPacket render_packet{};
|
||||
render_packet.frame = seq;
|
||||
f->render_packet = render_packet;
|
||||
f->render_packet = *pkt;
|
||||
|
||||
f->tiles[0].data = const_cast<char *>(data);
|
||||
f->tiles[0].data_len = vc_get_datalen(width, height, f->color_spec);
|
||||
|
||||
@@ -64,7 +64,7 @@ LIBUG_DLL struct ug_sender *ug_sender_init(const struct ug_sender_parameters *in
|
||||
*
|
||||
* This function is blocking.
|
||||
*/
|
||||
LIBUG_DLL void ug_send_frame(struct ug_sender *state, const char *data, libug_pixfmt_t pixel_format, int width, int height, uint32_t seq);
|
||||
LIBUG_DLL void ug_send_frame(struct ug_sender *state, const char *data, libug_pixfmt_t pixel_format, int width, int height, struct RenderPacket *pkt);
|
||||
LIBUG_DLL void ug_sender_done(struct ug_sender *state);
|
||||
|
||||
struct ug_receiver;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#include <libug.h>
|
||||
|
||||
#include "src/vrgstream-fallback.h"
|
||||
|
||||
#define DEFAULT_WIDTH 1920
|
||||
#define DEFAULT_HEIGHT 1080
|
||||
#define FPS 30.0
|
||||
@@ -105,7 +107,8 @@ int main(int argc, char *argv[]) {
|
||||
uint32_t frames = 0;
|
||||
uint32_t frames_last = 0;
|
||||
while (1) {
|
||||
ug_send_frame(s, (char *) test + width * 4 * (frames % 768), UG_RGBA, width, height, frames);
|
||||
struct RenderPacket pkt = { .frame = frames };
|
||||
ug_send_frame(s, (char *) test + width * 4 * (frames % 768), UG_RGBA, width, height, &pkt);
|
||||
frames += 1;
|
||||
time_t seconds = time(NULL) - t0;
|
||||
if (seconds > 0) {
|
||||
|
||||
Reference in New Issue
Block a user