void ac3_packetizer_c::adjust_header_values(ac3::frame_c const &ac3_header) { if (!m_first_packet) return; if (m_first_ac3_header.m_sample_rate != ac3_header.m_sample_rate) set_audio_sampling_freq((float)ac3_header.m_sample_rate); if (m_first_ac3_header.m_channels != ac3_header.m_channels) set_audio_channels(ac3_header.m_channels); if (ac3_header.is_eac3()) set_codec_id(MKV_A_EAC3); if ((m_samples_per_packet != ac3_header.m_samples) || (m_first_ac3_header.m_sample_rate != ac3_header.m_sample_rate)) { if (ac3_header.m_sample_rate) m_timecode_calculator.set_samples_per_second(ac3_header.m_sample_rate); if (ac3_header.m_samples) m_samples_per_packet = ac3_header.m_samples; m_packet_duration = m_timecode_calculator.get_duration(m_samples_per_packet).to_ns(); set_track_default_duration(m_packet_duration); } m_first_ac3_header = ac3_header; rerender_track_headers(); }
bool wav_ac3acm_demuxer_c::probe(mm_io_cptr &io) { io->save_pos(); int len = io->read(m_buf[m_cur_buf]->get_buffer(), AC3ACM_READ_SIZE); io->restore_pos(); ac3::parser_c parser; int pos = parser.find_consecutive_frames(m_buf[m_cur_buf]->get_buffer(), len, 4); if (-1 == pos) { m_swap_bytes = true; decode_buffer(len); pos = parser.find_consecutive_frames(m_buf[m_cur_buf]->get_buffer(), len, 4); } if (-1 == pos) return false; return m_ac3header.decode_header(m_buf[m_cur_buf]->get_buffer() + pos, len - pos); }
virtual std::string get_codec() { return m_ac3header.is_eac3() ? "EAC3" : "AC3"; };