本文整理汇总了C++中DllBcmHost::vc_tv_hdmi_power_on_explicit方法的典型用法代码示例。如果您正苦于以下问题:C++ DllBcmHost::vc_tv_hdmi_power_on_explicit方法的具体用法?C++ DllBcmHost::vc_tv_hdmi_power_on_explicit怎么用?C++ DllBcmHost::vc_tv_hdmi_power_on_explicit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DllBcmHost
的用法示例。
在下文中一共展示了DllBcmHost::vc_tv_hdmi_power_on_explicit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetVideoMode
void SetVideoMode(int width, int height, float fps, bool is3d)
{
int32_t num_modes;
HDMI_RES_GROUP_T prefer_group;
int i = 0;
uint32_t prefer_mode;
#define TV_MAX_SUPPORTED_MODES 60
TV_SUPPORTED_MODE_T supported_modes[TV_MAX_SUPPORTED_MODES];
uint32_t group = HDMI_RES_GROUP_CEA;
if(is3d)
group = HDMI_RES_GROUP_CEA_3D;
else
group = HDMI_RES_GROUP_CEA;
num_modes = m_BcmHost.vc_tv_hdmi_get_supported_modes((HDMI_RES_GROUP_T)group,
supported_modes, TV_MAX_SUPPORTED_MODES,
&prefer_group, &prefer_mode);
TV_SUPPORTED_MODE_T *tv_found = NULL;
int ifps = (int)(fps+0.5f);
//printf("num_modes %d, %d, %d\n", num_modes, prefer_group, prefer_mode);
if (num_modes > 0 && prefer_group != HDMI_RES_GROUP_INVALID)
{
TV_SUPPORTED_MODE_T *tv = supported_modes;
uint32_t best_score = 1<<30;
uint32_t isNative = tv->native ? 1:0;
uint32_t w = tv->width;
uint32_t h = tv->height;
uint32_t r = tv->frame_rate;
uint32_t match_flag = HDMI_MODE_MATCH_FRAMERATE | HDMI_MODE_MATCH_RESOLUTION;
uint32_t scan_mode = 0;
uint32_t score = 0;
for (i=0; i<num_modes; i++, tv++)
{
isNative = tv->native ? 1:0;
w = tv->width;
h = tv->height;
r = tv->frame_rate;
//printf("mode %dx%[email protected]%d %s%s:%x\n", tv->width, tv->height,
// tv->frame_rate, tv->native?"N":"", tv->scan_mode?"I":"", tv->code);
/* Check if frame rate match (equal or exact multiple) */
if(ifps)
{
if(r == ((r/ifps)*ifps))
score += abs((int)(r/ifps-1)) * (1<<8); // prefer exact framerate to multiples. Ideal is 1
else
score += ((match_flag & HDMI_MODE_MATCH_FRAMERATE) ? (1<<28):(1<<12))/r; // bad - but prefer higher framerate
}
/* Check size too, only choose, bigger resolutions */
if(width && height)
{
/* cost of too small a resolution is high */
score += max((int)(width - w), 0) * (1<<16);
score += max((int)(height- h), 0) * (1<<16);
/* cost of too high a resolution is lower */
score += max((int)(w-width), 0) * ((match_flag & HDMI_MODE_MATCH_RESOLUTION) ? (1<<8):(1<<0));
score += max((int)(h-height), 0) * ((match_flag & HDMI_MODE_MATCH_RESOLUTION) ? (1<<8):(1<<0));
}
else if (!isNative)
{
// native is good
score += 1<<16;
}
if (scan_mode != tv->scan_mode)
score += (match_flag & HDMI_MODE_MATCH_SCANMODE) ? (1<<20):(1<<8);
if (w*9 != h*16) // not 16:9 is a small negative
score += 1<<12;
printf("mode %dx%[email protected]%d %s%s:%x score=%d\n", tv->width, tv->height,
tv->frame_rate, tv->native?"N":"", tv->scan_mode?"I":"", tv->code, score);
if (score < best_score)
{
tv_found = tv;
best_score = score;
}
/* reset score */
score = 0;
}
}
if(tv_found)
{
printf("Output mode %d: %dx%[email protected]%d %s%s:%x\n", tv_found->code, tv_found->width, tv_found->height,
tv_found->frame_rate, tv_found->native?"N":"", tv_found->scan_mode?"I":"", tv_found->code);
// if we are closer to ntsc version of framerate, let gpu know
int ifps = (int)(fps+0.5f);
bool ntsc_freq = fabs(fps*1001.0f/1000.0f - ifps) < fabs(fps-ifps);
printf("ntsc_freq:%d\n", ntsc_freq);
char response[80];
vc_gencmd(response, sizeof response, "hdmi_ntsc_freqs %d", ntsc_freq);
m_BcmHost.vc_tv_hdmi_power_on_explicit(HDMI_MODE_HDMI, (HDMI_RES_GROUP_T)group, tv_found->code);
}
//.........这里部分代码省略.........