UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
ipc_frame.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <memory>
Include dependency graph for ipc_frame.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Ipc_frame
 
struct  Ipc_frame_deleter
 
struct  Ipc_frame_header
 

Macros

#define IPC_FRAME_HEADER_LEN   128
 

Typedefs

using Ipc_frame_uniq = std::unique_ptr<Ipc_frame, Ipc_frame_deleter>
 

Enumerations

enum  Ipc_frame_color_spec { IPC_FRAME_COLOR_NONE = 0 , IPC_FRAME_COLOR_RGBA = 1 , IPC_FRAME_COLOR_UYVY = 2 , IPC_FRAME_COLOR_RGB = 11 }
 

Functions

void ipc_frame_free (struct Ipc_frame *frame)
 
Ipc_frame * ipc_frame_new ()
 
bool ipc_frame_parse_header (struct Ipc_frame_header *hdr, const char *buf)
 
bool ipc_frame_reserve (struct Ipc_frame *frame, size_t size)
 
void ipc_frame_write_header (const struct Ipc_frame_header *hdr, char *dst)
 

Macro Definition Documentation

◆ IPC_FRAME_HEADER_LEN

#define IPC_FRAME_HEADER_LEN   128

Definition at line 7 of file ipc_frame.h.

Referenced by do_frame_read(), and ipc_frame_write_header().

Typedef Documentation

◆ Ipc_frame_uniq

using Ipc_frame_uniq = std::unique_ptr<Ipc_frame, Ipc_frame_deleter>

Definition at line 40 of file ipc_frame.h.

Enumeration Type Documentation

◆ Ipc_frame_color_spec

Enumerator
IPC_FRAME_COLOR_NONE 
IPC_FRAME_COLOR_RGBA 
IPC_FRAME_COLOR_UYVY 
IPC_FRAME_COLOR_RGB 

Definition at line 9 of file ipc_frame.h.

9 {
14};
@ IPC_FRAME_COLOR_NONE
Definition ipc_frame.h:10
@ IPC_FRAME_COLOR_UYVY
Definition ipc_frame.h:12
@ IPC_FRAME_COLOR_RGBA
Definition ipc_frame.h:11
@ IPC_FRAME_COLOR_RGB
Definition ipc_frame.h:13

Function Documentation

◆ ipc_frame_free()

void ipc_frame_free ( struct Ipc_frame * frame)

Definition at line 61 of file ipc_frame.cpp.

61 {
62 free(frame->data);
63 free(frame);
64}
struct video_frame * frame

References frame.

Referenced by Ipc_frame_deleter::operator()().

◆ ipc_frame_new()

Ipc_frame * ipc_frame_new ( )

Definition at line 48 of file ipc_frame.cpp.

48 {
49 auto frame = static_cast<Ipc_frame *>(malloc(sizeof(Ipc_frame)));
50 frame->header.width = 0;
51 frame->header.height = 0;
52 frame->header.data_len = 0;
54
55 frame->data = nullptr;
56 frame->alloc_size = 0;
57
58 return frame;
59}
codec_t color_spec
Definition types.h:306

References video_frame::color_spec, frame, and IPC_FRAME_COLOR_NONE.

Referenced by display_unix_sock_init(), init(), and main().

◆ ipc_frame_parse_header()

bool ipc_frame_parse_header ( struct Ipc_frame_header * hdr,
const char * buf )

Definition at line 31 of file ipc_frame.cpp.

31 {
32 hdr->width = read_int(buf + 0);
33 hdr->height = read_int(buf + 4);
34 hdr->data_len = read_int(buf + 8);
35 hdr->color_spec = static_cast<Ipc_frame_color_spec>(read_int(buf + 12));
36
37 return true;
38}
Ipc_frame_color_spec
Definition ipc_frame.h:9
enum Ipc_frame_color_spec color_spec
Definition ipc_frame.h:20

References Ipc_frame_header::color_spec, Ipc_frame_header::data_len, Ipc_frame_header::height, and Ipc_frame_header::width.

Referenced by do_frame_read().

◆ ipc_frame_reserve()

bool ipc_frame_reserve ( struct Ipc_frame * frame,
size_t size )

Definition at line 66 of file ipc_frame.cpp.

66 {
67 if(size <= frame->alloc_size)
68 return true;
69
70 auto newbuf = static_cast<char *>(realloc(frame->data, size));
71 if(!newbuf)
72 return false;
73 frame->data = newbuf;
74 frame->alloc_size = size;
75
76 return true;
77}

References frame.

Referenced by do_frame_read(), ipc_frame_from_ug_frame(), and ipc_frame_from_ug_frame_hq().

◆ ipc_frame_write_header()

void ipc_frame_write_header ( const struct Ipc_frame_header * hdr,
char * dst )

Definition at line 40 of file ipc_frame.cpp.

40 {
41 memset(dst, 0, IPC_FRAME_HEADER_LEN);
42 write_int(dst + 0, hdr->width);
43 write_int(dst + 4, hdr->height);
44 write_int(dst + 8, hdr->data_len);
45 write_int(dst + 12, hdr->color_spec);
46}
#define IPC_FRAME_HEADER_LEN
Definition ipc_frame.h:7

References Ipc_frame_header::color_spec, Ipc_frame_header::data_len, Ipc_frame_header::height, IPC_FRAME_HEADER_LEN, and Ipc_frame_header::width.

Referenced by ipc_frame_writer_write().