mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 04:11:44 +00:00
track statistics tags: don't write _STATISTICS_WRITING_DATE_UTC with --no-date
Fixes #2286.
This commit is contained in:
parent
e3f54fdbcb
commit
2dd33027fd
3
NEWS.md
3
NEWS.md
@ -42,6 +42,9 @@
|
||||
memory leaks.
|
||||
* mkvextract: fixed a crash when mkvextract with a non-Matroska file as the
|
||||
source file. Fixes #2281.
|
||||
* mkvmerge: track statistics tags: if writing the `Date` element is
|
||||
deactivated via `--no-date`, the `_STATISTICS_WRITING_DATE_UTC` isn't
|
||||
written either anymore. Fixes #2286.
|
||||
|
||||
## Build system changes
|
||||
|
||||
|
@ -19,11 +19,10 @@
|
||||
void
|
||||
track_statistics_c::create_tags(KaxTags &tags,
|
||||
std::string const &writing_app,
|
||||
boost::posix_time::ptime const &writing_date)
|
||||
boost::optional<boost::posix_time::ptime> writing_date)
|
||||
const {
|
||||
auto writing_date_str = !writing_date.is_not_a_date_time() ? mtx::date_time::to_string(writing_date, "%Y-%m-%d %H:%M:%S") : "1970-01-01 00:00:00";
|
||||
auto bps = get_bits_per_second();
|
||||
auto duration = get_duration();
|
||||
auto bps = get_bits_per_second();
|
||||
auto duration = get_duration();
|
||||
|
||||
mtx::tags::remove_simple_tags_for<KaxTagTrackUID>(tags, m_track_uid, "BPS");
|
||||
mtx::tags::remove_simple_tags_for<KaxTagTrackUID>(tags, m_track_uid, "DURATION");
|
||||
@ -39,8 +38,12 @@ track_statistics_c::create_tags(KaxTags &tags,
|
||||
mtx::tags::set_simple(*tag, "NUMBER_OF_FRAMES", ::to_string(m_num_frames));
|
||||
mtx::tags::set_simple(*tag, "NUMBER_OF_BYTES", ::to_string(m_num_bytes));
|
||||
|
||||
mtx::tags::set_simple(*tag, "_STATISTICS_WRITING_APP", writing_app);
|
||||
mtx::tags::set_simple(*tag, "_STATISTICS_WRITING_DATE_UTC", writing_date_str);
|
||||
mtx::tags::set_simple(*tag, "_STATISTICS_TAGS", "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES");
|
||||
mtx::tags::set_simple(*tag, "_STATISTICS_WRITING_APP", writing_app);
|
||||
|
||||
if (writing_date) {
|
||||
auto writing_date_str = !writing_date->is_not_a_date_time() ? mtx::date_time::to_string(*writing_date, "%Y-%m-%d %H:%M:%S") : "1970-01-01 00:00:00";
|
||||
mtx::tags::set_simple(*tag, "_STATISTICS_WRITING_DATE_UTC", writing_date_str);
|
||||
}
|
||||
|
||||
mtx::tags::set_simple(*tag, "_STATISTICS_TAGS", "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES");
|
||||
}
|
||||
|
@ -87,5 +87,5 @@ public:
|
||||
% (bps ? *bps : -1)).str();
|
||||
}
|
||||
|
||||
void create_tags(KaxTags &tags, std::string const &writing_app, boost::posix_time::ptime const &writing_date) const;
|
||||
void create_tags(KaxTags &tags, std::string const &writing_app, boost::optional<boost::posix_time::ptime> writing_date) const;
|
||||
};
|
||||
|
@ -699,10 +699,12 @@ void
|
||||
cluster_helper_c::create_tags_for_track_statistics(KaxTags &tags,
|
||||
std::string const &writing_app,
|
||||
boost::posix_time::ptime const &writing_date) {
|
||||
auto actual_writing_date = g_write_date ? boost::optional<boost::posix_time::ptime>{writing_date} : boost::optional<boost::posix_time::ptime>{};
|
||||
|
||||
for (auto const &ptzr : g_packetizers) {
|
||||
auto track_uid = ptzr.packetizer->get_uid();
|
||||
|
||||
m->track_statistics[track_uid].set_track_uid(track_uid).create_tags(tags, writing_app, writing_date);
|
||||
m->track_statistics[track_uid].set_track_uid(track_uid).create_tags(tags, writing_app, actual_writing_date);
|
||||
}
|
||||
|
||||
m->track_statistics.clear();
|
||||
|
@ -485,3 +485,4 @@ T_636flac_with_id3_tags:c8b37897660d88038c4e6f401fe6c94c:passed:20180310-182917:
|
||||
T_637mp4_8_channels_in_track_headers_but_7_in_codec_specific_config:true:passed:20180322-222201:0.012853536
|
||||
T_638av1_ivf_webm:75abc9d1c93b75f11f2cde679007988f-4c0b2d5332293c142c9ccff0103f5c00-7c939fffa12bc12aa4051cd037b82676-6735876d7334af154ff61994e9664239:passed:20180401-164905:0.057966018
|
||||
T_639vobsub_missing_duration_in_matroska:1da346761ddede951b1f2f5f11cd3f69:passed:20180401-193013:0.014669303
|
||||
T_640no_date:20fbba5a79a436caa36582e7675c1038:passed:20180427-231324:0.011724657
|
||||
|
5
tests/test-640no_date.rb
Executable file
5
tests/test-640no_date.rb
Executable file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/ruby -w
|
||||
|
||||
# T_640no_date
|
||||
describe "mkvmerge / don't write the date"
|
||||
test_merge "data/subtitles/srt/ven.srt", :args => "--no-date"
|
Loading…
Reference in New Issue
Block a user