Skip to content

Commit

Permalink
tidy: Replace DVD GETBE16 macro with QtEndian function.
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxdude42 committed Jul 10, 2022
1 parent a7991e7 commit ec27545
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions mythtv/libs/libmythtv/DVD/mythdvdbuffer.cpp
Expand Up @@ -4,6 +4,7 @@

// Qt
#include <QCoreApplication>
#include <QtEndian>

// MythTV
#include "libmyth/mythcontext.h"
Expand Down Expand Up @@ -1454,8 +1455,6 @@ QRect MythDVDBuffer::GetButtonCoords(void)
bool MythDVDBuffer::DecodeSubtitles(AVSubtitle *Subtitle, int *GotSubtitles,
const uint8_t *SpuPkt, int BufSize, uint32_t StartTime)
{
#define GETBE16(p) (((p)[0] << 8) | (p)[1])

AlphaArray alpha {0, 0, 0, 0};
PaletteArray palette {0, 0, 0, 0};

Expand All @@ -1471,13 +1470,13 @@ bool MythDVDBuffer::DecodeSubtitles(AVSubtitle *Subtitle, int *GotSubtitles,
Subtitle->start_display_time = StartTime;
Subtitle->end_display_time = StartTime;

int cmd_pos = GETBE16(SpuPkt + 2);
int cmd_pos = qFromBigEndian<qint16>(SpuPkt + 2);
while ((cmd_pos + 4) < BufSize)
{
int offset1 = -1;
int offset2 = -1;
int date = GETBE16(SpuPkt + cmd_pos);
int next_cmd_pos = GETBE16(SpuPkt + cmd_pos + 2);
int date = qFromBigEndian<qint16>(SpuPkt + cmd_pos);
int next_cmd_pos = qFromBigEndian<qint16>(SpuPkt + cmd_pos + 2);
int pos = cmd_pos + 4;
int x1 = 0;
int x2 = 0;
Expand Down Expand Up @@ -1535,8 +1534,8 @@ bool MythDVDBuffer::DecodeSubtitles(AVSubtitle *Subtitle, int *GotSubtitles,
{
if ((BufSize - pos) < 4)
goto fail;
offset1 = GETBE16(SpuPkt + pos);
offset2 = GETBE16(SpuPkt + pos + 2);
offset1 = qFromBigEndian<qint16>(SpuPkt + pos);
offset2 = qFromBigEndian<qint16>(SpuPkt + pos + 2);
pos +=4;
}
break;
Expand All @@ -1545,7 +1544,7 @@ bool MythDVDBuffer::DecodeSubtitles(AVSubtitle *Subtitle, int *GotSubtitles,
if ((BufSize - pos) < 2)
goto fail;

pos += GETBE16(SpuPkt + pos);
pos += qFromBigEndian<qint16>(SpuPkt + pos);
}
break;
case 0xff:
Expand Down

0 comments on commit ec27545

Please sign in to comment.