aboutsummaryrefslogtreecommitdiffstats
path: root/Managers/MultimediaStream.h
blob: 52a7ac9d03ac8739af20bc110c9cf522710a06e4 (plain)
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
/*
 * MultimediaStream.h
 *****************************************************************************
 * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
 *
 * Email: libdash-dev@vicky.bitmovin.net
 *
 * This source code and its use and distribution, is subject to the terms
 * and conditions of the applicable license agreement.
 *****************************************************************************/

#ifndef VIPER_MANAGERS_MULTIMEDIASTREAM_H_
#define VIPER_MANAGERS_MULTIMEDIASTREAM_H_

#include "IMPD.h"
#include "IStreamObserver.h"
#include "../MPD/MPDWrapper.h"
#include "../Input/DASHManager.h"
#include "../Buffer/IBufferObserver.h"
#include "../Adaptation/IAdaptationLogic.h"
#include <QtMultimedia/qaudioformat.h>
#include "../Input/IDASHManagerObserver.h"
#include "../Buffer/Buffer.h"
#include <QImage>

namespace libdash
{
namespace framework
{
namespace mpd
{
class MPDWrapper;
}
namespace input
{
class DASHManager;
}
}
}
namespace viper
{
namespace managers
{
class MultimediaStream : public libdash::framework::input::IDASHManagerObserver, public libdash::framework::buffer::IBufferObserver
{
public:
    MultimediaStream(StreamType type, libdash::framework::mpd::MPDWrapper *mpdWrapper, uint32_t segmentBufferSize, bool icnEnabled, double icnAlpha, bool nodecoding, float beta, float drop);
    virtual ~MultimediaStream();

    bool start();
    void stop();
    void stopDownload();
    bool startDownload();
    void clear();
    uint32_t getPosition();
    void setPosition(uint32_t segmentNumber);
    void setLooping(bool looping);
    void setPositionInMsec(uint32_t milliSecs);
    libdash::framework::input::MediaObject* getSegment();
    void setEOS(bool value);
    void notifyBufferChange(uint32_t bufferfill, int maxC);
    void setRepresentation();
    void enqueueRepresentation(dash::mpd::IPeriod *period, dash::mpd::IAdaptationSet *adaptationSet, dash::mpd::IRepresentation *representation);
    void setAdaptationLogic(libdash::framework::adaptation::IAdaptationLogic *logic);

    void attachStreamObserver(IStreamObserver *observer);

    void onSegmentBufferStateChanged(uint32_t fillstateInPercent, int maxC);
    void onBufferStateChanged(libdash::framework::buffer::BufferType type, uint32_t fillstateInPercent, int maxC);

    void notifyStatistics(int segNum, uint32_t bitrate, int fps, uint32_t quality);
    void notifyQualityDownloading (uint32_t quality);
    bool canPush();
    int	getBufferLevel();
    bool isICN();
    void shouldAbort();
    void setTargetDownloadingTime(double);

private:
    float                                               beta;
    float                                               drop;
    std::vector<IStreamObserver *>                      observers;
    libdash::framework::mpd::MPDWrapper                 *mpdWrapper;
    libdash::framework::adaptation::IAdaptationLogic    *logic;
    libdash::framework::input::DASHManager              *dashManager;
    uint32_t                                            segmentBufferSize;
    StreamType                                          type;
    bool                                                icn;
    double                                              icnAlpha;
    bool                                                noDecoding;

    void init();
};
}
}

#endif /* VIPER_MANAGERS_MULTIMEDIASTREAM_H_ */