[vlmc-devel] IInput: Implement getters of image and waveform
Yikai Lu
git at videolan.org
Sun Jul 24 11:54:43 CEST 2016
vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sun Jul 24 18:08:51 2016 +0900| [325b805018072f1718f5cca8c99336b9d0de84a0] | committer: Yikai Lu
IInput: Implement getters of image and waveform
> https://code.videolan.org/videolan/vlmc/commit/325b805018072f1718f5cca8c99336b9d0de84a0
---
src/Backend/IInput.h | 6 ++++++
src/Backend/MLT/MLTInput.cpp | 15 +++++++++++++++
src/Backend/MLT/MLTInput.h | 6 ++++++
3 files changed, 27 insertions(+)
diff --git a/src/Backend/IInput.h b/src/Backend/IInput.h
index cc4c1e1..0a2831b 100644
--- a/src/Backend/IInput.h
+++ b/src/Backend/IInput.h
@@ -81,6 +81,12 @@ namespace Backend
// The absolete position in frame
virtual int64_t frame() const = 0;
+ // Generates an 8-bit grayscale image at the current position
+ virtual uint8_t* waveform( uint32_t width, uint32_t height ) const = 0;
+
+ // Generates an 32-bit RGBA image at the current position
+ virtual uint8_t* image( uint32_t width, uint32_t height ) const = 0;
+
virtual double fps() const = 0;
virtual int width() const = 0;
virtual int height() const = 0;
diff --git a/src/Backend/MLT/MLTInput.cpp b/src/Backend/MLT/MLTInput.cpp
index 31e4849..23b130e 100644
--- a/src/Backend/MLT/MLTInput.cpp
+++ b/src/Backend/MLT/MLTInput.cpp
@@ -25,6 +25,7 @@
#include "MLTBackend.h"
#include "MLTFilter.h"
+#include <mlt++/MltFrame.h>
#include <mlt++/MltFilter.h>
#include <mlt++/MltProducer.h>
#include <cstring>
@@ -251,6 +252,20 @@ MLTInput::frame() const
return producer()->frame();
}
+uint8_t*
+MLTInput::waveform( uint32_t width, uint32_t height ) const
+{
+ std::unique_ptr<Mlt::Frame> waveformFrame( producer()->get_frame() );
+ return waveformFrame->get_waveform( (int)width, (int)height );
+}
+
+uint8_t*
+MLTInput::image( uint32_t width, uint32_t height ) const
+{
+ std::unique_ptr<Mlt::Frame> imageFrame( producer()->get_frame() );
+ return imageFrame->fetch_image( mlt_image_rgb24a, (int)width, (int)height );
+}
+
double
MLTInput::fps() const
{
diff --git a/src/Backend/MLT/MLTInput.h b/src/Backend/MLT/MLTInput.h
index 112657d..9a57e60 100644
--- a/src/Backend/MLT/MLTInput.h
+++ b/src/Backend/MLT/MLTInput.h
@@ -83,6 +83,12 @@ class MLTInput : virtual public IInput, public MLTService
// The absolete position in frame
virtual int64_t frame() const override;
+ // Generates an 8-bit grayscale image at the current position
+ virtual uint8_t* waveform( uint32_t width, uint32_t height ) const override;
+
+ // Generates an 32-bit RGBA image at the current position
+ virtual uint8_t* image( uint32_t width, uint32_t height ) const override;
+
virtual double fps() const override;
virtual int width() const override;
virtual int height() const override;
More information about the Vlmc-devel
mailing list