UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
video_display.h
Go to the documentation of this file.
1
15/* Copyright (c) 2001-2003 University of Southern California
16 * Copyright (c) 2005-2023 CESNET z.s.p.o.
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, is permitted provided that the following conditions
20 * are met:
21 *
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 *
25 * 2. Redistributions in binary form must reproduce the above copyright
26 * notice, this list of conditions and the following disclaimer in the
27 * documentation and/or other materials provided with the distribution.
28 *
29 * 3. All advertising materials mentioning features or use of this software
30 * must display the following acknowledgement:
31 *
32 * This product includes software developed by the University of Southern
33 * California Information Sciences Institute. This product also includes
34 * software developed by CESNET z.s.p.o.
35 *
36 * 4. Neither the name of the University, Institute, CESNET nor the names of
37 * its contributors may be used to endorse or promote products derived from
38 * this software without specific prior written permission.
39 *
40 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
41 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
42 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
43 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
44 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
45 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
46 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
47 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
49 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
50 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
51 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 */
53
90#ifndef _VIDEO_DISPLAY_H
91#define _VIDEO_DISPLAY_H
92
93#include "types.h"
94
95#ifndef __cplusplus
96#include <limits.h> // LLONG_MAX
97#include <stdbool.h>
98#else
99#include <climits> // LLONG_MAX
100#endif // ! defined __cplusplus
101
102#ifdef __cplusplus
103extern "C" {
104#endif // __cplusplus
105
109#define DISPLAY_FLAG_AUDIO_EMBEDDED (1<<1)
110#define DISPLAY_FLAG_AUDIO_AESEBU (1<<2)
111#define DISPLAY_FLAG_AUDIO_ANALOG (1<<3)
112
113#define DISPLAY_FLAG_AUDIO_ANY (DISPLAY_FLAG_AUDIO_EMBEDDED | DISPLAY_FLAG_AUDIO_AESEBU | DISPLAY_FLAG_AUDIO_ANALOG)
116struct audio_frame;
117struct module;
118struct video_frame;
119
121 bool val;
122 struct display *(*fork_display)(void *state);
123 void *state;
124};
125
139
140#define PITCH_DEFAULT -1
141
148
149#define VIDEO_DISPLAY_ABI_VERSION 21
150
151#define DISPLAY_NO_GENERIC_FPS_INDICATOR ((const char *) 0x00)
152
155 void *(*init) (struct module *parent, const char *fmt, unsigned int flags);
156 void (*run) (void *state);
157 void (*done) (void *state);
158 struct video_frame *(*getf) (void *state);
160 bool (*putf) (void *state, struct video_frame *frame, long long timeout_ns);
161 bool (*reconfigure_video)(void *state, struct video_desc desc);
162 bool (*ctl_property)(void *state, int property, void *val, size_t *len);
163 void (*put_audio_frame) (void *state, const struct audio_frame *frame);
165 int sample_rate);
167};
168
169/*
170 * Interface to initialize displays, and playout video
171 *
172 */
173struct display;
174struct module;
175
176void list_video_display_devices(bool full);
178 /* not_null */ const char *requested_display, /* not_null */ const char *fmt,
179 unsigned int flags, const char *postprocess, /* not_null */ struct display **out);
180bool display_needs_mainloop(struct display *d);
181void display_run_mainloop(struct display *d);
182void display_run_new_thread(struct display *d);
183void display_join(struct display *d);
184void display_done(struct display *d);
185struct video_frame *display_get_frame(struct display *d);
186
189#define PUTF_DISCARD (-1LL)
190#define PUTF_NONBLOCK 0LL
191#define PUTF_BLOCKING LLONG_MAX
193
194// documented at definition
195bool display_put_frame(struct display *d, struct video_frame *frame, long long timeout_ns);
199bool display_ctl_property(struct display *d, int property, void *val, size_t *len);
207void display_put_audio_frame(struct display *d, const struct audio_frame *frame);
209 // end of display_audio
210
211struct video_frame *get_splashscreen(void);
212const char *get_audio_conn_flag_name(int audio_init_flag);
213
214#ifdef __cplusplus
215}
216#endif // __cplusplus
217
218#endif /* _VIDEO_DISPLAY_H */
219
220 // end of display
221
void ** state
int void * val
struct video_desc desc
int int int sample_rate
int int channels
struct video_frame * frame
const char * fmt
int void size_t * len
const char unsigned int flags
int property
int quant_samples
bool display_reconfigure_audio(struct display *d, int quant_samples, int channels, int sample_rate)
void display_put_audio_frame(struct display *d, const struct audio_frame *frame)
Puts audio data.
bool display_put_frame(struct display *d, struct video_frame *frame, long long timeout_ns)
}
display_property
bool display_reconfigure(struct display *d, struct video_desc desc, enum video_mode mode)
void display_run_mainloop(struct display *d)
Display mainloop function.
bool display_ctl_property(struct display *d, int property, void *val, size_t *len)
Get/set property (similar to ioctl)
void display_run_new_thread(struct display *d)
display_prop_vid_mode
const char * get_audio_conn_flag_name(int audio_init_flag)
bool display_needs_mainloop(struct display *d)
struct video_frame * get_splashscreen(void)
void display_done(struct display *d)
This function performs cleanup after done.
void display_join(struct display *d)
int initialize_video_display(struct module *parent, const char *requested_display, const char *fmt, unsigned int flags, const char *postprocess, struct display **out)
Initializes video display.
void list_video_display_devices(bool full)
struct video_frame * display_get_frame(struct display *d)
Returns video framebuffer which will be written to.
@ DISPLAY_PROPERTY_BUF_PITCH
requested framebuffer pitch - int (bytes), may be PITCH_DEFAULT
@ DISPLAY_PROPERTY_SUPPORTS_MULTI_SOURCES
@ DISPLAY_PROPERTY_RGB_SHIFT
red,green,blue shift - int[3] (bits)
@ DISPLAY_PROPERTY_SUPPORTED_IL_MODES
display supported interlacing modes - enum interlacing_t[]
@ DISPLAY_PROPERTY_VIDEO_MODE
requested video mode - int (one of display_prop_vid_mode)
@ DISPLAY_PROPERTY_CODECS
list of natively supported codecs - codec_t[]
@ DISPLAY_PROPERTY_AUDIO_FORMAT
@ DISPLAY_PROPERTY_VIDEO_SEPARATE_TILES
framebuffer consists of separate tiles
@ DISPLAY_PROPERTY_VIDEO_MERGED
monolithic framebuffer
@ DISPLAY_PROPERTY_VIDEO_SEPARATE_3D
same as MERGED but 2 streams should be handled as separate 3D tiles
enum openssl_mode mode
const char * parent
Definition settings.cpp:198
struct used to comunicate with audio capture/playback device
Definition types.h:99
This struct represents initialized video display state.
void(* run)(void *state)
callback to display main event loop; may be NULL
device_probe_func probe
void(* put_audio_frame)(void *state, const struct audio_frame *frame)
may be NULL
bool(* reconfigure_video)(void *state, struct video_desc desc)
bool(* putf)(void *state, struct video_frame *frame, long long timeout_ns)
const char * generic_fps_indicator_prefix
NO_GENERIC_FPS_INDICATOR or pointer to preferred module name.
bool(* reconfigure_audio)(void *state, int quant_samples, int channels, int sample_rate)
bool(* ctl_property)(void *state, int property, void *val, size_t *len)
void(* done)(void *state)
Struct video_frame represents a video frame and contains video description.
Definition types.h:305
This file contains some common data types.
video_mode
Definition types.h:354
void(* device_probe_func)(struct device_info **available_cards, int *count, void(**deleter)(void *))
Definition types.h:404