当前位置: 首页>>代码示例>>C++>>正文


C++ OMXReader::SetActiveStream方法代码示例

本文整理汇总了C++中OMXReader::SetActiveStream方法的典型用法代码示例。如果您正苦于以下问题:C++ OMXReader::SetActiveStream方法的具体用法?C++ OMXReader::SetActiveStream怎么用?C++ OMXReader::SetActiveStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OMXReader的用法示例。


在下文中一共展示了OMXReader::SetActiveStream方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........

  if(m_dump_format)
    goto do_exit;

  m_bMpeg         = m_omx_reader.IsMpegVideo();
  m_has_video     = m_omx_reader.VideoStreamCount();
  m_has_audio     = m_omx_reader.AudioStreamCount();
  m_has_subtitle  = m_has_external_subtitles ||
                    m_omx_reader.SubtitleStreamCount();

  if(m_filename.find("3DSBS") != string::npos || m_filename.find("HSBS") != string::npos)
    m_3d = CONF_FLAGS_FORMAT_SBS;
  else if(m_filename.find("3DTAB") != string::npos || m_filename.find("HTAB") != string::npos)
    m_3d = CONF_FLAGS_FORMAT_TB;

  // 3d modes don't work without switch hdmi mode
  if (m_3d != CONF_FLAGS_FORMAT_NONE)
    m_refresh = true;

  // you really don't want want to match refresh rate without hdmi clock sync
  if (m_refresh && !m_no_hdmi_clock_sync)
    m_hdmi_clock_sync = true;

  if(!m_av_clock->OMXInitialize(m_has_video, m_has_audio))
    goto do_exit;

  if(m_hdmi_clock_sync && !m_av_clock->HDMIClockSync())
      goto do_exit;

  m_omx_reader.GetHints(OMXSTREAM_AUDIO, m_hints_audio);
  m_omx_reader.GetHints(OMXSTREAM_VIDEO, m_hints_video);

  if(m_audio_index_use != -1)
    m_omx_reader.SetActiveStream(OMXSTREAM_AUDIO, m_audio_index_use);
          
  if(m_has_video && m_refresh)
  {
    memset(&tv_state, 0, sizeof(TV_DISPLAY_STATE_T));
    m_BcmHost.vc_tv_get_display_state(&tv_state);

    SetVideoMode(m_hints_video.width, m_hints_video.height, m_hints_video.fpsrate, m_hints_video.fpsscale, m_3d);
  }
  // get display aspect
  TV_DISPLAY_STATE_T current_tv_state;
  memset(&current_tv_state, 0, sizeof(TV_DISPLAY_STATE_T));
  m_BcmHost.vc_tv_get_display_state(&current_tv_state);
  if(current_tv_state.state & ( VC_HDMI_HDMI | VC_HDMI_DVI )) {
    //HDMI or DVI on
    m_display_aspect = get_display_aspect_ratio((HDMI_ASPECT_T)current_tv_state.display.hdmi.aspect_ratio);
  } else {
    //composite on
    m_display_aspect = get_display_aspect_ratio((SDTV_ASPECT_T)current_tv_state.display.sdtv.display_options.aspect);
  }
  m_display_aspect *= (float)current_tv_state.display.hdmi.height/(float)current_tv_state.display.hdmi.width;

  // seek on start
  if (m_seek_pos !=0 && m_omx_reader.CanSeek()) {
        printf("Seeking start of video to %i seconds\n", m_seek_pos);
        m_omx_reader.SeekTime(m_seek_pos * 1000.0f, 0, &startpts);  // from seconds to DVD_TIME_BASE
  }
  
  if(m_has_video && !m_player_video.Open(m_hints_video, m_av_clock, DestRect, m_Deinterlace,  m_bMpeg,
                                         m_hdmi_clock_sync, m_thread_player, m_display_aspect))
    goto do_exit;

  {
开发者ID:flavioalsoares,项目名称:omxplayer,代码行数:67,代码来源:omxplayer.cpp

示例2: main


//.........这里部分代码省略.........

  m_filename = argv[optind];

  CLog::Init("./");

  g_RBP.Initialize();
  g_OMX.Initialize();

  m_av_clock = new OMXClock();

  m_thread_player = true;

  if(!m_omx_reader.Open(m_filename.c_str(), m_dump_format))
    goto do_exit;

  if(m_dump_format)
    goto do_exit;

  m_bMpeg         = m_omx_reader.IsMpegVideo();
  m_has_video     = m_omx_reader.VideoStreamCount();
  m_has_audio     = m_omx_reader.AudioStreamCount();
  m_has_subtitle  = m_omx_reader.SubtitleStreamCount();

  if(!m_av_clock->OMXInitialize(m_has_video, m_has_audio))
    goto do_exit;

  if(m_hdmi_clock_sync && !m_av_clock->HDMIClockSync())
      goto do_exit;

  m_omx_reader.GetHints(OMXSTREAM_AUDIO, m_hints_audio);
  m_omx_reader.GetHints(OMXSTREAM_VIDEO, m_hints_video);

  if(m_audio_index_use != -1)
    m_omx_reader.SetActiveStream(OMXSTREAM_AUDIO, m_audio_index_use);
          
  if(m_has_video && !m_player_video.Open(m_hints_video, m_av_clock, m_Deinterlace,  m_bMpeg, 
                                         m_hdmi_clock_sync, m_thread_player))
    goto do_exit;

  if(m_has_video && m_refresh)
  {
    memset(&tv_state, 0, sizeof(TV_GET_STATE_RESP_T));
    m_BcmHost.vc_tv_get_state(&tv_state);

    if(m_filename.find("3DSBS") != string::npos)
      m_3d = true;

    SetVideoMode(m_hints_video.width, m_hints_video.height, m_player_video.GetFPS(), m_3d);

  }

  // This is an upper bound check on the subtitle limits. When we pulled the subtitle
  // index from the user we check to make sure that the value is larger than zero, but
  // we couldn't know without scanning the file if it was too high. If this is the case
  // then we replace the subtitle index with the maximum value possible.
  if(m_has_subtitle && m_subtitle_index > (m_omx_reader.SubtitleStreamCount() - 1))
  {
    m_subtitle_index = m_omx_reader.SubtitleStreamCount() - 1;
  }

  // Here we actually enable the subtitle streams if we have one available.
  if (m_has_subtitle && m_subtitle_index <= (m_omx_reader.SubtitleStreamCount() - 1))
  {
    m_omx_reader.SetActiveStream(OMXSTREAM_SUBTITLE, m_subtitle_index);
    m_show_subtitle = true;
  }
开发者ID:Bengt,项目名称:omxplayer,代码行数:67,代码来源:omxplayer.cpp

示例3: startVideo


//.........这里部分代码省略.........
    if(!m_omx_reader.Open(m_filename.c_str(), m_dump_format))
#if 0
        goto do_exit;
#endif
    return 0;

#ifdef ENABLE_ORIGINAL
    if(m_dump_format)
        goto do_exit;
#endif

    m_bMpeg         = m_omx_reader.IsMpegVideo();
    m_has_video     = m_omx_reader.VideoStreamCount();
    m_has_audio     = m_omx_reader.AudioStreamCount();
    m_has_subtitle  = m_omx_reader.SubtitleStreamCount();

    LOG_VERBOSE(LOG_TAG, "Initializing OMX clock...");
    if(!m_av_clock->OMXInitialize(m_has_video, m_has_audio))
#if 0
        goto do_exit;
#endif
    return 0;

    if(m_hdmi_clock_sync && !m_av_clock->HDMIClockSync())
#if 0
        goto do_exit;
#endif
    return 0;

    m_omx_reader.GetHints(OMXSTREAM_AUDIO, m_hints_audio);
    m_omx_reader.GetHints(OMXSTREAM_VIDEO, m_hints_video);

    if(m_audio_index_use != -1)
        m_omx_reader.SetActiveStream(OMXSTREAM_AUDIO, m_audio_index_use);

    if(m_has_video && m_refresh)
    {
        memset(&tv_state, 0, sizeof(TV_GET_STATE_RESP_T));
        m_BcmHost.vc_tv_get_state(&tv_state);

        if(m_filename.find("3DSBS") != string::npos)
            m_3d = true;

        SetVideoMode(m_hints_video.width, m_hints_video.height, m_hints_video.fpsrate, m_hints_video.fpsscale, m_3d);

    }

    // get display aspect
    TV_GET_STATE_RESP_T current_tv_state;
    memset(&current_tv_state, 0, sizeof(TV_GET_STATE_RESP_T));
    m_BcmHost.vc_tv_get_state(&current_tv_state);

    if(current_tv_state.width && current_tv_state.height)
        m_display_aspect = (float)current_tv_state.width / (float)current_tv_state.height;

    // seek on start
    if (m_seek_pos !=0 && m_omx_reader.CanSeek()) {
        printf("Seeking start of video to %i seconds\n", m_seek_pos);
        m_omx_reader.SeekTime(m_seek_pos * 1000.0f, 0, &startpts);  // from seconds to DVD_TIME_BASE
    }

    LOG_VERBOSE(LOG_TAG, "Opening video using OMX...");
    uint textureId;
    if(m_has_video && !m_player_video->Open(m_hints_video, m_av_clock, textureId, m_Deinterlace,  m_bMpeg,
                                            m_hdmi_clock_sync, m_thread_player, m_display_aspect))
#if 0
开发者ID:kirgene,项目名称:pi,代码行数:67,代码来源:omxplayer.cpp


注:本文中的OMXReader::SetActiveStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。