arduino-audio-tools
Loading...
Searching...
No Matches
src
AudioTools
Video
OutputTFT_eSPI.h
Go to the documentation of this file.
1
#pragma once
2
#include <TFT_eSPI.h>
// https://github.com/Bodmer/TFT_eSPI
3
4
#include "
AudioTools/Video/CodecVideo.h
"
5
6
namespace
audio_tools
{
7
17
class
OutputTFT_eSPI
:
public
VideoOutput
{
18
public
:
19
OutputTFT_eSPI
(TFT_eSPI& tft) :
tft_
(tft) {}
20
21
bool
begin
() {
22
tft_
.init();
23
tft_
.setRotation(1);
24
tft_
.fillScreen(TFT_BLACK);
25
return
true
;
26
}
27
29
void
setVideoInfoSource
(
VideoInfoSource
& source) {
30
p_info
= &source;
31
}
32
34
void
setVideoInfo
(
VideoInfo
info) {
35
info_
= info;
36
}
37
38
size_t
write
(
const
uint8_t* data,
size_t
len)
override
{
39
if
(
p_info
!=
nullptr
) {
40
info_
=
p_info
->
videoInfo
();
41
}
42
if
(
info_
.
width
== 0 ||
info_
.
height
== 0) {
43
LOGE
(
"OutputTFT: invalid video size: %d x %d"
, (
int
)
info_
.
width
,
44
(
int
)
info_
.
height
);
45
return
0;
46
}
47
tft_
.pushImage(0, 0,
info_
.
width
,
info_
.
height
, (uint16_t*)data);
48
return
len;
49
}
50
51
protected
:
52
TFT_eSPI&
tft_
;
53
VideoInfoSource
*
p_info
=
nullptr
;
54
VideoInfo
info_
;
55
};
56
57
}
// namespace audio_tools
LOGE
#define LOGE(...)
Definition
AudioLoggerIDF.h:30
CodecVideo.h
audio_tools::OutputTFT_eSPI
Bridges VideoDecoder's write() calls to the TFT - VideoDecoder always hands over one complete frame p...
Definition
OutputTFT_eSPI.h:17
audio_tools::OutputTFT_eSPI::p_info
VideoInfoSource * p_info
Definition
OutputTFT_eSPI.h:53
audio_tools::OutputTFT_eSPI::info_
VideoInfo info_
Definition
OutputTFT_eSPI.h:54
audio_tools::OutputTFT_eSPI::begin
bool begin()
Definition
OutputTFT_eSPI.h:21
audio_tools::OutputTFT_eSPI::write
size_t write(const uint8_t *data, size_t len) override
Definition
OutputTFT_eSPI.h:38
audio_tools::OutputTFT_eSPI::OutputTFT_eSPI
OutputTFT_eSPI(TFT_eSPI &tft)
Definition
OutputTFT_eSPI.h:19
audio_tools::OutputTFT_eSPI::setVideoInfoSource
void setVideoInfoSource(VideoInfoSource &source)
Defines the source of the video information (width, height, fps, format)
Definition
OutputTFT_eSPI.h:29
audio_tools::OutputTFT_eSPI::tft_
TFT_eSPI & tft_
Definition
OutputTFT_eSPI.h:52
audio_tools::OutputTFT_eSPI::setVideoInfo
void setVideoInfo(VideoInfo info)
Defines the video format and dimensions - call before begin() if you.
Definition
OutputTFT_eSPI.h:34
audio_tools::VideoInfoSource
Definition
Video.h:176
audio_tools::VideoInfoSource::videoInfo
virtual VideoInfo videoInfo()=0
audio_tools::VideoOutput
Abstract class for video playback. This class is used to assemble a complete video frame in memory....
Definition
Video.h:192
audio_tools
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition
LMSEchoCancellationStream.h:6
audio_tools::VideoInfo
Basic video information (width/height/codec/frame size), analogous to AudioInfo - common to both Demu...
Definition
Video.h:102
audio_tools::VideoInfo::height
uint16_t height
Frame height in pixels.
Definition
Video.h:106
audio_tools::VideoInfo::width
uint16_t width
Frame width in pixels.
Definition
Video.h:104
Generated by
1.9.8