[vlmc-devel] commit: Avoid a useless buffer copy while rendering. (Hugo Beauzee-Luyssen )
git at videolan.org
git at videolan.org
Sun Mar 21 22:23:02 CET 2010
vlmc | branch: master | Hugo Beauzee-Luyssen <beauze.h at gmail.com> | Sun Mar 21 22:09:28 2010 +0100| [47310d7ff682ae0ac8ee6d882ce7bab01188be27] | committer: Hugo Beauzee-Luyssen
Avoid a useless buffer copy while rendering.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=47310d7ff682ae0ac8ee6d882ce7bab01188be27
---
src/Renderer/WorkflowFileRenderer.cpp | 2 +-
src/Renderer/WorkflowRenderer.cpp | 18 ++++++------------
src/Renderer/WorkflowRenderer.h | 1 -
3 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/src/Renderer/WorkflowFileRenderer.cpp b/src/Renderer/WorkflowFileRenderer.cpp
index 0c175dc..2daa624 100644
--- a/src/Renderer/WorkflowFileRenderer.cpp
+++ b/src/Renderer/WorkflowFileRenderer.cpp
@@ -107,7 +107,7 @@ WorkflowFileRenderer::lock( void *datas, qint64 *dts, qint64 *pts, quint32 *flag
if ( self->m_time.isValid() == false ||
self->m_time.elapsed() >= 1000 )
{
- self->emit imageUpdated( (uchar*)self->m_renderVideoFrame );
+ self->emit imageUpdated( (uchar*)*buffer );
self->m_time.restart();
}
#endif
diff --git a/src/Renderer/WorkflowRenderer.cpp b/src/Renderer/WorkflowRenderer.cpp
index e1b1093..dda3447 100644
--- a/src/Renderer/WorkflowRenderer.cpp
+++ b/src/Renderer/WorkflowRenderer.cpp
@@ -45,7 +45,6 @@ WorkflowRenderer::WorkflowRenderer() :
m_videoEsHandler( NULL ),
m_audioEsHandler( NULL ),
m_oldLength( 0 ),
- m_renderVideoFrame( NULL ),
m_media( NULL ),
m_width( 0 ),
m_height( 0 ),
@@ -83,6 +82,8 @@ WorkflowRenderer::~WorkflowRenderer()
delete m_audioEsHandler;
if ( m_media )
delete m_media;
+ if ( m_silencedAudioBuffer )
+ delete m_silencedAudioBuffer;
}
void
@@ -93,13 +94,9 @@ WorkflowRenderer::setupRenderer( quint32 width, quint32 height, double fps )
char audioParameters[256];
char callbacks[64];
- if ( m_renderVideoFrame != NULL )
- delete m_renderVideoFrame;
- m_renderVideoFrame = new unsigned char[width * height * Pixel::NbComposantes];
m_audioEsHandler->fps = fps;
m_videoEsHandler->fps = fps;
//Clean any previous render.
- memset( m_renderVideoFrame, 0, m_width * m_height * Pixel::NbComposantes );
sprintf( videoString, "width=%i:height=%i:dar=%s:fps=%s:data=%" PRId64 ":codec=%s:cat=2:caching=0",
width, height, "16/9", "30/1",
@@ -151,15 +148,12 @@ WorkflowRenderer::lock( void *datas, qint64 *dts, qint64 *pts, quint32 *flags,
int
WorkflowRenderer::lockVideo( EsHandler *handler, qint64 *pts, size_t *bufferSize, void **buffer )
{
- qint64 ptsDiff = 0;
+ qint64 ptsDiff = 0;
+ MainWorkflow::OutputBuffers* ret;
if ( m_stopping == false )
{
- MainWorkflow::OutputBuffers* ret =
- m_mainWorkflow->getOutput( MainWorkflow::VideoTrack, m_paused );
- memcpy( m_renderVideoFrame,
- (*(ret->video))->frame.octets,
- (*(ret->video))->nboctets );
+ ret = m_mainWorkflow->getOutput( MainWorkflow::VideoTrack, m_paused );
m_videoBuffSize = (*(ret->video))->nboctets;
ptsDiff = (*(ret->video))->ptsDiff;
}
@@ -171,7 +165,7 @@ WorkflowRenderer::lockVideo( EsHandler *handler, qint64 *pts, size_t *bufferSize
ptsDiff = 1000000 / handler->fps;
}
m_pts = *pts = ptsDiff + m_pts;
- *buffer = m_renderVideoFrame;
+ *buffer = (*(ret->video))->frame.octets;
*bufferSize = m_videoBuffSize;
return 0;
}
diff --git a/src/Renderer/WorkflowRenderer.h b/src/Renderer/WorkflowRenderer.h
index 78934d2..9ffa851 100644
--- a/src/Renderer/WorkflowRenderer.h
+++ b/src/Renderer/WorkflowRenderer.h
@@ -257,7 +257,6 @@ class WorkflowRenderer : public GenericRenderer
LibVLCpp::Media* m_media;
bool m_stopping;
float m_outputFps;
- unsigned char* m_renderVideoFrame;
/**
* \brief This isn't exactly the current PTS.
* It's the number of frame rendered since the render has started.
More information about the Vlmc-devel
mailing list