Monado OpenXR Runtime
gui_window_record.h
Go to the documentation of this file.
1// Copyright 2019-2021, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Recording window gui.
6 * @author Jakob Bornecrantz <jakob@collabora.com>
7 * @ingroup gui
8 */
9
10#pragma once
11
12#include "xrt/xrt_frame.h"
13#include "xrt/xrt_defines.h"
14#include "xrt/xrt_config_have.h"
15
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21struct xrt_frame_sink;
22struct gstreamer_sink;
24struct gui_program;
25struct gui_ogl_texture;
26
27
28enum gui_record_bitrate
29{
30 GUI_RECORD_BITRATE_32768,
31 GUI_RECORD_BITRATE_4096,
32 GUI_RECORD_BITRATE_2048,
33 GUI_RECORD_BITRATE_1024,
34};
35
36enum gui_record_pipeline
37{
38 GUI_RECORD_PIPELINE_SOFTWARE_ULTRAFAST,
39 GUI_RECORD_PIPELINE_SOFTWARE_VERYFAST,
40 GUI_RECORD_PIPELINE_SOFTWARE_FAST,
41 GUI_RECORD_PIPELINE_SOFTWARE_MEDIUM,
42 GUI_RECORD_PIPELINE_SOFTWARE_SLOW,
43 GUI_RECORD_PIPELINE_SOFTWARE_VERYSLOW,
44 GUI_RECORD_PIPELINE_VAAPI_H246,
45};
46
48{
49 struct xrt_frame_sink sink;
50
51 struct
52 {
53 uint32_t width, height;
54 enum xrt_format format;
55 } source;
56
57 struct
58 {
59 struct xrt_frame_context xfctx;
60
61 float scale;
62 bool rotate_180;
63
64 struct xrt_frame_sink *sink;
65 struct gui_ogl_texture *ogl;
66 } texture;
67
68#ifdef XRT_HAVE_GST
69 struct
70 {
71 enum gui_record_bitrate bitrate;
72
73 enum gui_record_pipeline pipeline;
74
75 struct xrt_frame_context xfctx;
76
77 //! When not null we are recording.
78 struct xrt_frame_sink *sink;
79
80 //! Protects sink
81 struct os_mutex mutex;
82
83 //! App sink we are pushing frames into.
84 struct gstreamer_sink *gs;
85
86 //! Recording pipeline.
87 struct gstreamer_pipeline *gp;
88
89 char filename[512];
90 } gst;
91#endif
92};
93
94
95/*!
96 * Initialise a embeddable record window.
97 */
98bool
100
101/*!
102 * Renders all controls of a record window.
103 */
104void
106
107/*!
108 * Draw the sink image as the background to the background of the render view.
109 * Basically the main window in which all ImGui windows lives in, not to a
110 * ImGui window.
111 */
112void
114
115/*!
116 * Frees all resources associated with a record window. Make sure to only call
117 * this function on the main gui thread, and that nothing is pushing into the
118 * record windows sink.
119 */
120void
122
123
124#ifdef __cplusplus
125}
126#endif
void gui_window_record_to_background(struct gui_record_window *rw, struct gui_program *p)
Draw the sink image as the background to the background of the render view.
Definition: gui_window_record.c:309
void gui_window_record_render(struct gui_record_window *rw, struct gui_program *p)
Renders all controls of a record window.
Definition: gui_window_record.c:324
bool gui_window_record_init(struct gui_record_window *rw)
Initialise a embeddable record window.
Definition: gui_window_record.c:279
void gui_window_record_close(struct gui_record_window *rw)
Frees all resources associated with a record window.
Definition: gui_window_record.c:354
A pipeline from which you can create one or more gstreamer_sink from.
Definition: gst_internal.h:34
An xrt_frame_sink that uses appsrc.
Definition: gst_internal.h:56
A OpenGL texture.
Definition: gui_common.h:79
A gui program.
Definition: gui_common.h:44
Definition: gui_window_record.h:48
A wrapper around a native mutex.
Definition: os_threading.h:55
Helper struct to make code easier to read.
Definition: render_distortion.c:183
Object used to track all sinks and frame producers in a graph.
Definition: xrt_frame.h:108
A object that is sent frames.
Definition: xrt_frame.h:58
Common defines and enums for XRT.
xrt_format
Common formats, use u_format_* functions to reason about them.
Definition: xrt_defines.h:176
Data frame header.