Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
da513a4e
Commit
da513a4e
authored
Feb 11, 2012
by
Christopher Mueller
Committed by
Hugo Beauzée-Luyssen
Feb 14, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dash: added resolution interpretation
Signed-off-by:
Hugo Beauzée-Luyssen
<
beauze.h@gmail.com
>
parent
62748a33
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
157 additions
and
42 deletions
+157
-42
modules/stream_filter/dash/DASHManager.cpp
modules/stream_filter/dash/DASHManager.cpp
+4
-3
modules/stream_filter/dash/DASHManager.h
modules/stream_filter/dash/DASHManager.h
+2
-1
modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
...m_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
+6
-4
modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h
...eam_filter/dash/adaptationlogic/AbstractAdaptationLogic.h
+4
-1
modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.cpp
...am_filter/dash/adaptationlogic/AdaptationLogicFactory.cpp
+3
-3
modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.h
...ream_filter/dash/adaptationlogic/AdaptationLogicFactory.h
+3
-1
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
...filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
+2
-1
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
...m_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
+1
-1
modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
..._filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
+10
-6
modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
...am_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
+6
-1
modules/stream_filter/dash/dash.cpp
modules/stream_filter/dash/dash.cpp
+9
-1
modules/stream_filter/dash/mpd/BasicCMManager.cpp
modules/stream_filter/dash/mpd/BasicCMManager.cpp
+5
-2
modules/stream_filter/dash/mpd/BasicCMManager.h
modules/stream_filter/dash/mpd/BasicCMManager.h
+3
-1
modules/stream_filter/dash/mpd/IMPDManager.h
modules/stream_filter/dash/mpd/IMPDManager.h
+10
-7
modules/stream_filter/dash/mpd/IsoffMainManager.cpp
modules/stream_filter/dash/mpd/IsoffMainManager.cpp
+46
-1
modules/stream_filter/dash/mpd/IsoffMainManager.h
modules/stream_filter/dash/mpd/IsoffMainManager.h
+3
-1
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+15
-6
modules/stream_filter/dash/mpd/Representation.cpp
modules/stream_filter/dash/mpd/Representation.cpp
+19
-1
modules/stream_filter/dash/mpd/Representation.h
modules/stream_filter/dash/mpd/Representation.h
+6
-0
No files found.
modules/stream_filter/dash/DASHManager.cpp
View file @
da513a4e
...
@@ -35,18 +35,19 @@ using namespace dash::mpd;
...
@@ -35,18 +35,19 @@ using namespace dash::mpd;
using
namespace
dash
::
exception
;
using
namespace
dash
::
exception
;
DASHManager
::
DASHManager
(
HTTPConnectionManager
*
conManager
,
MPD
*
mpd
,
DASHManager
::
DASHManager
(
HTTPConnectionManager
*
conManager
,
MPD
*
mpd
,
IAdaptationLogic
::
LogicType
type
)
:
IAdaptationLogic
::
LogicType
type
,
stream_t
*
stream
)
:
conManager
(
conManager
),
conManager
(
conManager
),
currentChunk
(
NULL
),
currentChunk
(
NULL
),
adaptationLogic
(
NULL
),
adaptationLogic
(
NULL
),
logicType
(
type
),
logicType
(
type
),
mpdManager
(
NULL
),
mpdManager
(
NULL
),
mpd
(
mpd
)
mpd
(
mpd
),
stream
(
stream
)
{
{
this
->
mpdManager
=
mpd
::
MPDManagerFactory
::
create
(
mpd
);
this
->
mpdManager
=
mpd
::
MPDManagerFactory
::
create
(
mpd
);
if
(
this
->
mpdManager
==
NULL
)
if
(
this
->
mpdManager
==
NULL
)
return
;
return
;
this
->
adaptationLogic
=
AdaptationLogicFactory
::
create
(
this
->
logicType
,
this
->
mpdManager
);
this
->
adaptationLogic
=
AdaptationLogicFactory
::
create
(
this
->
logicType
,
this
->
mpdManager
,
this
->
stream
);
if
(
this
->
adaptationLogic
==
NULL
)
if
(
this
->
adaptationLogic
==
NULL
)
return
;
return
;
this
->
conManager
->
attach
(
this
->
adaptationLogic
);
this
->
conManager
->
attach
(
this
->
adaptationLogic
);
...
...
modules/stream_filter/dash/DASHManager.h
View file @
da513a4e
...
@@ -40,7 +40,7 @@ namespace dash
...
@@ -40,7 +40,7 @@ namespace dash
{
{
public:
public:
DASHManager
(
http
::
HTTPConnectionManager
*
conManager
,
mpd
::
MPD
*
mpd
,
DASHManager
(
http
::
HTTPConnectionManager
*
conManager
,
mpd
::
MPD
*
mpd
,
logic
::
IAdaptationLogic
::
LogicType
type
);
logic
::
IAdaptationLogic
::
LogicType
type
,
stream_t
*
stream
);
virtual
~
DASHManager
();
virtual
~
DASHManager
();
int
read
(
void
*
p_buffer
,
size_t
len
);
int
read
(
void
*
p_buffer
,
size_t
len
);
...
@@ -56,6 +56,7 @@ namespace dash
...
@@ -56,6 +56,7 @@ namespace dash
logic
::
IAdaptationLogic
::
LogicType
logicType
;
logic
::
IAdaptationLogic
::
LogicType
logicType
;
mpd
::
IMPDManager
*
mpdManager
;
mpd
::
IMPDManager
*
mpdManager
;
mpd
::
MPD
*
mpd
;
mpd
::
MPD
*
mpd
;
stream_t
*
stream
;
};
};
}
}
...
...
modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
View file @
da513a4e
...
@@ -32,11 +32,13 @@ using namespace dash::xml;
...
@@ -32,11 +32,13 @@ using namespace dash::xml;
using
namespace
dash
::
mpd
;
using
namespace
dash
::
mpd
;
using
namespace
dash
::
exception
;
using
namespace
dash
::
exception
;
AbstractAdaptationLogic
::
AbstractAdaptationLogic
(
IMPDManager
*
mpdManager
)
AbstractAdaptationLogic
::
AbstractAdaptationLogic
(
IMPDManager
*
mpdManager
,
stream_t
*
stream
)
:
bpsAvg
(
-
1
),
bpsLastChunk
(
0
),
mpdManager
(
mpdManager
),
stream
(
stream
)
{
{
this
->
bpsAvg
=
-
1
;
this
->
bpsLastChunk
=
0
;
this
->
mpdManager
=
mpdManager
;
}
}
AbstractAdaptationLogic
::~
AbstractAdaptationLogic
()
AbstractAdaptationLogic
::~
AbstractAdaptationLogic
()
{
{
...
...
modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h
View file @
da513a4e
...
@@ -35,6 +35,8 @@
...
@@ -35,6 +35,8 @@
#include "mpd/Segment.h"
#include "mpd/Segment.h"
#include "exceptions/EOFException.h"
#include "exceptions/EOFException.h"
struct
stream_t
;
namespace
dash
namespace
dash
{
{
namespace
logic
namespace
logic
...
@@ -42,7 +44,7 @@ namespace dash
...
@@ -42,7 +44,7 @@ namespace dash
class
AbstractAdaptationLogic
:
public
IAdaptationLogic
class
AbstractAdaptationLogic
:
public
IAdaptationLogic
{
{
public:
public:
AbstractAdaptationLogic
(
dash
::
mpd
::
IMPDManager
*
mpdManager
);
AbstractAdaptationLogic
(
dash
::
mpd
::
IMPDManager
*
mpdManager
,
stream_t
*
stream
);
virtual
~
AbstractAdaptationLogic
();
virtual
~
AbstractAdaptationLogic
();
virtual
void
downloadRateChanged
(
long
bpsAvg
,
long
bpsLastChunk
);
virtual
void
downloadRateChanged
(
long
bpsAvg
,
long
bpsLastChunk
);
...
@@ -54,6 +56,7 @@ namespace dash
...
@@ -54,6 +56,7 @@ namespace dash
int
bpsAvg
;
int
bpsAvg
;
long
bpsLastChunk
;
long
bpsLastChunk
;
dash
::
mpd
::
IMPDManager
*
mpdManager
;
dash
::
mpd
::
IMPDManager
*
mpdManager
;
stream_t
*
stream
;
};
};
}
}
}
}
...
...
modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.cpp
View file @
da513a4e
...
@@ -32,12 +32,12 @@ using namespace dash::xml;
...
@@ -32,12 +32,12 @@ using namespace dash::xml;
using
namespace
dash
::
mpd
;
using
namespace
dash
::
mpd
;
IAdaptationLogic
*
AdaptationLogicFactory
::
create
(
IAdaptationLogic
::
LogicType
logic
,
IAdaptationLogic
*
AdaptationLogicFactory
::
create
(
IAdaptationLogic
::
LogicType
logic
,
IMPDManager
*
mpdManager
)
IMPDManager
*
mpdManager
,
stream_t
*
stream
)
{
{
switch
(
logic
)
switch
(
logic
)
{
{
case
IAdaptationLogic
:
:
AlwaysBest
:
return
new
AlwaysBestAdaptationLogic
(
mpdManager
);
case
IAdaptationLogic
:
:
AlwaysBest
:
return
new
AlwaysBestAdaptationLogic
(
mpdManager
,
stream
);
case
IAdaptationLogic
:
:
RateBased
:
return
new
RateBasedAdaptationLogic
(
mpdManager
);
case
IAdaptationLogic
:
:
RateBased
:
return
new
RateBasedAdaptationLogic
(
mpdManager
,
stream
);
case
IAdaptationLogic
:
:
Default
:
case
IAdaptationLogic
:
:
Default
:
case
IAdaptationLogic
:
:
AlwaysLowest
:
case
IAdaptationLogic
:
:
AlwaysLowest
:
default:
default:
...
...
modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.h
View file @
da513a4e
...
@@ -31,6 +31,8 @@
...
@@ -31,6 +31,8 @@
#include "adaptationlogic/AlwaysBestAdaptationLogic.h"
#include "adaptationlogic/AlwaysBestAdaptationLogic.h"
#include "adaptationlogic/RateBasedAdaptationLogic.h"
#include "adaptationlogic/RateBasedAdaptationLogic.h"
struct
stream_t
;
namespace
dash
namespace
dash
{
{
namespace
logic
namespace
logic
...
@@ -38,7 +40,7 @@ namespace dash
...
@@ -38,7 +40,7 @@ namespace dash
class
AdaptationLogicFactory
class
AdaptationLogicFactory
{
{
public:
public:
static
IAdaptationLogic
*
create
(
IAdaptationLogic
::
LogicType
logic
,
dash
::
mpd
::
IMPDManager
*
mpdManager
);
static
IAdaptationLogic
*
create
(
IAdaptationLogic
::
LogicType
logic
,
dash
::
mpd
::
IMPDManager
*
mpdManager
,
stream_t
*
stream
);
};
};
}
}
}
}
...
...
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
View file @
da513a4e
...
@@ -33,7 +33,8 @@ using namespace dash::http;
...
@@ -33,7 +33,8 @@ using namespace dash::http;
using
namespace
dash
::
mpd
;
using
namespace
dash
::
mpd
;
using
namespace
dash
::
exception
;
using
namespace
dash
::
exception
;
AlwaysBestAdaptationLogic
::
AlwaysBestAdaptationLogic
(
IMPDManager
*
mpdManager
)
:
AbstractAdaptationLogic
(
mpdManager
)
AlwaysBestAdaptationLogic
::
AlwaysBestAdaptationLogic
(
IMPDManager
*
mpdManager
,
stream_t
*
stream
)
:
AbstractAdaptationLogic
(
mpdManager
,
stream
)
{
{
this
->
mpdManager
=
mpdManager
;
this
->
mpdManager
=
mpdManager
;
this
->
count
=
0
;
this
->
count
=
0
;
...
...
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
View file @
da513a4e
...
@@ -42,7 +42,7 @@ namespace dash
...
@@ -42,7 +42,7 @@ namespace dash
class
AlwaysBestAdaptationLogic
:
public
AbstractAdaptationLogic
class
AlwaysBestAdaptationLogic
:
public
AbstractAdaptationLogic
{
{
public:
public:
AlwaysBestAdaptationLogic
(
dash
::
mpd
::
IMPDManager
*
mpdManager
);
AlwaysBestAdaptationLogic
(
dash
::
mpd
::
IMPDManager
*
mpdManager
,
stream_t
*
stream
);
virtual
~
AlwaysBestAdaptationLogic
();
virtual
~
AlwaysBestAdaptationLogic
();
dash
::
http
::
Chunk
*
getNextChunk
()
throw
(
dash
::
exception
::
EOFException
);
dash
::
http
::
Chunk
*
getNextChunk
()
throw
(
dash
::
exception
::
EOFException
);
...
...
modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
View file @
da513a4e
...
@@ -33,12 +33,16 @@ using namespace dash::http;
...
@@ -33,12 +33,16 @@ using namespace dash::http;
using
namespace
dash
::
mpd
;
using
namespace
dash
::
mpd
;
using
namespace
dash
::
exception
;
using
namespace
dash
::
exception
;
RateBasedAdaptationLogic
::
RateBasedAdaptationLogic
(
IMPDManager
*
mpdManager
)
:
RateBasedAdaptationLogic
::
RateBasedAdaptationLogic
(
IMPDManager
*
mpdManager
,
stream_t
*
stream
)
:
AbstractAdaptationLogic
(
mpdManager
),
AbstractAdaptationLogic
(
mpdManager
,
stream
),
mpdManager
(
mpdManager
),
mpdManager
(
mpdManager
),
count
(
0
),
count
(
0
),
currentPeriod
(
mpdManager
->
getFirstPeriod
()
)
currentPeriod
(
mpdManager
->
getFirstPeriod
()),
width
(
0
),
height
(
0
)
{
{
this
->
width
=
var_InheritInteger
(
stream
,
"dash-prefwidth"
);
this
->
height
=
var_InheritInteger
(
stream
,
"dash-prefheight"
);
}
}
Chunk
*
RateBasedAdaptationLogic
::
getNextChunk
()
throw
(
EOFException
)
Chunk
*
RateBasedAdaptationLogic
::
getNextChunk
()
throw
(
EOFException
)
...
@@ -51,7 +55,7 @@ Chunk* RateBasedAdaptationLogic::getNextChunk() throw(EOFException)
...
@@ -51,7 +55,7 @@ Chunk* RateBasedAdaptationLogic::getNextChunk() throw(EOFException)
long
bitrate
=
this
->
getBpsAvg
();
long
bitrate
=
this
->
getBpsAvg
();
Representation
*
rep
=
this
->
mpdManager
->
getRepresentation
(
this
->
currentPeriod
,
bitrate
);
Representation
*
rep
=
this
->
mpdManager
->
getRepresentation
(
this
->
currentPeriod
,
bitrate
,
this
->
width
,
this
->
height
);
if
(
rep
==
NULL
)
if
(
rep
==
NULL
)
throw
EOFException
();
throw
EOFException
();
...
...
modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
View file @
da513a4e
...
@@ -32,6 +32,9 @@
...
@@ -32,6 +32,9 @@
#include "exceptions/EOFException.h"
#include "exceptions/EOFException.h"
#include "mpd/BasicCMManager.h"
#include "mpd/BasicCMManager.h"
#include <vlc_common.h>
#include <vlc_stream.h>
namespace
dash
namespace
dash
{
{
namespace
logic
namespace
logic
...
@@ -39,7 +42,7 @@ namespace dash
...
@@ -39,7 +42,7 @@ namespace dash
class
RateBasedAdaptationLogic
:
public
AbstractAdaptationLogic
class
RateBasedAdaptationLogic
:
public
AbstractAdaptationLogic
{
{
public:
public:
RateBasedAdaptationLogic
(
dash
::
mpd
::
IMPDManager
*
mpdManager
);
RateBasedAdaptationLogic
(
dash
::
mpd
::
IMPDManager
*
mpdManager
,
stream_t
*
stream
);
dash
::
http
::
Chunk
*
getNextChunk
()
throw
(
dash
::
exception
::
EOFException
);
dash
::
http
::
Chunk
*
getNextChunk
()
throw
(
dash
::
exception
::
EOFException
);
const
dash
::
mpd
::
Representation
*
getCurrentRepresentation
()
const
;
const
dash
::
mpd
::
Representation
*
getCurrentRepresentation
()
const
;
...
@@ -48,6 +51,8 @@ namespace dash
...
@@ -48,6 +51,8 @@ namespace dash
dash
::
mpd
::
IMPDManager
*
mpdManager
;
dash
::
mpd
::
IMPDManager
*
mpdManager
;
size_t
count
;
size_t
count
;
dash
::
mpd
::
Period
*
currentPeriod
;
dash
::
mpd
::
Period
*
currentPeriod
;
int
width
;
int
height
;
};
};
}
}
}
}
...
...
modules/stream_filter/dash/dash.cpp
View file @
da513a4e
...
@@ -48,12 +48,20 @@
...
@@ -48,12 +48,20 @@
static
int
Open
(
vlc_object_t
*
);
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
#define DASH_WIDTH_TEXT N_("Preferred Width")
#define DASH_WIDTH_LONGTEXT N_("Preferred Width")
#define DASH_HEIGHT_TEXT N_("Preferred Height")
#define DASH_HEIGHT_LONGTEXT N_("Preferred Height")
vlc_module_begin
()
vlc_module_begin
()
set_shortname
(
N_
(
"DASH"
))
set_shortname
(
N_
(
"DASH"
))
set_description
(
N_
(
"Dynamic Adaptive Streaming over HTTP"
)
)
set_description
(
N_
(
"Dynamic Adaptive Streaming over HTTP"
)
)
set_capability
(
"stream_filter"
,
19
)
set_capability
(
"stream_filter"
,
19
)
set_category
(
CAT_INPUT
)
set_category
(
CAT_INPUT
)
set_subcategory
(
SUBCAT_INPUT_STREAM_FILTER
)
set_subcategory
(
SUBCAT_INPUT_STREAM_FILTER
)
add_integer
(
"dash-prefwidth"
,
480
,
DASH_WIDTH_TEXT
,
DASH_WIDTH_LONGTEXT
,
true
)
add_integer
(
"dash-prefheight"
,
360
,
DASH_HEIGHT_TEXT
,
DASH_HEIGHT_LONGTEXT
,
true
)
set_callbacks
(
Open
,
Close
)
set_callbacks
(
Open
,
Close
)
vlc_module_end
()
vlc_module_end
()
...
@@ -106,7 +114,7 @@ static int Open(vlc_object_t *p_obj)
...
@@ -106,7 +114,7 @@ static int Open(vlc_object_t *p_obj)
new
dash
::
http
::
HTTPConnectionManager
(
p_stream
);
new
dash
::
http
::
HTTPConnectionManager
(
p_stream
);
dash
::
DASHManager
*
p_dashManager
=
dash
::
DASHManager
*
p_dashManager
=
new
dash
::
DASHManager
(
p_conManager
,
p_sys
->
p_mpd
,
new
dash
::
DASHManager
(
p_conManager
,
p_sys
->
p_mpd
,
dash
::
logic
::
IAdaptationLogic
::
RateBased
);
dash
::
logic
::
IAdaptationLogic
::
RateBased
,
p_stream
);
if
(
p_dashManager
->
getMpdManager
()
==
NULL
||
if
(
p_dashManager
->
getMpdManager
()
==
NULL
||
p_dashManager
->
getMpdManager
()
->
getMPD
()
==
NULL
||
p_dashManager
->
getMpdManager
()
->
getMPD
()
==
NULL
||
...
...
modules/stream_filter/dash/mpd/BasicCMManager.cpp
View file @
da513a4e
...
@@ -91,7 +91,7 @@ Period* BasicCMManager::getFirstPeriod ()
...
@@ -91,7 +91,7 @@ Period* BasicCMManager::getFirstPeriod ()
return
periods
.
at
(
0
);
return
periods
.
at
(
0
);
}
}
Representation
*
BasicCMManager
::
getRepresentation
(
Period
*
period
,
int
bitrate
)
Representation
*
BasicCMManager
::
getRepresentation
(
Period
*
period
,
int
bitrate
)
const
{
{
std
::
vector
<
Group
*>
groups
=
period
->
getGroups
();
std
::
vector
<
Group
*>
groups
=
period
->
getGroups
();
...
@@ -134,4 +134,7 @@ const MPD* BasicCMManager::getMPD() const
...
@@ -134,4 +134,7 @@ const MPD* BasicCMManager::getMPD() const
{
{
return
this
->
mpd
;
return
this
->
mpd
;
}
}
Representation
*
BasicCMManager
::
getRepresentation
(
Period
*
period
,
int
bitrate
,
int
width
,
int
height
)
const
{
return
this
->
getRepresentation
(
period
,
bitrate
);
}
modules/stream_filter/dash/mpd/BasicCMManager.h
View file @
da513a4e
...
@@ -52,8 +52,10 @@ namespace dash
...
@@ -52,8 +52,10 @@ namespace dash
Period
*
getNextPeriod
(
Period
*
period
);
Period
*
getNextPeriod
(
Period
*
period
);
Representation
*
getBestRepresentation
(
Period
*
period
);
Representation
*
getBestRepresentation
(
Period
*
period
);
std
::
vector
<
Segment
*>
getSegments
(
const
Representation
*
rep
);
std
::
vector
<
Segment
*>
getSegments
(
const
Representation
*
rep
);
Representation
*
getRepresentation
(
Period
*
period
,
int
bitrate
);
Representation
*
getRepresentation
(
Period
*
period
,
int
bitrate
)
const
;
const
MPD
*
getMPD
()
const
;
const
MPD
*
getMPD
()
const
;
Representation
*
getRepresentation
(
Period
*
period
,
int
bitrate
,
int
width
,
int
height
)
const
;
private:
private:
MPD
*
mpd
;
MPD
*
mpd
;
...
...
modules/stream_filter/dash/mpd/IMPDManager.h
View file @
da513a4e
...
@@ -45,14 +45,17 @@ namespace dash
...
@@ -45,14 +45,17 @@ namespace dash
class
IMPDManager
class
IMPDManager
{
{
public:
public:
virtual
const
std
::
vector
<
Period
*>&
getPeriods
()
const
=
0
;
virtual
Period
*
getFirstPeriod
()
=
0
;
virtual
Period
*
getNextPeriod
(
Period
*
period
)
=
0
;
virtual
Representation
*
getBestRepresentation
(
Period
*
period
)
=
0
;
virtual
std
::
vector
<
Segment
*>
getSegments
(
const
Representation
*
rep
)
=
0
;
virtual
Representation
*
getRepresentation
(
Period
*
period
,
int
bitrate
)
=
0
;
virtual
const
MPD
*
getMPD
()
const
=
0
;
virtual
~
IMPDManager
(){}
virtual
~
IMPDManager
(){}
virtual
const
std
::
vector
<
Period
*>&
getPeriods
()
const
=
0
;
virtual
Period
*
getFirstPeriod
()
=
0
;
virtual
Period
*
getNextPeriod
(
Period
*
period
)
=
0
;
virtual
Representation
*
getBestRepresentation
(
Period
*
period
)
=
0
;
virtual
std
::
vector
<
Segment
*>
getSegments
(
const
Representation
*
rep
)
=
0
;
virtual
Representation
*
getRepresentation
(
Period
*
period
,
int
bitrate
)
const
=
0
;
virtual
const
MPD
*
getMPD
()
const
=
0
;
virtual
Representation
*
getRepresentation
(
Period
*
period
,
int
bitrate
,
int
width
,
int
height
)
const
=
0
;
};
};
}
}
}
}
...
...
modules/stream_filter/dash/mpd/IsoffMainManager.cpp
View file @
da513a4e
...
@@ -87,7 +87,7 @@ Period* IsoffMainManager::getFirstPeriod ()
...
@@ -87,7 +87,7 @@ Period* IsoffMainManager::getFirstPeriod ()
return
periods
.
at
(
0
);
return
periods
.
at
(
0
);
}
}
Representation
*
IsoffMainManager
::
getRepresentation
(
Period
*
period
,
int
bitrate
)
Representation
*
IsoffMainManager
::
getRepresentation
(
Period
*
period
,
int
bitrate
)
const
{
{
std
::
vector
<
AdaptationSet
*>
adaptationSets
=
period
->
getAdaptationSets
();
std
::
vector
<
AdaptationSet
*>
adaptationSets
=
period
->
getAdaptationSets
();
...
@@ -126,3 +126,48 @@ const MPD* IsoffMainManager::getMPD () const
...
@@ -126,3 +126,48 @@ const MPD* IsoffMainManager::getMPD () const
{
{
return
this
->
mpd
;
return
this
->
mpd
;
}
}
Representation
*
IsoffMainManager
::
getRepresentation
(
Period
*
period
,
int
bitrate
,
int
width
,
int
height
)
const
{
std
::
vector
<
AdaptationSet
*>
adaptationSets
=
period
->
getAdaptationSets
();
std
::
cout
<<
"Searching for best representation with bitrate: "
<<
bitrate
<<
" and resolution: "
<<
width
<<
"x"
<<
height
<<
std
::
endl
;
std
::
vector
<
Representation
*>
resMatchReps
;
int
lowerWidth
=
0
;
int
lowerHeight
=
0
;
for
(
size_t
i
=
0
;
i
<
adaptationSets
.
size
();
i
++
)
{
std
::
vector
<
Representation
*>
reps
=
adaptationSets
.
at
(
i
)
->
getRepresentations
();
for
(
size_t
j
=
0
;
j
<
reps
.
size
();
j
++
)
{
if
(
reps
.
at
(
j
)
->
getWidth
()
==
width
&&
reps
.
at
(
j
)
->
getHeight
()
==
height
)
resMatchReps
.
push_back
(
reps
.
at
(
j
));
if
(
reps
.
at
(
j
)
->
getHeight
()
<
height
)
{
lowerWidth
=
reps
.
at
(
j
)
->
getWidth
();
lowerHeight
=
reps
.
at
(
j
)
->
getHeight
();
}
}
}
if
(
resMatchReps
.
size
()
==
0
)
return
this
->
getRepresentation
(
period
,
bitrate
,
lowerWidth
,
lowerHeight
);
Representation
*
best
=
NULL
;
for
(
size_t
j
=
0
;
j
<
resMatchReps
.
size
();
j
++
)
{
int
currentBitrate
=
resMatchReps
.
at
(
j
)
->
getBandwidth
();
if
(
best
==
NULL
||
(
currentBitrate
>
best
->
getBandwidth
()
&&
currentBitrate
<
bitrate
))
{
std
::
cout
<<
"Found a better Representation bandwidth="
<<
resMatchReps
.
at
(
j
)
->
getBandwidth
()
<<
" and resolution: "
<<
resMatchReps
.
at
(
j
)
->
getWidth
()
<<
"x"
<<
resMatchReps
.
at
(
j
)
->
getHeight
()
<<
std
::
endl
;
best
=
resMatchReps
.
at
(
j
);
}
}
return
best
;
}
modules/stream_filter/dash/mpd/IsoffMainManager.h
View file @
da513a4e
...
@@ -52,8 +52,10 @@ namespace dash
...
@@ -52,8 +52,10 @@ namespace dash
Period
*
getNextPeriod
(
Period
*
period
);
Period
*
getNextPeriod
(
Period
*
period
);
Representation
*
getBestRepresentation
(
Period
*
period
);
Representation
*
getBestRepresentation
(
Period
*
period
);
std
::
vector
<
Segment
*>
getSegments
(
const
Representation
*
rep
);
std
::
vector
<
Segment
*>
getSegments
(
const
Representation
*
rep
);
Representation
*
getRepresentation
(
Period
*
period
,
int
bitrate
);
Representation
*
getRepresentation
(
Period
*
period
,
int
bitrate
)
const
;
const
MPD
*
getMPD
()
const
;
const
MPD
*
getMPD
()
const
;
Representation
*
getRepresentation
(
Period
*
period
,
int
bitrate
,
int
width
,
int
height
)
const
;
private:
private:
MPD
*
mpd
;
MPD
*
mpd
;
...
...
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
View file @
da513a4e
...
@@ -113,12 +113,21 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
...
@@ -113,12 +113,21 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
for
(
size_t
i
=
0
;
i
<
representations
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
representations
.
size
();
i
++
)
{
{
Representation
*
rep
=
new
Representation
;
this
->
currentRepresentation
=
new
Representation
;
this
->
currentRepresentation
=
rep
;
Node
*
repNode
=
representations
.
at
(
i
);
this
->
setSegmentBase
(
representations
.
at
(
i
),
rep
);
this
->
setSegmentList
(
representations
.
at
(
i
),
rep
);
if
(
repNode
->
hasAttribute
(
"width"
))
rep
->
setBandwidth
(
atoi
(
representations
.
at
(
i
)
->
getAttributeValue
(
"bandwidth"
).
c_str
()));
this
->
currentRepresentation
->
setWidth
(
atoi
(
repNode
->
getAttributeValue
(
"width"
).
c_str
()));
adaptationSet
->
addRepresentation
(
rep
);
if
(
repNode
->
hasAttribute
(
"height"
))
this
->
currentRepresentation
->
setHeight
(
atoi
(
repNode
->
getAttributeValue
(
"height"
).
c_str
()));
if
(
repNode
->
hasAttribute
(
"bandwidth"
))
this
->
currentRepresentation
->
setBandwidth
(
atoi
(
repNode
->
getAttributeValue
(
"bandwidth"
).
c_str
()));
this
->
setSegmentBase
(
repNode
,
this
->
currentRepresentation
);
this
->
setSegmentList
(
repNode
,
this
->
currentRepresentation
);
adaptationSet
->
addRepresentation
(
this
->
currentRepresentation
);
}
}
}
}
void
IsoffMainParser
::
setSegmentBase
(
dash
::
xml
::
Node
*
repNode
,
Representation
*
rep
)
void
IsoffMainParser
::
setSegmentBase
(
dash
::
xml
::
Node
*
repNode
,
Representation
*
rep
)
...
...
modules/stream_filter/dash/mpd/Representation.cpp
View file @
da513a4e
...
@@ -37,7 +37,9 @@ Representation::Representation () :
...
@@ -37,7 +37,9 @@ Representation::Representation () :
trickModeType
(
NULL
),
trickModeType
(
NULL
),
parentGroup
(
NULL
),
parentGroup
(
NULL
),
segmentBase
(
NULL
),
segmentBase
(
NULL
),
segmentList
(
NULL
)
segmentList
(
NULL
),
width
(
0
),
height
(
0
)
{
{
}
}
...
@@ -139,3 +141,19 @@ void Representation::setSegmentBase (SegmentBase *base)
...
@@ -139,3 +141,19 @@ void Representation::setSegmentBase (SegmentBase *base)
{
{
this
->
segmentBase
=
base
;
this
->
segmentBase
=
base
;
}
}
void
Representation
::
setWidth
(
int
width
)
{
this
->
width
=
width
;
}
int
Representation
::
getWidth
()
const
{
return
this
->
width
;
}
void
Representation
::
setHeight
(
int
height
)
{
this
->
height
=
height
;
}
int
Representation
::
getHeight
()
const
{
return
this
->
height
;
}
modules/stream_filter/dash/mpd/Representation.h
View file @
da513a4e
...
@@ -76,6 +76,10 @@ namespace dash
...
@@ -76,6 +76,10 @@ namespace dash
void
setSegmentList
(
SegmentList
*
list
);
void
setSegmentList
(
SegmentList
*
list
);
SegmentBase
*
getSegmentBase
()
const
;
SegmentBase
*
getSegmentBase
()
const
;
void
setSegmentBase
(
SegmentBase
*
base
);
void
setSegmentBase
(
SegmentBase
*
base
);
void
setWidth
(
int
width
);
int
getWidth
()
const
;
void
setHeight
(
int
height
);
int
getHeight
()
const
;
private:
private:
int
bandwidth
;
int
bandwidth
;
...
@@ -87,6 +91,8 @@ namespace dash
...
@@ -87,6 +91,8 @@ namespace dash
const
Group
*
parentGroup
;
const
Group
*
parentGroup
;
SegmentBase
*
segmentBase
;
SegmentBase
*
segmentBase
;
SegmentList
*
segmentList
;
SegmentList
*
segmentList
;
int
width
;
int
height
;
};
};
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment