[vlmc-devel] commit: Frame: Adding a clone method. ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Fri Jun 11 14:02:31 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Wed Jun 9 10:05:58 2010 +0200| [5d8d60b4de54680027a4bc5dcaefb83303d34946] | committer: Hugo Beauzée-Luyssen
Frame: Adding a clone method.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=5d8d60b4de54680027a4bc5dcaefb83303d34946
---
src/Workflow/Types.cpp | 10 ++++++++++
src/Workflow/Types.h | 1 +
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/Workflow/Types.cpp b/src/Workflow/Types.cpp
index ac64273..6171d7a 100644
--- a/src/Workflow/Types.cpp
+++ b/src/Workflow/Types.cpp
@@ -24,6 +24,8 @@
using namespace Workflow;
+#include <cstring> //memcpy
+
Frame::Frame( quint32 width, quint32 height ) :
ptsDiff( 0 ),
m_width( width ),
@@ -67,3 +69,11 @@ Frame::size() const
{
return m_size;
}
+
+Frame*
+Frame::clone() const
+{
+ Frame *f = new Frame( m_width, m_height );
+ memcpy( f->buffer(), m_buffer, m_size );
+ return f;
+}
diff --git a/src/Workflow/Types.h b/src/Workflow/Types.h
index 1bc30a6..5a23665 100644
--- a/src/Workflow/Types.h
+++ b/src/Workflow/Types.h
@@ -38,6 +38,7 @@ namespace Workflow
quint32 height() const;
quint8 *buffer();
const quint8 *buffer() const;
+ Frame *clone() const;
/**
* \returns The frame size in pixels
*
More information about the Vlmc-devel
mailing list