Example #1
0
static void PMTCallBack(void *p_cb_data, dvbpsi_pmt_t* p_pmt)
{
  dvbpsi_pmt_es_t* p_es = p_pmt->p_first_es;
  CDVDDemuxSMD* demux = (CDVDDemuxSMD*) p_cb_data;

  CLog::Log(LOGINFO, "New active PMT");
  CLog::Log(LOGINFO, "  program_number : %d", p_pmt->i_program_number);
  CLog::Log(LOGINFO, "  version_number : %d", p_pmt->i_version);
  CLog::Log(LOGINFO, "  PCR_PID        : 0x%x (%d)", p_pmt->i_pcr_pid, p_pmt->i_pcr_pid);

  demux->SetPcrPid(p_pmt->i_pcr_pid);

  CLog::Log(LOGINFO, "    | type @ elementary_PID\n");

  while(p_es)
  {
    CLog::Log(LOGINFO, "    | 0x%02x  @ 0x%x (%d)\n", p_es->i_type, p_es->i_pid, p_es->i_pid);

    if (p_es->i_pid == demux->GetVideoPid())
    {
      switch (p_es->i_type)
      {
      case 0x02: demux->SetUpVideo(CODEC_ID_MPEG2VIDEO); break;
      case 0x1B: demux->SetUpVideo(CODEC_ID_H264); break;
      default:   CLog::Log(LOGERROR, "PMTCallBack: Unknown video stream type: %d", p_es->i_type); break;
      }
    }

    if (p_es->i_pid == demux->GetAudioPid())
     {
       switch (p_es->i_type)
       {
       case 0x81: demux->SetUpAudio(CODEC_ID_AC3); break;
       case 0x11: demux->SetUpAudio(CODEC_ID_AAC_LATM); break;
       default:   CLog::Log(LOGERROR, "PMTCallBack: Unknown audio stream type: %d", p_es->i_type); break;
       }
     }

    p_es = p_es->p_next;
  }


  const std::vector<DvbTunerPtr>& tuners = DVBManager::GetInstance().GetTuners();
  tuners[0]->AddPidFilter(demux->GetVideoPid(), DvbTuner::DVB_FILTER_VIDEO);
  tuners[0]->AddPidFilter(demux->GetAudioPid(), DvbTuner::DVB_FILTER_AUDIO);

  if (tuners[0]->GetTunerType() == DvbTuner::TUNER_TYPE_DVBT)
    tuners[0]->AddPidFilter(EIT_PID, DvbTuner::DVB_FILTER_OTHER);

  tuners[0]->RemovePidFilter(demux->GetPmtPid());

  demux->SetState(CDVDDemuxSMD::DEMUX_STATE_FOUND_PMT);

  dvbpsi_DeletePMT(p_pmt);
  demux->dvbpsiPMT = NULL;
}
Example #2
0
/*****************************************************************************
 * PMTCallback
 *****************************************************************************/
static void PMTCallback( void *_unused, dvbpsi_pmt_t *p_pmt )
{
    if ( p_pmt->i_program_number != i_program )
    {
        dvbpsi_DeletePMT( p_pmt );
        return;
    }

    printf( "%u\n", p_pmt->i_pcr_pid );
    close( i_fd );
    exit(EXIT_SUCCESS);
}