aboutsummaryrefslogtreecommitdiffstats
path: root/UI/DASHPlayer.cpp
blob: efb85620861c0133165ea2ff33ddd5bc1c39593d (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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
/*
 * DASHPlayer.cpp
 *****************************************************************************
 * 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.
 *****************************************************************************/

#include "DASHPlayer.h"
#include <iostream>
#include "QtAV/AVError.h"

using namespace libdash::framework::adaptation;
using namespace libdash::framework::mpd;
using namespace libdash::framework::buffer;
using namespace viper;
using namespace viper::managers;
using namespace dash::mpd;
using namespace std;

DASHPlayer::DASHPlayer(ViperGui &gui, Config *config) :
    gui         (&gui),
    config      (config)
{
    InitializeCriticalSection(&this->monitorMutex);
    this->offset = 0;
    this->url = NULL;
    this->icn = false;
    this->adaptLogic = LogicType::RateBased;
    this->seek = false;
    this->reloadParameters();
    this->setSettings(0, 0, 0, 0, 0);
    this->multimediaManager = new MultimediaManager(this->gui, this->parametersAdaptation->segmentBufferSize, config->getConfigPath().toStdString() + QString::fromLatin1("/").toStdString());
    this->multimediaManager->setBeta(config->beta());
    this->multimediaManager->setDrop(config->drop());
    connect(this->gui->getVideoPlayer(), SIGNAL(positionChanged(qint64)), SLOT(updateSlider(qint64)));
    connect(this->gui->getVideoPlayer(), SIGNAL(stateChanged(QtAV::AVPlayer::State)), SLOT(manageGraph(QtAV::AVPlayer::State)));
    connect(this->gui->getVideoPlayer(), SIGNAL(error(QtAV::AVError)), this, SLOT(error(QtAV::AVError)));
    this->multimediaManager->attachManagerObserver(this);
    this->mpdWrapper = new MPDWrapper(NULL);
    this->multimediaManager->setMPDWrapper(this->mpdWrapper);
}

DASHPlayer::~DASHPlayer()
{
    this->multimediaManager->stop();
    delete(this->multimediaManager);
    if(this->mpdWrapper)
        delete(this->mpdWrapper);
    DeleteCriticalSection(&this->monitorMutex);
}

void DASHPlayer::setMPDWrapper(MPDWrapper* mpdWrapper)
{
    this->mpdWrapper = mpdWrapper;
}

void DASHPlayer::onStartButtonPressed(int period, int videoAdaptationSet, int videoRepresentation, int audioAdaptationSet, int audioRepresentation, int adaptationLogic)
{
    bool setOk = false;
    setOk = this->multimediaManager->setVideoAdaptationLogic((LogicType)adaptationLogic, parametersAdaptation);

    if(!setOk)
    {
        return;
    }
    Debug("DASH PLAYER:	STARTING VIDEO\n");
    this->multimediaManager->start(this->icn, 20, 0);
}
void DASHPlayer::stopButtonPressed()
{
    this->multimediaManager->stop();
}

void DASHPlayer::onStopButtonPressed()
{
    QMetaObject::invokeMethod(this->gui->getRootObject(), "unSetBuffering");
    this->gui->setPlay(false);
    this->gui->setStop(true);
    this->gui->setPause(false);
    this->gui->getVideoPlayer()->stop();
    this->stopButtonPressed();
    this->multimediaManager->setOffset(0);
    this->gui->resetGraphValues();
}

void DASHPlayer::onPauseButtonPressed()
{
    this->multimediaManager->onPausePressed();
}

void DASHPlayer::onSettingsChanged(int period, int videoAdaptationSet, int videoRepresentation, int audioAdaptationSet, int audioRepresentation)
{
    if(this->mpdWrapper->getMPD() == NULL)
        return;

    if (!this->settingsChanged(period, videoAdaptationSet, videoRepresentation, audioAdaptationSet, audioRepresentation))
        return;

    this->mpdWrapper->settingsChanged(period, videoAdaptationSet, videoRepresentation, audioAdaptationSet, audioRepresentation);
    this->multimediaManager->setVideoQuality();
}

void DASHPlayer::onVideoBufferStateChanged(uint32_t fillstateInPercent)
{
    emit videoBufferFillStateChanged(fillstateInPercent);
}

void DASHPlayer::onVideoSegmentBufferStateChanged(uint32_t fillstateInPercent)
{
    emit videoSegmentBufferFillStateChanged(fillstateInPercent);
}

void DASHPlayer::onAudioBufferStateChanged(uint32_t fillstateInPercent)
{
    emit audioBufferFillStateChanged(fillstateInPercent);
}

void DASHPlayer::onAudioSegmentBufferStateChanged(uint32_t fillstateInPercent)
{
    emit audioSegmentBufferFillStateChanged(fillstateInPercent);
}

void DASHPlayer::onEOS()
{
    this->onStopButtonPressed();
}

bool DASHPlayer::onDownloadMPDPressed (const std::string &url)
{
    this->multimediaManager->setOffset(0);
    if(this->icn)
    {
        if(!this->multimediaManager->initICN(url))
        {
            return false;
        }
    }
    else
    {
        if(!this->multimediaManager->init(url))
        {
            return false;
        }
    }
    this->setSettings(-1, -1, -1, -1, -1);
    this->gui->setMPDDuration(this->mpdWrapper->getMPD());
    return true;
}

bool DASHPlayer::settingsChanged (int period, int videoAdaptationSet, int videoRepresentation, int audioAdaptationSet, int audioRepresentation)
{
    EnterCriticalSection(&this->monitorMutex);
    bool settingsChanged = false;
    if (this->currentSettings.videoRepresentation != videoRepresentation ||
            this->currentSettings.audioRepresentation != audioRepresentation ||
            this->currentSettings.videoAdaptationSet != videoAdaptationSet ||
            this->currentSettings.audioAdaptationSet != audioAdaptationSet ||
            this->currentSettings.period != period)
        settingsChanged = true;
    if (settingsChanged)
        this->setSettings(period, videoAdaptationSet, videoRepresentation, audioAdaptationSet, audioRepresentation);
    LeaveCriticalSection(&this->monitorMutex);
    return settingsChanged;
}

void DASHPlayer::setSettings(int period, int videoAdaptationSet, int videoRepresentation, int audioAdaptationSet, int audioRepresentation)
{
    this->currentSettings.period                = period;
    this->currentSettings.videoAdaptationSet    = videoAdaptationSet;
    this->currentSettings.videoRepresentation   = videoRepresentation;
    this->currentSettings.audioAdaptationSet    = audioAdaptationSet;
    this->currentSettings.audioRepresentation   = audioRepresentation;
}

bool DASHPlayer::downloadMPD(const QString &adaptationLogic, bool icn)
{

    if (this->gui->getStop())
    {
        QMetaObject::invokeMethod(this->gui->getRootObject(), "stopGraph");
        this->gui->setStop(false);
        this->gui->setPause(false);
        this->gui->setPlay(true);
        this->offset = 0;
        this->multimediaManager->setOffset(0);
        this->gui->setOffset(0);
        this->gui->setPlay(true);
        this->gui->initVideoPlayer();
        this->icn = icn;
        this->segment = 0;
        std::string mUrl = this->videoURI;

        Debug("MPD is: %s\n", mUrl.c_str());
        if (!this->onDownloadMPDPressed(mUrl))
            return false;

        this->segmentDuration = this->mpdWrapper->onFirstDownloadMPD(this->gui);
        this->multimediaManager->setSegmentDuration(this->segmentDuration);
        this->parametersAdaptation->segmentDuration = this->segmentDuration / 1000.0; //to have it in seconds 
        this->onSettingsChanged(0,0,0,0,0);
        int j =0;
        std::string temp = adaptationLogic.toStdString();
        temp.erase(std::remove(temp.begin(), temp.end(), ' '), temp.end());
        int adaptationLogicID = (LogicType)1; //Always Lowest by default
        for(j = 0; j < LogicType::Count; j++)
        {
            if(!strcmp(LogicType_string[j],temp.c_str()))
            {
                adaptationLogicID = (LogicType)j;
                break;
            }
        }
        if(j == LogicType::Count)
        {
            std::cout << "Could not find the ID of the adaptation logic asked, using " << LogicType_string[adaptationLogicID] << " instead.\n" << std::endl;
        }
        this->onStartButtonPressed(0,0,0,0,0, adaptationLogicID );
        this->multimediaManager->setLooping(this->repeat);
        this->adaptationLogic = adaptationLogicID;
    } else {
        if (this->gui->getPause())
        {
            this->gui->setPlay(true);
            this->gui->setPause(false);
            this->gui->getVideoPlayer()->play();
            this->gui->getVideoPlayer()->pause(false);
        }
    }
    return true;
}

void DASHPlayer::play()
{
    this->offset = 0;
    this->gui->initVideoPlayer();
    this->multimediaManager->setOffset(0);
    this->onSettingsChanged(0,0,0,0,0);
    this->onStartButtonPressed(0,0,0,0,0, this->adaptationLogic);
}

void DASHPlayer::repeatVideo(bool repeat)
{
    this->repeat = repeat;
    this->multimediaManager->setLooping(repeat);
    this->gui->setRepeat(repeat);
}

void DASHPlayer::seekVideo(float value) {
    this->multimediaManager->stop();
    this->seek = true;
    this->gui->initVideoPlayer();
    this->segment = value*this->gui->getDurationMilliseconds()/this->segmentDuration;
    this->offset = this->segment * this->segmentDuration;
    this->gui->seekSegment(this->segment);
    this->multimediaManager->setOffset(this->offset);
    if (!(this->multimediaManager->setVideoAdaptationLogic((LogicType)this->adaptationLogic, this->parametersAdaptation)))
    {
        return;
    }
    this->multimediaManager->start(this->icn, 20, this->segment);
    this->multimediaManager->setLooping(this->repeat);

}

void DASHPlayer::notifyQualityDownloading(uint32_t quality)
{
    this->qualityDownloading = quality/1000000;
}

//WARNING FPS IS USED AS BUFFERLVL
void DASHPlayer::notifyStatistics(int segNum, uint32_t bitrate, int fps, uint32_t quality)
{
    if(quality == 240)
        this->mStats[segNum] = std::make_tuple(bitrate, fps, 1);
    else if(quality == 360)
        this->mStats[segNum] = std::make_tuple(bitrate, fps, 3);
    else if(quality == 720)
        this->mStats[segNum] = std::make_tuple(bitrate, fps, 5);
    else if(quality == 1080)
        this->mStats[segNum] = std::make_tuple(bitrate, fps, 7);
    else if(quality == 1440)
        this->mStats[segNum] = std::make_tuple(bitrate, fps, 9);
    else
        this->mStats[segNum] = std::make_tuple(bitrate, fps, 11);
}

void DASHPlayer::updateSlider(qint64 value)
{
    this->position = this->offset + (uint64_t)value;
    this->segment = (this->offset + value)/this->segmentDuration;
    this->gui->setAnaliticsValues(std::get<0>(this->mStats[segment])/1000000,
                                  std::get<2>(this->mStats[segment]),
                                  (uint32_t)this->qualityDownloading,
                                  (double)this->multimediaManager->getBufferLevel());
        if (this->gui->getDurationMilliseconds() && this->position <= this->gui->getDurationMilliseconds()){
            this->gui->getProgressBar()->setProperty("value", 1.0*(this->position)/(1.0*this->gui->getDurationMilliseconds()));
    }
    this->gui->getNowLabel()->setProperty("text", QVariant(msec2string(this->position).c_str()));
    this->gui->pauseIfBuffering(this->offset + value);
}

void DASHPlayer::initSlider()
{
    this->offset = 0;
    this->gui->getProgressBar()->setProperty("value", 0.0);
    this->gui->getNowLabel()->setProperty("text", QVariant("00:00:00"));
    this->gui->getLifeLabel()->setProperty("text", QVariant("00:00:00"));

}

std::string DASHPlayer::msec2string(uint64_t milliseconds)
{
    uint64_t seconds = milliseconds/1000;
    int32_t sec = seconds%60;
    seconds = (seconds - sec)/60;
    int32_t min = seconds%60;
    int32_t hours = (seconds - min)/60;
    char timeStamp[10];
    sprintf(timeStamp, "%02d:%02d:%02d", hours, min, sec);
    return std::string(timeStamp);
}

void DASHPlayer::onStopped()
{
    int posPlayer = this->position;
    if (this->seek)
    {
        this->seek = false;
    }
    else
    {
        if(!this->gui->getStop())
        {
            if (posPlayer <= 1000 || posPlayer > this->gui->getDurationMilliseconds() || (this->gui->getDurationMilliseconds()- posPlayer) <= 2000 )
            {
                if (this->repeat)
                {
                    this->gui->getStreamBuffer()->readFromNextBuffer();
                    this->gui->startIfRepeat();
                    this->offset = 0;
                    this->multimediaManager->setOffset(0);
                }
                else
                {
                    this->gui->initVideoPlayer();
                    this->gui->seekSegment(0);
                    this->gui->setStop(true);
                    this->gui->setPlay(false);
                    this->gui->setPause(false);
                    this->multimediaManager->stop();
                    QMetaObject::invokeMethod(this->gui->getRootObject(), "pauseGraph");
                    this->initSlider();
                    QMetaObject::invokeMethod(this->gui->getRootObject(), "setStop");
                }

            } else {
                qDebug("wrong position");
            }
        }
        else
        {
            this->gui->setStop(true);
            this->gui->setPlay(false);
            this->gui->setPause(false);
            this->gui->initVideoPlayer();
            this->gui->seekSegment(0);
            this->multimediaManager->stop();
            QMetaObject::invokeMethod(this->gui->getRootObject(), "pauseGraph");
            this->initSlider();
        }
    }
}

void DASHPlayer::pause()
{
    this->gui->setPlay(false);
    this->gui->setPause(true);
    this->gui->getVideoPlayer()->pause(true);
}

void DASHPlayer::setConfig (Config *config)
{
    this->config = config;
}

void DASHPlayer::manageGraph(QtAV::AVPlayer::State value)
{
    switch (value)
    {
    case QtAV::AVPlayer::State::PlayingState:
        if (config->graph())
        {
            QMetaObject::invokeMethod(this->gui->getRootObject(), "startGraph");
        }
        break;
    case QtAV::AVPlayer::State::StoppedState:
        if (config->graph())
        {
            QMetaObject::invokeMethod(this->gui->getRootObject(), "pauseGraph");
        }
        break;
    case QtAV::AVPlayer::State::PausedState:
        if (config->graph()) {
            QMetaObject::invokeMethod(this->gui->getRootObject(), "pauseGraph");
        }
        break;
    }
}

void DASHPlayer::reloadParameters()
{
    this->beta = config->beta();
    this->drop = config->drop();
    this->videoURI = config->videoURI().toStdString();
    this->alpha = config->alpha();
    this->repeat = config->repeat();
    this->parametersAdaptation = (struct AdaptationParameters *)malloc(sizeof(struct AdaptationParameters));
    this->parametersAdaptation->segmentBufferSize = config->segmentBufferSize();
    this->parametersAdaptation->segmentDuration = 2;
    this->parametersAdaptation->Rate_Alpha = config->rateAlpha();
    this->parametersAdaptation->Bola_Alpha = config->bolaAlpha();
    this->parametersAdaptation->Bola_bufferTargetSeconds = config->bolaBufferTarget();
    this->parametersAdaptation->BufferBased_reservoirThreshold = config->bufferReservoirThreshold();
    this->parametersAdaptation->BufferBased_maxThreshold = config->bufferMaxThreshold();
    this->parametersAdaptation->Adaptech_Alpha = config->adaptechAlpha();
    this->parametersAdaptation->Adaptech_FirstThreshold = config->adaptechFirstThreshold();
    this->parametersAdaptation->Adaptech_SecondThreshold = config->adaptechSecondThreshold();
    this->parametersAdaptation->Adaptech_SwitchUpThreshold = config->adaptechSwitchUpMargin();
    this->parametersAdaptation->Adaptech_SlackParameter = config->adaptechSlackParameter();
    this->parametersAdaptation->BufferThreeThreshold_FirstThreshold = config->bufferThreeThresholdFirst();
    this->parametersAdaptation->BufferThreeThreshold_SecondThreshold = config->bufferThreeThresholdSecond();
    this->parametersAdaptation->BufferThreeThreshold_ThirdThreshold = config->bufferThreeThresholdThird();
    this->parametersAdaptation->Panda_Alpha = config->pandaParamAlpha();
    this->parametersAdaptation->Panda_Beta = config->pandaParamBeta();
    this->parametersAdaptation->Panda_Bmin = config->pandaParamBMin();
    this->parametersAdaptation->Panda_K = config->pandaParamK();
    this->parametersAdaptation->Panda_W = config->pandaParamW();
    this->parametersAdaptation->Panda_Epsilon = config->pandaParamEpsilon();
}

QString DASHPlayer::getAdaptationLogic()
{
    return config->adaptationLogic();
}

void DASHPlayer::setAdaptationLogic(QString adaptationLogic)
{
    config->setAdaptationLogic(adaptationLogic);
}

bool DASHPlayer::getIcn()
{
    return config->icn();
}

void DASHPlayer::setIcn(bool icn)
{
    config->setIcn(icn);
}

QString DASHPlayer::getVideoURI()
{
    return config->videoURI();
}

void DASHPlayer::setVideoURI(QString videoURI)
{
    config->setVideoURI(videoURI);
}

qreal DASHPlayer::getAlpha()
{
    return config->alpha();
}

void DASHPlayer::setAlpha(qreal alpha)
{
    config->setAlpha(alpha);
}

qreal DASHPlayer::getSegmentBufferSize()
{
    return config->segmentBufferSize();
}

void DASHPlayer::setSegmentBufferSize(qreal segmentBufferSize)
{
    config->setSegmentBufferSize(segmentBufferSize);
}

qreal DASHPlayer::getRateAlpha()
{
    return config->rateAlpha();
}

void DASHPlayer::setRateAlpha(qreal rateAlpha)
{
    config->setRateAlpha(rateAlpha);
}

qreal DASHPlayer::getBufferReservoirThreshold()
{
    return config->bufferReservoirThreshold();
}

void DASHPlayer::setBufferReservoirThreshold(qreal bufferReservoirThreshold)
{
    config->setBufferReservoirThreshold(bufferReservoirThreshold);
}

qreal DASHPlayer::getBufferMaxThreshold()
{
    return config->bufferMaxThreshold();
}

void DASHPlayer::setBufferMaxThreshold(qreal bufferMaxThreshold)
{
    config->setBufferMaxThreshold(bufferMaxThreshold);
}

qreal DASHPlayer::getAdaptechFirstThreshold()
{
    return config->adaptechFirstThreshold();
}

void DASHPlayer::setAdaptechFirstThreshold(qreal adaptechFirstThreshold)
{
    config->setAdaptechFirstThreshold(adaptechFirstThreshold);
}

qreal DASHPlayer::getAdaptechSecondThreshold()
{
    return config->adaptechSecondThreshold();
}

void DASHPlayer::setAdaptechSecondThreshold(qreal adaptechSecondThreshold)
{
    config->setAdaptechSecondThreshold(adaptechSecondThreshold);
}

qreal DASHPlayer::getAdaptechSwitchUpMargin()
{
    return config->adaptechSwitchUpMargin();
}

void DASHPlayer::setAdaptechSwitchUpMargin(qreal adaptechSwitchUpMargin)
{
    config->setAdaptechSwitchUpMargin(adaptechSwitchUpMargin);
}

qreal DASHPlayer::getAdaptechSlackParameter()
{
    return config->adaptechSlackParameter();
}

void DASHPlayer::setAdaptechSlackParameter(qreal adaptechSlackParameter)
{
    config->setAdaptechSlackParameter(adaptechSlackParameter);
}

qreal DASHPlayer::getAdaptechAlpha()
{
    return config->adaptechAlpha();
}

void DASHPlayer::setAdaptechAlpha(qreal adaptechAlpha)
{
    config->setAdaptechAlpha(adaptechAlpha);
}

qreal DASHPlayer::getBufferThreeThresholdFirst()
{
    return config->bufferThreeThresholdFirst();
}

void DASHPlayer::setBufferThreeThresholdFirst(qreal bufferThreeThresholdFirst)
{
    config->setBufferThreeThresholdFirst(bufferThreeThresholdFirst);
}

qreal DASHPlayer::getBufferThreeThresholdSecond()
{
    return config->bufferThreeThresholdSecond();
}

void DASHPlayer::setBufferThreeThresholdSecond(qreal bufferThreeThresholdSecond)
{
    config->setBufferThreeThresholdSecond(bufferThreeThresholdSecond);
}

qreal DASHPlayer::getBufferThreeThresholdThird()
{
    return config->bufferThreeThresholdThird();
}

void DASHPlayer::setBufferThreeThresholdThird(qreal bufferThreeThresholdThird)
{
    config->setBufferThreeThresholdThird(bufferThreeThresholdThird);
}

qreal DASHPlayer::getPandaParamAlpha()
{
    return config->pandaParamAlpha();
}

void DASHPlayer::setPandaParamAlpha(qreal pandaParamAlpha)
{
    config->setPandaParamAlpha(pandaParamAlpha);
}

qreal DASHPlayer::getPandaParamBeta()
{
    return config->pandaParamBeta();
}

void DASHPlayer::setPandaParamBeta(qreal pandaParamBeta)
{
    config->setPandaParamBeta(pandaParamBeta);
}

qreal DASHPlayer::getPandaParamBMin()
{
    return config->pandaParamBMin();
}

void DASHPlayer::setPandaParamBMin(qreal pandaParamBMin)
{
    config->setPandaParamBMin(pandaParamBMin);
}

qreal DASHPlayer::getPandaParamK()
{
    return config->pandaParamK();
}

void DASHPlayer::setPandaParamK(qreal pandaParamK)
{
    config->setPandaParamK(pandaParamK);
}

qreal DASHPlayer::getPandaParamW()
{
    return config->pandaParamW();
}

void DASHPlayer::setPandaParamW(qreal pandaParamW)
{
    config->setPandaParamW(pandaParamW);
}

qreal DASHPlayer::getPandaParamEpsilon()
{
    return config->pandaParamEpsilon();
}

void DASHPlayer::setPandaParamEpsilon(qreal pandaParamEpsilon)
{
    config->setPandaParamEpsilon(pandaParamEpsilon);
}

qreal DASHPlayer::getBolaBufferTarget()
{
    return config->bolaBufferTarget();
}

void DASHPlayer::setBolaBufferTarget(qreal bolaBufferTarget)
{
    config->setBolaBufferTarget(bolaBufferTarget);
}

qreal DASHPlayer::getBolaAlpha()
{
    return config->bolaAlpha();
}

void DASHPlayer::setBolaAlpha(qreal bolaAlpha)
{
    config->setBolaAlpha(bolaAlpha);
}

bool DASHPlayer::getRepeat()
{
    return config->repeat();
}

void DASHPlayer::setRepeat(bool repeat)
{
    this->repeatVideo(repeat);
    config->setRepeat(repeat);
}

bool DASHPlayer::getGraph()
{
    return config->graph();
}

void DASHPlayer::setGraph (bool graph)
{
    config->setGraph(graph);
    if (graph) {
        if (this->gui->getPlay() && this->gui->getVideoPlayer()->isPlaying()) {
            QMetaObject::invokeMethod(this->gui->getRootObject(), "startGraph");
        }
    } else {
        QMetaObject::invokeMethod(this->gui->getRootObject(), "stopGraph");
    }
}

bool DASHPlayer::getFullScreen()
{
    return config->fullScreen();
}

void DASHPlayer::setFullScreen(bool fullScreen)
{
    config->setFullScreen(fullScreen);
}

bool DASHPlayer::getStop()
{
    return this->gui->getStop();
}

bool DASHPlayer::getAutotune()
{
    return config->autotune();
}

void DASHPlayer::setAutotune(bool autotune)
{
    config->setAutotune(autotune);
}

int DASHPlayer::getLifetime()
{
    return config->lifetime();
}

void DASHPlayer::setLifetime(int lifetime)
{
    config->setLifetime(lifetime);
}

int DASHPlayer::getRetransmissions()
{
    return config->retransmissions();
}

void DASHPlayer::setRetransmissions(int retransmissions)
{
    config->setRetransmissions(retransmissions);
}

qreal DASHPlayer::getBeta()
{
    return config->beta();
}

void DASHPlayer::setBeta(qreal beta)
{
    config->setBeta(beta);
    this->multimediaManager->setBeta(beta);
}

qreal DASHPlayer::getDrop()
{
    return config->drop();
}

void DASHPlayer::setDrop(qreal drop)
{
    config->setDrop(drop);
    this->multimediaManager->setDrop(drop);
}

qreal DASHPlayer::getBetaWifi()
{
    return config->betaWifi();
}

void DASHPlayer::setBetaWifi(qreal betaWifi)
{
    config->setBetaWifi(betaWifi);
}

qreal DASHPlayer::getDropWifi()
{
    return config->dropWifi();
}

void DASHPlayer::setDropWifi(qreal dropWifi)
{
    config->setDropWifi(dropWifi);
}

int DASHPlayer::getDelayWifi()
{
    return config->delayWifi();
}

void DASHPlayer::setDelayWifi(int delayWifi)
{
    config->setDelayWifi(delayWifi);
}

qreal DASHPlayer::getBetaLte()
{
    return config->betaLte();
}

void DASHPlayer::setBetaLte(qreal betaLte)
{
    config->setBetaLte(betaLte);
}

qreal DASHPlayer::getDropLte()
{
    return config->dropLte();
}

void DASHPlayer::setDropLte(qreal dropLte)
{
    config->setDropLte(dropLte);
}

int DASHPlayer::getDelayLte()
{
    return config->delayLte();
}

void DASHPlayer::setDelayLte(int delayLte)
{
    config->setDelayLte(delayLte);
}

int DASHPlayer::getBatchingParameter()
{
    return config->batchingParameter();
}

void DASHPlayer::setBatchingParameter(int batchingParameter)
{
    config->setBatchingParameter(batchingParameter);
}

int DASHPlayer::getRateEstimator ()
{
    return config->rateEstimator();
}

void DASHPlayer::setRateEstimator(int rateEstimator)
{
    config->setRateEstimator(rateEstimator);
}

void DASHPlayer::error(const QtAV::AVError &e)
{
    qDebug("error in the player!");
    seekVideo(0);
}