MythTV  master
thumbfinder.h
Go to the documentation of this file.
1 #ifndef THUMBFINDER_H_
2 #define THUMBFINDER_H_
3 
4 extern "C" {
5 #include <libavcodec/avcodec.h>
6 #include <libavformat/avformat.h>
7 }
8 
9 // qt
10 #include <QString>
11 #include <QStringList>
12 #include <QScopedPointer>
13 
14 // mythtv
15 #include <libmyth/mythavframe.h>
17 #include <libmythtv/mythavutil.h>
19 
20 // mytharchive
21 #include "archiveutil.h"
22 #include "remoteavformatcontext.h"
23 
24 struct SeekAmount
25 {
26  QString name;
27  int amount;
28 };
29 
30 class MythUIButton;
31 class MythUItext;
32 class MythUIImage;
33 class MythUIButtonList;
35 class MythImage;
36 
38 {
39 
40  Q_OBJECT
41 
42  public:
43 
44  ThumbFinder(MythScreenStack *parent, ArchiveItem *archiveItem,
45  const QString &menuTheme);
46  ~ThumbFinder() override;
47 
48  bool Create(void) override; // MythScreenType
49  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
50 
51 
52  private slots:
54  void ShowMenu(void) override; // MythScreenType
55  void cancelPressed(void);
56  void savePressed(void);
57  void updateThumb(void);
58 
59  private:
60  void Init(void) override; // MythScreenType
61  bool getThumbImages(void);
62  static int getChapterCount(const QString &menuTheme);
63  void changeSeekAmount(bool up);
64  void updateCurrentPos(void);
65  bool seekToFrame(int frame, bool checkPos = true);
66  static QString createThumbDir(void);
67  QString frameToTime(int64_t frame, bool addFrame = false) const;
68 
69  // avcodec stuff
70  bool initAVCodec(const QString &inFile);
71  void closeAVCodec();
72  bool seekForward();
73  bool seekBackward();
74  bool getFrameImage(bool needKeyFrame = true, int64_t requiredPTS = -1);
75  int checkFramePosition(int frameNumber);
76  void loadCutList(void);
77  void updatePositionBar(int64_t frame);
78  int calcFinalDuration(void);
79 
81  AVCodecContext *m_codecCtx {nullptr};
83  const AVCodec *m_codec {nullptr};
86 
87  float m_fps {0.0F};
88  unsigned char *m_outputbuf {nullptr};
89  QString m_frameFile;
90  int m_frameWidth { 0};
91  int m_frameHeight { 0};
92  int m_videostream { 0};
93  size_t m_currentSeek { 0};
94  int64_t m_startTime {-1}; // in time_base units
95  int64_t m_startPTS {-1}; // in time_base units
96  int64_t m_currentPTS {-1}; // in time_base units
97  int64_t m_firstIFramePTS {-1};
98  int64_t m_frameTime { 0}; // in time_base units
99  bool m_updateFrame {false};
101  int m_finalDuration { 0};
102  int m_offset { 0};
103 
106  QList<ThumbImage *> m_thumbList;
107  QString m_thumbDir;
108 
109  // GUI stuff
118 };
119 
120 #endif
ThumbFinder::m_frameHeight
int m_frameHeight
Definition: thumbfinder.h:91
remoteavformatcontext.h
ThumbFinder::getThumbImages
bool getThumbImages(void)
Definition: thumbfinder.cpp:416
ThumbFinder::cancelPressed
void cancelPressed(void)
Definition: thumbfinder.cpp:305
MythUIImage
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
ThumbFinder::m_startPTS
int64_t m_startPTS
Definition: thumbfinder.h:95
ThumbFinder::updateCurrentPos
void updateCurrentPos(void)
Definition: thumbfinder.cpp:310
SeekAmount
Definition: thumbfinder.h:24
ThumbFinder::seekBackward
bool seekBackward()
Definition: thumbfinder.cpp:721
ThumbFinder::m_videostream
int m_videostream
Definition: thumbfinder.h:92
MythAVFrame
MythAVFrame little utility class that act as a safe way to allocate an AVFrame which can then be allo...
Definition: mythavframe.h:26
ThumbFinder::m_firstIFramePTS
int64_t m_firstIFramePTS
Definition: thumbfinder.h:97
MythScreenStack
Definition: mythscreenstack.h:16
frm_dir_map_t
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:117
SeekAmount::name
QString name
Definition: thumbfinder.h:26
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
ThumbFinder::m_archiveItem
ArchiveItem * m_archiveItem
Definition: thumbfinder.h:104
ThumbFinder::m_codec
const AVCodec * m_codec
Definition: thumbfinder.h:83
mythavframe.h
ThumbFinder::m_startTime
int64_t m_startTime
Definition: thumbfinder.h:94
ThumbFinder::m_frameFile
QString m_frameFile
Definition: thumbfinder.h:89
ThumbFinder::calcFinalDuration
int calcFinalDuration(void)
Definition: thumbfinder.cpp:929
ThumbFinder
Definition: thumbfinder.h:37
ThumbFinder::m_offset
int m_offset
Definition: thumbfinder.h:102
programtypes.h
ThumbFinder::m_currentSeek
size_t m_currentSeek
Definition: thumbfinder.h:93
ThumbFinder::changeSeekAmount
void changeSeekAmount(bool up)
Definition: thumbfinder.cpp:321
ThumbFinder::m_frameButton
MythUIButton * m_frameButton
Definition: thumbfinder.h:110
ThumbFinder::m_frameWidth
int m_frameWidth
Definition: thumbfinder.h:90
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
ThumbFinder::Create
bool Create(void) override
Definition: thumbfinder.cpp:117
ThumbFinder::m_imageGrid
MythUIButtonList * m_imageGrid
Definition: thumbfinder.h:115
ThumbFinder::Init
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Definition: thumbfinder.cpp:103
ThumbFinder::m_updateFrame
bool m_updateFrame
Definition: thumbfinder.h:99
archiveutil.h
ThumbFinder::m_deleteMap
frm_dir_map_t m_deleteMap
Definition: thumbfinder.h:100
ThumbFinder::m_frame
MythAVFrame m_frame
Definition: thumbfinder.h:84
ThumbFinder::getFrameImage
bool getFrameImage(bool needKeyFrame=true, int64_t requiredPTS=-1)
Definition: thumbfinder.cpp:757
ThumbFinder::m_saveButton
MythUIButton * m_saveButton
Definition: thumbfinder.h:111
ThumbFinder::m_frameTime
int64_t m_frameTime
Definition: thumbfinder.h:98
MythUIButton
A single button widget.
Definition: mythuibutton.h:21
ThumbFinder::initAVCodec
bool initAVCodec(const QString &inFile)
Definition: thumbfinder.cpp:533
ArchiveRemoteAVFormatContext
Definition: remoteavformatcontext.h:15
ThumbFinder::m_positionImage
MythUIImage * m_positionImage
Definition: thumbfinder.h:114
ThumbFinder::ShowMenu
void ShowMenu(void) override
Definition: thumbfinder.cpp:860
MythCodecMap
Definition: mythavutil.h:26
ThumbFinder::ThumbFinder
ThumbFinder(MythScreenStack *parent, ArchiveItem *archiveItem, const QString &menuTheme)
Definition: thumbfinder.cpp:86
ThumbFinder::checkFramePosition
int checkFramePosition(int frameNumber)
Definition: thumbfinder.cpp:628
ThumbFinder::m_cancelButton
MythUIButton * m_cancelButton
Definition: thumbfinder.h:112
ThumbFinder::~ThumbFinder
~ThumbFinder() override
Definition: thumbfinder.cpp:108
ThumbFinder::createThumbDir
static QString createThumbDir(void)
Definition: thumbfinder.cpp:347
ThumbFinder::loadCutList
void loadCutList(void)
Definition: thumbfinder.cpp:258
ThumbFinder::frameToTime
QString frameToTime(int64_t frame, bool addFrame=false) const
Definition: thumbfinder.cpp:405
ThumbFinder::m_thumbList
QList< ThumbImage * > m_thumbList
Definition: thumbfinder.h:106
ThumbFinder::m_thumbDir
QString m_thumbDir
Definition: thumbfinder.h:107
ThumbFinder::m_thumbCount
int m_thumbCount
Definition: thumbfinder.h:105
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
ThumbFinder::gridItemChanged
void gridItemChanged(MythUIButtonListItem *item)
Definition: thumbfinder.cpp:339
ThumbFinder::seekToFrame
bool seekToFrame(int frame, bool checkPos=true)
Definition: thumbfinder.cpp:657
MythImage
Definition: mythimage.h:36
ThumbFinder::m_inputFC
ArchiveRemoteAVFormatContext m_inputFC
Definition: thumbfinder.h:80
mythavutil.h
ThumbFinder::m_frameImage
MythUIImage * m_frameImage
Definition: thumbfinder.h:113
ThumbFinder::updateThumb
void updateThumb(void)
Definition: thumbfinder.cpp:376
MythAVCopy
Definition: mythavutil.h:43
ThumbFinder::savePressed
void savePressed(void)
Definition: thumbfinder.cpp:288
ThumbFinder::m_finalDuration
int m_finalDuration
Definition: thumbfinder.h:101
ThumbFinder::m_codecMap
MythCodecMap m_codecMap
Definition: thumbfinder.h:82
ArchiveItem
Definition: archiveutil.h:50
ThumbFinder::m_fps
float m_fps
Definition: thumbfinder.h:87
ThumbFinder::m_copy
MythAVCopy m_copy
Definition: thumbfinder.h:85
ThumbFinder::closeAVCodec
void closeAVCodec()
Definition: thumbfinder.cpp:848
ThumbFinder::m_currentPosText
MythUIText * m_currentPosText
Definition: thumbfinder.h:117
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:191
ThumbFinder::updatePositionBar
void updatePositionBar(int64_t frame)
Definition: thumbfinder.cpp:874
ThumbFinder::m_outputbuf
unsigned char * m_outputbuf
Definition: thumbfinder.h:88
SeekAmount::amount
int amount
Definition: thumbfinder.h:27
ThumbFinder::m_seekAmountText
MythUIText * m_seekAmountText
Definition: thumbfinder.h:116
ThumbFinder::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: thumbfinder.cpp:157
ThumbFinder::m_currentPTS
int64_t m_currentPTS
Definition: thumbfinder.h:96
mythscreentype.h
ThumbFinder::getChapterCount
static int getChapterCount(const QString &menuTheme)
Definition: thumbfinder.cpp:233
ThumbFinder::m_codecCtx
AVCodecContext * m_codecCtx
Definition: thumbfinder.h:81
ThumbFinder::seekForward
bool seekForward()
Definition: thumbfinder.cpp:682