FastLED
3.9.3
Loading...
Searching...
No Matches
video.h
1
#pragma once
2
3
#include <stdint.h>
4
5
#include "namespace.h"
6
#include "ref.h"
7
#include "fx/fx2d.h"
8
9
10
FASTLED_NAMESPACE_BEGIN
11
12
// Forward declare dependencies.
13
FASTLED_SMART_REF(
VideoImpl
);
14
FASTLED_SMART_REF(
ByteStream
);
15
FASTLED_SMART_REF(
FileHandle
);
16
FASTLED_SMART_REF(
VideoFx
);
17
FASTLED_SMART_REF(
Frame
);
18
struct
CRGB
;
19
20
// Video represents a video file that can be played back on a LED strip.
21
// The video file is expected to be a sequence of frames. You can either use
22
// a file handle or a byte stream to read the video data.
23
class
Video
{
24
public
:
25
// frameHistoryCount is the number of frames to keep in the buffer after draw. This
26
// allows for time based effects like syncing video speed to audio triggers.
27
Video
();
// Please use FileSytem to construct a Video.
28
Video
(FileHandleRef h,
size_t
pixelsPerFrame,
float
fps = 30.0f,
size_t
frameHistoryCount = 0);
29
Video
(ByteStreamRef s,
size_t
pixelsPerFrame,
float
fps = 30.0f,
size_t
frameHistoryCount = 0);
30
~Video
();
31
Video
(
const
Video
&);
32
Video
& operator=(
const
Video
&);
33
// Api
34
void
begin(FileHandleRef h,
size_t
pixelsPerFrame,
float
fps = 30.0f,
size_t
frameHistoryCount = 0);
35
void
beginStream(ByteStreamRef s,
size_t
pixelsPerFrame,
float
fps = 30.0f,
size_t
frameHistoryCount = 0);
36
bool
draw(uint32_t now,
CRGB
* leds, uint8_t* alpha =
nullptr
);
37
bool
draw(uint32_t now,
Frame
* frame);
38
void
end();
39
bool
finished();
40
bool
rewind();
41
42
// make compatible with if statements
43
operator
bool()
const
{
return
mImpl.get(); }
44
private
:
45
bool
mFinished =
false
;
46
VideoImplRef mImpl;
47
};
48
49
50
class
VideoFx
:
public
FxGrid
{
51
public
:
52
VideoFx
(
Video
video,
XYMap
xymap);
53
void
draw
(
DrawContext
context)
override
;
54
const
char
*fxName(
int
)
const override
;
55
56
private
:
57
Video
mVideo;
58
FrameRef mFrame;
59
};
60
61
FASTLED_NAMESPACE_END
62
ByteStream
Definition
bytestream.h:17
FileHandle
Definition
file_system.h:43
Frame
Definition
frame.h:18
FxGrid
Definition
fx2d.h:16
VideoFx
Definition
video.h:50
VideoFx::draw
void draw(DrawContext context) override
Definition
video.cpp:234
Video
Definition
video.h:23
VideoImpl
Definition
video.cpp:30
XYMap
Definition
xymap.h:39
_DrawContext
Definition
draw_context.h:11
CRGB
Representation of an RGB pixel (Red, Green, Blue)
Definition
crgb.h:39
src
fx
video.h
Generated on Thu Nov 14 2024 00:00:34 for FastLED by
1.11.0