Commit 43143768 authored by luyikei's avatar luyikei Committed by Hugo Beauzée-Luyssen

SourceRenderer: Add enableOutputToMemory

void enableOutputToMemory( void* videoData, void* audioData, VideoOutputLockCallback videoLock, VideoOutputUnlockCallback videoUnlock,
                                           AudioOutputLockCallback audioLock, AudioOutputUnlockCallback audioUnlock, bool timeSync )
Signed-off-by: 's avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent 33eaec33
......@@ -99,6 +99,9 @@ namespace Backend
virtual void setTime( int64_t time ) = 0;
virtual void setPosition( float position ) = 0;
// For video and audio output to memory:
virtual void enableOutputToMemory( void* videoData, void* audioData, VideoOutputLockCallback videoLock, VideoOutputUnlockCallback videoUnlock,
AudioOutputLockCallback audioLock, AudioOutputUnlockCallback audioUnlock, bool timeSync ) = 0;
// For video output to memory:
virtual void enableVideoOutputToMemory( void* data, VideoOutputLockCallback lock, VideoOutputUnlockCallback unlock, bool timeSync ) = 0;
// For audio output to memory:
......
......@@ -115,8 +115,6 @@ VLCSourceRenderer::setupStreamOutput()
QString transcodeStr = ":sout=#transcode{";
if ( m_modes.testFlag( VideoSmem ) || m_modes.testFlag( FileOutput ) )
{
Q_ASSERT( m_modes.testFlag( AudioSmem ) == false );
if ( m_outputVideoFourCC.isNull() == false )
transcodeStr += ",vcodec=" + m_outputVideoFourCC;
if ( m_outputVideoBitrate > 0 )
......@@ -130,8 +128,6 @@ VLCSourceRenderer::setupStreamOutput()
}
if ( m_modes.testFlag( AudioSmem ) || m_modes.testFlag( FileOutput ) )
{
Q_ASSERT( m_modes.testFlag( VideoSmem ) == false );
if ( m_outputAudioFourCC.isNull() == false )
transcodeStr += ",acodec=" + m_outputAudioFourCC;
if ( m_outputAudioBitrate > 0 )
......@@ -318,6 +314,30 @@ VLCSourceRenderer::setOutputAudioBitrate(unsigned int aBitrate)
m_outputAudioBitrate = aBitrate;
}
void
VLCSourceRenderer::enableOutputToMemory( void* videoData, void* audioData, VideoOutputLockCallback videoLock, VideoOutputUnlockCallback videoUnlock,
AudioOutputLockCallback audioLock, AudioOutputUnlockCallback audioUnlock, bool timeSync )
{
m_modes |= VideoSmem;
m_modes |= AudioSmem;
m_smemChain = ":smem{";
if ( timeSync == true )
m_smemChain += "time-sync";
else
m_smemChain += "no-time-sync";
m_smemChain += ",video-data=" % QString::number( reinterpret_cast<intptr_t>( videoData ) )
% ",video-prerender-callback="
% QString::number( reinterpret_cast<intptr_t>( videoLock ) )
% ",video-postrender-callback="
% QString::number( reinterpret_cast<intptr_t>( videoUnlock ) )
% ",audio-data=" % QString::number( reinterpret_cast<intptr_t>( audioData ) )
% ",audio-prerender-callback="
% QString::number( reinterpret_cast<intptr_t>( audioLock ) )
% ",audio-postrender-callback="
% QString::number( reinterpret_cast<intptr_t>( audioUnlock ) )
% '}';
}
void
VLCSourceRenderer::enableVideoOutputToMemory( void *data, VideoOutputLockCallback lock, VideoOutputUnlockCallback unlock, bool timeSync )
{
......@@ -371,4 +391,3 @@ VLCSourceRenderer::enableMemoryInput( void *data, MemoryInputLockCallback lockCa
sprintf( buffer, ":imem-data=%p", data );
m_media.addOption( buffer );
}
......@@ -90,6 +90,8 @@ public:
virtual void enableMemoryInput( void* data, MemoryInputLockCallback lockCallback, MemoryInputUnlockCallback unlockCallback ) override;
// smem:
virtual void enableOutputToMemory( void* videoData, void* audioData, VideoOutputLockCallback videoLock, VideoOutputUnlockCallback videoUnlock,
AudioOutputLockCallback audioLock, AudioOutputUnlockCallback audioUnlock, bool timeSync ) override;
virtual void enableVideoOutputToMemory( void* data, VideoOutputLockCallback lock, VideoOutputUnlockCallback unlock, bool timeSync ) override;
virtual void enableAudioOutputToMemory( void* data, AudioOutputLockCallback lock,
AudioOutputUnlockCallback unlock, bool timeSync ) override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment