void aac_reader_c::identify() { std::string verbose_info = std::string("aac_is_sbr:") + std::string(AAC_PROFILE_SBR == m_aacheader.profile ? "true" : "unknown"); id_result_container(); id_result_track(0, ID_RESULT_TRACK_AUDIO, "AAC", verbose_info); }
void ogm_reader_c::identify() { std::vector<std::string> verbose_info; size_t i; // Check if a video track has a TITLE comment. If yes we use this as the // new segment title / global file title. for (i = 0; i < sdemuxers.size(); i++) if ((sdemuxers[i]->title != "") && (sdemuxers[i]->stype == OGM_STREAM_TYPE_V_MSCOMP)) { verbose_info.push_back(std::string("title:") + escape(sdemuxers[i]->title)); break; } id_result_container(join(" ", verbose_info)); for (i = 0; i < sdemuxers.size(); i++) { verbose_info.clear(); if (sdemuxers[i]->language != "") verbose_info.push_back(std::string("language:") + escape(sdemuxers[i]->language)); if ((sdemuxers[i]->title != "") && (sdemuxers[i]->stype != OGM_STREAM_TYPE_V_MSCOMP)) verbose_info.push_back(std::string("track_name:") + escape(sdemuxers[i]->title)); if ((0 != sdemuxers[i]->display_width) && (0 != sdemuxers[i]->display_height)) verbose_info.push_back((boost::format("display_dimensions:%1%x%2%") % sdemuxers[i]->display_width % sdemuxers[i]->display_height).str()); id_result_track(i, sdemuxers[i]->get_type(), sdemuxers[i]->get_codec(), verbose_info); } if (m_chapters.get()) id_result_chapters(count_chapter_atoms(*m_chapters)); }
void avi_reader_c::identify_audio() { int i; for (i = 0; i < AVI_audio_tracks(m_avi); i++) { AVI_set_audio_track(m_avi, i); unsigned int audio_format = AVI_audio_format(m_avi); alWAVEFORMATEX *wfe = m_avi->wave_format_ex[i]; if ((0xfffe == audio_format) && (get_uint16_le(&wfe->cb_size) >= (sizeof(alWAVEFORMATEXTENSION)))) { alWAVEFORMATEXTENSIBLE *ext = reinterpret_cast<alWAVEFORMATEXTENSIBLE *>(wfe); audio_format = get_uint32_le(&ext->extension.guid.data1); } std::string type = (0x0001 == audio_format) || (0x0003 == audio_format) ? "PCM" : (0x0050 == audio_format) ? "MP2" : (0x0055 == audio_format) ? "MP3" : (0x2000 == audio_format) ? "AC3" : (0x2001 == audio_format) ? "DTS" : (0x0050 == audio_format) ? "MP2" : (0x00ff == audio_format) || (0x706d == audio_format) ? "AAC" : (0x566f == audio_format) ? "Vorbis" : (boost::format("unsupported (0x%|1$04x|)") % audio_format).str(); id_result_track(i + 1, ID_RESULT_TRACK_AUDIO, type); } }
void avc_es_reader_c::identify() { auto info = mtx::id::info_c{}; info.add(mtx::id::packetizer, mtx::id::mpeg4_p10_es_video); id_result_container(); id_result_track(0, ID_RESULT_TRACK_VIDEO, codec_c::get_name(codec_c::type_e::V_MPEG4_P10, "MPEG-4 part 10 ES"), info.get()); }
void ac3_reader_c::identify() { auto info = mtx::id::info_c{}; info.add(mtx::id::audio_channels, m_ac3header.m_channels); info.add(mtx::id::audio_sampling_frequency, m_ac3header.m_sample_rate); id_result_container(); id_result_track(0, ID_RESULT_TRACK_AUDIO, codec_c::get_name(codec_c::type_e::A_AC3, "AC3"), info.get()); }
void avi_reader_c::identify_subtitles() { size_t i; for (i = 0; m_subtitle_demuxers.size() > i; ++i) id_result_track(1 + AVI_audio_tracks(m_avi) + i, ID_RESULT_TRACK_SUBTITLES, avi_subs_demuxer_t::TYPE_SRT == m_subtitle_demuxers[i].m_type ? "SRT" : avi_subs_demuxer_t::TYPE_SSA == m_subtitle_demuxers[i].m_type ? "SSA/ASS" : "unknown"); }
void ssa_reader_c::identify() { id_result_container(); id_result_track(0, ID_RESULT_TRACK_SUBTITLES, codec_c::get_name(codec_c::type_e::S_SSA_ASS, "SSA/ASS"), std::vector<std::string>{"text_subtitles:1"}); size_t i; for (i = 0; i < g_attachments.size(); i++) id_result_attachment(g_attachments[i].ui_id, g_attachments[i].mime_type, g_attachments[i].data->get_size(), g_attachments[i].name, g_attachments[i].description); }
void truehd_reader_c::identify() { id_result_container(); auto info = mtx::id::info_c{}; info.add(mtx::id::audio_channels, m_header->m_channels); info.add(mtx::id::audio_sampling_frequency, m_header->m_sampling_rate); id_result_track(0, ID_RESULT_TRACK_AUDIO, codec_c::get_name(m_header->is_truehd() ? codec_c::type_e::A_TRUEHD : codec_c::type_e::A_MLP, m_header->is_truehd() ? "TrueHD" : "MLP"), info.get()); if (!m_ac3_header.m_valid) return; info = mtx::id::info_c{}; info.add(mtx::id::audio_channels, m_ac3_header.m_channels); info.add(mtx::id::audio_sampling_frequency, m_ac3_header.m_sample_rate); id_result_track(1, ID_RESULT_TRACK_AUDIO, codec_c::get_name(codec_c::type_e::A_AC3, "AC-3"), info.get()); }
void dts_reader_c::identify() { auto info = mtx::id::info_c{}; info.add(mtx::id::audio_channels, m_dtsheader.get_total_num_audio_channels()); info.add(mtx::id::audio_sampling_frequency, m_dtsheader.core_sampling_frequency); info.add(mtx::id::audio_bits_per_sample, std::max(m_dtsheader.source_pcm_resolution, 0)); id_result_container(); id_result_track(0, ID_RESULT_TRACK_AUDIO, m_codec.get_name(), info.get()); }
void wav_reader_c::identify() { if (m_demuxer) { id_result_container(); id_result_track(0, ID_RESULT_TRACK_AUDIO, m_demuxer->get_codec()); } else { uint16_t format_tag = get_uint16_le(&m_wheader.common.wFormatTag); id_result_container_unsupported(m_in->get_file_name(), (boost::format("RIFF WAVE (wFormatTag = 0x%|1$04x|)") % format_tag).str()); } }
void mpeg_ts_reader_c::identify() { std::vector<std::string> verbose_info; auto mpls_in = dynamic_cast<mm_mpls_multi_file_io_c *>(get_underlying_input_as_multi_file_io()); if (mpls_in) mpls_in->create_verbose_identification_info(verbose_info); id_result_container(verbose_info); size_t i; for (i = 0; i < tracks.size(); i++) { mpeg_ts_track_ptr &track = tracks[i]; if (!track->probed_ok) continue; const char *fourcc = FOURCC('M', 'P', 'G', '1') == track->fourcc ? "MPEG-1" : FOURCC('M', 'P', 'G', '2') == track->fourcc ? "MPEG-2" : FOURCC('A', 'V', 'C', '1') == track->fourcc ? "AVC/h.264" : FOURCC('W', 'V', 'C', '1') == track->fourcc ? "VC1" : FOURCC('M', 'P', '1', ' ') == track->fourcc ? "MPEG-1 layer 1" : FOURCC('M', 'P', '2', ' ') == track->fourcc ? "MPEG-1 layer 2" : FOURCC('M', 'P', '3', ' ') == track->fourcc ? "MPEG-1 layer 3" : FOURCC('A', 'A', 'C', ' ') == track->fourcc ? "AAC" : FOURCC('A', 'C', '3', ' ') == track->fourcc ? "AC3" : FOURCC('D', 'T', 'S', ' ') == track->fourcc ? "DTS" : FOURCC('T', 'R', 'H', 'D') == track->fourcc ? "TrueHD" : FOURCC('P', 'G', 'S', ' ') == track->fourcc ? "HDMV PGS" // : FOURCC('P', 'C', 'M', ' ') == track->fourcc ? "PCM" // : FOURCC('L', 'P', 'C', 'M') == track->fourcc ? "LPCM" : nullptr; if (!fourcc) continue; verbose_info.clear(); if (!track->language.empty()) verbose_info.push_back((boost::format("language:%1%") % escape(track->language)).str()); verbose_info.push_back((boost::format("ts_pid:%1%") % track->pid).str()); std::string type = ES_AUDIO_TYPE == track->type ? ID_RESULT_TRACK_AUDIO : ES_VIDEO_TYPE == track->type ? ID_RESULT_TRACK_VIDEO : ID_RESULT_TRACK_SUBTITLES; id_result_track(i, type, fourcc, verbose_info); } if (!m_chapter_timecodes.empty()) id_result_chapters(m_chapter_timecodes.size()); }
void usf_reader_c::identify() { size_t i; id_result_container(); for (i = 0; m_tracks.size() > i; ++i) { auto track = m_tracks[i]; auto info = mtx::id::info_c{}; 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()); } }
void avi_reader_c::identify_subtitles() { size_t i; for (i = 0; m_subtitle_demuxers.size() > i; ++i) { auto info = mtx::id::info_c{}; if ( (avi_subs_demuxer_t::TYPE_SRT == m_subtitle_demuxers[i].m_type) || (avi_subs_demuxer_t::TYPE_SSA == m_subtitle_demuxers[i].m_type)) info.add(mtx::id::text_subtitles, 1); id_result_track(1 + AVI_audio_tracks(m_avi) + i, ID_RESULT_TRACK_SUBTITLES, avi_subs_demuxer_t::TYPE_SRT == m_subtitle_demuxers[i].m_type ? codec_c::get_name(codec_c::type_e::S_SRT, "SRT") : avi_subs_demuxer_t::TYPE_SSA == m_subtitle_demuxers[i].m_type ? codec_c::get_name(codec_c::type_e::S_SSA_ASS, "SSA/ASS") : "unknown", info.get()); } }
void wav_reader_c::identify() { if (!m_demuxer) { uint16_t format_tag = get_uint16_le(&m_wheader.common.wFormatTag); id_result_container_unsupported(m_in->get_file_name(), (boost::format("RIFF WAVE (wFormatTag = 0x%|1$04x|)") % format_tag).str()); return; } std::vector<std::string> verbose_info; verbose_info.push_back((boost::format("channels:%1%") % get_uint16_le(&m_wheader.common.wChannels)).str()); verbose_info.push_back((boost::format("sample_rate:%1%") % get_uint32_le(&m_wheader.common.dwSamplesPerSec)).str()); verbose_info.push_back((boost::format("bits_per_sample:%1%") % get_uint16_le(&m_wheader.common.wBitsPerSample)).str()); id_result_container(); id_result_track(0, ID_RESULT_TRACK_AUDIO, m_demuxer->m_codec.get_name(), verbose_info); }
void usf_reader_c::identify() { std::vector<std::string> verbose_info; size_t i; id_result_container(); for (i = 0; m_tracks.size() > i; ++i) { auto track = m_tracks[i]; verbose_info.clear(); if (!track->m_language.empty()) verbose_info.push_back(std::string("language:") + escape(track->m_language)); id_result_track(i, ID_RESULT_TRACK_SUBTITLES, "USF", verbose_info); } }
void avi_reader_c::identify_video() { if (!m_video_track_ok) return; auto info = mtx::id::info_c{}; auto codec = codec_c::look_up(AVI_video_compressor(m_avi)); auto fourcc_str = fourcc_c{AVI_video_compressor(m_avi)}.description(); if (codec.is(codec_c::type_e::V_MPEG4_P2)) extended_identify_mpeg4_l2(info); else if (codec.is(codec_c::type_e::V_MPEG4_P10)) info.add(mtx::id::packetizer, mtx::id::mpeg4_p10_es_video); info.add(mtx::id::pixel_dimensions, boost::format("%1%x%2%") % AVI_video_width(m_avi) % AVI_video_height(m_avi)); id_result_track(0, ID_RESULT_TRACK_VIDEO, codec.get_name(fourcc_str), join(" ", info.get())); }
void avi_reader_c::identify_audio() { int i; for (i = 0; i < AVI_audio_tracks(m_avi); i++) { AVI_set_audio_track(m_avi, i); auto info = mtx::id::info_c{}; info.add(mtx::id::audio_channels, AVI_audio_channels(m_avi)); info.add(mtx::id::audio_sampling_frequency, AVI_audio_rate(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]; if ((0xfffe == audio_format) && (get_uint16_le(&wfe->cb_size) >= (sizeof(alWAVEFORMATEXTENSION)))) { alWAVEFORMATEXTENSIBLE *ext = reinterpret_cast<alWAVEFORMATEXTENSIBLE *>(wfe); audio_format = get_uint32_le(&ext->extension.guid.data1); } auto codec = codec_c::look_up_audio_format(audio_format); id_result_track(i + 1, ID_RESULT_TRACK_AUDIO, codec.get_name((boost::format("unsupported (0x%|1$04x|)") % audio_format).str()), info.get()); } }
void avi_reader_c::identify_video() { if (!m_video_track_ok) return; std::vector<std::string> extended_info; const char *fourcc_str = AVI_video_compressor(m_avi); std::string type = fourcc_str; if (IS_MPEG4_L2_FOURCC(fourcc_str)) extended_identify_mpeg4_l2(extended_info); else if (mpeg4::p10::is_avc_fourcc(fourcc_str)) extended_info.push_back("packetizer:mpeg4_p10_es_video"); else if (mpeg1_2::is_fourcc(get_uint32_le(fourcc_str))) type = "MPEG-1/2"; else if (type == "VP80") type = "VP8"; id_result_track(0, ID_RESULT_TRACK_VIDEO, type, join(" ", extended_info)); }
void flac_reader_c::identify() { id_result_container(); id_result_track(0, ID_RESULT_TRACK_AUDIO, "FLAC"); }
void hevc_es_reader_c::identify() { id_result_container(); id_result_track(0, ID_RESULT_TRACK_VIDEO, codec_c::get_name(codec_c::type_e::V_MPEGH_P2, "HEVC"), "packetizer:mpegh_p2_es_video"); }
void ivf_reader_c::identify() { id_result_container(); id_result_track(0, ID_RESULT_TRACK_VIDEO, "VP8"); }
void tta_reader_c::identify() { id_result_container(); id_result_track(0, ID_RESULT_TRACK_AUDIO, codec_c::get_name(CT_A_TTA, "TTA")); }
void dirac_es_reader_c::identify() { id_result_container(); id_result_track(0, ID_RESULT_TRACK_VIDEO, codec_c::get_name(codec_c::type_e::V_DIRAC, "Dirac")); }
void dts_reader_c::identify() { id_result_container(); id_result_track(0, ID_RESULT_TRACK_AUDIO, "DTS"); }
void mp3_reader_c::identify() { id_result_container(); id_result_track(0, ID_RESULT_TRACK_AUDIO, (boost::format("MPEG-%1% layer %2%") % (m_mp3header.version == 1 ? "1" : m_mp3header.version == 2 ? "2" : "2.5") % m_mp3header.layer).str()); }
void vc1_es_reader_c::identify() { id_result_container(); id_result_track(0, ID_RESULT_TRACK_VIDEO, codec_c::get_name(codec_c::type_e::V_VC1, "VC1")); }
void mpeg_es_reader_c::identify() { id_result_container(); id_result_track(0, ID_RESULT_TRACK_VIDEO, (boost::format("MPEG %1%") % version).str()); }
void pgssup_reader_c::identify() { id_result_container(); id_result_track(0, ID_RESULT_TRACK_SUBTITLES, codec_c::get_name(CT_S_PGS, "PGS")); }
void tta_reader_c::identify() { id_result_container(); id_result_track(0, ID_RESULT_TRACK_AUDIO, "TTA"); }
void ac3_reader_c::identify() { id_result_container(); id_result_track(0, ID_RESULT_TRACK_AUDIO, codec_c::get_name(CT_A_AC3, "AC3")); }