1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/*
* Copyright (c) 2017 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef VIPER_H
#define VIPER_H
#include <QtMultimedia/qmediaplayer.h>
#include <QtMultimediaWidgets/qvideowidget.h>
#include <QtGui/QMovie>
#include <QtAV/QtAV.h>
#include <QByteArray>
#include "Common/ViperBuffer.h"
#include <QBuffer>
#include "libdash.h"
#include "../MPD/AdaptationSetHelper.h"
#include "../Common/QtQuick2ApplicationViewer.h"
#include "../Managers/MultimediaStream.h"
#include "GraphDataSource.h"
#include "IViperGui.h"
#include <QLabel>
namespace viper
{
class IDASHPlayerGuiObserver;
class ViperGui : public QObject,public IViperGui
{
Q_OBJECT
public:
ViperGui(QObject *parent = 0);
virtual ~ViperGui ();
void seekSegment(int segment);
void writeData(libdash::framework::input::MediaObject* media);
void setListSegmentSize(int listSegmentSize);
ViperBuffer* getStreamBuffer();
QtAV::AVPlayer* getVideoPlayer();
void setMPDDuration(dash::mpd::IMPD* mpd);
void setLifeLabel(QObject *lifeLabel);
void setNowLabel(QObject *nowLabel);
void setPlayButton(QObject *playButton);
void setProgressBar(QObject *progressBar);
void seekVideo(float value);
uint64_t getDurationMilliseconds();
void initVideoPlayer();
void setOffset(int offset);
void setPosition(qint64 position);
qint64 getPosition();
void initSlider();
void setVideoStream(managers::MultimediaStream *videoStream);
QObject* getLifeLabel();
QObject* getNowLabel();
QObject* getProgressBar();
void clearGraph();
void setAnaliticsValues(uint32_t bitRate, int fps, uint32_t quality, double bufferSize);
void setGraphDataSource(GraphDataSource *graphDataSource);
void setPlay(bool play);
bool getPlay();
void setStop(bool stop);
bool getStop();
void setPause(bool pause);
bool getPause();
void setRepeat(bool repeat);
void setSegmentDuration(qint64 segmentDuration);
void initPlayer(int segmentOffset);
void pauseIfBuffering(qint64 position);
void startIfRepeat();
int64_t getLastSegmentDuration();
int64_t getBufferDuration();
int64_t getSegmentDuration();
void setRootObject(QObject *rootObject);
QObject *getRootObject();
void resetGraphValues();
private:
pthread_mutex_t monitorMutex;
GraphDataSource *graphDataSource;
managers::MultimediaStream *videoStream;
int64_t offset;
int64_t durationMilliseconds;
qint64 position;
std::string durationString;
QtAV::AVPlayer *videoPlayer;
ViperBuffer *streamBuffer;
std::map<std::string, std::string> keyValues;
std::map<std::string, int> keyIndices;
std::map<std::string, std::vector<std::string>> video;
std::map<std::string, std::vector<std::string>> audio;
QObject *lifeLabel;
QObject *nowLabel;
QObject *progressBar;
QObject *playButton;
std::vector<IDASHPlayerGuiObserver *> observers;
dash::mpd::IMPD *mpd;
int listSegmentSize;
int segment;
int64_t bufferDuration;
int64_t segmentDuration;
int64_t lastSegmentDuration;
bool play;
bool stop;
bool pause;
bool repeat;
QObject *rootObject;
void parse8601(std::string durationISO8601);
};
}
#endif // VIPER_H
|