00001 #ifndef THUMBFINDER_H_ 00002 #define THUMBFINDER_H_ 00003 00004 // qt 00005 #include <QString> 00006 #include <QStringList> 00007 00008 // mythtv 00009 #include <mythscreentype.h> 00010 extern "C" { 00011 #include <libavcodec/avcodec.h> 00012 #include <libavformat/avformat.h> 00013 } 00014 #include "programtypes.h" 00015 00016 // mytharchive 00017 #include "archiveutil.h" 00018 00019 typedef struct SeekAmount 00020 { 00021 QString name; 00022 int amount; 00023 } SeekAmount; 00024 00025 extern struct SeekAmount SeekAmounts[]; 00026 extern int SeekAmountsCount; 00027 00028 class MythUIButton; 00029 class MythUItext; 00030 class MythUIImage; 00031 class MythUIButtonList; 00032 class MythUIButtonListItem; 00033 class MythImage; 00034 00035 class ThumbFinder : public MythScreenType 00036 { 00037 00038 Q_OBJECT 00039 00040 public: 00041 00042 ThumbFinder(MythScreenStack *parent, ArchiveItem *archiveItem, 00043 const QString &menuTheme); 00044 ~ThumbFinder(); 00045 00046 bool Create(void); 00047 bool keyPressEvent(QKeyEvent *); 00048 00049 00050 private slots: 00051 void gridItemChanged(MythUIButtonListItem *item); 00052 void showMenu(void); 00053 void cancelPressed(void); 00054 void savePressed(void); 00055 void updateThumb(void); 00056 00057 private: 00058 void Init(void); 00059 bool getThumbImages(void); 00060 int getChapterCount(const QString &menuTheme); 00061 void changeSeekAmount(bool up); 00062 void updateCurrentPos(void); 00063 bool seekToFrame(int frame, bool checkPos = true); 00064 QString createThumbDir(void); 00065 QString frameToTime(int64_t frame, bool addFrame = false); 00066 00067 // avcodec stuff 00068 bool initAVCodec(const QString &inFile); 00069 void closeAVCodec(); 00070 bool seekForward(); 00071 bool seekBackward(); 00072 bool getFrameImage(bool needKeyFrame = true, int64_t requiredPTS = -1); 00073 int checkFramePosition(int frameNumber); 00074 void loadCutList(void); 00075 void updatePositionBar(int64_t frame); 00076 int calcFinalDuration(void); 00077 00078 AVFormatContext *m_inputFC; 00079 AVCodecContext *m_codecCtx; 00080 AVCodec *m_codec; 00081 AVFrame *m_frame; 00082 00083 float m_fps; 00084 unsigned char *m_outputbuf; 00085 QString m_frameFile; 00086 int m_frameWidth; 00087 int m_frameHeight; 00088 int m_videostream; 00089 int m_currentSeek; 00090 int64_t m_startTime; // in time_base units 00091 int64_t m_startPTS; // in time_base units 00092 int64_t m_currentPTS; // in time_base units 00093 int64_t m_firstIFramePTS; 00094 int m_frameTime; // in time_base units 00095 bool m_updateFrame; 00096 frm_dir_map_t m_deleteMap; 00097 int m_finalDuration; 00098 int m_offset; 00099 00100 ArchiveItem *m_archiveItem; 00101 int m_thumbCount; 00102 QList<ThumbImage *> m_thumbList; 00103 QString m_thumbDir; 00104 MythImage *m_image; 00105 00106 // GUI stuff 00107 MythUIButton *m_frameButton; 00108 MythUIButton *m_saveButton; 00109 MythUIButton *m_cancelButton; 00110 MythUIImage *m_frameImage; 00111 MythUIImage *m_positionImage; 00112 MythUIButtonList *m_imageGrid; 00113 MythUIText *m_seekAmountText; 00114 MythUIText *m_currentPosText; 00115 }; 00116 00117 #endif
1.6.3