Output the segment duration with --identify-verbose.

This commit is contained in:
Moritz Bunkus 2005-02-07 13:27:46 +00:00
parent c9a560c5c6
commit f426fea17a
2 changed files with 20 additions and 12 deletions

View File

@ -133,7 +133,7 @@ kax_reader_c::kax_reader_c(track_info_c *nti)
throw (error_c): throw (error_c):
generic_reader_c(nti) { generic_reader_c(nti) {
segment_duration = 0.0; segment_duration = 0;
first_timecode = -1; first_timecode = -1;
writing_app_ver = -1; writing_app_ver = -1;
@ -878,9 +878,10 @@ kax_reader_c::read_headers() {
kduration = FINDFIRST(l1, KaxDuration); kduration = FINDFIRST(l1, KaxDuration);
if (kduration != NULL) { if (kduration != NULL) {
segment_duration = float(*kduration) * tc_scale / 1000000000.0; segment_duration = irnd(double(*kduration) * tc_scale);
if (verbose > 1) if (verbose > 1)
mxinfo(PFX "| + duration: %.3fs\n", segment_duration); mxinfo(PFX "| + duration: %.3fs\n", segment_duration /
1000000000.0);
} }
ktitle = FINDFIRST(l1, KaxTitle); ktitle = FINDFIRST(l1, KaxTitle);
@ -2183,9 +2184,8 @@ kax_reader_c::read(generic_packetizer_c *,
int int
kax_reader_c::get_progress() { kax_reader_c::get_progress() {
if (segment_duration != 0.0) if (segment_duration != 0)
return (int64_t)((last_timecode - first_timecode) / 10000000.0 / return (last_timecode - first_timecode) * 100 / segment_duration;
segment_duration);
return 100 * in->getFilePointer() / file_size; return 100 * in->getFilePointer() / file_size;
} }
@ -2211,11 +2211,19 @@ kax_reader_c::identify() {
int i; int i;
string info; string info;
if (identify_verbose && (title.length() > 0)) if (identify_verbose) {
mxinfo("File '%s': container: Matroska [title:%s]\n", ti->fname.c_str(), if (!title.empty())
escape(title).c_str()); info = mxsprintf("title:%s", escape(title).c_str());
else if (0 != segment_duration) {
mxinfo("File '%s': container: Matroska\n", ti->fname.c_str()); if (!info.empty())
info += " ";
info += mxsprintf("duration:%lld", segment_duration);
}
if (!info.empty())
info = mxsprintf(" [%s]", info.c_str());
}
mxinfo("File '%s': container: Matroska%s\n", ti->fname.c_str(),
info.c_str());
for (i = 0; i < tracks.size(); i++) for (i = 0; i < tracks.size(); i++)
if (tracks[i]->ok) { if (tracks[i]->ok) {
if (identify_verbose) { if (identify_verbose) {

View File

@ -181,7 +181,7 @@ private:
EbmlElement *saved_l1, *saved_l2, *segment; EbmlElement *saved_l1, *saved_l2, *segment;
KaxCluster *cluster; KaxCluster *cluster;
double segment_duration; int64_t segment_duration;
int64_t last_timecode, first_timecode; int64_t last_timecode, first_timecode;
string title; string title;