Torc  0.1
torcomxcomponent.cpp
Go to the documentation of this file.
1 /* Class TorcOMXComponent
2 *
3 * This file is part of the Torc project.
4 *
5 * Copyright (C) Mark Kendall 2013-18
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 * USA.
21 */
22 
23 // Qt
24 #include <QElapsedTimer>
25 
26 // Torc
27 #include "torclogging.h"
28 #include "torcomxport.h"
29 #include "torcomxcomponent.h"
30 
31 TorcOMXEvent::TorcOMXEvent(OMX_EVENTTYPE Type, OMX_U32 Data1, OMX_U32 Data2)
32  : m_type(Type),
33  m_data1(Data1),
34  m_data2(Data2)
35 {
36 }
37 
38 static OMX_CALLBACKTYPE gCallbacks;
39 
41  : m_valid(false),
42  m_handle(nullptr),
43  m_lock(QMutex::NonRecursive),
44  m_componentName(Component),
45  m_inputPorts(),
46  m_outputPorts(),
47  m_eventQueue(),
48  m_eventQueueLock(QMutex::NonRecursive),
49  m_eventQueueWait()
50 {
51  // set the global callbacks
52  gCallbacks.EventHandler = &EventHandlerCallback;
53  gCallbacks.EmptyBufferDone = &EmptyBufferDoneCallback;
54  gCallbacks.FillBufferDone = &FillBufferDoneCallback;
55 
56  // get handle
57  OMX_ERRORTYPE status = OMX_GetHandle(&m_handle, Component, this, &gCallbacks);
58  if (status != OMX_ErrorNone || !m_handle)
59  {
60  LOG(VB_GENERAL, LOG_ERR, QStringLiteral("%1: Failed to get handle").arg(m_componentName));
61  return;
62  }
63 
64  // disable all ports in all domains
65  m_valid = true;
66  if ((DisablePorts(OMX_IndexParamAudioInit) != OMX_ErrorNone) ||
67  (DisablePorts(OMX_IndexParamImageInit) != OMX_ErrorNone) ||
68  (DisablePorts(OMX_IndexParamVideoInit) != OMX_ErrorNone) ||
69  (DisablePorts(OMX_IndexParamOtherInit) != OMX_ErrorNone))
70  {
71  m_valid = false;
72  return;
73  }
74 
75  // retrieve ports for each domain
76  AnalysePorts(OMX_IndexParamAudioInit);
77  AnalysePorts(OMX_IndexParamImageInit);
78  AnalysePorts(OMX_IndexParamVideoInit);
79  AnalysePorts(OMX_IndexParamOtherInit);
80 }
81 
82 void TorcOMXComponent::AnalysePorts(OMX_INDEXTYPE Domain)
83 {
84  OMX_PORT_PARAM_TYPE portparameters;
85  OMX_INITSTRUCTURE(portparameters);
86 
87  if (OMX_GetParameter(m_handle, Domain, &portparameters) != OMX_ErrorNone)
88  {
89  LOG(VB_GENERAL, LOG_ERR, QStringLiteral("%1: Failed to get port parameters").arg(m_componentName));
90  return;
91  }
92 
93  QString inports;
94  QString outports;
95  int input = 0;
96  int output = 0;
97 
98  for (OMX_U32 port = portparameters.nStartPortNumber; port < (portparameters.nStartPortNumber + portparameters.nPorts); ++port)
99  {
100  OMX_PARAM_PORTDEFINITIONTYPE portdefinition;
101  OMX_INITSTRUCTURE(portdefinition);
102  portdefinition.nPortIndex = port;
103 
104  OMX_ERRORTYPE error = OMX_GetParameter(m_handle, OMX_IndexParamPortDefinition, &portdefinition);
105  if (OMX_ErrorNone == error)
106  {
107  if (OMX_DirInput == portdefinition.eDir)
108  {
109  input++;
110  inports += QStringLiteral("%1 ").arg(port);
111  m_inputPorts.append(new TorcOMXPort(this, m_handle, port, Domain));
112  }
113  else if (OMX_DirOutput == portdefinition.eDir)
114  {
115  output++;
116  outports += QStringLiteral("%1 ").arg(port);
117  m_outputPorts.append(new TorcOMXPort(this, m_handle, port, Domain));
118  }
119  }
120  else
121  {
122  OMX_ERROR(error, m_componentName, QStringLiteral("Failed to get port definition"));
123  }
124  }
125 
126  if (input || output)
127  {
128  LOG(VB_GENERAL, LOG_INFO, QStringLiteral("%1, %2: %3 input ports (%4), %5 output ports (%6)")
129  .arg(m_componentName, DomainToString(Domain)).arg(input).arg(inports).arg(output).arg(outports));
130  }
131 }
132 
133 TorcOMXPort* TorcOMXComponent::FindPort(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain)
134 {
135  OMX_U32 count = 0;
136  if (OMX_DirInput == Direction && (Index < (OMX_U32)m_inputPorts.size()))
137  {
138  for (int i = 0; i < m_inputPorts.size(); ++i)
139  {
140  if (m_inputPorts.at(i)->GetDomain() == Domain)
141  {
142  if (count == Index)
143  return m_inputPorts.at(i);
144  count++;
145  }
146  }
147  }
148  else if (OMX_DirOutput == Direction && (Index < (OMX_U32)m_outputPorts.size()))
149  {
150  for (int i = 0; i < m_outputPorts.size(); ++i)
151  {
152  if (m_outputPorts.at(i)->GetDomain() == Domain)
153  {
154  if (count == Index)
155  return m_outputPorts.at(i);
156  count++;
157  }
158  }
159  }
160 
161  LOG(VB_GENERAL, LOG_ERR, QStringLiteral("%1: Failed to find port (Dir: %1, Index %2, Domain %3)")
162  .arg(m_componentName).arg(Index).arg(DomainToString(Domain)));
163  return nullptr;
164 }
165 
167 {
168  QMutexLocker locker(&m_lock);
169 
170  while (!m_inputPorts.isEmpty())
171  delete m_inputPorts.takeLast();
172  while (!m_outputPorts.isEmpty())
173  delete m_outputPorts.takeLast();
174 
175  if (m_handle)
176  OMX_FreeHandle(m_handle);
177  m_handle = nullptr;
178 }
179 
181 {
182  return m_valid;
183 }
184 
185 OMX_ERRORTYPE TorcOMXComponent::EventHandlerCallback(OMX_HANDLETYPE Component, OMX_PTR OMXComponent, OMX_EVENTTYPE Event, OMX_U32 Data1, OMX_U32 Data2, OMX_PTR EventData)
186 {
187  TorcOMXComponent *component = static_cast<TorcOMXComponent*>(OMXComponent);
188  if (component)
189  return component->EventHandler(Component, Event, Data1, Data2, EventData);
190 
191  return OMX_ErrorNone;
192 }
193 
194 OMX_ERRORTYPE TorcOMXComponent::EmptyBufferDoneCallback(OMX_HANDLETYPE Component, OMX_PTR OMXComponent, OMX_BUFFERHEADERTYPE *Buffer)
195 {
196  TorcOMXComponent *component = static_cast<TorcOMXComponent*>(OMXComponent);
197  if (component)
198  return component->EmptyBufferDone(Component, Buffer);
199 
200  return OMX_ErrorNone;
201 }
202 
203 OMX_ERRORTYPE TorcOMXComponent::FillBufferDoneCallback(OMX_HANDLETYPE Component, OMX_PTR OMXComponent, OMX_BUFFERHEADERTYPE *Buffer)
204 {
205  TorcOMXComponent *component = static_cast<TorcOMXComponent*>(OMXComponent);
206  if (component)
207  return component->FillBufferDone(Component, Buffer);
208 
209  return OMX_ErrorNone;
210 }
211 
213 {
214  return m_componentName;
215 }
216 
217 OMX_HANDLETYPE TorcOMXComponent::GetHandle(void)
218 {
219  return m_handle;
220 }
221 
222 OMX_ERRORTYPE TorcOMXComponent::SetState(OMX_STATETYPE State, bool Wait/*=true*/)
223 {
224  if (!m_valid)
225  return OMX_ErrorUndefined;
226 
227  QMutexLocker locker(&m_lock);
228  OMX_ERRORTYPE error = OMX_SendCommand(m_handle, OMX_CommandStateSet, State, nullptr);
229 
230  if (OMX_ErrorSameState == error)
231  {
232  return OMX_ErrorNone;
233  }
234  else if (OMX_ErrorNone == error)
235  {
236  if (Wait)
237  error = WaitForResponse(OMX_CommandStateSet, State, 1000);
238  if (OMX_ErrorSameState == error || OMX_ErrorNone == error)
239  {
240  LOG(VB_GENERAL, LOG_INFO, QStringLiteral("%1: Set state to %2").arg(m_componentName, StateToString(State)));
241  return OMX_ErrorNone;
242  }
243  }
244 
245  OMX_ERROR(error, m_componentName, QStringLiteral("Failed to set state"));
246  return error;
247 }
248 
249 OMX_STATETYPE TorcOMXComponent::GetState(void)
250 {
251  if (!m_valid)
252  return OMX_StateInvalid;
253 
254  QMutexLocker locker(&m_lock);
255 
256  OMX_STATETYPE state;
257  OMX_ERRORTYPE error = OMX_GetState(m_handle, &state);
258  if (OMX_ErrorNone == error)
259  return state;
260 
261  OMX_ERROR(error, m_componentName, QStringLiteral("Failed to get state"));
262  return OMX_StateInvalid;
263 }
264 
265 OMX_ERRORTYPE TorcOMXComponent::SetParameter(OMX_INDEXTYPE Index, OMX_PTR Structure)
266 {
267  if (!m_valid)
268  return OMX_ErrorUndefined;
269 
270  QMutexLocker locker(&m_lock);
271 
272  OMX_CHECK(OMX_SetParameter(m_handle, Index, Structure), m_componentName, QStringLiteral("Failed to set parameter"));
273  return OMX_ErrorNone;
274 }
275 
276 OMX_ERRORTYPE TorcOMXComponent::GetParameter(OMX_INDEXTYPE Index, OMX_PTR Structure)
277 {
278  if (!m_valid)
279  return OMX_ErrorUndefined;
280 
281  QMutexLocker locker(&m_lock);
282 
283  OMX_CHECK(OMX_GetParameter(m_handle, Index, Structure), m_componentName, QStringLiteral("Failed to get parameter"));
284  return OMX_ErrorNone;
285 }
286 
287 OMX_ERRORTYPE TorcOMXComponent::SetConfig(OMX_INDEXTYPE Index, OMX_PTR Structure)
288 {
289  if (!m_valid)
290  return OMX_ErrorUndefined;
291 
292  QMutexLocker locker(&m_lock);
293 
294  OMX_CHECK(OMX_SetConfig(m_handle, Index, Structure), m_componentName, QStringLiteral("Failed to set config"));
295  return OMX_ErrorNone;
296 }
297 
298 OMX_ERRORTYPE TorcOMXComponent::GetConfig(OMX_INDEXTYPE Index, OMX_PTR Structure)
299 {
300  if (!m_valid)
301  return OMX_ErrorUndefined;
302 
303  QMutexLocker locker(&m_lock);
304 
305  OMX_CHECK(OMX_GetConfig(m_handle, Index, Structure), m_componentName, QStringLiteral("Failed to get config"));
306  return OMX_ErrorNone;
307 }
308 
309 OMX_U32 TorcOMXComponent::GetPort(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain)
310 {
311  QMutexLocker locker(&m_lock);
312 
313  TorcOMXPort* port = FindPort(Direction, Index, Domain);
314  if (port)
315  return port->GetPort();
316 
317  return 0;
318 }
319 
320 OMX_ERRORTYPE TorcOMXComponent::EnablePort(OMX_DIRTYPE Direction, OMX_U32 Index, bool Enable, OMX_INDEXTYPE Domain, bool Wait /*=true*/)
321 {
322  QMutexLocker locker(&m_lock);
323 
324  TorcOMXPort* port = FindPort(Direction, Index, Domain);
325  if (port)
326  return port->EnablePort(Enable, Wait);
327 
328  return OMX_ErrorUndefined;
329 }
330 
331 OMX_U32 TorcOMXComponent::GetAvailableBuffers(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain)
332 {
333  TorcOMXPort* port = FindPort(Direction, Index, Domain);
334  if (port)
335  return port->GetAvailableBuffers();
336 
337  return 0;
338 }
339 
340 OMX_U32 TorcOMXComponent::GetInUseBuffers(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain)
341 {
342  TorcOMXPort* port = FindPort(Direction, Index, Domain);
343  if (port)
344  return port->GetInUseBuffers();
345 
346  return 0;
347 }
348 
349 OMX_ERRORTYPE TorcOMXComponent::EmptyThisBuffer(OMX_BUFFERHEADERTYPE *Buffer)
350 {
351  if (!m_valid || !Buffer)
352  return OMX_ErrorUndefined;
353 
354  OMX_CHECK(OMX_EmptyThisBuffer(m_handle, Buffer), m_componentName, QStringLiteral("EmptyThisBuffer failed"));
355  return OMX_ErrorNone;
356 }
357 
358 OMX_ERRORTYPE TorcOMXComponent::FillThisBuffer(OMX_BUFFERHEADERTYPE *Buffer)
359 {
360  if (!m_valid || !Buffer)
361  return OMX_ErrorUndefined;
362 
363  OMX_CHECK(OMX_FillThisBuffer(m_handle, Buffer), m_componentName, QStringLiteral("FillThisBuffer failed"));
364  return OMX_ErrorNone;
365 }
366 
367 OMX_ERRORTYPE TorcOMXComponent::CreateBuffers(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain, QObject* Owner /*=nullptr*/)
368 {
369  QMutexLocker locker(&m_lock);
370 
371  TorcOMXPort *port = FindPort(Direction, Index, Domain);
372  if (port)
373  return port->CreateBuffers(Owner);
374 
375  return OMX_ErrorUndefined;
376 }
377 
378 OMX_ERRORTYPE TorcOMXComponent::DestroyBuffers(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain)
379 {
380  QMutexLocker locker(&m_lock);
381 
382  TorcOMXPort *port = FindPort(Direction, Index, Domain);
383  if (port)
384  return port->DestroyBuffers();
385 
386  return OMX_ErrorUndefined;
387 }
388 
389 OMX_BUFFERHEADERTYPE* TorcOMXComponent::GetBuffer(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_U32 Timeout, OMX_INDEXTYPE Domain)
390 {
391  TorcOMXPort *port = FindPort(Direction, Index, Domain);
392  if (port)
393  return port->GetBuffer(Timeout);
394 
395  return nullptr;
396 }
397 
398 OMX_ERRORTYPE TorcOMXComponent::FlushBuffer(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain)
399 {
400  QMutexLocker locker(&m_lock);
401 
402  TorcOMXPort* port = FindPort(Direction, Index, Domain);
403  if (port)
404  {
405  OMX_CHECK(port->Flush(), m_componentName, QStringLiteral("Failed to flush buffers"));
406  return OMX_ErrorNone;
407  }
408 
409  return OMX_ErrorUndefined;
410 }
411 
412 OMX_ERRORTYPE TorcOMXComponent::EventHandler(OMX_HANDLETYPE Component, OMX_EVENTTYPE Event, OMX_U32 Data1, OMX_U32 Data2, OMX_PTR EventData)
413 {
414  (void)EventData;
415  if (m_handle != Component)
416  return OMX_ErrorBadParameter;
417 
418  m_eventQueueLock.lock();
419  m_eventQueue.append(TorcOMXEvent(Event, Data1, Data2));
420  m_eventQueueLock.unlock();
421  LOG(VB_GENERAL, LOG_DEBUG, QStringLiteral("%1: Event %2 %3 %4").arg(m_componentName, EventToString(Event)).arg(Data1).arg(Data2));
422 
423  m_eventQueueWait.wakeAll();
424 
425  return OMX_ErrorNone;
426 }
427 
428 OMX_ERRORTYPE TorcOMXComponent::EmptyBufferDone(OMX_HANDLETYPE Component, OMX_BUFFERHEADERTYPE *Buffer)
429 {
430  if (m_handle != Component || !Buffer)
431  return OMX_ErrorBadParameter;
432 
433  TorcOMXPort *port = static_cast<TorcOMXPort*>(Buffer->pAppPrivate);
434  if (port)
435  return port->MakeAvailable(Buffer);
436 
437  return OMX_ErrorUndefined;
438 }
439 
440 OMX_ERRORTYPE TorcOMXComponent::FillBufferDone(OMX_HANDLETYPE Component, OMX_BUFFERHEADERTYPE *Buffer)
441 {
442  if (m_handle != Component)
443  return OMX_ErrorBadParameter;
444 
445  TorcOMXPort *port = static_cast<TorcOMXPort*>(Buffer->pAppPrivate);
446  if (port)
447  return port->MakeAvailable(Buffer);
448 
449  LOG(VB_GENERAL, LOG_ERR, QStringLiteral("No buffers allocated for output"));
450  return OMX_ErrorUndefined;
451 }
452 
453 OMX_ERRORTYPE TorcOMXComponent::SendCommand(OMX_COMMANDTYPE Command, OMX_U32 Parameter, OMX_PTR Data)
454 {
455  if (!m_valid)
456  return OMX_ErrorUndefined;
457 
458  QMutexLocker locker(&m_lock);
459 
460  OMX_CHECK(OMX_SendCommand(m_handle, Command, Parameter, Data), m_componentName, QStringLiteral("Failed to send command"));
461  return OMX_ErrorNone;
462 }
463 
464 OMX_ERRORTYPE TorcOMXComponent::WaitForResponse(OMX_U32 Command, OMX_U32 Data2, OMX_S32 Timeout)
465 {
466  QElapsedTimer timer;
467  timer.start();
468 
469  LOG(VB_GENERAL, LOG_DEBUG, QStringLiteral("%1: Waiting for %2 %3")
470  .arg(m_componentName, CommandToString((OMX_COMMANDTYPE)Command)).arg(Data2));
471 
472  while (timer.elapsed() < Timeout)
473  {
474  m_eventQueueLock.lock();
475 
476  QMutableListIterator<TorcOMXEvent> it(m_eventQueue);
477  while (it.hasNext())
478  {
479  it.next();
480  TorcOMXEvent event = it.value();
481  if (event.m_type == OMX_EventCmdComplete && event.m_data1 == Command && event.m_data2 == Data2)
482  {
483  it.remove();
484  m_eventQueueLock.unlock();
485  return OMX_ErrorNone;
486  }
487  else if (event.m_type == Command)
488  {
489  LOG(VB_GENERAL, LOG_DEBUG, QStringLiteral("1 %1 2 %2").arg(event.m_data1).arg(event.m_data2));
490  it.remove();
491  m_eventQueueLock.unlock();
492  return OMX_ErrorNone;
493  }
494  else if (event.m_type == OMX_EventError)
495  {
496  OMX_ERRORTYPE omxerror = (OMX_ERRORTYPE)event.m_data1;
497  if (omxerror == OMX_ErrorSameState && event.m_data2 == 1)
498  {
499  it.remove();
500  m_eventQueueLock.unlock();
501  return OMX_ErrorNone;
502  }
503 
504  LOG(VB_GENERAL, (omxerror == OMX_ErrorPortUnpopulated) ? LOG_DEBUG : LOG_ERR, QStringLiteral("%1: Error event '%2' data2 %3")
505  .arg(m_componentName, ErrorToString(omxerror)).arg(event.m_data2));
506  OMX_ERRORTYPE error = (OMX_ERRORTYPE)event.m_data1;
507  it.remove();
508  m_eventQueueLock.unlock();
509  return error;
510  }
511  }
512 
514  m_eventQueueLock.unlock();
515  }
516 
517  LOG(VB_GENERAL, LOG_INFO, QStringLiteral("%1: Response never received for command %2 %3")
518  .arg(m_componentName, CommandToString((OMX_COMMANDTYPE)Command)).arg(Data2));
519  return OMX_ErrorMax;
520 }
521 
522 OMX_ERRORTYPE TorcOMXComponent::DisablePorts(OMX_INDEXTYPE Domain)
523 {
524  if (!m_valid)
525  return OMX_ErrorUndefined;
526 
527  QMutexLocker locker(&m_lock);
528 
529  OMX_PORT_PARAM_TYPE portparameters;
530  OMX_INITSTRUCTURE(portparameters);
531 
532  OMX_CHECK(OMX_GetParameter(m_handle, Domain, &portparameters), m_componentName, QStringLiteral("Failed to get port parameters"));
533 
534  for (OMX_U32 i = 0; i < portparameters.nPorts; ++i)
535  {
536  OMX_PARAM_PORTDEFINITIONTYPE portdefinition;
537  OMX_INITSTRUCTURE(portdefinition);
538  OMX_U32 portnumber = portparameters.nStartPortNumber + i;
539  portdefinition.nPortIndex = portnumber;
540 
541  if (OMX_GetParameter(m_handle, OMX_IndexParamPortDefinition, &portdefinition) == OMX_ErrorNone)
542  {
543  OMX_ERRORTYPE error = OMX_SendCommand(m_handle, OMX_CommandPortDisable, portnumber, nullptr);
544  if (OMX_ErrorNone == error)
545  {
546  error = WaitForResponse(OMX_CommandPortDisable, portnumber, 100);
547  if (OMX_ErrorNone != error)
548  {
549  OMX_ERROR(error, m_componentName, QStringLiteral("Failed to disable port"));
550  }
551  }
552  else
553  {
554  OMX_ERROR(error, m_componentName, QStringLiteral("Failed to send command"));
555  }
556  }
557  else
558  {
559  portdefinition.bEnabled = OMX_FALSE;
560  }
561  }
562 
563  return OMX_ErrorNone;
564 }
OMX_ERRORTYPE Flush(void)
QString StateToString(OMX_STATETYPE State)
Definition: torcomxcore.cpp:46
OMX_U32 GetInUseBuffers(void)
OMX_ERRORTYPE FillBufferDone(OMX_HANDLETYPE Component, OMX_BUFFERHEADERTYPE *Buffer)
OMX_U32 GetInUseBuffers(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain)
OMX_ERRORTYPE SetState(OMX_STATETYPE State, bool Wait=true)
OMX_U32 GetPort(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain)
OMX_ERRORTYPE DestroyBuffers(void)
OMX_HANDLETYPE m_handle
OMX_BUFFERHEADERTYPE * GetBuffer(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_U32 Timeout, OMX_INDEXTYPE Domain)
QString ErrorToString(OMX_ERRORTYPE Error)
Definition: torcomxcore.cpp:61
TorcOMXComponent(OMX_STRING Component)
QString GetName(void)
OMX_ERRORTYPE MakeAvailable(OMX_BUFFERHEADERTYPE *Buffer)
OMX_ERRORTYPE SetConfig(OMX_INDEXTYPE Index, OMX_PTR Structure)
OMX_ERRORTYPE DestroyBuffers(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain)
TorcOMXEvent(OMX_EVENTTYPE Type, OMX_U32 Data1, OMX_U32 Data2)
QList< TorcOMXPort * > m_outputPorts
QString CommandToString(OMX_COMMANDTYPE Command)
QWaitCondition m_eventQueueWait
OMX_ERRORTYPE EnablePort(OMX_DIRTYPE Direction, OMX_U32 Index, bool Enable, OMX_INDEXTYPE Domain, bool Wait=true)
TorcOMXPort * FindPort(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain)
static OMX_ERRORTYPE EmptyBufferDoneCallback(OMX_HANDLETYPE Component, OMX_PTR OMXComponent, OMX_BUFFERHEADERTYPE *Buffer)
OMX_U32 GetAvailableBuffers(void)
Definition: torcomxport.cpp:95
OMX_ERRORTYPE CreateBuffers(QObject *Owner=nullptr)
OMX_ERRORTYPE EmptyThisBuffer(OMX_BUFFERHEADERTYPE *Buffer)
OMX_ERRORTYPE SendCommand(OMX_COMMANDTYPE Command, OMX_U32 Parameter, OMX_PTR Data)
QString DomainToString(OMX_INDEXTYPE Domain)
static OMX_ERRORTYPE FillBufferDoneCallback(OMX_HANDLETYPE Component, OMX_PTR OMXComponent, OMX_BUFFERHEADERTYPE *Buffer)
OMX_ERRORTYPE CreateBuffers(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain, QObject *Owner=nullptr)
OMX_U32 GetPort(void)
Definition: torcomxport.cpp:49
OMX_ERRORTYPE EnablePort(bool Enable, bool Wait=true)
Definition: torcomxport.cpp:59
OMX_ERRORTYPE EventHandler(OMX_HANDLETYPE Component, OMX_EVENTTYPE Event, OMX_U32 Data1, OMX_U32 Data2, OMX_PTR EventData)
QList< TorcOMXEvent > m_eventQueue
OMX_HANDLETYPE GetHandle(void)
OMX_STATETYPE GetState(void)
static OMX_ERRORTYPE EventHandlerCallback(OMX_HANDLETYPE Component, OMX_PTR OMXComponent, OMX_EVENTTYPE Event, OMX_U32 Data1, OMX_U32 Data2, OMX_PTR EventData)
#define OMX_ERROR(Error, Component, Message)
Definition: torcomxcore.h:42
#define OMX_CHECK(Error, Component, Message)
Definition: torcomxcore.h:44
#define LOG(_MASK_, _LEVEL_, _STRING_)
Definition: torclogging.h:20
OMX_U32 GetAvailableBuffers(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain)
OMX_ERRORTYPE GetParameter(OMX_INDEXTYPE Index, OMX_PTR Structure)
OMX_ERRORTYPE GetConfig(OMX_INDEXTYPE Index, OMX_PTR Structure)
QString EventToString(OMX_EVENTTYPE Event)
Definition: torcomxcore.cpp:27
OMX_ERRORTYPE FlushBuffer(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain)
OMX_BUFFERHEADERTYPE * GetBuffer(OMX_S32 Timeout)
QList< TorcOMXPort * > m_inputPorts
OMX_ERRORTYPE EmptyBufferDone(OMX_HANDLETYPE Component, OMX_BUFFERHEADERTYPE *Buffer)
static OMX_CALLBACKTYPE gCallbacks
OMX_ERRORTYPE SetParameter(OMX_INDEXTYPE Index, OMX_PTR Structure)
OMX_ERRORTYPE WaitForResponse(OMX_U32 Command, OMX_U32 Data2, OMX_S32 Timeout)
void AnalysePorts(OMX_INDEXTYPE Domain)
OMX_ERRORTYPE FillThisBuffer(OMX_BUFFERHEADERTYPE *Buffer)
#define OMX_INITSTRUCTURE(Struct)
Definition: torcomxcore.h:28
OMX_ERRORTYPE DisablePorts(OMX_INDEXTYPE Domain)