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