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 class 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 {
32 public:
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 
42 private:
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  struct timeval m_convertTime {0,0};
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: */
PGMConverter::m_timeReported
bool m_timeReported
Definition: PGMConverter.h:49
MythPlayer
Definition: mythplayer.h:100
PGMConverter::m_height
int m_height
Definition: PGMConverter.h:45
PGMConverter::m_copy
MythAVCopy * m_copy
Definition: PGMConverter.h:50
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
PGMConverter::MythPlayerInited
int MythPlayerInited(const MythPlayer *player)
Definition: PGMConverter.cpp:35
PGMConverter::m_width
int m_width
Definition: PGMConverter.h:44
PGMConverter
Definition: PGMConverter.h:31
PGMConverter::getImage
const AVFrame * getImage(const MythVideoFrame *frame, long long frameno, int *pwidth, int *pheight)
Definition: PGMConverter.cpp:72
PGMConverter::PGMConverter
PGMConverter(void)=default
PGMConverter::m_frameNo
long long m_frameNo
Definition: PGMConverter.h:43
PGMConverter::m_pgm
AVFrame m_pgm
Definition: PGMConverter.h:46
PGMConverter::~PGMConverter
~PGMConverter(void)
Definition: PGMConverter.cpp:24
MythAVCopy
Definition: mythavutil.h:41
PGMConverter::reportTime
int reportTime(void)
Definition: PGMConverter.cpp:120
MythVideoFrame
Definition: mythframe.h:83
PGMConverter::m_convertTime
Definition: PGMConverter.h:48