int microdvd_reader_c::probe_file(mm_text_io_c *in, uint64_t) { try { boost::regex re("^\\{\\d+?\\}\\{\\d+?\\}.+$", boost::regex::perl); in->setFilePointer(0, seek_beginning); std::string line; while (1) { line = in->getline(); strip(line); if (!line.empty()) break; } if (boost::regex_match(line, re)) id_result_container_unsupported(in->get_file_name(), "MicroDVD"); } catch (mtx::mm_io::end_of_file_x &) { } return 0; }
int aac_adif_reader_c::probe_file(mm_io_c *in, uint64_t size) { try { if (4 > size) return 0; unsigned char buf[4]; in->setFilePointer(0, seek_beginning); if (in->read(buf, 4) != 4) return 0; in->setFilePointer(0, seek_beginning); if (FOURCC('A', 'D', 'I', 'F') == get_uint32_be(buf)) { id_result_container_unsupported(in->get_file_name(), Y("AAC with ADIF headers")); // Never reached: return 1; } return 0; } catch (...) { return 0; } }
int asf_reader_c::probe_file(mm_io_c *in, uint64_t size) { try { if (4 > size) return 0; unsigned char buf[4]; in->setFilePointer(0, seek_beginning); if (in->read(buf, 4) != 4) return 0; in->setFilePointer(0, seek_beginning); if (MAGIC_ASF_WMV == get_uint32_be(buf)) { id_result_container_unsupported(in->get_file_name(), "Windows Media (ASF/WMV)"); // Never reached: return 1; } return 0; } catch (...) { return 0; } }
int flv_reader_c::probe_file(mm_io_c *in, uint64_t size) { try { if (3 > size) return 0; unsigned char buf[3]; in->setFilePointer(0, seek_beginning); if (in->read(buf, 3) != 3) return 0; in->setFilePointer(0, seek_beginning); if (!memcmp(buf, "FLV", 3)) { id_result_container_unsupported(in->get_file_name(), "Macromedia Flash Video (FLV)"); // Never reached: return 1; } return 0; } catch (...) { return 0; } }
int dv_reader_c::probe_file(mm_io_c *in, uint64_t size) { try { if (5 > size) return 0; uint64_t probe_size = std::min(size, static_cast<uint64_t>(20 * 1024 * 1024)); memory_cptr mem = memory_c::alloc(probe_size); in->setFilePointer(0, seek_beginning); if (in->read(mem, probe_size) != probe_size) return 0; mm_mem_io_c mem_io(mem->get_buffer(), probe_size); uint32_t state = mem_io.read_uint32_be(); unsigned matches = 0; unsigned secondary_matches = 0; uint64_t marker_pos = 0; uint64_t i; for (i = 4; i < probe_size; ++i) { if ((state & 0xffffff7f) == 0x1f07003f) ++matches; // any section header, also with seq/chan num != 0, // should appear around every 12000 bytes, at least 10 per frame if ((state & 0xff07ff7f) == 0x1f07003f) ++secondary_matches; if ((0x003f0700 == state) || (0xff3f0700 == state)) marker_pos = i; if ((0xff3f0701 == state) && (80 == (i - marker_pos))) ++matches; state = (state << 8) | mem_io.read_uint8(); } if ( matches && ((probe_size / matches) < (1024 * 1024)) && ( (matches > 4) || ( (secondary_matches >= 10) && ((probe_size / secondary_matches) < 24000)))) { id_result_container_unsupported(in->get_file_name(), file_type_t::get_name(FILE_TYPE_DV)); // Never reached: return 1; } } catch (...) { } return 0; }
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 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); }
bool flac_reader_c::probe_file(mm_io_c *in, uint64_t size) { if (4 > size) return false; std::string data; try { in->setFilePointer(0, seek_beginning); if (in->read(data, 4) != 4) return false; in->setFilePointer(0, seek_beginning); if (data == "fLaC") id_result_container_unsupported(in->get_file_name(), "FLAC"); } catch (...) { } return false; }
bool cdxa_reader_c::probe_file(mm_io_c *in, uint64_t size) { try { if (12 > size) return false; unsigned char buffer[12]; in->setFilePointer(0, seek_beginning); if (in->read(buffer, 12) != 12) return false; if ((FOURCC('R', 'I', 'F', 'F') == get_uint32_be(&buffer[0])) && (FOURCC('C', 'D', 'X', 'A') == get_uint32_be(&buffer[8]))) { id_result_container_unsupported(in->get_file_name(), "RIFF CDXA"); // Never reached: return true; } } catch (...) { } return false; }