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 typedef struct VideoFrame_ VideoFrame;
15 class MythPlayer;
16 class MythAVCopy;
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 VideoFrame *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_convert_time {0,0};
49  bool m_time_reported {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: */
bool m_time_reported
Definition: PGMConverter.h:49
struct AVFrame AVFrame
MythAVCopy Copy AVFrame<->frame, performing the required conversion if any.
Definition: mythavutil.h:114
PGMConverter(void)=default
AVFrame m_pgm
Definition: PGMConverter.h:46
~PGMConverter(void)
int MythPlayerInited(const MythPlayer *player)
MythAVCopy * m_copy
Definition: PGMConverter.h:50
long long m_frameno
Definition: PGMConverter.h:43
const AVFrame * getImage(const VideoFrame *frame, long long frameno, int *pwidth, int *pheight)
int reportTime(void)