コード例 #1
0
ファイル: demux.cpp プロジェクト: nerddtvg/xbmc-pvr-addons
bool Demux::get_stream_data(TSDemux::STREAM_PKT* pkt)
{
  TSDemux::ElementaryStream* es = m_AVContext->GetPIDStream();
  if (!es)
    return false;

  if (!es->GetStreamPacket(pkt))
    return false;

  if (pkt->duration > 180000)
  {
    pkt->duration = 0;
  }
  else if (pkt->pid == m_mainStreamPID)
  {
    // Fill duration map for main stream
    m_curTime += pkt->duration;
    if (m_curTime >= m_pinTime)
    {
      m_pinTime += POSMAP_PTS_INTERVAL;
      if (m_curTime > m_endTime)
      {
        AV_POSMAP_ITEM item;
        item.av_pts = pkt->pts;
        item.av_pos = m_AVContext->GetPosition();
        m_posmap.insert(std::make_pair(m_curTime, item));
        m_endTime = m_curTime;
      }
    }
    // Sync main DTS & PTS
    m_DTS = pkt->dts;
    m_PTS = pkt->pts;
  }
  return true;
}
コード例 #2
0
ファイル: demux.cpp プロジェクト: nerddtvg/xbmc-pvr-addons
bool Demux::update_pvr_stream(uint16_t pid)
{
  TSDemux::ElementaryStream* es = m_AVContext->GetStream(pid);
  if (!es)
    return false;

  const char* codec_name = es->GetStreamCodecName();
  xbmc_codec_t codec = CODEC->GetCodecByName(codec_name);
  if (g_bExtraDebug)
    XBMC->Log(LOG_DEBUG, LOGTAG "%s: update info PES %.4x %s", __FUNCTION__, es->pid, codec_name);

  CLockObject Lock(m_mutex);

  XbmcPvrStream* stream = m_streams.GetStreamById(es->pid);
  if (stream)
  {
    stream->iCodecId       = codec.codec_id;
    stream->iCodecType     = codec.codec_type;
    recode_language(es->stream_info.language, stream->strLanguage);
    stream->iIdentifier    = stream_identifier(es->stream_info.composition_id, es->stream_info.ancillary_id);
    stream->iFPSScale      = es->stream_info.fps_scale;
    stream->iFPSRate       = es->stream_info.fps_rate;
    stream->iHeight        = es->stream_info.height;
    stream->iWidth         = es->stream_info.width;
    stream->fAspect        = es->stream_info.aspect;
    stream->iChannels      = es->stream_info.channels;
    stream->iSampleRate    = es->stream_info.sample_rate;
    stream->iBlockAlign    = es->stream_info.block_align;
    stream->iBitRate       = es->stream_info.bit_rate;
    stream->iBitsPerSample = es->stream_info.bits_Per_sample;

    if (es->has_stream_info)
    {
      // Now stream is setup. Remove it from no setup set
      std::set<uint16_t>::iterator it = m_nosetup.find(es->pid);
      if (it != m_nosetup.end())
      {
        m_nosetup.erase(it);
        if (m_nosetup.empty())
          XBMC->Log(LOG_DEBUG, LOGTAG "%s: setup is completed", __FUNCTION__);
      }
    }
    return true;
  }
  return false;
}
コード例 #3
0
ファイル: avinfo.cpp プロジェクト: b-pass/pvr.mythtv
bool AVInfo::get_stream_data(TSDemux::STREAM_PKT* pkt)
{
  TSDemux::ElementaryStream* es = m_AVContext->GetPIDStream();
  if (!es)
    return false;

  if (!es->GetStreamPacket(pkt))
    return false;

  if (pkt->duration > 180000)
  {
    pkt->duration = 0;
  }
  else if (pkt->pid == m_mainStreamPID)
  {
    // Sync main DTS & PTS
    m_DTS = pkt->dts;
    m_PTS = pkt->pts;
  }
  return true;
}
コード例 #4
0
ファイル: avinfo.cpp プロジェクト: b-pass/pvr.mythtv
bool AVInfo::update_pvr_stream(uint16_t pid)
{
  TSDemux::ElementaryStream* es = m_AVContext->GetStream(pid);
  if (!es)
    return false;

  if (g_bExtraDebug)
    XBMC->Log(LOG_DEBUG, LOGTAG "%s: update info PES %.4x %s", __FUNCTION__, es->pid, es->GetStreamCodecName());

  if (es->has_stream_info)
  {
    // Now stream is setup. Remove it from no setup set
    std::set<uint16_t>::iterator it = m_nosetup.find(es->pid);
    if (it != m_nosetup.end())
    {
      m_nosetup.erase(it);
      if (m_nosetup.empty())
        XBMC->Log(LOG_DEBUG, LOGTAG "%s: setup is completed", __FUNCTION__);
    }
  }
  return true;
}