28 TorcOMXComponent *Destination, OMX_U32 DestinationIndex, OMX_INDEXTYPE DestinationDomain)
30 m_lock(QMutex::NonRecursive),
32 m_sourceIndex(SourceIndex),
33 m_sourceDomain(SourceDomain),
35 m_destination(Destination),
36 m_destinationIndex(DestinationIndex),
37 m_destinationDomain(DestinationDomain),
40 m_sourcePort = m_source->
GetPort(OMX_DirOutput, m_sourceIndex, m_sourceDomain);
41 m_destinationPort = m_destination->
GetPort(OMX_DirInput, m_destinationIndex, m_destinationDomain);
57 return OMX_ErrorUndefined;
59 QMutexLocker locker(&m_lock);
61 OMX_CHECK(m_source->
FlushBuffer(OMX_DirOutput, m_sourceIndex, m_sourceDomain), m_source->
GetName(), QStringLiteral(
"Tunnel failed to flush source"));
62 OMX_CHECK(m_destination->
FlushBuffer(OMX_DirInput, m_destinationIndex, m_destinationDomain), m_destination->
GetName(), QStringLiteral(
"Tunnel failed to flush destination"));
64 OMX_CHECK(m_destination->
WaitForResponse(OMX_CommandFlush, m_destinationPort, 200), m_destination->
GetName(), QStringLiteral(
"Tunnel failed to flush destination"));
73 if (!m_source || !m_destination)
74 return OMX_ErrorUndefined;
77 return OMX_ErrorUndefined;
79 QMutexLocker locker(&m_lock);
81 QString description = QStringLiteral(
"%1:%2->%3:%4").arg(m_source->
GetName()).arg(m_sourcePort).arg(m_destination->
GetName()).arg(m_destinationPort);
83 OMX_CHECK(OMX_SetupTunnel(m_source->
GetHandle(), m_sourcePort, m_destination->
GetHandle(), m_destinationPort), QStringLiteral(
""), QStringLiteral(
"Failed to create tunnel: %1").arg(description));
85 LOG(VB_GENERAL, LOG_INFO, QStringLiteral(
"Created tunnel: %1").arg(description));
93 if (!m_source || !m_destination)
94 return OMX_ErrorUndefined;
98 return OMX_ErrorUndefined;
101 QMutexLocker locker(&m_lock);
103 m_source->
EnablePort(OMX_DirOutput, m_sourceIndex,
false, m_sourceDomain);
104 m_destination->
EnablePort(OMX_DirInput, m_destinationIndex,
false, m_destinationDomain);
106 OMX_ERRORTYPE error = OMX_SetupTunnel(m_source->
GetHandle(), m_sourcePort,
nullptr, 0);
107 if (OMX_ErrorNone != error)
108 OMX_ERROR(error, m_source->
GetName(), QStringLiteral(
"Failed to destroy tunnel input"));
110 error = OMX_SetupTunnel(m_destination->
GetHandle(), m_destinationPort,
nullptr, 0);
111 if (OMX_ErrorNone != error)
112 OMX_ERROR(error, m_destination->
GetName(), QStringLiteral(
"Failed to destroy tunnel output"));
115 return OMX_ErrorNone;
OMX_U32 GetPort(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain)
OMX_ERRORTYPE Create(void)
OMX_ERRORTYPE Flush(void)
OMX_ERRORTYPE EnablePort(OMX_DIRTYPE Direction, OMX_U32 Index, bool Enable, OMX_INDEXTYPE Domain, bool Wait=true)
OMX_HANDLETYPE GetHandle(void)
#define OMX_ERROR(Error, Component, Message)
#define OMX_CHECK(Error, Component, Message)
#define LOG(_MASK_, _LEVEL_, _STRING_)
TorcOMXTunnel(TorcOMXComponent *Source, OMX_U32 SourceIndex, OMX_INDEXTYPE SourceDomain, TorcOMXComponent *Destination, OMX_U32 DestinationIndex, OMX_INDEXTYPE DestinationDomain)
OMX_ERRORTYPE FlushBuffer(OMX_DIRTYPE Direction, OMX_U32 Index, OMX_INDEXTYPE Domain)
OMX_ERRORTYPE Destroy(void)
OMX_ERRORTYPE WaitForResponse(OMX_U32 Command, OMX_U32 Data2, OMX_S32 Timeout)