Ticket #6211: 0004-PPC-fixing-endian.patch

File 0004-PPC-fixing-endian.patch, 12.6 KB (added by chr, 14 years ago)
  • mythplugins/mythmusic/mythmusic/avfdecoder.cpp

    From 500bca172a1b49c4faacf3355eb6e29d1f2cc5bb Mon Sep 17 00:00:00 2001
    From: chris <chris@ rudorff com>
    Date: Sat, 26 Jun 2010 19:22:05 +0200
    Subject: [PATCH 4/5] PPC fixing endian:
    
    WORDS_ENDIAN isn't defined by configure anymore.
    Use HAVE_BIGENDIAN instead.
    
    Fixes white noise instead sound on linux+osx/PPC
    
    http://svn.mythtv.org/trac/ticket/8442
    ---
     mythplugins/mythmusic/mythmusic/avfdecoder.cpp |    3 ++-
     mythtv/libs/libmyth/audiooutputalsa.cpp        |    4 ++--
     mythtv/libs/libmyth/audiooutputca.cpp          |    2 +-
     mythtv/libs/libmyth/audiooutputoss.cpp         |    2 +-
     mythtv/libs/libmyth/mythcdrom-linux.cpp        |   12 +++++++-----
     mythtv/libs/libmythtv/NuppelVideoRecorder.cpp  |   12 ++++++------
     mythtv/libs/libmythtv/RTjpegN.h                |    2 +-
     mythtv/libs/libmythtv/nuppeldecoder.cpp        |   20 ++++++++++----------
     mythtv/libs/libmythtv/nuppeldecoder.h          |    4 +++-
     mythtv/libs/libmythtv/yuv2rgb.cpp              |    4 ++--
     10 files changed, 35 insertions(+), 30 deletions(-)
    
    diff --git a/mythplugins/mythmusic/mythmusic/avfdecoder.cpp b/mythplugins/mythmusic/mythmusic/avfdecoder.cpp
    index 4a47e63..51086d8 100644
    a b  
    2727#include <QFile>
    2828
    2929// Myth headers
     30#include <mythconfig.h>
    3031#include <mythcontext.h>
    3132#include <audiooutput.h>
    3233#include <mythverbose.h>
    bool avfDecoder::initialize() 
    192193    // Given we are outputing to a sound card, this will always
    193194    // be a PCM format
    194195
    195 #ifdef WORDS_BIGENDIAN
     196#if HAVE_BIGENDIAN
    196197    m_outputFormat = guess_format("s16be", NULL, NULL);
    197198#else
    198199    m_outputFormat = guess_format("s16le", NULL, NULL);
  • mythtv/libs/libmyth/audiooutputalsa.cpp

    diff --git a/mythtv/libs/libmyth/audiooutputalsa.cpp b/mythtv/libs/libmyth/audiooutputalsa.cpp
    index 73f094a..09fd358 100644
    a b bool AudioOutputALSA::OpenDevice() 
    221221    else if (audio_bits == 16)
    222222        // is the sound data coming in really little-endian or is it
    223223        // CPU-endian?
    224 #ifdef WORDS_BIGENDIAN
     224#if HAVE_BIGENDIAN
    225225        format = SND_PCM_FORMAT_S16;
    226226#else
    227227        format = SND_PCM_FORMAT_S16_LE;
    228228#endif
    229229    else if (audio_bits == 24)
    230 #ifdef WORDS_BIGENDIAN
     230#if HAVE_BIGENDIAN
    231231        format = SND_PCM_FORMAT_S24;
    232232#else
    233233        format = SND_PCM_FORMAT_S24_LE;
  • mythtv/libs/libmyth/audiooutputca.cpp

    diff --git a/mythtv/libs/libmyth/audiooutputca.cpp b/mythtv/libs/libmyth/audiooutputca.cpp
    index 2d59454..ba67056 100644
    a b bool CoreAudioData::OpenAnalog() 
    176176    conv_in_desc.mSampleRate       = mCA->audio_samplerate;
    177177    conv_in_desc.mFormatID         = kAudioFormatLinearPCM;
    178178    conv_in_desc.mFormatFlags      = kLinearPCMFormatFlagIsSignedInteger;
    179 #ifdef WORDS_BIGENDIAN
     179#if HAVE_BIGENDIAN
    180180    conv_in_desc.mFormatFlags     |= kLinearPCMFormatFlagIsBigEndian;
    181181#endif
    182182    conv_in_desc.mBytesPerPacket   = mCA->audio_bytes_per_sample;
  • mythtv/libs/libmyth/audiooutputoss.cpp

    diff --git a/mythtv/libs/libmyth/audiooutputoss.cpp b/mythtv/libs/libmyth/audiooutputoss.cpp
    index 9bd4db1..2d4fc29 100644
    a b bool AudioOutputOSS::OpenDevice() 
    123123            format = AFMT_S8;
    124124            break;
    125125        case 16:
    126 #ifdef WORDS_BIGENDIAN
     126#if HAVE_BIGENDIAN
    127127            format = AFMT_S16_BE;
    128128#else
    129129            format = AFMT_S16_LE;
  • mythtv/libs/libmyth/mythcdrom-linux.cpp

    diff --git a/mythtv/libs/libmyth/mythcdrom-linux.cpp b/mythtv/libs/libmyth/mythcdrom-linux.cpp
    index 80820f2..5827a45 100644
    a b  
    1212
    1313#include "mythcdrom.h"
    1414#include "mythcdrom-linux.h"
    15 #include "mythconfig.h"      // for WORDS_BIGENDIAN
     15#include "mythconfig.h"      // for HAVE_BIGENDIAN
    1616#include "mythcontext.h"
    1717#include "mythverbose.h"
    1818
    typedef struct cdrom_generic_command CDROMgenericCmd; 
    3535typedef struct
    3636{
    3737    uint16_t data_len[2];
    38 #ifdef WORDS_BIGENDIAN
     38#if HAVE_BIGENDIAN
     39#warning "BIG"
    3940    uint8_t  nea                : 1;
    4041    uint8_t  reserved1          : 4;
    4142    uint8_t  notification_class : 3;
    4243#else
     44#warning "littl"
    4345    uint8_t  notification_class : 3;
    4446    uint8_t  reserved1          : 4;
    4547    uint8_t  nea                : 1;
    4648#endif
    4749    uint8_t  supp_event_class;
    48 #ifdef WORDS_BIGENDIAN
     50#if HAVE_BIGENDIAN
    4951    uint8_t  reserved2          : 4;
    5052    uint8_t  media_event_code   : 4;
    5153    uint8_t  reserved3          : 6;
    typedef struct 
    6567// and this is returned by GPCMD_READ_DISC_INFO
    6668typedef struct {
    6769    uint16_t disc_information_length;
    68 #ifdef WORDS_BIGENDIAN
     70#if HAVE_BIGENDIAN
    6971    uint8_t  reserved1          : 3;
    7072    uint8_t  erasable           : 1;
    7173    uint8_t  border_status      : 2;
    typedef struct { 
    8082    uint8_t  n_sessions_lsb;
    8183    uint8_t  first_track_lsb;
    8284    uint8_t  last_track_lsb;
    83 #ifdef WORDS_BIGENDIAN
     85#if HAVE_BIGENDIAN
    8486    uint8_t  did_v              : 1;
    8587    uint8_t  dbc_v              : 1;
    8688    uint8_t  uru                : 1;
  • mythtv/libs/libmythtv/NuppelVideoRecorder.cpp

    diff --git a/mythtv/libs/libmythtv/NuppelVideoRecorder.cpp b/mythtv/libs/libmythtv/NuppelVideoRecorder.cpp
    index 12ea0ab..86d4c41 100644
    a b using namespace std; 
    3333#include "audioinput.h"
    3434#include "myth_imgconvert.h"
    3535
    36 #ifdef WORDS_BIGENDIAN
     36#if HAVE_BIGENDIAN
    3737extern "C" {
    3838#include "bswap.h"
    3939}
    void NuppelVideoRecorder::BufferIt(unsigned char *buf, int len, bool forcekey) 
    18731873
    18741874inline void NuppelVideoRecorder::WriteFrameheader(rtframeheader *fh)
    18751875{
    1876 #ifdef WORDS_BIGENDIAN
     1876#if HAVE_BIGENDIAN
    18771877    fh->timecode     = bswap_32(fh->timecode);
    18781878    fh->packetlength = bswap_32(fh->packetlength);
    18791879#endif
    void NuppelVideoRecorder::WriteFileHeader(void) 
    19211921    fileheader.textsblocks = -1; // TODO: make only -1 if VBI support active?
    19221922    fileheader.keyframedist = KEYFRAMEDIST;
    19231923
    1924 #ifdef WORDS_BIGENDIAN
     1924#if HAVE_BIGENDIAN
    19251925    fileheader.width         = bswap_32(fileheader.width);
    19261926    fileheader.height        = bswap_32(fileheader.height);
    19271927    fileheader.desiredwidth  = bswap_32(fileheader.desiredwidth);
    void NuppelVideoRecorder::WriteHeader(void) 
    20302030
    20312031    extendeddataOffset = ringBuffer->GetWritePosition();
    20322032
    2033 #ifdef WORDS_BIGENDIAN
     2033#if HAVE_BIGENDIAN
    20342034    moredata.version                 = bswap_32(moredata.version);
    20352035    moredata.video_fourcc            = bswap_32(moredata.video_fourcc);
    20362036    moredata.audio_fourcc            = bswap_32(moredata.audio_fourcc);
    void NuppelVideoRecorder::WriteVideo(VideoFrame *frame, bool skipsync, 
    31473147    lf = fnum;
    31483148}
    31493149
    3150 #ifdef WORDS_BIGENDIAN
     3150#if HAVE_BIGENDIAN
    31513151static void bswap_16_buf(short int *buf, int buf_cnt, int audio_channels)
    31523152    __attribute__ ((unused)); /* <- suppress compiler warning */
    31533153
    void NuppelVideoRecorder::WriteAudio(unsigned char *buf, int fnum, int timecode) 
    32143214
    32153215        int sample_cnt = audio_buffer_size / audio_bytes_per_sample;
    32163216
    3217 #ifdef WORDS_BIGENDIAN
     3217#if HAVE_BIGENDIAN
    32183218        bswap_16_buf((short int*) buf, sample_cnt, audio_channels);
    32193219#endif
    32203220
  • mythtv/libs/libmythtv/RTjpegN.h

    diff --git a/mythtv/libs/libmythtv/RTjpegN.h b/mythtv/libs/libmythtv/RTjpegN.h
    index 2342f30..b3dc470 100644
    a b Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
    3333#define RTJPEG_FILE_VERSION 0
    3434#define RTJPEG_HEADER_SIZE 12
    3535
    36 #ifdef WORDS_BIGENDIAN
     36#if HAVE_BIGENDIAN
    3737#define RTJPEG_SWAP_WORD(a) ( ((a) << 24) | \
    3838                        (((a) << 8) & 0x00ff0000) | \
    3939                        (((a) >> 8) & 0x0000ff00) | \
  • mythtv/libs/libmythtv/nuppeldecoder.cpp

    diff --git a/mythtv/libs/libmythtv/nuppeldecoder.cpp b/mythtv/libs/libmythtv/nuppeldecoder.cpp
    index 1450a9a..495de67 100644
    a b using namespace std; 
    2727
    2828#include "minilzo.h"
    2929
    30 #ifdef WORDS_BIGENDIAN
     30#if HAVE_BIGENDIAN
    3131extern "C" {
    3232#include "bswap.h"
    3333}
    NuppelDecoder::NuppelDecoder(NuppelVideoPlayer *parent, 
    4141    : DecoderBase(parent, pginfo),
    4242      rtjd(0), video_width(0), video_height(0), video_size(0),
    4343      video_frame_rate(0.0f), audio_samplerate(44100),
    44 #ifdef WORDS_BIGENDIAN
     44#if HAVE_BIGENDIAN
    4545      audio_bits_per_sample(0),
    4646#endif
    4747      ffmpeg_extradatasize(0), ffmpeg_extradata(0), usingextradata(false),
    bool NuppelDecoder::ReadFileheader(struct rtfileheader *fh) 
    139139    if (ringBuffer->Read(fh, FILEHEADERSIZE) != FILEHEADERSIZE)
    140140        return false;
    141141
    142 #ifdef WORDS_BIGENDIAN
     142#if HAVE_BIGENDIAN
    143143    fh->width         = bswap_32(fh->width);
    144144    fh->height        = bswap_32(fh->height);
    145145    fh->desiredwidth  = bswap_32(fh->desiredwidth);
    bool NuppelDecoder::ReadFrameheader(struct rtframeheader *fh) 
    160160    if (ringBuffer->Read(fh, FRAMEHEADERSIZE) != FRAMEHEADERSIZE)
    161161        return false;
    162162
    163 #ifdef WORDS_BIGENDIAN
     163#if HAVE_BIGENDIAN
    164164    fh->timecode     = bswap_32(fh->timecode);
    165165    fh->packetlength = bswap_32(fh->packetlength);
    166166#endif
    int NuppelDecoder::OpenFile(RingBuffer *rbuffer, bool novideo, 
    287287        else
    288288        {
    289289            ringBuffer->Read(&extradata, frameheader.packetlength);
    290 #ifdef WORDS_BIGENDIAN
     290#if HAVE_BIGENDIAN
    291291            struct extendeddata *ed = &extradata;
    292292            ed->version                 = bswap_32(ed->version);
    293293            ed->video_fourcc            = bswap_32(ed->video_fourcc);
    int NuppelDecoder::OpenFile(RingBuffer *rbuffer, bool novideo, 
    353353                {
    354354                    memcpy(&ste, seekbuf + offset,
    355355                           sizeof(struct seektable_entry));
    356 #ifdef WORDS_BIGENDIAN
     356#if HAVE_BIGENDIAN
    357357                    ste.file_offset     = bswap_64(ste.file_offset);
    358358                    ste.keyframe_number = bswap_32(ste.keyframe_number);
    359359#endif
    int NuppelDecoder::OpenFile(RingBuffer *rbuffer, bool novideo, 
    422422                {
    423423                    memcpy(&kfate, kfa_buf + offset,
    424424                           sizeof(struct kfatable_entry));
    425 #ifdef WORDS_BIGENDIAN
     425#if HAVE_BIGENDIAN
    426426                    kfate.adjust          = bswap_32(kfate.adjust);
    427427                    kfate.keyframe_number = bswap_32(kfate.keyframe_number);
    428428#endif
    int NuppelDecoder::OpenFile(RingBuffer *rbuffer, bool novideo, 
    495495        effdsp = extradata.audio_sample_rate * 100;
    496496        GetNVP()->SetEffDsp(effdsp);
    497497        audio_samplerate = extradata.audio_sample_rate;
    498 #ifdef WORDS_BIGENDIAN
     498#if HAVE_BIGENDIAN
    499499        // Why only if using extradata?
    500500        audio_bits_per_sample = extradata.audio_bits_per_sample;
    501501#endif
    bool NuppelDecoder::GetFrame(DecodeType decodetype) 
    12421242            else
    12431243            {
    12441244                getrawframes = 0;
    1245 #ifdef WORDS_BIGENDIAN
     1245#if HAVE_BIGENDIAN
    12461246                // Why endian correct the audio buffer here?
    12471247                // Don't big-endian clients have to do it in audiooutBlah.cpp?
    12481248                if (audio_bits_per_sample == 16) {
    bool NuppelDecoder::GetFrame(DecodeType decodetype) 
    12901290
    12911291            if (QString(fh->finfo) == "MythTVVideo")
    12921292            {
    1293 #ifdef WORDS_BIGENDIAN
     1293#if HAVE_BIGENDIAN
    12941294                fh->width         = bswap_32(fh->width);
    12951295                fh->height        = bswap_32(fh->height);
    12961296                fh->desiredwidth  = bswap_32(fh->desiredwidth);
  • mythtv/libs/libmythtv/nuppeldecoder.h

    diff --git a/mythtv/libs/libmythtv/nuppeldecoder.h b/mythtv/libs/libmythtv/nuppeldecoder.h
    index e0a61ad..0366b18 100644
    a b  
    11#ifndef NUPPELDECODER_H_
    22#define NUPPELDECODER_H_
    33
     4#include "config.h"
     5
    46#include <list>
    57using namespace std;
    68
    class NuppelDecoder : public DecoderBase 
    8183    int video_width, video_height, video_size;
    8284    double video_frame_rate;
    8385    int audio_samplerate;
    84 #ifdef WORDS_BIGENDIAN
     86#if HAVE_BIGENDIAN
    8587    int audio_bits_per_sample;
    8688#endif
    8789
  • mythtv/libs/libmythtv/yuv2rgb.cpp

    diff --git a/mythtv/libs/libmythtv/yuv2rgb.cpp b/mythtv/libs/libmythtv/yuv2rgb.cpp
    index a488d1b..87a63b9 100644
    a b static void yuv420_argb32_non_mmx(unsigned char *image, unsigned char *py, 
    417417    int dstwidth;
    418418
    419419// byte indices
    420 #ifdef WORDS_BIGENDIAN
     420#if HAVE_BIGENDIAN
    421421#define R_OI  1
    422422#define G_OI  2
    423423#define B_OI  3
    void rgb32_to_yuv420p(unsigned char *lum, unsigned char *cb, unsigned char *cr, 
    490490    unsigned char *p;
    491491
    492492// byte indices
    493 #ifdef WORDS_BIGENDIAN
     493#if HAVE_BIGENDIAN
    494494#define R_II  3
    495495#define G_II  2
    496496#define B_II  1