merge: verbose identification: don't output values that aren't known

This commit is contained in:
Moritz Bunkus 2015-09-17 21:05:39 +02:00
parent 538d86b6b6
commit aa69ec3775
14 changed files with 60 additions and 61 deletions

View File

@ -65,11 +65,37 @@ protected:
std::vector<std::string> m_info;
public:
template<typename T> info_c &add(std::string const &key, T const &value) {
template<typename T> info_c &
set(std::string const &key,
T const &value) {
m_info.emplace_back((boost::format("%1%:%2%") % escape(key) % escape((boost::format("%1%") % value).str())).str());
return *this;
}
template<typename T> info_c &
add(std::string const &key,
T const &value,
T const &unset_value = T{}) {
if (value != unset_value)
set(key, value);
return *this;
}
info_c &
add(std::string const &key,
char const *value,
std::string const &unset_value = {}) {
if (std::string{value} != unset_value)
set(key, value);
return *this;
}
info_c &
add(std::string const &key,
boost::format const &value) {
return add(key, value.str());
}
std::vector<std::string> const &get() const {
return m_info;
}

View File

@ -142,11 +142,10 @@ aac_reader_c::read(generic_packetizer_c *,
void
aac_reader_c::identify() {
auto info = mtx::id::info_c{};
info.add(mtx::id::aac_is_sbr, AAC_PROFILE_SBR == m_aacheader.profile ? "true" : "unknown");
info.add(mtx::id::audio_channels, m_aacheader.channels);
info.add(mtx::id::audio_sampling_frequency, m_aacheader.sample_rate);
if (m_aacheader.output_sample_rate)
info.add(mtx::id::audio_output_sampling_frequency, m_aacheader.output_sample_rate);
info.add(mtx::id::aac_is_sbr, AAC_PROFILE_SBR == m_aacheader.profile ? std::string{"true"} : std::string{"unknown"});
info.add(mtx::id::audio_channels, m_aacheader.channels);
info.add(mtx::id::audio_sampling_frequency, m_aacheader.sample_rate);
info.add(mtx::id::audio_output_sampling_frequency, m_aacheader.output_sample_rate);
id_result_container();
id_result_track(0, ID_RESULT_TRACK_AUDIO, codec_c::get_name(codec_c::type_e::A_AAC, "AAC"), info.get());

View File

@ -883,8 +883,7 @@ avi_reader_c::identify_audio() {
info.add(mtx::id::audio_channels, AVI_audio_channels(m_avi));
info.add(mtx::id::audio_sampling_frequency, AVI_audio_rate(m_avi));
if (AVI_audio_bits(m_avi))
info.add(mtx::id::audio_bits_per_sample, AVI_audio_bits(m_avi));
info.add(mtx::id::audio_bits_per_sample, AVI_audio_bits(m_avi));
unsigned int audio_format = AVI_audio_format(m_avi);
alWAVEFORMATEX *wfe = m_avi->wave_format_ex[i];

View File

@ -71,8 +71,7 @@ coreaudio_reader_c::identify() {
auto info = mtx::id::info_c{};
info.add(mtx::id::audio_channels, m_channels);
info.add(mtx::id::audio_sampling_frequency, static_cast<int64_t>(m_sample_rate));
if (m_bits_per_sample)
info.add(mtx::id::audio_bits_per_sample, m_bits_per_sample);
info.add(mtx::id::audio_bits_per_sample, m_bits_per_sample);
id_result_container();
id_result_track(0, ID_RESULT_TRACK_AUDIO, m_codec.get_name(m_codec_name), info.get());

View File

@ -339,8 +339,7 @@ flv_reader_c::identify() {
else if (track->is_audio()) {
info.add(mtx::id::audio_channels, track->m_a_channels);
info.add(mtx::id::audio_sampling_frequency, track->m_a_sample_rate);
if (track->m_a_bits_per_sample)
info.add(mtx::id::audio_bits_per_sample, track->m_a_bits_per_sample);
info.add(mtx::id::audio_bits_per_sample, track->m_a_bits_per_sample);
}
id_result_track(idx, track->is_audio() ? ID_RESULT_TRACK_AUDIO : ID_RESULT_TRACK_VIDEO,

View File

@ -2276,49 +2276,37 @@ kax_reader_c::identify() {
info = mtx::id::info_c{};
info.add(mtx::id::number, track->track_number);
if (track->track_uid)
info.add(mtx::id::uid, track->track_uid);
info.add(mtx::id::uid, track->track_uid);
info.add(mtx::id::codec_id, track->codec_id);
info.add(mtx::id::codec_private_length, track->private_size);
info.set(mtx::id::codec_private_length, track->private_size);
info.add(mtx::id::language, track->language);
info.add(mtx::id::track_name, track->track_name);
info.add(mtx::id::stereo_mode, static_cast<int>(track->v_stereo_mode), static_cast<int>(stereo_mode_c::unspecified));
info.add(mtx::id::default_duration, track->default_duration);
info.set(mtx::id::default_track, track->default_track ? 1 : 0);
info.set(mtx::id::forced_track, track->forced_track ? 1 : 0);
info.set(mtx::id::enabled_track, track->enabled_track ? 1 : 0);
if ((0 != track->private_size) && track->private_data)
info.add(mtx::id::codec_private_data, to_hex(static_cast<const unsigned char *>(track->private_data), track->private_size, true));
if (!track->language.empty())
info.add(mtx::id::language, track->language);
if (!track->track_name.empty())
info.add(mtx::id::track_name, track->track_name);
if ((0 != track->v_width) && (0 != track->v_height))
info.add(mtx::id::pixel_dimensions, boost::format("%1%x%2%") % track->v_width % track->v_height);
if ((0 != track->v_dwidth) && (0 != track->v_dheight))
info.add(mtx::id::display_dimensions, boost::format("%1%x%2%") % track->v_dwidth % track->v_dheight);
if (stereo_mode_c::unspecified != track->v_stereo_mode)
info.add(mtx::id::stereo_mode, static_cast<int>(track->v_stereo_mode));
if ((0 != track->v_pcleft) || (0 != track->v_pctop) || (0 != track->v_pcright) || (0 != track->v_pcbottom))
info.add(mtx::id::cropping, boost::format("cropping:%1%,%2%,%3%,%4%") % track->v_pcleft % track->v_pctop % track->v_pcright % track->v_pcbottom);
info.add(mtx::id::default_track, track->default_track ? 1 : 0);
info.add(mtx::id::forced_track, track->forced_track ? 1 : 0);
info.add(mtx::id::enabled_track, track->enabled_track ? 1 : 0);
if (track->codec.is(codec_c::type_e::V_MPEG4_P10))
info.add(mtx::id::packetizer, track->ms_compat ? mtx::id::mpeg4_p10_es_video : mtx::id::mpeg4_p10_video);
else if (track->codec.is(codec_c::type_e::V_MPEGH_P2))
info.add(mtx::id::packetizer, track->ms_compat ? mtx::id::mpegh_p2_es_video : mtx::id::mpegh_p2_video);
if (0 != track->default_duration)
info.add(mtx::id::default_duration, track->default_duration);
if ('a' == track->type) {
if (0.0 != track->a_sfreq)
info.add(mtx::id::audio_sampling_frequency, static_cast<int64_t>(track->a_sfreq));
if (0 != track->a_channels)
info.add(mtx::id::audio_channels, track->a_channels);
info.add(mtx::id::audio_sampling_frequency, static_cast<int64_t>(track->a_sfreq));
info.add(mtx::id::audio_channels, track->a_channels);
} else if ('s' == track->type) {
if (track->codec.is(codec_c::type_e::S_SRT) || track->codec.is(codec_c::type_e::S_SSA_ASS) || track->codec.is(codec_c::type_e::S_KATE))

View File

@ -802,10 +802,8 @@ mpeg_ts_reader_c::identify() {
continue;
info = mtx::id::info_c{};
if (!track->language.empty())
info.add(mtx::id::language, track->language);
info.add(mtx::id::ts_pid, track->pid);
info.add(mtx::id::language, track->language);
info.add(mtx::id::ts_pid, track->pid);
if (ES_AUDIO_TYPE == track->type) {
info.add(mtx::id::audio_channels, track->a_channels);

View File

@ -717,8 +717,7 @@ ogm_reader_c::identify() {
for (i = 0; i < sdemuxers.size(); i++) {
info = mtx::id::info_c{};
if (!sdemuxers[i]->language.empty())
info.add(mtx::id::language, sdemuxers[i]->language);
info.add(mtx::id::language, sdemuxers[i]->language);
if (!sdemuxers[i]->title.empty() && !sdemuxers[i]->ms_compat)
info.add(mtx::id::track_name, sdemuxers[i]->title);
@ -733,10 +732,8 @@ ogm_reader_c::identify() {
if (pixel_dimensions.first && pixel_dimensions.second)
info.add(mtx::id::pixel_dimensions, boost::format("%1%x%2%") % pixel_dimensions.first % pixel_dimensions.second);
if (sdemuxers[i]->channels)
info.add(mtx::id::audio_channels, sdemuxers[i]->channels);
if (sdemuxers[i]->sample_rate)
info.add(mtx::id::audio_sampling_frequency, sdemuxers[i]->sample_rate);
info.add(mtx::id::audio_channels, sdemuxers[i]->channels);
info.add(mtx::id::audio_sampling_frequency, sdemuxers[i]->sample_rate);
id_result_track(i, sdemuxers[i]->get_type(), sdemuxers[i]->get_codec(), info.get());
}

View File

@ -1757,8 +1757,7 @@ qtmp4_reader_c::identify() {
else if (dmx->codec.is(codec_c::type_e::V_MPEGH_P2))
info.add(mtx::id::packetizer, mtx::id::mpegh_p2_video);
if (!dmx->language.empty())
info.add(mtx::id::language, dmx->language);
info.add(mtx::id::language, dmx->language);
if (dmx->is_video())
info.add(mtx::id::pixel_dimensions, boost::format("%1%x%2%") % dmx->v_width % dmx->v_height);
@ -1766,8 +1765,7 @@ qtmp4_reader_c::identify() {
else if (dmx->is_audio()) {
info.add(mtx::id::audio_channels, dmx->a_channels);
info.add(mtx::id::audio_sampling_frequency, dmx->a_samplerate);
if (dmx->a_bitdepth)
info.add(mtx::id::audio_bits_per_sample, dmx->a_bitdepth);
info.add(mtx::id::audio_bits_per_sample, dmx->a_bitdepth);
}
id_result_track(dmx->id,

View File

@ -601,8 +601,7 @@ real_reader_c::identify() {
else if (RMFF_TRACK_TYPE_AUDIO == demuxer->track->type) {
info.add(mtx::id::audio_channels, demuxer->channels);
info.add(mtx::id::audio_sampling_frequency, demuxer->samples_per_second);
if (demuxer->bits_per_sample)
info.add(mtx::id::audio_bits_per_sample, demuxer->bits_per_sample);
info.add(mtx::id::audio_bits_per_sample, demuxer->bits_per_sample);
}
id_result_track(demuxer->track->id, type, codec_c::get_name(demuxer->fourcc, demuxer->fourcc), info.get());

View File

@ -143,8 +143,7 @@ tta_reader_c::identify() {
info.add(mtx::id::audio_channels, get_uint16_le(&header.channels));
info.add(mtx::id::audio_sampling_frequency, get_uint32_le(&header.sample_rate));
if (get_uint16_le(&header.bits_per_sample))
info.add(mtx::id::audio_bits_per_sample, get_uint16_le(&header.bits_per_sample));
info.add(mtx::id::audio_bits_per_sample, get_uint16_le(&header.bits_per_sample));
id_result_container();
id_result_track(0, ID_RESULT_TRACK_AUDIO, codec_c::get_name(codec_c::type_e::A_TTA, "TTA"), info.get());

View File

@ -220,8 +220,7 @@ usf_reader_c::identify() {
auto track = m_tracks[i];
auto info = mtx::id::info_c{};
if (!track->m_language.empty())
info.add(mtx::id::language, track->m_language);
info.add(mtx::id::language, track->m_language);
id_result_track(i, ID_RESULT_TRACK_SUBTITLES, codec_c::get_name(codec_c::type_e::S_USF, "USF"), info.get());
}

View File

@ -658,8 +658,7 @@ vobsub_reader_c::identify() {
for (i = 0; i < tracks.size(); i++) {
auto info = mtx::id::info_c{};
if (!tracks[i]->language.empty())
info.add(mtx::id::language, tracks[i]->language);
info.add(mtx::id::language, tracks[i]->language);
id_result_track(i, ID_RESULT_TRACK_SUBTITLES, codec_c::get_name(codec_c::type_e::S_VOBSUB, "VobSub"), info.get());
}

View File

@ -206,7 +206,7 @@ T_357segment_info:c734542adcdeca270db3b6e41fd85ffc-61d4730547bcd79e9a692caa4c214
T_358usf:13cc323a8e690b4e1c236010938e1ee3:passed:20120329-142144:0.051754089
T_359split_parts:bc2ff718d54847937b9f6b4f2e38036d+49341e4669faff0225236af4eda8eb09+ok-5efda882c230b3ff5a044af4148f8d1c+ok-b1619e39ba9194cf2ef3187991f6ed18+ok-497448adf872f4050f5e34d9aacf5fa0+4f25451d573042cfdff4809a28638e93+782db07154db9054ff9f0ef3bf1235c6+f129ab41e298b6358fc0197c92c3da5f+91120826bea5d0462090d54416a571b1+4e8b657d7e371b84a7d89232e5c9fb3f+1586ba9b356c823bd58566c58e635889+ok-32b1d647cec6dc843b31f3030daf9ee7+ok-a72d22cdc1ab54c605930259a9953aff+ok:passed:20120331-133448:2.321768368
T_360X_chapters_hex_format:87a60c81c05fb0a153a2e041485ae2cb-3853793b0d88fc10efadb146ca948833:passed:20120404-152038:0.047282116
T_361file_concatenation:f4d6474cb3bf0b1f5a51fb7f304bbd8f-ed5c6fbaedc5f24c2a8321c306baff41-ed5c6fbaedc5f24c2a8321c306baff41-98fd5ee77c40d1de6244c7afca3cfa15-98fd5ee77c40d1de6244c7afca3cfa15-98fd5ee77c40d1de6244c7afca3cfa15-2b0cde47d9cff1d464c78f2e158582f1-7ecd98ea1713eb40ca44c967153f9491-740607972d7bb60c595835efdb9d880d-740607972d7bb60c595835efdb9d880d-740607972d7bb60c595835efdb9d880d-740607972d7bb60c595835efdb9d880d-09ffbb6cd3ce4f4947f1f2e782be6cdd-d7039c2d63d417c29d4ba7bf623563e5-80e456901895bd509cc8f2f6ed10d587-80e456901895bd509cc8f2f6ed10d587:passed:20120406-144928:18.646532342
T_361file_concatenation:110a43494103bdef8ed3f673bf181c6f-ed5c6fbaedc5f24c2a8321c306baff41-ed5c6fbaedc5f24c2a8321c306baff41-98fd5ee77c40d1de6244c7afca3cfa15-98fd5ee77c40d1de6244c7afca3cfa15-98fd5ee77c40d1de6244c7afca3cfa15-2b0cde47d9cff1d464c78f2e158582f1-ffd60b9f244fd22afb06236424a81422-740607972d7bb60c595835efdb9d880d-740607972d7bb60c595835efdb9d880d-740607972d7bb60c595835efdb9d880d-740607972d7bb60c595835efdb9d880d-09ffbb6cd3ce4f4947f1f2e782be6cdd-d7039c2d63d417c29d4ba7bf623563e5-80e456901895bd509cc8f2f6ed10d587-80e456901895bd509cc8f2f6ed10d587:passed:20120406-144928:18.646532342
T_362xtr_avc:abc9dd7b4579a2e14783271d1d64d486-49ae33bdb1e43de90886bc2ac6410c35:passed:20120416-153515:1.811589633
T_363srt_colon_decimal_separator:d75be97f27797c8b3fc62e5d39a8d7ea:passed:20120520-180625:0.032379535
T_364qtmp4_track_with_empty_chunkmap_table:f7837ed142ed9a5cca5d2fbc5788d597:passed:20120605-223925:0.168392001
@ -334,7 +334,7 @@ T_485dtshd_file_format:577be0cf2bffc155aacd74a7bc2619dd:passed:20150329-085728:1
T_486m2ts_eac3_with_extension_in_own_packet:265d8436497eb50f49b24805a08cd39a:passed:20150329-193642:0.518299841
T_487matroska_version_and_read_version_with_opus:4+2-4+2-4+2-4+1-4+2-4+1-4+1-4+1:passed:20150329-213811:0.670610463
T_488hevc_conformance_window_with_cropping:71d84f56384c2d25fe55477766b7604d:passed:20150329-220212:0.705828455
T_489dts_es:5273ccb05087a45dedaacaa8ad42c195-24863912d7166fc7ef5b9b650aa2b9f6-46185b2febdc886c68a33818f728a2a5:passed:20150403-115948:1.604769748
T_489dts_es:5273ccb05087a45dedaacaa8ad42c195-306b0918348fed72b0ab278c0066b723-ab27e20a1ef8df7698bd286561d1a5fd:passed:20150403-115948:1.604769748
T_490sequence_numbers_no_0_in_first_gop:10a0cc2f79acd8cb520661b45721e652:passed:20150411-142423:0.832402022
T_491auto_additional_files_only_with_vts_prefix:98fd5ee77c40d1de6244c7afca3cfa15:passed:20150413-202924:0.904251401
T_492truehd_ac3_setting_track_properties:076b157723cf84fa785130f4f87f15ab-cf8baeb632991b669c172fa96278d11a-5eb0ff15ecb155e7828f6724a60b77d1-ec21ebdd433ed1a6f9d25a337323045b-ab9b806b3de4e93c52e767f925111834-c1644709f2dd31bb03e3555e96ad12f3:passed:20150413-211600:9.416716642
@ -343,8 +343,8 @@ T_494dont_abort_with_aac_error_proection_specific_config:5a711a4c515b656e9418e34
T_495default_durataion_and_sync:b360d52e56d8d291a7dc24ecd2b63c18-0a38dc656269f588fc4228d50e930d12-8f3d5eeacee5a77075eed0e7ae0d882a:passed:20150417-213623:0.894261521
T_496segment_size_0:9fd6d5e57b47693a483f9aad112a6a15-ed68216741f23c974bf72dcfe9470595:passed:20150530-180226:0.051304978
T_497crash_in_base64_decoder:f6526cfaaef01627c52ee2ba25f03255:passed:20150601-192215:0.02848152
T_498mp2_misidentification:b20b43decdbb7d67850ea8aab441eec1-48104c68acb24bc1530b3b82549e0180:passed:20150610-111131:0.763502595
T_498mp2_misidentification:c0b9472b69eb990c4cf25977703e0840-c0644154c2ec6ba99e3e9ba8083fd131:passed:20150610-111131:0.763502595
T_499propedit_tags_and_track_properties:0075366ca11568fbb5c77c55298d0068:passed:20150621-111029:0.162830224
T_500mp4_eac3_fourcc_ec_3:ceb9015450fa8322f6ad308a7b852c41:passed:20150621-224248:0.192381554
T_501mpeg_ts_pat_and_pmt_crc_errors:caad7790fb05d1447075ea04301f9770:passed:20150704-110859:0.857051787
T_501mpeg_ts_pat_and_pmt_crc_errors:7d6ce48e6df5b650af37b71c18ce5fe0:passed:20150704-110859:0.857051787
T_502ui_locale_sr_RS:650e05c9c091234882980f4c1da05dc4-25fa402006e7971d8e5a2b1139a4c4d8:passed:20150829-213708:0.062939538