Beispiel #1
0
/**
 * Generate the pmt and pat from a streaming start message
 */
static int
pass_muxer_reconfigure(muxer_t* m, const struct streaming_start *ss)
{
  pass_muxer_t *pm = (pass_muxer_t*)m;
  const source_info_t *si = &ss->ss_si;

  if(si->si_type == S_MPEG_TS && ss->ss_pmt_pid) {
    pm->pm_pat = realloc(pm->pm_pat, 188);
    memset(pm->pm_pat, 0xff, 188);
    pm->pm_pat[0] = 0x47;
    pm->pm_pat[1] = 0x40;
    pm->pm_pat[2] = 0x00;
    pm->pm_pat[3] = 0x10;
    pm->pm_pat[4] = 0x00;
    if(psi_build_pat(NULL, pm->pm_pat+5, 183, ss->ss_pmt_pid) < 0) {
      pm->m_errors++;
      tvhlog(LOG_ERR, "pass", "%s: Unable to build pat", pm->pm_filename);
      return -1;
    }

    pm->pm_pmt = realloc(pm->pm_pmt, 188);
    memset(pm->pm_pmt, 0xff, 188);
    pm->pm_pmt[0] = 0x47;
    pm->pm_pmt[1] = 0x40 | (ss->ss_pmt_pid >> 8);
    pm->pm_pmt[2] = 0x00 | (ss->ss_pmt_pid >> 0);
    pm->pm_pmt[3] = 0x10;
    pm->pm_pmt[4] = 0x00;
    if(psi_build_pmt(ss, pm->pm_pmt+5, 183, pm->pm_pmt_version,
		     ss->ss_pcr_pid) < 0) {
      pm->m_errors++;
      tvhlog(LOG_ERR, "pass", "%s: Unable to build pmt", pm->pm_filename);
      return -1;
    }
    pm->pm_pmt_version++;
  }
Beispiel #2
0
/**
 * Init the passthrough muxer with streams
 */
static int
pass_muxer_init(muxer_t* m, const struct streaming_start *ss, const char *name)
{
  pass_muxer_t *pm = (pass_muxer_t*)m;

  if(pm->m_container == MC_MPEGTS) {
    
    memset(pm->pm_pat, 0xff, 188);
    pm->pm_pat[0] = 0x47;
    pm->pm_pat[1] = 0x40;
    pm->pm_pat[2] = 0x00;
    pm->pm_pat[3] = 0x10;
    pm->pm_pat[4] = 0x00;
    if(psi_build_pat(NULL, pm->pm_pat+5, 183, pm->pm_pmt_pid) < 0) {
      pm->m_errors++;
      tvhlog(LOG_ERR, "pass", "%s: Unable to build pat", pm->pm_filename);
      return -1;
    }

    memset(pm->pm_pmt, 0xff, 188);
    pm->pm_pmt[0] = 0x47;
    pm->pm_pmt[1] = 0x40 | (pm->pm_pmt_pid >> 8);
    pm->pm_pmt[2] = 0x00 | (pm->pm_pmt_pid >> 0);
    pm->pm_pmt[3] = 0x10;
    pm->pm_pmt[4] = 0x00;
    if(psi_build_pmt(ss, pm->pm_pmt+5, 183, pm->pm_pcr_pid) < 0) {
      pm->m_errors++;
      tvhlog(LOG_ERR, "pass", "%s: Unable to build pmt", pm->pm_filename);
      return -1;
    }
  }