Commit 325b8050 authored by luyikei's avatar luyikei

IInput: Implement getters of image and waveform

parent 52ca2caa
......@@ -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;
......
......@@ -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
{
......
......@@ -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;
......
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