[vlc-commits] demux: mp4: split/store in sidx timescale and set timescale
Francois Cartegnie
git at videolan.org
Thu Oct 8 12:47:28 CEST 2020
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Oct 8 12:44:31 2020 +0200| [7a07508abc4e0613a76cd5e8e4f95ddca627efe0] | committer: Francois Cartegnie
demux: mp4: split/store in sidx timescale and set timescale
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7a07508abc4e0613a76cd5e8e4f95ddca627efe0
---
modules/demux/adaptive/playlist/SegmentInformation.cpp | 12 ++++--------
modules/demux/adaptive/playlist/SegmentInformation.hpp | 4 ++--
modules/demux/dash/mp4/IndexReader.cpp | 8 +++++---
3 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/modules/demux/adaptive/playlist/SegmentInformation.cpp b/modules/demux/adaptive/playlist/SegmentInformation.cpp
index 27a433627e..d76025da8a 100644
--- a/modules/demux/adaptive/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptive/playlist/SegmentInformation.cpp
@@ -601,7 +601,6 @@ void SegmentInformation::SplitUsingIndex(std::vector<SplitPoint> &splitlist)
getSegments(INFOTYPE_MEDIA, seglist);
size_t prevstart = 0;
stime_t prevtime = 0;
- const Timescale timescale = inheritTimescale();
SplitPoint split = {0,0,0};
std::vector<SplitPoint>::const_iterator splitIt;
@@ -611,22 +610,19 @@ void SegmentInformation::SplitUsingIndex(std::vector<SplitPoint> &splitlist)
if(splitIt != splitlist.begin())
{
/* do previous splitpoint */
- const stime_t duration = timescale.ToScaled(split.duration);
- insertIntoSegment(seglist, prevstart, split.offset - 1, prevtime, duration);
+ insertIntoSegment(seglist, prevstart, split.offset - 1, prevtime, split.duration);
}
prevstart = split.offset;
- prevtime = timescale.ToScaled(split.time);
+ prevtime = split.time;
}
if(splitlist.size() == 1)
{
- const stime_t duration = timescale.ToScaled(split.duration);
- insertIntoSegment(seglist, prevstart, 0, prevtime, duration);
+ insertIntoSegment(seglist, prevstart, 0, prevtime, split.duration);
}
else if(splitlist.size() > 1)
{
- const stime_t duration = timescale.ToScaled(split.duration);
- insertIntoSegment(seglist, prevstart, split.offset - 1, prevtime, duration);
+ insertIntoSegment(seglist, prevstart, split.offset - 1, prevtime, split.duration);
}
}
diff --git a/modules/demux/adaptive/playlist/SegmentInformation.hpp b/modules/demux/adaptive/playlist/SegmentInformation.hpp
index 7b763eb4c3..a32f1f360d 100644
--- a/modules/demux/adaptive/playlist/SegmentInformation.hpp
+++ b/modules/demux/adaptive/playlist/SegmentInformation.hpp
@@ -59,8 +59,8 @@ namespace adaptive
{
public:
size_t offset;
- vlc_tick_t time;
- vlc_tick_t duration;
+ stime_t time;
+ stime_t duration;
};
void SplitUsingIndex(std::vector<SplitPoint>&);
diff --git a/modules/demux/dash/mp4/IndexReader.cpp b/modules/demux/dash/mp4/IndexReader.cpp
index 83ef5cab66..5dc8089a6d 100644
--- a/modules/demux/dash/mp4/IndexReader.cpp
+++ b/modules/demux/dash/mp4/IndexReader.cpp
@@ -48,14 +48,16 @@ bool IndexReader::parseIndex(block_t *p_block, BaseRepresentation *rep, uint64_t
/* sidx refers to offsets from end of sidx pos in the file + first offset */
point.offset = sidx->i_first_offset + i_fileoffset + sidxbox->i_pos + sidxbox->i_size;
point.time = 0;
- for(uint16_t i=0; i<sidx->i_reference_count && sidx->i_timescale; i++)
+ if(!sidx->i_timescale)
+ return false;
+ for(uint16_t i=0; i<sidx->i_reference_count; i++)
{
splitlist.push_back(point);
point.offset += sidx->p_items[i].i_referenced_size;
- point.duration = vlc_tick_from_samples( sidx->p_items[i].i_subsegment_duration,
- sidx->i_timescale );
+ point.duration = sidx->p_items[i].i_subsegment_duration;
point.time += point.duration;
}
+ rep->setTimescale(Timescale(sidx->i_timescale));
rep->SplitUsingIndex(splitlist);
rep->getPlaylist()->debug();
}
More information about the vlc-commits
mailing list