Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
f3600cde
Commit
f3600cde
authored
Oct 06, 2011
by
Christopher Mueller
Committed by
Jean-Baptiste Kempf
Oct 26, 2011
Browse files
Added DASH stream filter
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
3d0a5eb4
Changes
71
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
f3600cde
...
...
@@ -4311,6 +4311,7 @@ AC_CONFIG_FILES([
modules/packetizer/Makefile
modules/services_discovery/Makefile
modules/stream_filter/Makefile
modules/stream_filter/dash/Makefile
modules/stream_out/Makefile
modules/stream_out/transcode/Makefile
modules/text_renderer/Makefile
...
...
modules/stream_filter/Modules.am
View file @
f3600cde
SUBDIRS = dash
SOURCES_decomp = decomp.c
SOURCES_stream_filter_record = record.c
SOURCES_stream_filter_httplive = httplive.c
...
...
modules/stream_filter/dash/DASHManager.cpp
0 → 100644
View file @
f3600cde
/*
* DASHManager.cpp
*****************************************************************************
* Copyright (C) 2010 - 2011 Klagenfurt University
*
* Created on: Aug 10, 2010
* Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
* Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "DASHManager.h"
using
namespace
dash
;
using
namespace
dash
::
http
;
using
namespace
dash
::
xml
;
using
namespace
dash
::
logic
;
using
namespace
dash
::
mpd
;
using
namespace
dash
::
exception
;
DASHManager
::
DASHManager
(
HTTPConnectionManager
*
conManager
,
Node
*
node
,
IAdaptationLogic
::
LogicType
type
,
Profile
profile
)
{
this
->
conManager
=
conManager
;
this
->
node
=
node
;
this
->
logicType
=
type
;
this
->
profile
=
profile
;
this
->
mpdManagerFactory
=
new
MPDManagerFactory
();
this
->
mpdManager
=
this
->
mpdManagerFactory
->
create
(
this
->
profile
,
this
->
node
);
this
->
logicFactory
=
new
AdaptationLogicFactory
();
this
->
adaptationLogic
=
this
->
logicFactory
->
create
(
this
->
logicType
,
this
->
mpdManager
);
this
->
currentChunk
=
NULL
;
this
->
conManager
->
attach
(
this
->
adaptationLogic
);
}
DASHManager
::~
DASHManager
()
{
delete
(
this
->
logicFactory
);
delete
(
this
->
adaptationLogic
);
delete
(
this
->
mpdManager
);
}
int
DASHManager
::
read
(
void
*
p_buffer
,
size_t
len
)
{
if
(
this
->
currentChunk
==
NULL
)
{
try
{
this
->
currentChunk
=
this
->
adaptationLogic
->
getNextChunk
();
}
catch
(
EOFException
&
e
)
{
this
->
currentChunk
=
NULL
;
return
0
;
}
}
int
ret
=
this
->
conManager
->
read
(
this
->
currentChunk
,
p_buffer
,
len
);
if
(
ret
<=
0
)
{
this
->
currentChunk
=
NULL
;
return
this
->
read
(
p_buffer
,
len
);
}
return
ret
;
}
int
DASHManager
::
peek
(
const
uint8_t
**
pp_peek
,
size_t
i_peek
)
{
if
(
this
->
currentChunk
==
NULL
)
{
try
{
this
->
currentChunk
=
this
->
adaptationLogic
->
getNextChunk
();
}
catch
(
EOFException
&
e
)
{
return
0
;
}
}
int
ret
=
this
->
conManager
->
peek
(
this
->
currentChunk
,
pp_peek
,
i_peek
);
return
ret
;
}
modules/stream_filter/dash/DASHManager.h
0 → 100644
View file @
f3600cde
/*
* DASHManager.h
*****************************************************************************
* Copyright (C) 2010 - 2011 Klagenfurt University
*
* Created on: Aug 10, 2010
* Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
* Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef DASHMANAGER_H_
#define DASHMANAGER_H_
#include <stdint.h>
#include <stddef.h>
#include <iostream>
#include "http/HTTPConnectionManager.h"
#include "xml/Node.h"
#include "adaptationlogic/IAdaptationLogic.h"
#include "adaptationlogic/AdaptationLogicFactory.h"
#include "mpd/IMPDManager.h"
#include "mpd/MPDManagerFactory.h"
#include "exceptions/EOFException.h"
namespace
dash
{
class
DASHManager
{
public:
DASHManager
(
http
::
HTTPConnectionManager
*
conManager
,
xml
::
Node
*
node
,
logic
::
IAdaptationLogic
::
LogicType
type
,
mpd
::
Profile
profile
);
virtual
~
DASHManager
();
int
read
(
void
*
p_buffer
,
size_t
len
);
int
peek
(
const
uint8_t
**
pp_peek
,
size_t
i_peek
);
private:
http
::
HTTPConnectionManager
*
conManager
;
http
::
Chunk
*
currentChunk
;
logic
::
AdaptationLogicFactory
*
logicFactory
;
logic
::
IAdaptationLogic
*
adaptationLogic
;
logic
::
IAdaptationLogic
::
LogicType
logicType
;
mpd
::
Profile
profile
;
xml
::
Node
*
node
;
mpd
::
MPDManagerFactory
*
mpdManagerFactory
;
mpd
::
IMPDManager
*
mpdManager
;
};
}
#endif
/* DASHMANAGER_H_ */
modules/stream_filter/dash/Modules.am
0 → 100644
View file @
f3600cde
SOURCES_stream_filter_dash = \
adaptationlogic/AbstractAdaptationLogic.cpp \
adaptationlogic/AbstractAdaptationLogic.h \
adaptationlogic/AdaptationLogicFactory.cpp \
adaptationlogic/AdaptationLogicFactory.h \
adaptationlogic/AlwaysBestAdaptationLogic.cpp \
adaptationlogic/AlwaysBestAdaptationLogic.h \
adaptationlogic/IAdaptationLogic.h \
adaptationlogic/IDownloadRateObserver.h \
adaptationlogic/NullAdaptationLogic.h \
adaptationlogic/RateBasedAdaptationLogic.h \
adaptationlogic/RateBasedAdaptationLogic.cpp \
exceptions/AttributeNotPresentException.h \
exceptions/ElementNotPresentException.h \
exceptions/EOFException.h \
http/Chunk.cpp \
http/Chunk.h \
http/HTTPConnection.cpp \
http/HTTPConnection.h \
http/HTTPConnectionManager.cpp \
http/HTTPConnectionManager.h \
http/IHTTPConnection.h \
mpd/Accessibility.h \
mpd/BaseUrl.h \
mpd/BasicCMManager.cpp \
mpd/BasicCMManager.h \
mpd/BasicCMParser.cpp \
mpd/BasicCMParser.h \
mpd/ContentDescription.cpp \
mpd/ContentDescription.h \
mpd/ContentProtection.h \
mpd/Group.cpp \
mpd/Group.h \
mpd/IMPDManager.h \
mpd/IMPDParser.h \
mpd/InitSegment.cpp \
mpd/InitSegment.h \
mpd/ISegment.h \
mpd/MPD.cpp \
mpd/MPD.h \
mpd/MPDManagerFactory.cpp \
mpd/MPDManagerFactory.h \
mpd/NullManager.cpp \
mpd/NullManager.h \
mpd/Period.cpp \
mpd/Period.h \
mpd/ProgramInformation.cpp \
mpd/ProgramInformation.h \
mpd/Rating.h \
mpd/Representation.cpp \
mpd/Representation.h \
mpd/SchemeInformation.cpp \
mpd/SchemeInformation.h \
mpd/Segment.cpp \
mpd/Segment.h \
mpd/SegmentInfo.cpp \
mpd/SegmentInfo.h \
mpd/TrickModeType.cpp \
mpd/TrickModeType.h \
mpd/Viewpoint.h \
xml/DOMHelper.cpp \
xml/DOMHelper.h \
xml/DOMParser.cpp \
xml/DOMParser.h \
xml/Node.cpp \
xml/Node.h \
dash.cpp \
DASHManager.cpp \
DASHManager.h \
$(NULL)
libvlc_LTLIBRARIES += libstream_filter_dash_plugin.la
modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
0 → 100644
View file @
f3600cde
/*
* AbstractAdaptationLogic.cpp
*****************************************************************************
* Copyright (C) 2010 - 2011 Klagenfurt University
*
* Created on: Aug 10, 2010
* Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
* Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "AbstractAdaptationLogic.h"
using
namespace
dash
::
logic
;
using
namespace
dash
::
xml
;
using
namespace
dash
::
mpd
;
using
namespace
dash
::
exception
;
AbstractAdaptationLogic
::
AbstractAdaptationLogic
(
IMPDManager
*
mpdManager
)
{
this
->
bpsAvg
=
0
;
this
->
bpsLastChunk
=
0
;
this
->
mpdManager
=
mpdManager
;
}
AbstractAdaptationLogic
::~
AbstractAdaptationLogic
()
{
}
void
AbstractAdaptationLogic
::
downloadRateChanged
(
long
bpsAvg
,
long
bpsLastChunk
)
{
this
->
bpsAvg
=
bpsAvg
;
this
->
bpsLastChunk
=
bpsLastChunk
;
}
long
AbstractAdaptationLogic
::
getBpsAvg
()
{
return
this
->
bpsAvg
;
}
long
AbstractAdaptationLogic
::
getBpsLastChunk
()
{
return
this
->
bpsLastChunk
;
}
modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h
0 → 100644
View file @
f3600cde
/*
* AbstractAdaptationLogic.h
*****************************************************************************
* Copyright (C) 2010 - 2011 Klagenfurt University
*
* Created on: Aug 10, 2010
* Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
* Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef ABSTRACTADAPTATIONLOGIC_H_
#define ABSTRACTADAPTATIONLOGIC_H_
#include "adaptationlogic/IAdaptationLogic.h"
#include "xml/Node.h"
#include "http/Chunk.h"
#include "mpd/MPD.h"
#include "mpd/IMPDManager.h"
#include "mpd/Period.h"
#include "mpd/Representation.h"
#include "mpd/InitSegment.h"
#include "mpd/Segment.h"
#include "exceptions/AttributeNotPresentException.h"
#include "exceptions/EOFException.h"
namespace
dash
{
namespace
logic
{
class
AbstractAdaptationLogic
:
public
IAdaptationLogic
{
public:
AbstractAdaptationLogic
(
dash
::
mpd
::
IMPDManager
*
mpdManager
);
virtual
~
AbstractAdaptationLogic
();
virtual
dash
::
http
::
Chunk
*
getNextChunk
()
throw
(
dash
::
exception
::
EOFException
)
=
0
;
virtual
void
downloadRateChanged
(
long
bpsAvg
,
long
bpsLastChunk
);
long
getBpsAvg
();
long
getBpsLastChunk
();
private:
long
bpsAvg
;
long
bpsLastChunk
;
dash
::
mpd
::
IMPDManager
*
mpdManager
;
};
}
}
#endif
/* ABSTRACTADAPTATIONLOGIC_H_ */
modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.cpp
0 → 100644
View file @
f3600cde
/*
* AdaptationLogicFactory.cpp
*****************************************************************************
* Copyright (C) 2010 - 2011 Klagenfurt University
*
* Created on: Aug 10, 2010
* Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
* Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "AdaptationLogicFactory.h"
using
namespace
dash
::
logic
;
using
namespace
dash
::
xml
;
using
namespace
dash
::
mpd
;
AdaptationLogicFactory
::
AdaptationLogicFactory
()
{
}
AdaptationLogicFactory
::~
AdaptationLogicFactory
()
{
}
IAdaptationLogic
*
AdaptationLogicFactory
::
create
(
IAdaptationLogic
::
LogicType
logic
,
IMPDManager
*
mpdManager
)
{
switch
(
logic
)
{
case
IAdaptationLogic
::
Default
:
return
new
NullAdaptationLogic
(
mpdManager
);
case
IAdaptationLogic
::
AlwaysBest
:
return
new
AlwaysBestAdaptationLogic
(
mpdManager
);
case
IAdaptationLogic
::
AlwaysLowest
:
return
new
NullAdaptationLogic
(
mpdManager
);
case
IAdaptationLogic
::
RateBased
:
return
new
RateBasedAdaptationLogic
(
mpdManager
);
default:
return
new
NullAdaptationLogic
(
mpdManager
);
}
}
modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.h
0 → 100644
View file @
f3600cde
/*
* AdaptationLogicFactory.h
*****************************************************************************
* Copyright (C) 2010 - 2011 Klagenfurt University
*
* Created on: Aug 10, 2010
* Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
* Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef ADAPTATIONLOGICFACTORY_H_
#define ADAPTATIONLOGICFACTORY_H_
#include "adaptationlogic/IAdaptationLogic.h"
#include "xml/Node.h"
#include "mpd/IMPDManager.h"
#include "adaptationlogic/AlwaysBestAdaptationLogic.h"
#include "adaptationlogic/NullAdaptationLogic.h"
#include "adaptationlogic/RateBasedAdaptationLogic.h"
namespace
dash
{
namespace
logic
{
class
AdaptationLogicFactory
{
public:
AdaptationLogicFactory
();
virtual
~
AdaptationLogicFactory
();
IAdaptationLogic
*
create
(
IAdaptationLogic
::
LogicType
logic
,
dash
::
mpd
::
IMPDManager
*
mpdManager
);
};
}
}
#endif
/* ADAPTATIONLOGICFACTORY_H_ */
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
0 → 100644
View file @
f3600cde
/*
* AlwaysBestAdaptationLogic.cpp
*****************************************************************************
* Copyright (C) 2010 - 2011 Klagenfurt University
*
* Created on: Aug 10, 2010
* Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
* Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "AlwaysBestAdaptationLogic.h"
using
namespace
dash
::
logic
;
using
namespace
dash
::
xml
;
using
namespace
dash
::
http
;
using
namespace
dash
::
mpd
;
using
namespace
dash
::
exception
;
AlwaysBestAdaptationLogic
::
AlwaysBestAdaptationLogic
(
IMPDManager
*
mpdManager
)
:
AbstractAdaptationLogic
(
mpdManager
)
{
this
->
mpdManager
=
mpdManager
;
this
->
count
=
0
;
this
->
initSchedule
();
}
AlwaysBestAdaptationLogic
::~
AlwaysBestAdaptationLogic
()
{
}
Chunk
*
AlwaysBestAdaptationLogic
::
getNextChunk
()
throw
(
EOFException
)
{
if
(
this
->
schedule
.
size
()
==
0
)
throw
EOFException
();
if
(
this
->
count
==
this
->
schedule
.
size
())
throw
EOFException
();
for
(
int
i
=
0
;
i
<
this
->
schedule
.
size
();
i
++
)
{
if
(
this
->
count
==
i
)
{
Chunk
*
chunk
=
new
Chunk
();
chunk
->
setUrl
(
this
->
schedule
.
at
(
i
)
->
getSourceUrl
());
this
->
count
++
;
return
chunk
;
}
}
return
NULL
;
}
void
AlwaysBestAdaptationLogic
::
initSchedule
()
{
if
(
this
->
mpdManager
!=
NULL
)
{
std
::
vector
<
Period
*>
periods
=
this
->
mpdManager
->
getPeriods
();
for
(
int
i
=
0
;
i
<
periods
.
size
();
i
++
)
{
Representation
*
best
=
this
->
mpdManager
->
getBestRepresentation
(
periods
.
at
(
i
));
if
(
best
!=
NULL
)
{
std
::
vector
<
ISegment
*>
segments
=
this
->
mpdManager
->
getSegments
(
best
);
for
(
int
j
=
0
;
j
<
segments
.
size
();
j
++
)
{
this
->
schedule
.
push_back
(
segments
.
at
(
j
));
}
}
}
}
}
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
0 → 100644
View file @
f3600cde
/*
* AlwaysBestAdaptationLogic.h
*****************************************************************************
* Copyright (C) 2010 - 2011 Klagenfurt University
*
* Created on: Aug 10, 2010
* Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
* Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef ALWAYSBESTADAPTATIONLOGIC_H_
#define ALWAYSBESTADAPTATIONLOGIC_H_
#include "adaptationlogic/AbstractAdaptationLogic.h"
#include "http/Chunk.h"
#include "xml/Node.h"
#include "mpd/IMPDManager.h"