mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Add new Stream base class, internal-only for now.
This commit is contained in:
@@ -31,11 +31,12 @@ namespace data
|
||||
|
||||
love::Type ByteData::type("ByteData", &Data::type);
|
||||
|
||||
ByteData::ByteData(size_t size)
|
||||
ByteData::ByteData(size_t size, bool clear)
|
||||
: size(size)
|
||||
{
|
||||
create();
|
||||
memset(data, 0, size);
|
||||
if (clear)
|
||||
memset(data, 0, size);
|
||||
}
|
||||
|
||||
ByteData::ByteData(const void *d, size_t size)
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
|
||||
static love::Type type;
|
||||
|
||||
ByteData(size_t size);
|
||||
ByteData(size_t size, bool clear = true);
|
||||
ByteData(const void *d, size_t size);
|
||||
ByteData(void *d, size_t size, bool own);
|
||||
ByteData(const ByteData &d);
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
// LOVE
|
||||
#include "common/Module.h"
|
||||
#include "common/Stream.h"
|
||||
#include "filesystem/File.h"
|
||||
|
||||
#include "VideoStream.h"
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace love
|
||||
namespace video
|
||||
{
|
||||
|
||||
love::Type VideoStream::type("VideoStream", &Stream::type);
|
||||
love::Type VideoStream::type("VideoStream", &Object::type);
|
||||
|
||||
void VideoStream::setSync(VideoStream::FrameSync *frameSync)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define LOVE_VIDEO_VIDEOSTREAM_H
|
||||
|
||||
// LOVE
|
||||
#include "common/Stream.h"
|
||||
#include "common/Object.h"
|
||||
#include "audio/Source.h"
|
||||
#include "thread/threads.h"
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace love
|
||||
namespace video
|
||||
{
|
||||
|
||||
class VideoStream : public Stream
|
||||
class VideoStream : public love::Object
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -39,6 +39,28 @@ public:
|
||||
|
||||
virtual ~VideoStream() {}
|
||||
|
||||
/**
|
||||
* A callback, gets called when some Stream consumer exhausts the data
|
||||
**/
|
||||
virtual void fillBackBuffer() {}
|
||||
|
||||
/**
|
||||
* Get the front buffer, Streams are supposed to be (at least) double-buffered
|
||||
**/
|
||||
virtual const void* getFrontBuffer() const = 0;
|
||||
|
||||
/**
|
||||
* Get the size of any (and in particular the front) buffer
|
||||
**/
|
||||
virtual size_t getSize() const = 0;
|
||||
|
||||
/**
|
||||
* Swap buffers. Returns true if there is new data in the front buffer,
|
||||
* false otherwise.
|
||||
* NOTE: If there is no back buffer ready, this call must be ignored
|
||||
**/
|
||||
virtual bool swapBuffers() = 0;
|
||||
|
||||
virtual int getWidth() const = 0;
|
||||
virtual int getHeight() const = 0;
|
||||
virtual const std::string &getFilename() const = 0;
|
||||
|
||||
Reference in New Issue
Block a user