MythTV master
PGMConverter.h
Go to the documentation of this file.
1/*
2 * PGMConverter
3 *
4 * Object to convert a MythPlayer frame into a greyscale image.
5 */
6
7#ifndef PGMCONVERTER_H
8#define PGMCONVERTER_H
9
10extern "C" {
11#include "libavcodec/avcodec.h" /* AVFrame */
12}
13
14class MythPlayer;
15class MythAVCopy;
16class MythVideoFrame;
17
18/*
19 * PGM_CONVERT_GREYSCALE:
20 *
21 * If #define'd, perform a true greyscale conversion of "frame" in
22 * PGMConverter::getImage .
23 *
24 * If #undef'd, just fake up a greyscale data structure. The "frame" data is
25 * YUV data, and the Y channel is close enough for our purposes, and it's
26 * faster than a full-blown true greyscale conversion.
27 */
28#define PGM_CONVERT_GREYSCALE
29
31{
32public:
33 /* Ctor/dtor. */
34 PGMConverter(void) = default;
35 ~PGMConverter(void);
36
37 int MythPlayerInited(const MythPlayer *player);
38 const AVFrame *getImage(const MythVideoFrame *frame, long long frameno,
39 int *pwidth, int *pheight);
40 int reportTime(void);
41
42private:
43 long long m_frameNo {-1}; /* frame number */
44 int m_width {-1}; /* frame dimensions */
45 int m_height {-1}; /* frame dimensions */
46 AVFrame m_pgm {}; /* grayscale frame */
47#ifdef PGM_CONVERT_GREYSCALE
48 std::chrono::microseconds m_convertTime {0us};
49 bool m_timeReported {false};
50 MythAVCopy *m_copy {nullptr};
51#endif /* PGM_CONVERT_GREYSCALE */
52};
53
54#endif /* !PGMCONVERTER_H */
55
56/* vim: set expandtab tabstop=4 shiftwidth=4: */
AVFrame AVFrame
AVFrame m_pgm
Definition: PGMConverter.h:46
int MythPlayerInited(const MythPlayer *player)
const AVFrame * getImage(const MythVideoFrame *frame, long long frameno, int *pwidth, int *pheight)
int reportTime(void)
MythAVCopy * m_copy
Definition: PGMConverter.h:50
PGMConverter(void)=default
bool m_timeReported
Definition: PGMConverter.h:49
std::chrono::microseconds m_convertTime
Definition: PGMConverter.h:48
long long m_frameNo
Definition: PGMConverter.h:43
~PGMConverter(void)