FastLED 3.9.15
Loading...
Searching...
No Matches
pixel_stream.h
Go to the documentation of this file.
1#pragma once
2
3#include "crgb.h"
4#include "fl/bytestream.h"
5#include "fl/file_system.h"
6#include "fl/namespace.h"
7#include "fl/memory.h"
8#include "fx/frame.h"
9#include "fl/int.h"
10namespace fl {
13} // namespace fl
14
15namespace fl {
16
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 enum Type {
27 };
28
29 explicit PixelStream(int bytes_per_frame);
30
31 bool begin(fl::FileHandlePtr h);
32 bool beginStream(fl::ByteStreamPtr s);
33 void close();
34 int32_t bytesPerFrame();
35 bool readPixel(CRGB *dst); // Convenience function to read a pixel
36 size_t readBytes(uint8_t *dst, size_t len);
37
38 bool readFrame(Frame *frame);
39 bool readFrameAt(fl::u32 frameNumber, Frame *frame);
40 bool hasFrame(fl::u32 frameNumber);
41 int32_t framesRemaining() const; // -1 if this is a stream.
42 int32_t framesDisplayed() const;
43 bool available() const;
44 bool atEnd() const;
45
46 int32_t bytesRemaining() const;
47 int32_t bytesRemainingInFrame() const;
48 bool
49 rewind(); // Returns false on failure, which can happen for streaming mode.
51 const; // Returns the type of the video stream (kStreaming or kFile)
52
53 private:
55 fl::FileHandlePtr mFileHandle;
56 fl::ByteStreamPtr mByteStream;
58
59 public:
60 virtual ~PixelStream();
61};
62
63} // namespace fl
int32_t framesRemaining() const
fl::i32 mbytesPerFrame
int32_t bytesRemaining() const
bool begin(fl::FileHandlePtr h)
int32_t bytesPerFrame()
virtual ~PixelStream()
int32_t bytesRemainingInFrame() const
bool hasFrame(fl::u32 frameNumber)
PixelStream(int bytes_per_frame)
int32_t framesDisplayed() const
bool atEnd() const
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
bool readFrameAt(fl::u32 frameNumber, Frame *frame)
fl::FileHandlePtr mFileHandle
Type getType() const
bool available() const
Defines the red, green, and blue (RGB) pixel struct.
Implements the FastLED namespace macros.
IMPORTANT!
Definition crgb.h:20
#define FASTLED_SMART_PTR(type)
Definition ptr.h:33
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86