Valkka  1.6.1
OpenSource Video Management
threadsignal.h
1 #ifndef threadsignal_HEADER_GUARD
2 #define threadsignal_HEADER_GUARD
3 /*
4  * signal.h : Signals used by thread classes
5  *
6  * (c) Copyright 2017-2024 Sampsa Riikonen
7  *
8  * Authors: Sampsa Riikonen <sampsa.riikonen@iki.fi>
9  *
10  * This file is part of the Valkka library.
11  *
12  * Valkka is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License as
14  * published by the Free Software Foundation, either version 3 of the
15  * License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * along with this program. If not, see <https://www.gnu.org/licenses/>
24  *
25  */
26 
36 #include "constant.h"
37 
43 {
44  none,
45  error,
46  seek, // seek start
47  stop, // stream stopped
48  play // stream is playing
49 };
50 
53 /*
54 enum class SignalType
55 {
56  avthread, ///< AVThread
57  openglthread, ///< OpenGLThread
58  valkkafswriterthread, ///< ValkkaFSWriterThread
59  valkkafsreaderthread, ///< ValkkaFSReaderThread
60  offline ///< A special signal caught by AlertFrameFilter
61 };
62 */
63 
64 namespace SignalType {
65  const static unsigned none = 0;
66  const static unsigned livethread = 1;
67  const static unsigned avthread = 2;
68  const static unsigned openglthread = 3;
69  const static unsigned valkkafswriterthread = 4;
70  const static unsigned valkkafsreaderthread = 5;
71  const static unsigned filecachethread = 6;
72  const static unsigned fdwritethread = 7;
73  const static unsigned offline = 8;
74 }
75 
76 
81 enum class AVSignal
82 {
83  none,
84  exit,
85  on,
86  off
87 };
88 
94 {
95  AVSignal signal;
96  // AVConnectionContext connection_context; // in the case we want pass more information
97 };
98 
104 { // used by signals:
105  SlotNumber n_slot;
106  Window x_window_id;
107 
108  unsigned int z;
110 
111  std::array<float, 4> object_coordinates;
112 
113  bool success;
114 };
115 
116 // std::ostream &operator<<(std::ostream &os, OpenGLSignalPars const &m);
117 inline std::ostream &operator<<(std::ostream &os, OpenGLSignalPars const &m)
118 {
119  return os << "<OpenGLSignalPars: slot=" << m.n_slot << " x_window_id=" << m.x_window_id << " z=" << m.z << " render_context=" << m.render_ctx << " success=" << m.success << ">";
120 };
121 
126 enum class OpenGLSignal
127 {
128  none,
129  exit,
130  info,
131 
134 
137 
138  new_rectangle,
140 };
141 
149 {
151  // OpenGLSignalPars *pars; ///< Why pointers? .. we have return values here // nopes .. not anymore
152  OpenGLSignalPars pars;
153 };
154 
159 {
160  std::size_t n_block;
161  SlotNumber n_slot;
162  IdNumber id;
163 };
164 
168 enum class ValkkaFSWriterSignal
169 {
170  none,
171  exit,
172 
173  seek,
174 
175  set_slot_id,
176  unset_slot_id,
177  clear_slot_id,
178  report_slot_id
179 };
180 
185 {
186  ValkkaFSWriterSignal signal;
188 };
189 
194 {
195  std::list<std::size_t> block_list;
196  SlotNumber n_slot;
197  IdNumber id;
198 };
199 
203 enum class ValkkaFSReaderSignal
204 {
205  none,
206  exit,
207 
208  pull_blocks,
209 
210  set_slot_id,
211  unset_slot_id,
212  clear_slot_id,
213  report_slot_id
214 };
215 
220 {
221  ValkkaFSReaderSignal signal;
223 };
224 
225 
227 {
228  SlotNumber n_slot;
229 };
230 
231 
232 #endif
Constant/default values, version numbers.
AVSignal
Signals used by AVThread.
Definition: threadsignal.h:82
@ off
turn decoding off
@ on
turn decoding on
AbstractFileState
Describes the state of a stream.
Definition: threadsignal.h:43
OpenGLSignal
Signals used by OpenGLThread.
Definition: threadsignal.h:127
@ new_rectangle
used by API newRectangleCall
@ del_render_group
used by API delRenderGroupCall
@ clear_objects
used by API clearObjectsCall
@ new_render_group
used by API newRenderCroupCall
@ info
used by API infoCall
@ del_render_context
used by API delRenderContextCall
@ new_render_context
used by API newRenderContextCall
Different signal types understood by Threads (sending them to the Thread by an interrupt (Thread::sen...
Definition: threadsignal.h:64
Redefinition of characteristic signal contexts (info that goes with the signal) for AVThread thread.
Definition: threadsignal.h:94
Definition: threadsignal.h:227
Encapsulates data sent by the signal.
Definition: threadsignal.h:149
OpenGLSignal signal
The signal.
Definition: threadsignal.h:150
Signal information for OpenGLThread.
Definition: threadsignal.h:104
int render_ctx
in: del_render_context, out: new_render_context
Definition: threadsignal.h:109
unsigned int z
in: new_render_context
Definition: threadsignal.h:108
Window x_window_id
in: new_render_context, new_render_group, del_render_group
Definition: threadsignal.h:106
std::array< float, 4 > object_coordinates
in: new_rectangle
Definition: threadsignal.h:111
SlotNumber n_slot
in: new_render_context
Definition: threadsignal.h:105
bool success
return value: was the call succesful?
Definition: threadsignal.h:113
Encapsulate data sent in the ValkkaFSReaderSignal.
Definition: threadsignal.h:220
Signal information for ValkkaFSReaderThread.
Definition: threadsignal.h:194
IdNumber id
Id. Used by set_slot_id and unset_slot_id.
Definition: threadsignal.h:197
std::list< std::size_t > block_list
List of blocks to be read and sent. Used by pull_blocks.
Definition: threadsignal.h:195
SlotNumber n_slot
Slot number. Used by set_slot_id and unset_slot_id.
Definition: threadsignal.h:196
Encapsulate data sent in the ValkkaFSWriterSignal.
Definition: threadsignal.h:185
Signal information for ValkkaFSWriterThread.
Definition: threadsignal.h:159
IdNumber id
Id. Used by set_slot_id and unset_slot_id.
Definition: threadsignal.h:162
SlotNumber n_slot
Slot number. Used by set_slot_id and unset_slot_id.
Definition: threadsignal.h:161
std::size_t n_block
Seek target block. Used by signal seek.
Definition: threadsignal.h:160