本文整理汇总了C++中OMXReader::SeekTime方法的典型用法代码示例。如果您正苦于以下问题:C++ OMXReader::SeekTime方法的具体用法?C++ OMXReader::SeekTime怎么用?C++ OMXReader::SeekTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OMXReader
的用法示例。
在下文中一共展示了OMXReader::SeekTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
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(¤t_tv_state, 0, sizeof(TV_DISPLAY_STATE_T));
m_BcmHost.vc_tv_get_display_state(¤t_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;
{
std::vector<Subtitle> external_subtitles;
if(m_has_external_subtitles &&
!ReadSrt(m_external_subtitles_path, external_subtitles))
{
puts("Unable to read the subtitle file.");
goto do_exit;
}
if(m_has_subtitle &&
!m_player_subtitles.Open(m_omx_reader.SubtitleStreamCount(),
std::move(external_subtitles),
m_font_path,
m_font_size,
m_centered,
m_subtitle_lines,
m_av_clock))
goto do_exit;
}
if(m_has_subtitle)
{
if(!m_has_external_subtitles)
{
if(m_subtitle_index != -1)
{
示例2: main
//.........这里部分代码省略.........
case '-':
m_player_audio.SetCurrentVolume(m_player_audio.GetCurrentVolume() - 50);
printf("Current Volume: %.2fdB\n", m_player_audio.GetCurrentVolume() / 100.0f);
break;
case '+':
m_player_audio.SetCurrentVolume(m_player_audio.GetCurrentVolume() + 50);
printf("Current Volume: %.2fdB\n", m_player_audio.GetCurrentVolume() / 100.0f);
break;
default:
break;
}
if(m_Pause)
{
OMXClock::OMXSleep(2);
continue;
}
if(m_incr != 0 && !m_bMpeg)
{
int seek_flags = 0;
double seek_pos = 0;
double pts = 0;
pts = m_av_clock->GetPTS();
seek_pos = (pts / DVD_TIME_BASE) + m_incr;
seek_flags = m_incr < 0.0f ? AVSEEK_FLAG_BACKWARD : 0;
seek_pos *= 1000.0f;
m_incr = 0;
if(m_omx_reader.SeekTime(seek_pos, seek_flags, &startpts))
FlushStreams(startpts);
m_player_video.Close();
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;
}
/* when the audio buffer runs under 0.1 seconds we buffer up */
if(m_has_audio)
{
if(m_player_audio.GetDelay() < 0.1f && !m_buffer_empty)
{
if(!m_av_clock->OMXIsPaused())
{
m_av_clock->OMXPause();
//printf("buffering start\n");
m_buffer_empty = true;
clock_gettime(CLOCK_REALTIME, &starttime);
}
}
if(m_player_audio.GetDelay() > (AUDIO_BUFFER_SECONDS * 0.75f) && m_buffer_empty)
{
if(m_av_clock->OMXIsPaused())
{
m_av_clock->OMXResume();
//printf("buffering end\n");
m_buffer_empty = false;
}
}
if(m_buffer_empty)
{
示例3: startVideo
//.........这里部分代码省略.........
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(¤t_tv_state, 0, sizeof(TV_GET_STATE_RESP_T));
m_BcmHost.vc_tv_get_state(¤t_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
goto do_exit;
#endif
return 0;
LOG_VERBOSE(LOG_TAG, "Opening subtitles using OMX...");
if(m_has_subtitle &&
!m_player_subtitles->Open(m_font_path, m_font_size, m_centered, m_av_clock))
#if 0
goto do_exit;
#endif
return 0;
// 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_show_subtitle && m_has_subtitle && m_subtitle_index <= (m_omx_reader.SubtitleStreamCount() - 1))
m_omx_reader.SetActiveStream(OMXSTREAM_SUBTITLE, m_subtitle_index);