FastLED 3.9.15
Loading...
Searching...
No Matches
pixel_stream.h
Go to the documentation of this file.
1#pragma once
2
3#include "fl/namespace.h"
4#include "crgb.h"
5#include "fl/ptr.h"
6#include "fl/bytestream.h"
7#include "fl/file_system.h"
8#include "fx/frame.h"
9namespace fl {
12}
13
14namespace fl {
15
17
18
19// PixelStream takes either a file handle or a byte stream
20// and reads frames from it in order to serve data to the
21// video system.
23 public:
24
25 enum Type {
28 };
29
30 explicit PixelStream(int bytes_per_frame);
31
32 bool begin(fl::FileHandlePtr h);
33 bool beginStream(fl::ByteStreamPtr s);
34 void close();
35 int32_t bytesPerFrame();
36 bool readPixel(CRGB* dst); // Convenience function to read a pixel
37 size_t readBytes(uint8_t* dst, size_t len);
38
39 bool readFrame(Frame* frame);
40 bool readFrameAt(uint32_t frameNumber, Frame* frame);
41 bool hasFrame(uint32_t frameNumber);
42 int32_t framesRemaining() const; // -1 if this is a stream.
43 int32_t framesDisplayed() const;
44 bool available() const;
45 bool atEnd() const;
46
47 int32_t bytesRemaining() const;
48 int32_t bytesRemainingInFrame() const;
49 bool rewind(); // Returns false on failure, which can happen for streaming mode.
50 Type getType() const; // Returns the type of the video stream (kStreaming or kFile)
51
52 private:
54 fl::FileHandlePtr mFileHandle;
55 fl::ByteStreamPtr mByteStream;
57
58protected:
59 virtual ~PixelStream();
60};
61
62} // namespace fl
bool hasFrame(uint32_t frameNumber)
int32_t framesRemaining() const
bool readFrameAt(uint32_t frameNumber, Frame *frame)
int32_t bytesRemaining() const
bool begin(fl::FileHandlePtr h)
int32_t bytesPerFrame()
virtual ~PixelStream()
int32_t bytesRemainingInFrame() const
PixelStream(int bytes_per_frame)
int32_t framesDisplayed() const
bool atEnd() const
int32_t mbytesPerFrame
bool readPixel(CRGB *dst)
bool readFrame(Frame *frame)
bool beginStream(fl::ByteStreamPtr s)
size_t readBytes(uint8_t *dst, size_t len)
fl::ByteStreamPtr mByteStream
fl::FileHandlePtr mFileHandle
Type getType() const
bool available() const
Defines the red, green, and blue (RGB) pixel struct.
#define FASTLED_SMART_PTR(type)
Definition ptr.h:17
Implements the FastLED namespace macros.
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54