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
|
/*
* SingleMediaSegmentStream.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 "SingleMediaSegmentStream.h"
using namespace dash::mpd;
using namespace libdash::framework::mpd;
SingleMediaSegmentStream::SingleMediaSegmentStream(IMPD *mpd, IPeriod *period, IAdaptationSet *adaptationSet, IRepresentation *representation) :
AbstractRepresentationStream (mpd, period, adaptationSet, representation)
{
this->baseUrls = BaseUrlResolver::resolveBaseUrl(mpd, period, adaptationSet, 0, 0, 0);
}
SingleMediaSegmentStream::~SingleMediaSegmentStream()
{
}
ISegment* SingleMediaSegmentStream::getInitializationSegment()
{
if (this->representation->GetSegmentBase())
{
/* TODO: check whether @sourceURL and/or @range is available in SegmentBase.Initialization, see Table 13 */
if (this->representation->GetSegmentBase()->GetInitialization())
return this->representation->GetSegmentBase()->GetInitialization()->ToSegment(baseUrls);
}
return NULL;
}
ISegment* SingleMediaSegmentStream::getIndexSegment(size_t segmentNumber)
{
/* segmentNumber is not used in this case */
if (this->representation->GetSegmentBase())
{
if (this->representation->GetSegmentBase()->GetRepresentationIndex())
return this->representation->GetSegmentBase()->GetRepresentationIndex()->ToSegment(baseUrls);
}
return NULL;
}
ISegment* SingleMediaSegmentStream::getMediaSegment(size_t segmentNumber)
{
/* segmentNumber equals the desired BaseUrl */
if (this->representation->GetBaseURLs().size() > segmentNumber)
return this->representation->GetBaseURLs().at(segmentNumber)->ToMediaSegment(baseUrls);
return this->representation->GetBaseURLs().at(0)->ToMediaSegment(baseUrls);
}
ISegment* SingleMediaSegmentStream::getBitstreamSwitchingSegment()
{
/* not possible */
return NULL;
}
RepresentationStreamType SingleMediaSegmentStream::getStreamType()
{
return SingleMediaSegment;
}
uint32_t SingleMediaSegmentStream::getFirstSegmentNumber()
{
return 0;
}
uint32_t SingleMediaSegmentStream::getCurrentSegmentNumber()
{
return 0;
}
uint32_t SingleMediaSegmentStream::getLastSegmentNumber()
{
return 0;
}
|