[vlmc-devel] [PATCH 10/10] Remove AudioSample and OutputBuffer
Yikai Lu
luyikei.qmltu at gmail.com
Wed May 4 16:18:41 CEST 2016
---
src/Renderer/WorkflowRenderer.cpp | 5 ++---
src/Workflow/MainWorkflow.cpp | 4 ++--
src/Workflow/MainWorkflow.h | 2 +-
src/Workflow/TrackWorkflow.cpp | 12 ++++++------
src/Workflow/TrackWorkflow.h | 4 ++--
src/Workflow/Types.cpp | 3 ---
src/Workflow/Types.h | 25 +------------------------
7 files changed, 14 insertions(+), 41 deletions(-)
diff --git a/src/Renderer/WorkflowRenderer.cpp b/src/Renderer/WorkflowRenderer.cpp
index 2962c5c..7be9e31 100644
--- a/src/Renderer/WorkflowRenderer.cpp
+++ b/src/Renderer/WorkflowRenderer.cpp
@@ -133,7 +133,7 @@ WorkflowRenderer::lockVideo( void* data, int64_t *pts, size_t *bufferSize, const
if ( m_stopping == true )
return 1;
- ret = static_cast<const Workflow::Frame*>( m_mainWorkflow->getOutput( Workflow::VideoTrack, m_paused ) );
+ ret = m_mainWorkflow->getOutput( Workflow::VideoTrack, m_paused );
ptsDiff = ret->ptsDiff;
if ( ptsDiff == 0 )
{
@@ -169,8 +169,7 @@ WorkflowRenderer::lockAudio( EsHandler *handler, int64_t *pts, size_t *bufferSiz
if ( m_stopping == false && m_paused == false )
{
- renderAudioSample = static_cast<const Workflow::Frame*>( m_mainWorkflow->getOutput( Workflow::AudioTrack,
- m_paused ) );
+ renderAudioSample = m_mainWorkflow->getOutput( Workflow::AudioTrack, m_paused );
}
else
renderAudioSample = nullptr;
diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index ceb06fa..2d3d134 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -111,7 +111,7 @@ MainWorkflow::startRender( quint32 width, quint32 height )
computeLength();
}
-const Workflow::OutputBuffer*
+const Workflow::Frame*
MainWorkflow::getOutput( Workflow::TrackType trackType, bool paused )
{
if ( m_renderStarted == true )
@@ -126,7 +126,7 @@ MainWorkflow::getOutput( Workflow::TrackType trackType, bool paused )
}
bool validTrack = false;
- Workflow::OutputBuffer *ret = nullptr;
+ Workflow::Frame *ret = nullptr;
for ( int i = m_trackCount - 1; i >= 0; --i )
{
diff --git a/src/Workflow/MainWorkflow.h b/src/Workflow/MainWorkflow.h
index 09c2a0b..8f5b96e 100644
--- a/src/Workflow/MainWorkflow.h
+++ b/src/Workflow/MainWorkflow.h
@@ -79,7 +79,7 @@ class MainWorkflow : public QObject
* \param trackType The type of track you wish to get the render from.
* \param paused The paused state of the renderer
*/
- const Workflow::OutputBuffer *getOutput( Workflow::TrackType trackType, bool paused );
+ const Workflow::Frame *getOutput( Workflow::TrackType trackType, bool paused );
/**
* \brief Set the workflow position by the desired frame
* \param currentFrame: The desired frame to render from
diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
index 9d34269..92a34ee 100644
--- a/src/Workflow/TrackWorkflow.cpp
+++ b/src/Workflow/TrackWorkflow.cpp
@@ -162,7 +162,7 @@ TrackWorkflow::getClipHelper( const QUuid& uuid )
return nullptr;
}
-Workflow::OutputBuffer*
+Workflow::Frame*
TrackWorkflow::renderClip( Workflow::TrackType trackType, ClipWorkflow* cw, qint64 currentFrame,
qint64 start , bool needRepositioning,
bool renderOneFrame, bool paused )
@@ -258,7 +258,7 @@ TrackWorkflow::stop()
m_isRendering = false;
}
-Workflow::OutputBuffer*
+Workflow::Frame*
TrackWorkflow::getOutput( Workflow::TrackType trackType, qint64 currentFrame, qint64 subFrame, bool paused )
{
QReadLocker lock( m_clipsLock );
@@ -266,7 +266,7 @@ TrackWorkflow::getOutput( Workflow::TrackType trackType, qint64 currentFrame, qi
QMap<qint64, ClipWorkflow*>::iterator it = m_clips.begin();
QMap<qint64, ClipWorkflow*>::iterator end = m_clips.end();
bool needRepositioning;
- Workflow::OutputBuffer *ret = nullptr;
+ Workflow::Frame *ret = nullptr;
Workflow::Frame *frames[EffectsEngine::MaxFramesForMixer];
quint32 frameId = 0;
bool renderOneFrame;
@@ -308,7 +308,7 @@ TrackWorkflow::getOutput( Workflow::TrackType trackType, qint64 currentFrame, qi
renderOneFrame, paused );
if ( trackType == Workflow::VideoTrack )
{
- frames[frameId] = static_cast<Workflow::Frame*>( ret );
+ frames[frameId] = ret;
++frameId;
}
}
@@ -337,12 +337,12 @@ TrackWorkflow::getOutput( Workflow::TrackType trackType, qint64 currentFrame, qi
else //If there's no mixer, just use the first frame, ignore the rest. It will be cleaned by the responsible ClipWorkflow.
ret = frames[0];
//Now handle filters :
- quint32 *newFrame = applyFilters( ret != nullptr ? static_cast<const Workflow::Frame*>( ret ) : Core::instance()->workflow()->blackOutput(),
+ quint32 *newFrame = applyFilters( ret != nullptr ? ret : Core::instance()->workflow()->blackOutput(),
currentFrame );
if ( newFrame != nullptr )
{
if ( ret != nullptr )
- static_cast<Workflow::Frame*>( ret )->setBuffer( newFrame );
+ ret->setBuffer( newFrame );
else //Use the m_mixerBuffer as the frame to return. Ugly but avoid another attribute.
{
m_mixerBuffer->setBuffer( newFrame );
diff --git a/src/Workflow/TrackWorkflow.h b/src/Workflow/TrackWorkflow.h
index dff05b0..d8b32f3 100644
--- a/src/Workflow/TrackWorkflow.h
+++ b/src/Workflow/TrackWorkflow.h
@@ -52,7 +52,7 @@ class TrackWorkflow : public EffectUser
TrackWorkflow( quint32 trackId );
~TrackWorkflow();
- Workflow::OutputBuffer *getOutput( Workflow::TrackType trackType, qint64 currentFrame,
+ Workflow::Frame *getOutput( Workflow::TrackType trackType, qint64 currentFrame,
qint64 subFrame, bool paused );
qint64 getLength() const;
void stop();
@@ -102,7 +102,7 @@ class TrackWorkflow : public EffectUser
private:
void computeLength();
- Workflow::OutputBuffer *renderClip( Workflow::TrackType trackType, ClipWorkflow* cw, qint64 currentFrame,
+ Workflow::Frame *renderClip( Workflow::TrackType trackType, ClipWorkflow* cw, qint64 currentFrame,
qint64 start, bool needRepositioning,
bool renderOneFrame, bool paused );
void preloadClip( ClipWorkflow* cw );
diff --git a/src/Workflow/Types.cpp b/src/Workflow/Types.cpp
index 94efd18..aad04ad 100644
--- a/src/Workflow/Types.cpp
+++ b/src/Workflow/Types.cpp
@@ -27,7 +27,6 @@ using namespace Workflow;
#include <cstring> //memcpy
Frame::Frame() :
- OutputBuffer( VideoTrack ),
ptsDiff( 0 ),
m_buffer( 0 ),
m_size( 0 ),
@@ -36,7 +35,6 @@ Frame::Frame() :
}
Frame::Frame( quint32 width, quint32 height ) :
- OutputBuffer( VideoTrack ),
ptsDiff( 0 ),
m_pts( 0 )
{
@@ -45,7 +43,6 @@ Frame::Frame( quint32 width, quint32 height ) :
}
Frame::Frame( size_t forcedSize ) :
- OutputBuffer( VideoTrack ),
ptsDiff( 0 ),
m_pts( 0 )
{
diff --git a/src/Workflow/Types.h b/src/Workflow/Types.h
index 1b289a0..c54ee2a 100644
--- a/src/Workflow/Types.h
+++ b/src/Workflow/Types.h
@@ -40,14 +40,7 @@ namespace Workflow
NbTrackType, ///< Used to know how many types we have
};
- struct OutputBuffer
- {
- TrackType type;
- protected:
- OutputBuffer( TrackType _type ) : type( _type ) {}
- };
-
- class Frame : public OutputBuffer
+ class Frame
{
public:
explicit Frame();
@@ -95,22 +88,6 @@ namespace Workflow
quint32 m_nbPixels;
qint64 m_pts;
};
- class AudioSample : public OutputBuffer
- {
- public:
- AudioSample()
- : OutputBuffer( AudioTrack )
- , buff( nullptr )
- , size( 0 )
- {
- }
- unsigned char* buff;
- size_t size;
- quint32 nbSample;
- quint32 nbChannels;
- qint64 ptsDiff;
- qint64 pts;
- };
}
namespace Vlmc
--
1.9.1
More information about the Vlmc-devel
mailing list