本文整理汇总了C++中OMXReader::Read方法的典型用法代码示例。如果您正苦于以下问题:C++ OMXReader::Read方法的具体用法?C++ OMXReader::Read怎么用?C++ OMXReader::Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OMXReader
的用法示例。
在下文中一共展示了OMXReader::Read方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
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)
{
m_player_subtitles.SetActiveStream(
std::min(m_subtitle_index, m_omx_reader.SubtitleStreamCount()-1));
}
m_player_subtitles.SetUseExternalSubtitles(false);
}
if(m_subtitle_index == -1 && !m_has_external_subtitles)
m_player_subtitles.SetVisible(false);
}
示例2: main
//.........这里部分代码省略.........
{
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)
{
clock_gettime(CLOCK_REALTIME, &endtime);
if((endtime.tv_sec - starttime.tv_sec) > 1)
{
m_buffer_empty = false;
m_av_clock->OMXResume();
//printf("buffering timed out\n");
}
}
}
if(!m_omx_pkt)
m_omx_pkt = m_omx_reader.Read();
if(m_has_video && m_omx_pkt && m_omx_reader.IsActive(OMXSTREAM_VIDEO, m_omx_pkt->stream_index))
{
if(m_player_video.AddPacket(m_omx_pkt))
m_omx_pkt = NULL;
else
OMXClock::OMXSleep(10);
if(m_tv_show_info)
{
char response[80];
vc_gencmd(response, sizeof response, "render_bar 4 video_fifo %d %d %d %d",
m_player_video.GetDecoderBufferSize()-m_player_video.GetDecoderFreeSpace(),
0 , 0, m_player_video.GetDecoderBufferSize());
vc_gencmd(response, sizeof response, "render_bar 5 audio_fifo %d %d %d %d",
(int)(100.0*m_player_audio.GetDelay()), 0, 0, 100*AUDIO_BUFFER_SECONDS);
}
}
else if(m_has_audio && m_omx_pkt && m_omx_pkt->codec_type == AVMEDIA_TYPE_AUDIO)
{
if(m_player_audio.AddPacket(m_omx_pkt))
m_omx_pkt = NULL;
else
OMXClock::OMXSleep(10);
}
else if(m_omx_pkt && m_omx_reader.IsActive(OMXSTREAM_SUBTITLE, m_omx_pkt->stream_index))
{
if(m_omx_pkt->size && (m_omx_pkt->hints.codec == CODEC_ID_TEXT ||
m_omx_pkt->hints.codec == CODEC_ID_SSA))
{
if(m_player_video.AddPacket(m_omx_pkt))
m_omx_pkt = NULL;
示例3: startVideo
//int main(int argc, char *argv[])
int startVideo(OMX_TextureProvider* provider, OMX_VideoSurfaceElement* element)
{
#ifdef ENABLE_ORIGINAL
signal(SIGINT, sig_handler);
if (isatty(STDIN_FILENO))
{
struct termios new_termios;
tcgetattr(STDIN_FILENO, &orig_termios);
new_termios = orig_termios;
new_termios.c_lflag &= ~(ICANON | ECHO | ECHOCTL | ECHONL);
new_termios.c_cflag |= HUPCL;
new_termios.c_cc[VMIN] = 0;
tcsetattr(STDIN_FILENO, TCSANOW, &new_termios);
atexit(restore_termios);
}
else
{
orig_fl = fcntl(STDIN_FILENO, F_GETFL);
fcntl(STDIN_FILENO, F_SETFL, orig_fl | O_NONBLOCK);
atexit(restore_fl);
}
#endif
LOG_VERBOSE(LOG_TAG, "Starting video...");
std::string last_sub = "";
std::string m_filename;
double m_incr = 0;
CRBP g_RBP;
COMXCore g_OMX;
bool m_stats = false;
bool m_dump_format = false;
bool m_3d = false;
bool m_refresh = false;
double startpts = 0;
m_player_video = new OMXPlayerVideo(provider);
m_player_audio = new OMXPlayerAudio;
m_player_subtitles = new OMXPlayerSubtitles;
QObject::connect(m_player_video, SIGNAL(textureReady(uint)), element, SLOT(onTextureChanged(uint)));
TV_GET_STATE_RESP_T tv_state;
const int boost_on_downmix_opt = 0x200;
#ifdef ENABLE_ORIGINAL
struct option longopts[] = {
{ "info", no_argument, NULL, 'i' },
{ "help", no_argument, NULL, 'h' },
{ "aidx", required_argument, NULL, 'n' },
{ "adev", required_argument, NULL, 'o' },
{ "stats", no_argument, NULL, 's' },
{ "passthrough", no_argument, NULL, 'p' },
{ "deinterlace", no_argument, NULL, 'd' },
{ "hw", no_argument, NULL, 'w' },
{ "3d", no_argument, NULL, '3' },
{ "hdmiclocksync", no_argument, NULL, 'y' },
{ "refresh", no_argument, NULL, 'r' },
{ "sid", required_argument, NULL, 't' },
{ "pos", required_argument, NULL, 'l' },
{ "font", required_argument, NULL, 0x100 },
{ "font-size", required_argument, NULL, 0x101 },
{ "align", required_argument, NULL, 0x102 },
{ "boost-on-downmix", no_argument, NULL, boost_on_downmix_opt },
{ 0, 0, 0, 0 }
};
int c;
while ((c = getopt_long(argc, argv, "wihnl:o:cslpd3yt:r", longopts, NULL)) != -1)
{
switch (c)
{
case 'r':
m_refresh = true;
break;
case 'y':
m_hdmi_clock_sync = true;
break;
case '3':
m_3d = true;
break;
case 'd':
m_Deinterlace = true;
break;
case 'w':
m_use_hw_audio = true;
break;
case 'p':
m_passthrough = true;
break;
case 's':
m_stats = true;
break;
case 'o':
deviceString = optarg;
//.........这里部分代码省略.........