Commit b8528548 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Don't use m_outputFps while rendering.

parent 33dbf530
......@@ -49,6 +49,7 @@ void WorkflowFileRenderer::run()
m_width = width();
m_height = height();
m_outputFps = 30.0;
setupRenderer( m_width, m_height, m_outputFps );
//Media as already been created and mainly initialized by the WorkflowRenderer
......
......@@ -88,6 +88,8 @@ WorkflowRenderer::setupRenderer( quint32 width, quint32 height, double fps )
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 );
......@@ -123,13 +125,13 @@ WorkflowRenderer::lock( void *datas, qint64 *dts, qint64 *pts, quint32 *flags,
*flags = 0;
if ( handler->type == Video )
{
ret = handler->self->lockVideo( pts, bufferSize, buffer );
ret = handler->self->lockVideo( handler, pts, bufferSize, buffer );
if ( paused == false )
handler->self->m_mainWorkflow->nextFrame( MainWorkflow::VideoTrack );
}
else if ( handler->type == Audio )
{
ret = handler->self->lockAudio( pts, bufferSize, buffer );
ret = handler->self->lockAudio( handler, pts, bufferSize, buffer );
if ( paused == false )
handler->self->m_mainWorkflow->nextFrame( MainWorkflow::AudioTrack );
}
......@@ -139,7 +141,7 @@ WorkflowRenderer::lock( void *datas, qint64 *dts, qint64 *pts, quint32 *flags,
}
int
WorkflowRenderer::lockVideo( qint64 *pts, size_t *bufferSize, void **buffer )
WorkflowRenderer::lockVideo( EsHandler *handler, qint64 *pts, size_t *bufferSize, void **buffer )
{
qint64 ptsDiff = 0;
......@@ -158,7 +160,7 @@ WorkflowRenderer::lockVideo( qint64 *pts, size_t *bufferSize, void **buffer )
//If no ptsDiff has been computed, we have to fake it, so we compute
//the theorical pts for one frame.
//this is a bit hackish though... (especially regarding the "no frame computed" detection)
ptsDiff = 1000000 / m_outputFps;
ptsDiff = 1000000 / handler->fps;
}
m_pts = *pts = ptsDiff + m_pts;
*buffer = m_renderVideoFrame;
......@@ -167,7 +169,7 @@ WorkflowRenderer::lockVideo( qint64 *pts, size_t *bufferSize, void **buffer )
}
int
WorkflowRenderer::lockAudio( qint64 *pts, size_t *bufferSize, void **buffer )
WorkflowRenderer::lockAudio( EsHandler *handler, qint64 *pts, size_t *bufferSize, void **buffer )
{
qint64 ptsDiff;
uint32_t nbSample;
......@@ -190,7 +192,7 @@ WorkflowRenderer::lockAudio( qint64 *pts, size_t *bufferSize, void **buffer )
}
else
{
nbSample = m_rate / m_outputFps;
nbSample = m_rate / handler->fps;
unsigned int buffSize = m_nbChannels * 2 * nbSample;
if ( m_silencedAudioBuffer == NULL )
m_silencedAudioBuffer = new uint8_t[ buffSize ];
......
......@@ -61,6 +61,7 @@ class WorkflowRenderer : public GenericRenderer
{
WorkflowRenderer* self; ///< The 'this' pointer will be passed in this field
EsType type; ///< The elementary stream type
double fps; ///< The fps to use for this rendering session.
};
WorkflowRenderer();
......@@ -192,7 +193,8 @@ class WorkflowRenderer : public GenericRenderer
* \param bufferSize The size of the buffer that will be provided
* \param buffer The buffer itself.
*/
int lockVideo( qint64 *pts, size_t *bufferSize, void **buffer );
int lockVideo( EsHandler *handler, qint64 *pts,
size_t *bufferSize, void **buffer );
/**
* \brief "Subcallback", for audio sample injection
*
......@@ -200,7 +202,8 @@ class WorkflowRenderer : public GenericRenderer
* \param bufferSize The size of the buffer that will be provided
* \param buffer The buffer itself.
*/
int lockAudio( qint64 *pts, size_t *bufferSize, void **buffer );
int lockAudio( EsHandler *handler, qint64 *pts,
size_t *bufferSize, void **buffer );
/**
* \brief unlock callback for the imem module
*
......
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