Beispiel #1
0
bool
wav_ac3wav_demuxer_c::probe(mm_io_cptr &io) {
  io->save_pos();
  int len = io->read(m_buf[m_cur_buf]->get_buffer(), AC3WAV_BLOCK_SIZE);
  io->restore_pos();

  if (decode_buffer(len) > 0)
    return true;

  m_swap_bytes = true;
  return decode_buffer(len) > 0;
}
bool
wav_dts_demuxer_c::probe(mm_io_cptr &io) {
  io->save_pos();
  auto read_buf = memory_c::alloc(DTS_READ_SIZE);
  read_buf->set_size(io->read(read_buf->get_buffer(), DTS_READ_SIZE));
  io->restore_pos();

  if (!m_parser.detect(*read_buf, 5))
    return false;

  m_codec.set_specialization(m_parser.get_first_header().get_codec_specialization());

  return true;
}
generic_reader_c::generic_reader_c(const track_info_c &ti,
                                   const mm_io_cptr &in)
  : m_ti{ti}
  , m_in{in}
  , m_size{static_cast<uint64_t>(in->get_size())}
  , m_ptzr_first_packet{}
  , m_max_timecode_seen{}
  , m_appending{}
  , m_num_video_tracks{}
  , m_num_audio_tracks{}
  , m_num_subtitle_tracks{}
  , m_reference_timecode_tolerance{}
{
  add_all_requested_track_ids(*this, m_ti.m_atracks.m_items);
  add_all_requested_track_ids(*this, m_ti.m_vtracks.m_items);
  add_all_requested_track_ids(*this, m_ti.m_stracks.m_items);
  add_all_requested_track_ids(*this, m_ti.m_btracks.m_items);
  add_all_requested_track_ids(*this, m_ti.m_track_tags.m_items);
  add_all_requested_track_ids(*this, m_ti.m_all_fourccs);
  add_all_requested_track_ids(*this, m_ti.m_display_properties);
  add_all_requested_track_ids(*this, m_ti.m_timecode_syncs);
  add_all_requested_track_ids(*this, m_ti.m_cue_creations);
  add_all_requested_track_ids(*this, m_ti.m_default_track_flags);
  add_all_requested_track_ids(*this, m_ti.m_fix_bitstream_frame_rate_flags);
  add_all_requested_track_ids(*this, m_ti.m_languages);
  add_all_requested_track_ids(*this, m_ti.m_sub_charsets);
  add_all_requested_track_ids(*this, m_ti.m_all_tags);
  add_all_requested_track_ids(*this, m_ti.m_all_aac_is_sbr);
  add_all_requested_track_ids(*this, m_ti.m_compression_list);
  add_all_requested_track_ids(*this, m_ti.m_track_names);
  add_all_requested_track_ids(*this, m_ti.m_all_ext_timecodes);
  add_all_requested_track_ids(*this, m_ti.m_pixel_crop_list);
  add_all_requested_track_ids(*this, m_ti.m_reduce_to_core);
}
Beispiel #4
0
bool
wav_dts_demuxer_c::probe(mm_io_cptr &io) {
  io->save_pos();
  int len = io->read(m_buf[m_cur_buf]->get_buffer(), DTS_READ_SIZE);
  io->restore_pos();

  if (detect_dts(m_buf[m_cur_buf]->get_buffer(), len, m_pack_14_16, m_swap_bytes)) {
    len     = decode_buffer(len);
    int pos = find_consecutive_dts_headers(m_buf[m_cur_buf]->get_buffer(), len, 5);
    if (0 <= pos) {
      if (0 > find_dts_header(m_buf[m_cur_buf]->get_buffer() + pos, len - pos, &m_dtsheader))
        return false;

      mxverb(3, boost::format("DTSinWAV: 14->16 %1% swap %2%\n") % m_pack_14_16 % m_swap_bytes);
      return true;
    }
  }

  return false;
}
Beispiel #5
0
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);
}
Beispiel #6
0
size_t
fourcc_c::write(mm_io_cptr const &io,
                fourcc_c::byte_order_t byte_order) {
  return write(io.get(), byte_order);
}