MythTV master
thumbfinder.h
Go to the documentation of this file.
1#ifndef THUMBFINDER_H_
2#define THUMBFINDER_H_
3
4extern "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>
19
20// mytharchive
21#include "archiveutil.h"
23
25{
26 QString name;
27 int amount;
28};
29
30class MythUIButton;
31class MythUItext;
32class MythUIImage;
35class 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};
102 int m_offset { 0};
103
106 QList<ThumbImage *> m_thumbList;
107 QString m_thumbDir;
108
109 // GUI stuff
118};
119
120#endif
MythAVFrame little utility class that act as a safe way to allocate an AVFrame which can then be allo...
Definition: mythavframe.h:27
Screen in which all other widgets are contained and rendered.
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
A single button widget.
Definition: mythuibutton.h:22
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:98
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
bool seekForward()
bool seekToFrame(int frame, bool checkPos=true)
void ShowMenu(void) override
unsigned char * m_outputbuf
Definition: thumbfinder.h:88
QString frameToTime(int64_t frame, bool addFrame=false) const
int m_frameHeight
Definition: thumbfinder.h:91
int m_finalDuration
Definition: thumbfinder.h:101
int64_t m_firstIFramePTS
Definition: thumbfinder.h:97
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
size_t m_currentSeek
Definition: thumbfinder.h:93
QList< ThumbImage * > m_thumbList
Definition: thumbfinder.h:106
bool initAVCodec(const QString &inFile)
ArchiveRemoteAVFormatContext m_inputFC
Definition: thumbfinder.h:80
int64_t m_startPTS
Definition: thumbfinder.h:95
int checkFramePosition(int frameNumber)
bool seekBackward()
MythUIButton * m_cancelButton
Definition: thumbfinder.h:112
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
bool getFrameImage(bool needKeyFrame=true, int64_t requiredPTS=-1)
int64_t m_startTime
Definition: thumbfinder.h:94
ArchiveItem * m_archiveItem
Definition: thumbfinder.h:104
MythUIButton * m_saveButton
Definition: thumbfinder.h:111
bool Create(void) override
frm_dir_map_t m_deleteMap
Definition: thumbfinder.h:100
bool m_updateFrame
Definition: thumbfinder.h:99
static int getChapterCount(const QString &menuTheme)
MythAVCopy m_copy
Definition: thumbfinder.h:85
~ThumbFinder() override
void updateCurrentPos(void)
int64_t m_frameTime
Definition: thumbfinder.h:98
int m_frameWidth
Definition: thumbfinder.h:90
void closeAVCodec()
MythUIImage * m_positionImage
Definition: thumbfinder.h:114
void updateThumb(void)
void changeSeekAmount(bool up)
float m_fps
Definition: thumbfinder.h:87
MythUIButton * m_frameButton
Definition: thumbfinder.h:110
MythUIButtonList * m_imageGrid
Definition: thumbfinder.h:115
void gridItemChanged(MythUIButtonListItem *item)
QString m_thumbDir
Definition: thumbfinder.h:107
MythCodecMap m_codecMap
Definition: thumbfinder.h:82
const AVCodec * m_codec
Definition: thumbfinder.h:83
int64_t m_currentPTS
Definition: thumbfinder.h:96
int calcFinalDuration(void)
void updatePositionBar(int64_t frame)
int m_thumbCount
Definition: thumbfinder.h:105
QString m_frameFile
Definition: thumbfinder.h:89
void savePressed(void)
ThumbFinder(MythScreenStack *parent, ArchiveItem *archiveItem, const QString &menuTheme)
Definition: thumbfinder.cpp:86
int m_videostream
Definition: thumbfinder.h:92
bool getThumbImages(void)
static QString createThumbDir(void)
MythUIText * m_seekAmountText
Definition: thumbfinder.h:116
AVCodecContext * m_codecCtx
Definition: thumbfinder.h:81
MythAVFrame m_frame
Definition: thumbfinder.h:84
MythUIImage * m_frameImage
Definition: thumbfinder.h:113
void loadCutList(void)
void cancelPressed(void)
MythUIText * m_currentPosText
Definition: thumbfinder.h:117
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
Definition: programtypes.h:117
QString name
Definition: thumbfinder.h:26