Skip to content

Commit

Permalink
Revert "[bluray] modernize casts in DVDInputStreamBluray.cpp."
Browse files Browse the repository at this point in the history
This reverts commit 1cf75c5.
  • Loading branch information
popcornmix committed Sep 12, 2018
1 parent aa2c915 commit bfd83fa
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamBluray.cpp
Expand Up @@ -476,7 +476,7 @@ void CDVDInputStreamBluray::ProcessEvent() {

case BD_EVENT_AUDIO_STREAM:
pid = -1;
if (m_title && m_clip && static_cast<uint32_t>(m_clip->audio_stream_count) > (m_event.param - 1))
if (m_title && m_clip && (uint32_t) m_clip->audio_stream_count > (m_event.param - 1))
pid = m_clip->audio_streams[m_event.param - 1].pid;
CLog::Log(LOGDEBUG, "CDVDInputStreamBluray - BD_EVENT_AUDIO_STREAM %d %d", m_event.param, pid);
m_player->OnDiscNavResult(static_cast<void*>(&pid), BD_EVENT_AUDIO_STREAM);
Expand All @@ -490,7 +490,7 @@ void CDVDInputStreamBluray::ProcessEvent() {

case BD_EVENT_PG_TEXTST_STREAM:
pid = -1;
if (m_title && m_clip && static_cast<uint32_t>(m_clip->pg_stream_count) > (m_event.param - 1))
if (m_title && m_clip && (uint32_t)m_clip->pg_stream_count > (m_event.param - 1))
pid = m_clip->pg_streams[m_event.param - 1].pid;
CLog::Log(LOGDEBUG, "CDVDInputStreamBluray - BD_EVENT_PG_TEXTST_STREAM %d, %d", m_event.param, pid);
m_player->OnDiscNavResult(static_cast<void*>(&pid), BD_EVENT_PG_TEXTST_STREAM);
Expand Down Expand Up @@ -551,7 +551,7 @@ void CDVDInputStreamBluray::ProcessEvent() {
int CDVDInputStreamBluray::Read(uint8_t* buf, int buf_size)
{
int result = 0;
m_dispTimeBeforeRead = static_cast<int>((bd_tell_time(m_bd) / 90));
m_dispTimeBeforeRead = (int)(bd_tell_time(m_bd) / 90);
if(m_navmode)
{
do {
Expand Down Expand Up @@ -615,18 +615,18 @@ int CDVDInputStreamBluray::Read(uint8_t* buf, int buf_size)

static uint8_t clamp(double v)
{
return (v) > 255.0 ? 255 : ((v) < 0.0 ? 0 : static_cast<uint32_t>((v+0.5f)));
return (v) > 255.0 ? 255 : ((v) < 0.0 ? 0 : (uint8_t)(v+0.5f));
}

static uint32_t build_rgba(const BD_PG_PALETTE_ENTRY &e)
{
double r = 1.164 * (e.Y - 16) + 1.596 * (e.Cr - 128);
double g = 1.164 * (e.Y - 16) - 0.391 * (e.Cb - 128) - 0.813 * (e.Cr - 128);
double b = 1.164 * (e.Y - 16) + 2.018 * (e.Cb - 128);
return static_cast<uint32_t>(e.T) << PIXEL_ASHIFT
| static_cast<uint32_t>(clamp(r)) << PIXEL_RSHIFT
| static_cast<uint32_t>(clamp(g)) << PIXEL_GSHIFT
| static_cast<uint32_t>(clamp(b)) << PIXEL_BSHIFT;
return (uint32_t)e.T << PIXEL_ASHIFT
| (uint32_t)clamp(r) << PIXEL_RSHIFT
| (uint32_t)clamp(g) << PIXEL_GSHIFT
| (uint32_t)clamp(b) << PIXEL_BSHIFT;
}

void CDVDInputStreamBluray::OverlayClose()
Expand Down Expand Up @@ -698,7 +698,7 @@ void CDVDInputStreamBluray::OverlayFlush(int64_t pts)
#if(BD_OVERLAY_INTERFACE_VERSION >= 2)
CDVDOverlayGroup* group = new CDVDOverlayGroup();
group->bForced = true;
group->iPTSStartTime = static_cast<double>(pts);
group->iPTSStartTime = (double) pts;
group->iPTSStopTime = 0;

for(SPlane& plane : m_planes)
Expand Down Expand Up @@ -754,14 +754,14 @@ void CDVDInputStreamBluray::OverlayCallback(const BD_OVERLAY * const ov)
if (ov->palette)
{
overlay->palette_colors = 256;
overlay->palette = reinterpret_cast<uint32_t*>(calloc(overlay->palette_colors, 4));
overlay->palette = (uint32_t*)calloc(overlay->palette_colors, 4);

for(unsigned i = 0; i < 256; i++)
overlay->palette[i] = build_rgba(ov->palette[i]);
}

const BD_PG_RLE_ELEM *rlep = ov->img;
uint8_t *img = reinterpret_cast<uint8_t*>(malloc(static_cast<size_t>(ov->w) * static_cast<size_t>(ov->h)));
uint8_t *img = (uint8_t*) malloc((size_t)ov->w * (size_t)ov->h);
if (!img)
return;
unsigned pixels = ov->w * ov->h;
Expand Down Expand Up @@ -820,8 +820,8 @@ void CDVDInputStreamBluray::OverlayCallbackARGB(const struct bd_argb_overlay_s *
overlay->palette_colors = 0;
overlay->palette = nullptr;

size_t bytes = static_cast<size_t>(ov->stride * ov->h * 4);
uint8_t *img = reinterpret_cast<uint8_t*>(malloc(bytes));
unsigned bytes = ov->stride * ov->h * 4;
uint8_t *img = (uint8_t*) malloc(bytes);
memcpy(img, ov->argb, bytes);

overlay->data = img;
Expand All @@ -844,7 +844,7 @@ void CDVDInputStreamBluray::OverlayCallbackARGB(const struct bd_argb_overlay_s *
int CDVDInputStreamBluray::GetTotalTime()
{
if(m_title)
return static_cast<int>(m_title->duration / 90);
return (int)(m_title->duration / 90);
else
return 0;
}
Expand All @@ -868,15 +868,15 @@ bool CDVDInputStreamBluray::PosTime(int ms)
int CDVDInputStreamBluray::GetChapterCount()
{
if(m_title)
return static_cast<int>(m_title->chapter_count);
return m_title->chapter_count;
else
return 0;
}

int CDVDInputStreamBluray::GetChapter()
{
if(m_title)
return static_cast<int>(bd_get_current_chapter(m_bd) + 1);
return bd_get_current_chapter(m_bd) + 1;
else
return 0;
}
Expand Down Expand Up @@ -940,15 +940,15 @@ int64_t CDVDInputStreamBluray::Seek(int64_t offset, int whence)

int64_t CDVDInputStreamBluray::GetLength()
{
return static_cast<int64_t>(bd_get_title_size(m_bd));
return bd_get_title_size(m_bd);
}

static bool find_stream(int pid, BLURAY_STREAM_INFO *info, int count, std::string &language)
{
int i=0;
for(;i<count;i++,info++)
{
if(info->pid == static_cast<uint16_t>(pid))
if(info->pid == pid)
break;
}
if(i==count)
Expand Down Expand Up @@ -1014,7 +1014,7 @@ bool CDVDInputStreamBluray::MouseMove(const CPoint &point)
if (m_bd == nullptr || !m_navmode)
return false;

if (bd_mouse_select(m_bd, -1, static_cast<uint16_t>(point.x), static_cast<uint16_t>(point.y)) < 0)
if (bd_mouse_select(m_bd, -1, (uint16_t)point.x, (uint16_t)point.y) < 0)
{
CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::MouseMove - mouse select failed");
return false;
Expand All @@ -1028,7 +1028,7 @@ bool CDVDInputStreamBluray::MouseClick(const CPoint &point)
if (m_bd == nullptr || !m_navmode)
return false;

if (bd_mouse_select(m_bd, -1, static_cast<uint16_t>(point.x), static_cast<uint16_t>(point.y)) < 0)
if (bd_mouse_select(m_bd, -1, (uint16_t)point.x, (uint16_t)point.y) < 0)
{
CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::MouseClick - mouse select failed");
return false;
Expand Down Expand Up @@ -1101,7 +1101,7 @@ void CDVDInputStreamBluray::SetupPlayerSettings()
CLog::Log(LOGWARNING, "CDVDInputStreamBluray::Open - Blu-ray region must be set in setting, assuming region A");
region = BLURAY_REGION_A;
}
bd_set_player_setting(m_bd, BLURAY_PLAYER_SETTING_REGION_CODE, static_cast<uint32_t>(region));
bd_set_player_setting(m_bd, BLURAY_PLAYER_SETTING_REGION_CODE, region);
bd_set_player_setting(m_bd, BLURAY_PLAYER_SETTING_PARENTAL, 99);
bd_set_player_setting(m_bd, BLURAY_PLAYER_SETTING_PLAYER_PROFILE, BLURAY_PLAYER_PROFILE_5_v2_4);
bd_set_player_setting(m_bd, BLURAY_PLAYER_SETTING_3D_CAP, 0xffffffff);
Expand Down

0 comments on commit bfd83fa

Please sign in to comment.