From 2035b7ad6424836b91fcda37bb95f70f31e9ab7f Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Thu, 20 Dec 2012 08:25:02 +0100 Subject: [PATCH] Fixes for next firmware tree --- videoomx.cc | 71 ++++++++++++++++++++++++++++------------------------- videoomx.h | 4 +-- 2 files changed, 40 insertions(+), 35 deletions(-) diff --git a/videoomx.cc b/videoomx.cc index 449437f..f3b3002 100644 --- a/videoomx.cc +++ b/videoomx.cc @@ -395,7 +395,7 @@ void VideoOMX::selectVideoMode(int interlaced) if (hdmi) { - TV_SUPPORTED_MODE_T all_supp_modes[TV_MAX_SUPPORTED_MODES]; + TV_SUPPORTED_MODE_T all_supp_modes[200]; HDMI_RES_GROUP_T pref_group; TV_SUPPORTED_MODE_T *mymode=NULL; TV_SUPPORTED_MODE_T *mymode_second_best=NULL; @@ -403,12 +403,12 @@ void VideoOMX::selectVideoMode(int interlaced) uint32_t pref_mode; HDMI_RES_GROUP_T group=HDMI_RES_GROUP_CEA; int all_my_modes=vc_tv_hdmi_get_supported_modes(HDMI_RES_GROUP_CEA, - all_supp_modes,TV_MAX_SUPPORTED_MODES, + all_supp_modes,200, &pref_group,&pref_mode); if (all_my_modes<=0) { group=HDMI_RES_GROUP_DMT; all_my_modes=vc_tv_hdmi_get_supported_modes(HDMI_RES_GROUP_DMT, - all_supp_modes,TV_MAX_SUPPORTED_MODES, + all_supp_modes,200, &pref_group,&pref_mode); Log::getInstance()->log("Video", Log::NOTICE, "No CEA fall back to DMT modes "); } @@ -1002,7 +1002,7 @@ int VideoOMX::AllocateCodecsOMX() Demuxer* demux=Demuxer::getInstance(); dodeint=false; - deint_first_frame=false; + first_frame=true; Log::getInstance()->log("Video", Log::NOTICE, "Allocate Codecs OMX"); //Clock, move later to audio including events @@ -1010,7 +1010,7 @@ int VideoOMX::AllocateCodecsOMX() Log::getInstance()->log("Video", Log::NOTICE, "VideoType %d x %d i: %d", demux->getHorizontalSize(),demux->getVerticalSize(),demux->getInterlaced()); if (deinterlace!=0 && /*(demux->getHorizontalSize()<=720 ) &&*/ demux->getInterlaced()) { //only deinterlace SD material dodeint=true; - deint_first_frame=true; + Log::getInstance()->log("Video", Log::NOTICE, "Deinterlacing activated %d",deinterlace); @@ -2392,7 +2392,7 @@ void VideoOMX::ResetTimeOffsets() { } -void VideoOMX::DeinterlaceFix() +void VideoOMX::FirstFrameFix() { int oldcancelstate; int oldcanceltype; @@ -2419,42 +2419,47 @@ void VideoOMX::DeinterlaceFix() && port_def_type.format.video.nFrameHeight == demux->getVerticalSize()){ Log::getInstance()->log("Video", Log::DEBUG, "Deinit first frame fix"); - deint_first_frame=false; + first_frame=false; WaitForEvent(omx_vid_dec,OMX_EventPortSettingsChanged); DisablePort(omx_vid_dec,omx_codec_output_port,false); DisablePort(omx_vid_sched,omx_shed_input_port,false); - DisablePort(omx_vid_deint,omx_deint_output_port,false); - DisablePort(omx_vid_deint,omx_deint_input_port,false); + if (dodeint) { + DisablePort(omx_vid_deint,omx_deint_output_port,false); + DisablePort(omx_vid_deint,omx_deint_input_port,false); - port_def_type.nPortIndex=omx_deint_input_port; - error = OMX_SetParameter(omx_vid_deint, OMX_IndexParamPortDefinition, - &port_def_type); - if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "Set OMX_IndexParamPortDefinition1 failed %x", error); - clock_mutex.Unlock(); - pthread_setcancelstate(oldcancelstate, NULL); - pthread_setcanceltype(oldcanceltype, NULL); - return; - } - port_def_type.nPortIndex=omx_deint_output_port; - error = OMX_SetParameter(omx_vid_deint, OMX_IndexParamPortDefinition, - &port_def_type); - if (error != OMX_ErrorNone) { - Log::getInstance()->log("Video", Log::DEBUG, - "Set OMX_IndexParamPortDefinition2 failed %x", error); - clock_mutex.Unlock(); - pthread_setcancelstate(oldcancelstate, NULL); - pthread_setcanceltype(oldcanceltype, NULL); - return; + port_def_type.nPortIndex=omx_deint_input_port; + error = OMX_SetParameter(omx_vid_deint, OMX_IndexParamPortDefinition, + &port_def_type); + if (error != OMX_ErrorNone) { + Log::getInstance()->log("Video", Log::DEBUG, + "Set OMX_IndexParamPortDefinition1 failed %x", error); + clock_mutex.Unlock(); + pthread_setcancelstate(oldcancelstate, NULL); + pthread_setcanceltype(oldcanceltype, NULL); + return; + } + + port_def_type.nPortIndex=omx_deint_output_port; + error = OMX_SetParameter(omx_vid_deint, OMX_IndexParamPortDefinition, + &port_def_type); + if (error != OMX_ErrorNone) { + Log::getInstance()->log("Video", Log::DEBUG, + "Set OMX_IndexParamPortDefinition2 failed %x", error); + clock_mutex.Unlock(); + pthread_setcancelstate(oldcancelstate, NULL); + pthread_setcanceltype(oldcanceltype, NULL); + return; + } } EnablePort(omx_vid_dec,omx_codec_output_port,false); - EnablePort(omx_vid_deint,omx_deint_input_port,false); - EnablePort(omx_vid_deint,omx_deint_output_port,false); + if (dodeint) { + EnablePort(omx_vid_deint,omx_deint_input_port,false); + EnablePort(omx_vid_deint,omx_deint_output_port,false); + } EnablePort(omx_vid_sched,omx_shed_input_port,false); } clock_mutex.Unlock(); @@ -2474,7 +2479,7 @@ void VideoOMX::PutBufferToPres(OMX_BUFFERHEADERTYPE* buffer) Log::getInstance()->log("Video", Log::DEBUG, "OMX_EmptyThisBuffer failed %x", error); } - if (deint_first_frame && dodeint) DeinterlaceFix(); + if (first_frame) FirstFrameFix(); } diff --git a/videoomx.h b/videoomx.h index 85c0a5b..7974e4a 100644 --- a/videoomx.h +++ b/videoomx.h @@ -233,8 +233,8 @@ class VideoOMX : public Video OMX_HANDLETYPE omx_clock; int clock_references; bool dodeint; //deinterlacer was activated in omx filtergraph - bool deint_first_frame; //handle frame change - void DeinterlaceFix(); + bool first_frame; //handle frame change + void FirstFrameFix(); OMX_U32 omx_codec_input_port; -- 2.39.5