xref: /OK3568_Linux_fs/app/forlinx/flapp/src/plugins/allwinner/video/videoplayer.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*!
2  * @file videoplayer.h
3  * Copyright (c) 2018
4  * @brief des
5  * detailed des
6  *
7  * @date 2018
8  * @author lee
9  */
10 #ifndef VIDEOPLAYER_H
11 #define VIDEOPLAYER_H
12 
13 #include <QWidget>
14 #include <QTimer>
15 #include "videoplaylist.h"
16 #include "commonfunction.h"
17 #include "searchfiledialog.h"
18 #include "xmetadataretriever.h"
19 #include <iwidget.h>
20 
21 
22 namespace Ui {
23 class VideoPlayer;
24 }
25 extern int autCb_func(int msgType, void *user,void* data,int len);
26 
27 class VideoPlayer : public IWidget
28 {
29     Q_OBJECT
30    Q_PLUGIN_METADATA(IID PLUGIN_INTERFACE_iid FILE "video.json")
31 public:
32     explicit VideoPlayer(QWidget *parent = 0);
33     static VideoPlayer *Instance(QWidget *parent = 0);//create window by this interface
34 
35     ~VideoPlayer();
36 
37     virtual QString id() override;
38     virtual void initUi()override;
39     void setFullScrren(bool bFullScrren);
40 
41     void initAutPlayer();
42 
43     void startPlay();
44 
45     void updateDurationInfo(qint64 currentInfo);
46 
47     static int autVideoCb_func(int msgType, void* user,void* data,int len);
48 
49     void getNumOfAudioAndSubtitle(int&,int&);
50 
51 private slots:
52     void on_return_btn_clicked();
53 
54     void on_fullScreenButton_clicked();
55 
56     void on_preVideoButton_clicked();
57 
58     //void on_playListButton_clicked();
59 
60     void on_subtitleSelectButton_clicked();
61 
62     void on_searchButton_clicked();
63 
64     void on_playButton_clicked();
65 
66     void on_nextVideoButton_clicked();
67 
68     void on_notifyVideoPlayerToPlay(QList<QFileInfo>,int);
69 
70     void on_notifyVideoPlayerListChanged(QList<QFileInfo>);
71 
72     void timerUpdate();
73 
74     void onProgressSliderMoved(int);
75 
76     void onProgressSliderReleased();
77 
78     void on_UnFullscreenButton_clicked();
79 
80     void setSubtitleNum(QAction*);
81 
82     void setAudioNum(QAction*);
83 
84     void stopPlay();
85 
86     void doMsgCmd(int msgType,void* user,void* data,int len);
87 
88     void on_notifyVideoPlayerAddFile(QString strpath);
89 
90     void on_notifyVideoCancelSearch();
91 
92 signals:
93     void msgSignal(int msgType,void* user,void* data,int len);
94 
95     void hideSearchFileDialog();
96 
97     void showSearchFileDialog();
98 
99     void hidePlayList();
100 
101     void showPlayList();
102 
103 private:
104 
105     Ui::VideoPlayer *ui;
106     static VideoPlayer* self;//this  is for single instance
107 
108     CommonFunction* m_commonFunction;
109     searchFileDialog *m_pSearchDialog;
110     bool m_bSearchDialogOpen;//for open is 1;close is 0
111 
112     //VideoPlayList* m_pVideoPlayList;
113     bool m_bVideoListOpen;//for open is 1;close is 0
114 
115     QList<QFileInfo> m_playList;
116     QString m_curVideoFilePath;
117     QString m_curVideoFileName;
118     QString str_SelectPath;
119     int m_curVideoFileCount;
120 
121     AUTPlayer* ap; //视频接口.
122     qint64 m_totalDuration;
123     qint64 m_curDuration;
124     qint64 m_pretime;
125     QTimer* progressSliderTimer;
126     PLAYSTATE m_bPlayState;//ENUM of state
127 
128     int m_subtitleNow;
129     int m_audioNow;
130 
131     QWidget *m_topWidget;
132 };
133 
134 static VideoPlayer *pStaticVideoPlayer=NULL;
135 
136 #endif // VIDEOPLAYER_H
137