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 
10 extern "C" {
11 #include "libavcodec/avcodec.h" /* AVFrame */
12 }
13 
14 class MythPlayer;
15 class MythAVCopy;
16 
17 /*
18  * PGM_CONVERT_GREYSCALE:
19  *
20  * If #define'd, perform a true greyscale conversion of "frame" in
21  * PGMConverter::getImage .
22  *
23  * If #undef'd, just fake up a greyscale data structure. The "frame" data is
24  * YUV data, and the Y channel is close enough for our purposes, and it's
25  * faster than a full-blown true greyscale conversion.
26  */
27 #define PGM_CONVERT_GREYSCALE
28 
30 {
31 public:
32  /* Ctor/dtor. */
33  PGMConverter(void) = default;
34  ~PGMConverter(void);
35 
36  int MythPlayerInited(const MythPlayer *player);
37  const AVFrame *getImage(const VideoFrame *frame, long long frameno,
38  int *pwidth, int *pheight);
39  int reportTime(void);
40 
41 private:
42  long long m_frameNo {-1}; /* frame number */
43  int m_width {-1}; /* frame dimensions */
44  int m_height {-1}; /* frame dimensions */
45  AVFrame m_pgm {}; /* grayscale frame */
46 #ifdef PGM_CONVERT_GREYSCALE
47  struct timeval m_convertTime {0,0};
48  bool m_timeReported {false};
49  MythAVCopy *m_copy {nullptr};
50 #endif /* PGM_CONVERT_GREYSCALE */
51 };
52 
53 #endif /* !PGMCONVERTER_H */
54 
55 /* vim: set expandtab tabstop=4 shiftwidth=4: */
PGMConverter::m_timeReported
bool m_timeReported
Definition: PGMConverter.h:48
MythPlayer
Definition: mythplayer.h:165
VideoFrame
Definition: mythframe.h:138
PGMConverter::m_height
int m_height
Definition: PGMConverter.h:44
PGMConverter::m_copy
MythAVCopy * m_copy
Definition: PGMConverter.h:49
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
PGMConverter::getImage
const AVFrame * getImage(const VideoFrame *frame, long long frameno, int *pwidth, int *pheight)
Definition: PGMConverter.cpp:72
PGMConverter::MythPlayerInited
int MythPlayerInited(const MythPlayer *player)
Definition: PGMConverter.cpp:35
PGMConverter::m_width
int m_width
Definition: PGMConverter.h:43
PGMConverter
Definition: PGMConverter.h:30
PGMConverter::PGMConverter
PGMConverter(void)=default
PGMConverter::m_frameNo
long long m_frameNo
Definition: PGMConverter.h:42
PGMConverter::m_pgm
AVFrame m_pgm
Definition: PGMConverter.h:45
PGMConverter::~PGMConverter
~PGMConverter(void)
Definition: PGMConverter.cpp:24
MythAVCopy
MythAVCopy Copy AVFrame<->frame, performing the required conversion if any.
Definition: mythavutil.h:108
PGMConverter::reportTime
int reportTime(void)
Definition: PGMConverter.cpp:120
PGMConverter::m_convertTime
Definition: PGMConverter.h:47