[vlmc-devel] [PATCH 01/10] SourceRenderer: Add enableOutputToMemory
Yikai Lu
luyikei.qmltu at gmail.com
Wed May 4 16:18:32 CEST 2016
void enableOutputToMemory( void* videoData, void* audioData, VideoOutputLockCallback videoLock, VideoOutputUnlockCallback videoUnlock, AudioOutputLockCallback audioLock, AudioOutputUnlockCallback audioUnlock, bool timeSync )
---
src/Backend/ISourceRenderer.h | 3 +++
src/Backend/VLC/VLCSourceRenderer.cpp | 29 ++++++++++++++++++++++++-----
src/Backend/VLC/VLCSourceRenderer.h | 2 ++
3 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/src/Backend/ISourceRenderer.h b/src/Backend/ISourceRenderer.h
index ead40f8..8df7b26 100644
--- a/src/Backend/ISourceRenderer.h
+++ b/src/Backend/ISourceRenderer.h
@@ -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:
diff --git a/src/Backend/VLC/VLCSourceRenderer.cpp b/src/Backend/VLC/VLCSourceRenderer.cpp
index d0b43e5..a2a4e28 100644
--- a/src/Backend/VLC/VLCSourceRenderer.cpp
+++ b/src/Backend/VLC/VLCSourceRenderer.cpp
@@ -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 )
@@ -319,6 +315,30 @@ VLCSourceRenderer::setOutputAudioBitrate(unsigned int 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 )
{
m_modes |= VideoSmem;
@@ -371,4 +391,3 @@ VLCSourceRenderer::enableMemoryInput( void *data, MemoryInputLockCallback lockCa
sprintf( buffer, ":imem-data=%p", data );
m_media.addOption( buffer );
}
-
diff --git a/src/Backend/VLC/VLCSourceRenderer.h b/src/Backend/VLC/VLCSourceRenderer.h
index f03ba86..39ca84f 100644
--- a/src/Backend/VLC/VLCSourceRenderer.h
+++ b/src/Backend/VLC/VLCSourceRenderer.h
@@ -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;
--
1.9.1
More information about the Vlmc-devel
mailing list