Valkka  0.17.0
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  * Copyright 2017, 2018 Valkka Security Ltd. and 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 Affero 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 Affero General Public License for more details.
21  *
22  * You should have received a copy of the GNU Affero General Public License
23  * along with this program. If not, see <https://www.gnu.org/licenses/>
24  *
25  */
26 
36 #include "constant.h"
37 
38 
43 enum class AbstractFileState {
44  none,
45  error,
46  seek, // seek start
47  stop, // stream stopped
48  play // stream is playing
49 };
50 
51 
52 
55 enum class SignalType {
56  av,
57  gl,
58  writer,
59  reader
60 };
61 
66 enum class AVSignal {
67  none,
68  exit,
69  on,
70  off
71 };
72 
73 
80  // AVConnectionContext connection_context; // in the case we want pass more information
81 };
82 
83 
88 struct OpenGLSignalPars { // used by signals:
89  SlotNumber n_slot;
90  Window x_window_id;
91 
92  unsigned int z;
93  int render_ctx;
94 
95  std::array<float, 4> object_coordinates;
96 
97  bool success;
98 };
99 
100 // std::ostream &operator<<(std::ostream &os, OpenGLSignalPars const &m);
101 inline std::ostream &operator<<(std::ostream &os, OpenGLSignalPars const &m) {
102  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<<">";
103 };
104 
109 enum class OpenGLSignal {
110  none,
111  exit,
112  info,
113 
116 
119 
120  new_rectangle,
122 };
123 
132  // OpenGLSignalPars *pars; ///< Why pointers? .. we have return values here // nopes .. not anymore
133  OpenGLSignalPars pars;
134 };
135 
140  std::size_t n_block;
141  SlotNumber n_slot;
142  IdNumber id;
143 };
144 
148 enum class ValkkaFSWriterSignal {
149  none,
150  exit,
151 
152  seek,
153 
154  set_slot_id,
155  unset_slot_id,
156  clear_slot_id,
157  report_slot_id
158 };
159 
164  ValkkaFSWriterSignal signal;
166 };
167 
168 
173  std::list<std::size_t> block_list;
174  SlotNumber n_slot;
175  IdNumber id;
176 };
177 
181 enum class ValkkaFSReaderSignal {
182  none,
183  exit,
184 
185  pull_blocks,
186 
187  set_slot_id,
188  unset_slot_id,
189  clear_slot_id,
190  report_slot_id
191 };
192 
197  ValkkaFSReaderSignal signal;
199 };
200 
201 
202 #endif
OpenGLSignal
Signals used by OpenGLThread.
Definition: threadsignal.h:109
SlotNumber n_slot
Slot number. Used by set_slot_id and unset_slot_id.
Definition: threadsignal.h:174
used by API newRenderCroupCall
Signal information for ValkkaFSReaderThread.
Definition: threadsignal.h:172
SlotNumber n_slot
Slot number. Used by set_slot_id and unset_slot_id.
Definition: threadsignal.h:141
signal to AVThread or OpenGLThread. Also custom signals to custom Threads
used by API infoCall
Encapsulates data sent by the signal.
Definition: threadsignal.h:130
Constant/default values, version numbers.
used by API delRenderGroupCall
IdNumber id
Id. Used by set_slot_id and unset_slot_id.
Definition: threadsignal.h:175
std::size_t n_block
Seek target block. Used by signal seek.
Definition: threadsignal.h:140
undefined (initial value)
Definition: usbthread.h:143
Redefinition of characteristic signal contexts (info that goes with the signal) for AVThread thread...
Definition: threadsignal.h:78
bool success
return value: was the call succesful?
Definition: threadsignal.h:97
used by API delRenderContextCall
Encapsulate data sent in the ValkkaFSReaderSignal.
Definition: threadsignal.h:196
turn decoding on
Signal information for OpenGLThread.
Definition: threadsignal.h:88
std::array< float, 4 > object_coordinates
in: new_rectangle
Definition: threadsignal.h:95
used by API newRectangleCall
used by API clearObjectsCall
turn decoding off
Encapsulate data sent in the ValkkaFSWriterSignal.
Definition: threadsignal.h:163
IdNumber id
Id. Used by set_slot_id and unset_slot_id.
Definition: threadsignal.h:142
OpenGLSignal signal
The signal.
Definition: threadsignal.h:131
Window x_window_id
in: new_render_context, new_render_group, del_render_group
Definition: threadsignal.h:90
std::list< std::size_t > block_list
List of blocks to be read and sent. Used by pull_blocks.
Definition: threadsignal.h:173
SlotNumber n_slot
in: new_render_context
Definition: threadsignal.h:89
AbstractFileState
Describes the state of a stream.
Definition: threadsignal.h:43
Signal information for ValkkaFSWriterThread.
Definition: threadsignal.h:139
int render_ctx
in: del_render_context, out: new_render_context
Definition: threadsignal.h:93
unsigned int z
in: new_render_context
Definition: threadsignal.h:92
AVSignal
Signals used by AVThread.
Definition: threadsignal.h:66
used by API newRenderContextCall