Commit a0ffe7d3 authored by Steve Lhomme's avatar Steve Lhomme

mkclean: fix the Segment duration when using --timecodescale

git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/foundation_src@748 a6f86f6d-0131-4f8e-9e7b-e335508773d5
parent e2730af6
2011-04-xx
2011-06-02
version 0.8.3:
- fix the Segment duration when using --timecodescale
- fix the progress display on segments with no size set (like live streams)
- add -alt-3d to pack video frames by 2 when left/right eyes are coded sequentially in time (half duration frames)
......
......@@ -1418,7 +1418,7 @@ int main(int argc, const char *argv[])
bool_t CuesChanged;
bool_t KeepCues = 0, Remux = 0, CuesCreated = 0, Optimize = 0, OptimizeVideo = 1, UnOptimize = 0, ClustersNeedRead = 0, Regression = 0;
int InputPathIndex = 1;
int64_t TimeCodeScale = 0;
int64_t TimeCodeScale = 0, OldTimeCodeScale;
size_t MaxTrackNum = 0;
array TrackMaxHeader; // array of uint8_t (max common header)
filepos_t TotalSize;
......@@ -1712,9 +1712,11 @@ int main(int argc, const char *argv[])
Result = -10;
goto exit;
}
OldTimeCodeScale = EBML_IntegerValue((ebml_integer*)RLevel1);
if (TimeCodeScale==0)
{
TimeCodeScale = EBML_IntegerValue((ebml_integer*)RLevel1);
// avoid using a TimeCodeScale too small
TimeCodeScale = OldTimeCodeScale;
while (TimeCodeScale < 100000)
TimeCodeScale <<= 1;
}
......@@ -1724,10 +1726,18 @@ int main(int argc, const char *argv[])
if (Live)
{
// remove MATROSKA_ContextDuration from Live streams
EbmlHead = (ebml_master*)EBML_MasterFindChild(WSegmentInfo, &MATROSKA_ContextDuration);
if (EbmlHead)
NodeDelete((node*)EbmlHead);
EbmlHead = NULL;
ebml_float *Duration = (ebml_master*)EBML_MasterFindChild(WSegmentInfo, &MATROSKA_ContextDuration);
if (Duration)
NodeDelete((node*)Duration);
}
else if (TimeCodeScale && TimeCodeScale != OldTimeCodeScale)
{
ebml_float *Duration = (ebml_master*)EBML_MasterFindChild(WSegmentInfo, &MATROSKA_ContextDuration);
if (Duration)
{
double duration = EBML_FloatValue(Duration);
EBML_FloatSetValue(Duration, (duration * OldTimeCodeScale) / TimeCodeScale);
}
}
// reorder elements in WSegmentInfo
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment