[vlc-commits] stream_filter: dash: simplify getting duration
Francois Cartegnie
git at videolan.org
Thu Dec 18 22:39:46 CET 2014
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Nov 18 23:31:54 2014 +0100| [02c07d358a373d41ec60861d57b6e2f51f3df1a0] | committer: Francois Cartegnie
stream_filter: dash: simplify getting duration
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=02c07d358a373d41ec60861d57b6e2f51f3df1a0
---
modules/stream_filter/dash/DASHManager.cpp | 15 +++++++++++++--
modules/stream_filter/dash/DASHManager.h | 2 +-
modules/stream_filter/dash/dash.cpp | 13 +------------
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/modules/stream_filter/dash/DASHManager.cpp b/modules/stream_filter/dash/DASHManager.cpp
index 2901219..58faa2f 100644
--- a/modules/stream_filter/dash/DASHManager.cpp
+++ b/modules/stream_filter/dash/DASHManager.cpp
@@ -97,9 +97,20 @@ const mpd::MPDManager* DASHManager::getMpdManager() const
return this->mpdManager;
}
-const logic::IAdaptationLogic* DASHManager::getAdaptionLogic() const
+mtime_t DASHManager::getDuration() const
{
- return this->adaptationLogic;
+ if (mpd->isLive())
+ {
+ return 0;
+ }
+ else
+ {
+ const Representation *rep = adaptationLogic->getCurrentRepresentation();
+ if ( !rep )
+ return 0;
+ else
+ return mpd->getDuration() * rep->getBandwidth() / 8;
+ }
}
const Chunk *DASHManager::getCurrentChunk() const
diff --git a/modules/stream_filter/dash/DASHManager.h b/modules/stream_filter/dash/DASHManager.h
index a48e6fd..8ab6756 100644
--- a/modules/stream_filter/dash/DASHManager.h
+++ b/modules/stream_filter/dash/DASHManager.h
@@ -50,7 +50,7 @@ namespace dash
int seekBackwards ( unsigned len );
const mpd::MPDManager* getMpdManager () const;
- const logic::IAdaptationLogic* getAdaptionLogic() const;
+ mtime_t getDuration() const;
const http::Chunk *getCurrentChunk() const;
private:
diff --git a/modules/stream_filter/dash/dash.cpp b/modules/stream_filter/dash/dash.cpp
index 4f3aac0..88251c3 100644
--- a/modules/stream_filter/dash/dash.cpp
+++ b/modules/stream_filter/dash/dash.cpp
@@ -81,7 +81,6 @@ struct stream_sys_t
dash::DASHManager *p_dashManager;
dash::mpd::MPD *p_mpd;
uint64_t position;
- bool isLive;
};
static int Read (stream_t *p_stream, void *p_ptr, unsigned int i_len);
@@ -129,7 +128,6 @@ static int Open(vlc_object_t *p_obj)
}
p_sys->p_dashManager = p_dashManager;
p_sys->position = 0;
- p_sys->isLive = p_dashManager->getMpdManager()->getMPD()->isLive();
p_stream->p_sys = p_sys;
p_stream->pf_read = Read;
p_stream->pf_peek = Peek;
@@ -276,16 +274,7 @@ static int Control (stream_t *p_stream, int i_query, va_list args)
case STREAM_GET_SIZE:
{
uint64_t* res = (va_arg (args, uint64_t *));
- if(p_sys->isLive)
- *res = 0;
- else
- {
- const dash::mpd::Representation *rep = p_sys->p_dashManager->getAdaptionLogic()->getCurrentRepresentation();
- if ( rep == NULL )
- *res = 0;
- else
- *res = p_sys->p_mpd->getDuration() * rep->getBandwidth() / 8;
- }
+ *res = p_sys->p_dashManager->getDuration();
break;
}
case STREAM_GET_PTS_DELAY:
More information about the vlc-commits
mailing list