From f86215baf77d5b928a047d83ea19ea442f2a83f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 16 Jun 2007 15:11:56 +0200 Subject: Rename the BE/LE/ME macros with a _X_ prefix, so they don't clash with Solaris definitions. --- src/audio_out/audio_arts_out.c | 2 +- src/demuxers/asfheader.c | 12 +- src/demuxers/demux_4xm.c | 38 ++--- src/demuxers/demux_aac.c | 2 +- src/demuxers/demux_ac3.c | 6 +- src/demuxers/demux_aiff.c | 16 +- src/demuxers/demux_asf.c | 18 +-- src/demuxers/demux_aud.c | 6 +- src/demuxers/demux_avi.c | 76 +++++----- src/demuxers/demux_dts.c | 6 +- src/demuxers/demux_eawve.c | 2 +- src/demuxers/demux_film.c | 24 +-- src/demuxers/demux_flac.c | 16 +- src/demuxers/demux_fli.c | 16 +- src/demuxers/demux_flv.c | 30 ++-- src/demuxers/demux_idcin.c | 12 +- src/demuxers/demux_iff.c | 98 ++++++------ src/demuxers/demux_image.c | 2 +- src/demuxers/demux_ipmovie.c | 22 +-- src/demuxers/demux_matroska.c | 2 +- src/demuxers/demux_mod.c | 2 +- src/demuxers/demux_mpc.c | 14 +- src/demuxers/demux_mpeg.c | 14 +- src/demuxers/demux_mpgaudio.c | 36 ++--- src/demuxers/demux_nsv.c | 22 +-- src/demuxers/demux_ogg.c | 56 +++---- src/demuxers/demux_pva.c | 12 +- src/demuxers/demux_qt.c | 214 +++++++++++++------------- src/demuxers/demux_real.c | 114 +++++++------- src/demuxers/demux_realaudio.c | 16 +- src/demuxers/demux_roq.c | 18 +-- src/demuxers/demux_smjpeg.c | 20 +-- src/demuxers/demux_snd.c | 12 +- src/demuxers/demux_str.c | 28 ++-- src/demuxers/demux_tta.c | 2 +- src/demuxers/demux_vmd.c | 18 +-- src/demuxers/demux_voc.c | 2 +- src/demuxers/demux_vqa.c | 16 +- src/demuxers/demux_wav.c | 4 +- src/demuxers/demux_wc3movie.c | 34 ++--- src/demuxers/ebml.c | 4 +- src/demuxers/flacutils.h | 14 +- src/demuxers/id3.c | 32 ++-- src/demuxers/id3.h | 6 +- src/input/libreal/real.c | 184 +++++++++++------------ src/input/libreal/rmff.c | 272 +++++++++++++++++----------------- src/input/mms.c | 40 ++--- src/input/mmsh.c | 12 +- src/libffmpeg/ff_audio_decoder.c | 12 +- src/libffmpeg/ff_video_decoder.c | 6 +- src/libreal/xine_real_audio_decoder.c | 26 ++-- src/libreal/xine_real_video_decoder.c | 12 +- src/libw32dll/qt_decoder.c | 26 ++-- src/libxineadec/nsf.c | 2 +- src/libxinevdec/bitplane.c | 44 +++--- src/libxinevdec/rgb.c | 4 +- src/xine-engine/bswap.h | 52 +++---- 57 files changed, 904 insertions(+), 904 deletions(-) diff --git a/src/audio_out/audio_arts_out.c b/src/audio_out/audio_arts_out.c index f38575aff..5347d7f76 100644 --- a/src/audio_out/audio_arts_out.c +++ b/src/audio_out/audio_arts_out.c @@ -90,7 +90,7 @@ static void ao_arts_volume(void *buffer, int length, int volume) { while (length--) { v=(int) ((*(data) * volume) / 100); *(data)=(v>32767) ? 32767 : ((v<-32768) ? -32768 : v); - *(data)=LE_16(data); + *(data)=_X_LE_16(data); data++; } } diff --git a/src/demuxers/asfheader.c b/src/demuxers/asfheader.c index 3c3cdb689..ea92f878b 100644 --- a/src/demuxers/asfheader.c +++ b/src/demuxers/asfheader.c @@ -95,7 +95,7 @@ static int asf_reader_get_8(asf_reader_t *reader, uint8_t *value) { static int asf_reader_get_16(asf_reader_t *reader, uint16_t *value) { if ((reader->size - reader->pos) < 2) return 0; - *value = LE_16(reader->buffer + reader->pos); + *value = _X_LE_16(reader->buffer + reader->pos); reader->pos += 2; return 1; } @@ -103,7 +103,7 @@ static int asf_reader_get_16(asf_reader_t *reader, uint16_t *value) { static int asf_reader_get_32(asf_reader_t *reader, uint32_t *value) { if ((reader->size - reader->pos) < 4) return 0; - *value = LE_32(reader->buffer + reader->pos); + *value = _X_LE_32(reader->buffer + reader->pos); reader->pos += 4; return 1; } @@ -111,7 +111,7 @@ static int asf_reader_get_32(asf_reader_t *reader, uint32_t *value) { static int asf_reader_get_64(asf_reader_t *reader, uint64_t *value) { if ((reader->size - reader->pos) < 8) return 0; - *value = LE_64(reader->buffer + reader->pos); + *value = _X_LE_64(reader->buffer + reader->pos); reader->pos += 8; return 1; } @@ -187,9 +187,9 @@ static size_t asf_reader_get_size(asf_reader_t *reader) { void asf_get_guid(uint8_t *buffer, GUID *value) { int i; - value->Data1 = LE_32(buffer); - value->Data2 = LE_16(buffer + 4); - value->Data3 = LE_16(buffer + 6); + value->Data1 = _X_LE_32(buffer); + value->Data2 = _X_LE_16(buffer + 4); + value->Data3 = _X_LE_16(buffer + 6); for(i = 0; i < 8; i++) { value->Data4[i] = *(buffer + i + 8); } diff --git a/src/demuxers/demux_4xm.c b/src/demuxers/demux_4xm.c index 56360542c..6d599adac 100644 --- a/src/demuxers/demux_4xm.c +++ b/src/demuxers/demux_4xm.c @@ -144,8 +144,8 @@ static int open_fourxm_file(demux_fourxm_t *fourxm) { return 0; /* check for the signature tags */ - if ((LE_32(&preview[0]) != RIFF_TAG) || - (LE_32(&preview[8]) != _4XMV_TAG)) + if ((_X_LE_32(&preview[0]) != RIFF_TAG) || + (_X_LE_32(&preview[8]) != _4XMV_TAG)) return 0; /* file is qualified; skip over the header bytes in the stream */ @@ -154,12 +154,12 @@ static int open_fourxm_file(demux_fourxm_t *fourxm) { /* fetch the LIST-HEAD header */ if (fourxm->input->read(fourxm->input, preview, 12) != 12) return 0; - if ((LE_32(&preview[0]) != LIST_TAG) || - (LE_32(&preview[8]) != HEAD_TAG)) + if ((_X_LE_32(&preview[0]) != LIST_TAG) || + (_X_LE_32(&preview[8]) != HEAD_TAG)) return 0; /* read the whole header */ - header_size = LE_32(&preview[4]) - 4; + header_size = _X_LE_32(&preview[4]) - 4; header = xine_xmalloc(header_size); if (fourxm->input->read(fourxm->input, header, header_size) != header_size) { free(header); @@ -174,8 +174,8 @@ static int open_fourxm_file(demux_fourxm_t *fourxm) { /* take the lazy approach and search for any and all vtrk and strk chunks */ for (i = 0; i < header_size - 8; i++) { - fourcc_tag = LE_32(&header[i]); - size = LE_32(&header[i + 4]); + fourcc_tag = _X_LE_32(&header[i]); + size = _X_LE_32(&header[i + 4]); if (fourcc_tag == std__TAG) { fps = get_le_float(&header[i + 12]); @@ -186,13 +186,13 @@ static int open_fourxm_file(demux_fourxm_t *fourxm) { free(header); return 0; } - total_frames = LE_32(&header[i + 24]); + total_frames = _X_LE_32(&header[i + 24]); fourxm->duration_in_ms = total_frames; fourxm->duration_in_ms *= fourxm->video_pts_inc; fourxm->duration_in_ms /= 90000; fourxm->duration_in_ms *= 1000; - fourxm->bih.biWidth = LE_32(&header[i + 36]); - fourxm->bih.biHeight = LE_32(&header[i + 40]); + fourxm->bih.biWidth = _X_LE_32(&header[i + 36]); + fourxm->bih.biHeight = _X_LE_32(&header[i + 40]); i += 8 + size; } else if (fourcc_tag == strk_TAG) { /* check that there is enough data */ @@ -200,7 +200,7 @@ static int open_fourxm_file(demux_fourxm_t *fourxm) { free(header); return 0; } - current_track = LE_32(&header[i + 8]); + current_track = _X_LE_32(&header[i + 8]); if (current_track + 1 > fourxm->track_count) { fourxm->track_count = current_track + 1; fourxm->tracks = realloc(fourxm->tracks, @@ -211,10 +211,10 @@ static int open_fourxm_file(demux_fourxm_t *fourxm) { } } - fourxm->tracks[current_track].channels = LE_32(&header[i + 36]); - fourxm->tracks[current_track].sample_rate = LE_32(&header[i + 40]); - fourxm->tracks[current_track].bits = LE_32(&header[i + 44]); - audio_type = LE_32(&header[i + 12]); + fourxm->tracks[current_track].channels = _X_LE_32(&header[i + 36]); + fourxm->tracks[current_track].sample_rate = _X_LE_32(&header[i + 40]); + fourxm->tracks[current_track].bits = _X_LE_32(&header[i + 44]); + audio_type = _X_LE_32(&header[i + 12]); if (audio_type == 0) fourxm->tracks[current_track].audio_type = BUF_AUDIO_LPCM_LE; else if (audio_type == 1) @@ -253,8 +253,8 @@ static int demux_fourxm_send_chunk(demux_plugin_t *this_gen) { return this->status; } - fourcc_tag = LE_32(&header[0]); - size = LE_32(&header[4]); + fourcc_tag = _X_LE_32(&header[0]); + size = _X_LE_32(&header[4]); switch (fourcc_tag) { @@ -314,8 +314,8 @@ static int demux_fourxm_send_chunk(demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; return this->status; } - current_track = LE_32(&header[0]); -// size = LE_32(&header[4]); + current_track = _X_LE_32(&header[0]); +// size = _X_LE_32(&header[4]); if (current_track >= this->track_count) { lprintf ("bad audio track number (%d >= %d)\n", diff --git a/src/demuxers/demux_aac.c b/src/demuxers/demux_aac.c index 1775a4e0e..1a89cb328 100644 --- a/src/demuxers/demux_aac.c +++ b/src/demuxers/demux_aac.c @@ -84,7 +84,7 @@ static int open_aac_file(demux_aac_t *this) { /* Check if there's an ID3v2 tag at the start */ if ( id3v2_istag(peak) ) { - id3size = BE_32_synchsafe(&peak[6]); + id3size = _X_BE_32_synchsafe(&peak[6]); this->input->seek(this->input, 4, SEEK_SET); diff --git a/src/demuxers/demux_ac3.c b/src/demuxers/demux_ac3.c index bb4bc8b4e..ce33ab3c8 100644 --- a/src/demuxers/demux_ac3.c +++ b/src/demuxers/demux_ac3.c @@ -178,10 +178,10 @@ static int open_ac3_file(demux_ac3_t *this) { lprintf("looks like a cd audio wav file\n"); /* Find the data chunk */ - offset = 20 + LE_32(&peak[16]); + offset = 20 + _X_LE_32(&peak[16]); while (offset < peak_size-8) { - unsigned int chunk_tag = LE_32(&peak[offset]); - unsigned int chunk_size = LE_32(&peak[offset+4]); + unsigned int chunk_tag = _X_LE_32(&peak[offset]); + unsigned int chunk_size = _X_LE_32(&peak[offset+4]); if (chunk_tag == DATA_TAG) { offset += 8; diff --git a/src/demuxers/demux_aiff.c b/src/demuxers/demux_aiff.c index f88c58572..2039a3958 100644 --- a/src/demuxers/demux_aiff.c +++ b/src/demuxers/demux_aiff.c @@ -96,8 +96,8 @@ static int open_aiff_file(demux_aiff_t *this) { return 0; /* check the signature */ - if ((BE_32(&signature[0]) != FORM_TAG) || - (BE_32(&signature[8]) != AIFF_TAG)) + if ((_X_BE_32(&signature[0]) != FORM_TAG) || + (_X_BE_32(&signature[8]) != AIFF_TAG)) return 0; /* file is qualified; skip over the header bytes in the stream */ @@ -118,8 +118,8 @@ static int open_aiff_file(demux_aiff_t *this) { this->status = DEMUX_FINISHED; return 0; } - chunk_type = BE_32(&preamble[0]); - chunk_size = BE_32(&preamble[4]); + chunk_type = _X_BE_32(&preamble[0]); + chunk_size = _X_BE_32(&preamble[4]); if (chunk_size > sizeof(buffer) / sizeof(buffer[0])) { /* the chunk is too large to fit in the buffer -> this cannot be an aiff chunk */ @@ -134,10 +134,10 @@ static int open_aiff_file(demux_aiff_t *this) { return 0; } - this->audio_channels = BE_16(&buffer[0]); - this->audio_frames = BE_32(&buffer[2]); - this->audio_bits = BE_16(&buffer[6]); - this->audio_sample_rate = BE_16(&buffer[0x0A]); + this->audio_channels = _X_BE_16(&buffer[0]); + this->audio_frames = _X_BE_32(&buffer[2]); + this->audio_bits = _X_BE_16(&buffer[6]); + this->audio_sample_rate = _X_BE_16(&buffer[0x0A]); this->audio_bytes_per_second = this->audio_channels * (this->audio_bits / 8) * this->audio_sample_rate; diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index 65838138f..62e245666 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.c @@ -201,7 +201,7 @@ static uint16_t get_le16 (demux_asf_t *this) { this->status = DEMUX_FINISHED; } - return LE_16(buf); + return _X_LE_16(buf); } static uint32_t get_le32 (demux_asf_t *this) { @@ -218,7 +218,7 @@ static uint32_t get_le32 (demux_asf_t *this) { this->status = DEMUX_FINISHED; } - return LE_32(buf); + return _X_LE_32(buf); } static uint64_t get_le64 (demux_asf_t *this) { @@ -233,7 +233,7 @@ static uint64_t get_le64 (demux_asf_t *this) { this->status = DEMUX_FINISHED; } - return LE_64(buf); + return _X_LE_64(buf); } static int get_guid_id (demux_asf_t *this, GUID *g) { @@ -483,10 +483,10 @@ static int asf_read_header (demux_asf_t *this) { uint16_t bmiheader_size; xine_bmiheader *bmiheader; - width = LE_32(asf_stream->private_data); - height = LE_32(asf_stream->private_data + 4); + width = _X_LE_32(asf_stream->private_data); + height = _X_LE_32(asf_stream->private_data + 4); /* there is one unknown byte between height and the bmiheader size */ - bmiheader_size = LE_16(asf_stream->private_data + 9); + bmiheader_size = _X_LE_16(asf_stream->private_data + 9); /* FIXME: bmiheader_size must be >= sizeof(xine_bmiheader) */ @@ -935,9 +935,9 @@ static int asf_parse_packet_ecd(demux_asf_t *this, uint32_t *p_hdr_size) { return 1; } *p_hdr_size += 15; - guid->Data1 = LE_32(buf); - guid->Data2 = LE_16(buf + 4); - guid->Data3 = LE_16(buf + 6); + guid->Data1 = _X_LE_32(buf); + guid->Data2 = _X_LE_16(buf + 4); + guid->Data3 = _X_LE_16(buf + 6); if (get_guid_id(this, guid) == GUID_ASF_HEADER) { lprintf("new asf header detected\n"); _x_demux_control_end(this->stream, 0); diff --git a/src/demuxers/demux_aud.c b/src/demuxers/demux_aud.c index ea57a6939..8604ea317 100644 --- a/src/demuxers/demux_aud.c +++ b/src/demuxers/demux_aud.c @@ -97,7 +97,7 @@ static int open_aud_file(demux_aud_t *this) { * of numbers. There is a 80002/16777216 = 0.48% chance of a false * positive. */ - this->audio_samplerate = LE_16(&header[0]); + this->audio_samplerate = _X_LE_16(&header[0]); if ((this->audio_samplerate < 8000) || (this->audio_samplerate > 48000)) return 0; @@ -145,12 +145,12 @@ static int demux_aud_send_chunk(demux_plugin_t *this_gen) { } /* validate the chunk */ - if (LE_32(&chunk_preamble[4]) != 0x0000DEAF) { + if (_X_LE_32(&chunk_preamble[4]) != 0x0000DEAF) { this->status = DEMUX_FINISHED; return this->status; } - chunk_size = LE_16(&chunk_preamble[0]); + chunk_size = _X_LE_16(&chunk_preamble[0]); current_file_pos = this->input->get_current_pos(this->input) - this->data_start; diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index fe324c2f4..960d396f3 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.c @@ -333,13 +333,13 @@ typedef struct { /* bit 31 denotes a keyframe */ static uint32_t odml_len (unsigned char *str) { - return LE_32(str) & 0x7fffffff; + return _X_LE_32(str) & 0x7fffffff; } /* if bit 31 is 0, its a keyframe */ static uint32_t odml_key (unsigned char *str) { - return (LE_32(str) & 0x80000000)?0:0x10; + return (_X_LE_32(str) & 0x80000000)?0:0x10; } static void check_newpts (demux_avi_t *this, int64_t pts, int video) { @@ -554,7 +554,7 @@ static int idx_grow(demux_avi_t *this, int (*stopper)(demux_avi_t *, void *), continue; } - chunk_len = LE_32(data + 4); + chunk_len = _X_LE_32(data + 4); this->idx_grow.nexttagoffset += PAD_EVEN(chunk_len + AVI_HEADER_SIZE); @@ -777,7 +777,7 @@ static avi_t *AVI_init(demux_avi_t *this) { break; /* We assume it's EOF */ } - n = LE_32(data + 4); + n = _X_LE_32(data + 4); n = PAD_EVEN(n); next_chunk = this->idx_grow.nexttagoffset + 8 + n; @@ -850,7 +850,7 @@ static avi_t *AVI_init(demux_avi_t *this) { continue; } - n = LE_32(hdrl_data + i + 4); + n = _X_LE_32(hdrl_data + i + 4); n = PAD_EVEN(n); /* Interpret the tag and its args */ @@ -862,10 +862,10 @@ static avi_t *AVI_init(demux_avi_t *this) { if(strncasecmp(hdrl_data + i, "vids", 4) == 0 && !vids_strh_seen) { AVI->compressor = *(uint32_t *) (hdrl_data + i + 4); - AVI->dwInitialFrames = LE_32(hdrl_data + i + 16); - AVI->dwScale = LE_32(hdrl_data + i + 20); - AVI->dwRate = LE_32(hdrl_data + i + 24); - AVI->dwStart = LE_32(hdrl_data + i + 28); + AVI->dwInitialFrames = _X_LE_32(hdrl_data + i + 16); + AVI->dwScale = _X_LE_32(hdrl_data + i + 20); + AVI->dwRate = _X_LE_32(hdrl_data + i + 24); + AVI->dwStart = _X_LE_32(hdrl_data + i + 28); if(AVI->dwScale!=0) AVI->fps = (double)AVI->dwRate/(double)AVI->dwScale; @@ -890,15 +890,15 @@ static avi_t *AVI_init(demux_avi_t *this) { AVI->audio[AVI->n_audio] = a; a->audio_strn = num_stream; - a->dwInitialFrames = LE_32(hdrl_data + i + 16); - a->dwScale = LE_32(hdrl_data + i + 20); - a->dwRate = LE_32(hdrl_data + i + 24); - a->dwStart = LE_32(hdrl_data + i + 28); + a->dwInitialFrames = _X_LE_32(hdrl_data + i + 16); + a->dwScale = _X_LE_32(hdrl_data + i + 20); + a->dwRate = _X_LE_32(hdrl_data + i + 24); + a->dwStart = _X_LE_32(hdrl_data + i + 28); lprintf("dwScale=%d, dwRate=%d, dwInitialFrames=%d, dwStart=%d, num_stream=%d\n", a->dwScale, a->dwRate, a->dwInitialFrames, a->dwStart, num_stream); - a->dwSampleSize = LE_32(hdrl_data + i + 44); + a->dwSampleSize = _X_LE_32(hdrl_data + i + 44); a->audio_tot = 0; auds_strh_seen = 1; lprintf("audio stream header, num_stream=%d\n", num_stream); @@ -913,7 +913,7 @@ static avi_t *AVI_init(demux_avi_t *this) { num_stream++; } else if(strncasecmp(hdrl_data+i,"dmlh",4) == 0) { - AVI->total_frames = LE_32(hdrl_data+i+8); + AVI->total_frames = _X_LE_32(hdrl_data+i+8); #ifdef DEBUG_ODML lprintf( "AVI: real number of frames %d\n", AVI->total_frames); #endif @@ -921,7 +921,7 @@ static avi_t *AVI_init(demux_avi_t *this) { } else if(strncasecmp(hdrl_data + i, "strf", 4) == 0) { i += 4; - strf_size = LE_32(hdrl_data + i); + strf_size = _X_LE_32(hdrl_data + i); i += 4; if(lasttag == 1) { /* lprintf ("size : %d\n",sizeof(AVI->bih)); */ @@ -1000,11 +1000,11 @@ static avi_t *AVI_init(demux_avi_t *this) { superindex = (avisuperindex_chunk *) malloc (sizeof (avisuperindex_chunk)); a = hdrl_data + i; memcpy (superindex->fcc, a, 4); a += 4; - superindex->dwSize = LE_32(a); a += 4; - superindex->wLongsPerEntry = LE_16(a); a += 2; + superindex->dwSize = _X_LE_32(a); a += 4; + superindex->wLongsPerEntry = _X_LE_16(a); a += 2; superindex->bIndexSubType = *a; a += 1; superindex->bIndexType = *a; a += 1; - superindex->nEntriesInUse = LE_32(a); a += 4; + superindex->nEntriesInUse = _X_LE_32(a); a += 4; memcpy (superindex->dwChunkId, a, 4); a += 4; #ifdef DEBUG_ODML @@ -1038,9 +1038,9 @@ static avi_t *AVI_init(demux_avi_t *this) { superindex->aIndex = malloc (superindex->nEntriesInUse * sizeof (avisuperindex_entry)); /* position of ix## chunks */ for (j = 0; j < superindex->nEntriesInUse; ++j) { - superindex->aIndex[j].qwOffset = LE_64 (a); a += 8; - superindex->aIndex[j].dwSize = LE_32 (a); a += 4; - superindex->aIndex[j].dwDuration = LE_32 (a); a += 4; + superindex->aIndex[j].qwOffset = _X_LE_64 (a); a += 8; + superindex->aIndex[j].dwSize = _X_LE_32 (a); a += 4; + superindex->aIndex[j].dwDuration = _X_LE_32 (a); a += 4; #ifdef DEBUG_ODML printf("[%d] 0x%llx 0x%x %u\n", j, (uint64_t)superindex->aIndex[j].qwOffset, @@ -1148,21 +1148,21 @@ static avi_t *AVI_init(demux_avi_t *this) { ERR_EXIT(AVI_ERR_NO_VIDS); } - pos = LE_32(AVI->idx[i] + 8); - len = LE_32(AVI->idx[i] + 12); + pos = _X_LE_32(AVI->idx[i] + 8); + len = _X_LE_32(AVI->idx[i] + 12); this->input->seek(this->input, pos, SEEK_SET); if(this->input->read(this->input, data, 8) != 8) ERR_EXIT(AVI_ERR_READ) ; - if( (strncasecmp(data, AVI->idx[i], 4) == 0) && (LE_32(data + 4) == len) ) { + if( (strncasecmp(data, AVI->idx[i], 4) == 0) && (_X_LE_32(data + 4) == len) ) { idx_type = 1; /* Index from start of file */ } else { this->input->seek(this->input, pos + AVI->movi_start - 4, SEEK_SET); if(this->input->read(this->input, data, 8) != 8) ERR_EXIT(AVI_ERR_READ) ; - if( strncasecmp(data,AVI->idx[i], 4) == 0 && LE_32(data + 4) == len ) { + if( strncasecmp(data,AVI->idx[i], 4) == 0 && _X_LE_32(data + 4) == len ) { idx_type = 2; /* Index from start of movi list */ } } @@ -1183,9 +1183,9 @@ static avi_t *AVI_init(demux_avi_t *this) { if((AVI->idx[i][0] == AVI->video_tag[0]) && (AVI->idx[i][1] == AVI->video_tag[1])) { - off_t pos = LE_32(AVI->idx[i] + 8) + ioff; - uint32_t len = LE_32(AVI->idx[i] + 12); - uint32_t flags = LE_32(AVI->idx[i] + 4); + off_t pos = _X_LE_32(AVI->idx[i] + 8) + ioff; + uint32_t len = _X_LE_32(AVI->idx[i] + 12); + uint32_t flags = _X_LE_32(AVI->idx[i] + 4); if (video_index_append(AVI, pos, len, flags) == -1) { ERR_EXIT(AVI_ERR_NO_MEM) ; @@ -1196,8 +1196,8 @@ static avi_t *AVI_init(demux_avi_t *this) { if((AVI->idx[i][0] == audio->audio_tag[0]) && (AVI->idx[i][1] == audio->audio_tag[1])) { - off_t pos = LE_32(AVI->idx[i] + 8) + ioff; - uint32_t len = LE_32(AVI->idx[i] + 12); + off_t pos = _X_LE_32(AVI->idx[i] + 8) + ioff; + uint32_t len = _X_LE_32(AVI->idx[i] + 12); /* VBR streams (hack from mplayer) */ if (audio->wavex && audio->wavex->nBlockAlign) { @@ -1255,11 +1255,11 @@ static avi_t *AVI_init(demux_avi_t *this) { continue; } - nrEntries = LE_32(en + 12); + nrEntries = _X_LE_32(en + 12); #ifdef DEBUG_ODML printf("[%d:0] Video nrEntries %ld\n", j, (long)nrEntries); #endif - offset = LE_64(en + 20); + offset = _X_LE_64(en + 20); /* skip header */ en += hdrl_len; @@ -1270,7 +1270,7 @@ static avi_t *AVI_init(demux_avi_t *this) { uint32_t len; uint32_t flags; - pos = offset + LE_32(en); en += 4; + pos = offset + _X_LE_32(en); en += 4; len = odml_len(en); flags = odml_key(en); en += 4; video_index_append(AVI, pos, len, flags); @@ -1325,11 +1325,11 @@ static avi_t *AVI_init(demux_avi_t *this) { continue; } - nrEntries = LE_32(en + 12); + nrEntries = _X_LE_32(en + 12); #ifdef DEBUG_ODML /*printf("[%d:%d] Audio nrEntries %ld\n", j, audtr, nrEntries); */ #endif - offset = LE_64(en + 20); + offset = _X_LE_64(en + 20); /* skip header */ en += hdrl_len; @@ -1340,7 +1340,7 @@ static avi_t *AVI_init(demux_avi_t *this) { off_t pos; uint32_t len; - pos = offset + LE_32(en); en += 4; + pos = offset + _X_LE_32(en); en += 4; len = odml_len(en); en += 4; /* VBR streams (hack from mplayer) */ @@ -1647,7 +1647,7 @@ static int get_chunk_header(demux_avi_t *this, uint32_t *len, int *audio_stream) while (1) { if (this->input->read(this->input, data, AVI_HEADER_SIZE) != AVI_HEADER_SIZE) break; - *len = LE_32(data + 4); + *len = _X_LE_32(data + 4); lprintf("header: %c%c%c%c, pos=%" PRIdMAX ", len=%u\n", data[0], data[1], data[2], data[3], diff --git a/src/demuxers/demux_dts.c b/src/demuxers/demux_dts.c index 8f6f9c66e..0fe758e70 100644 --- a/src/demuxers/demux_dts.c +++ b/src/demuxers/demux_dts.c @@ -128,10 +128,10 @@ static int open_dts_file(demux_dts_t *this) { lprintf("looks like a cd audio wav file\n"); /* Find the data chunk */ - offset = 20 + LE_32(&peak[16]); + offset = 20 + _X_LE_32(&peak[16]); while (offset < peak_size-8) { - unsigned int chunk_tag = LE_32(&peak[offset]); - unsigned int chunk_size = LE_32(&peak[offset+4]); + unsigned int chunk_tag = _X_LE_32(&peak[offset]); + unsigned int chunk_size = _X_LE_32(&peak[offset+4]); if (chunk_tag == DATA_TAG) { offset += 8; diff --git a/src/demuxers/demux_eawve.c b/src/demuxers/demux_eawve.c index 67c087208..c1718d803 100644 --- a/src/demuxers/demux_eawve.c +++ b/src/demuxers/demux_eawve.c @@ -247,7 +247,7 @@ static int demux_eawve_send_chunk(demux_eawve_t *this){ if (first_segment) { buf->decoder_flags |= BUF_FLAG_FRAME_START; - this->sample_counter += LE_32(buf->content); + this->sample_counter += _X_LE_32(buf->content); first_segment = 0; } diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index d3cedc0e1..3a88ddfab 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -152,7 +152,7 @@ static int open_film_file(demux_film_t *film) { film->input->seek(film->input, 16, SEEK_SET); /* header size = header size - 16-byte FILM signature */ - film_header_size = BE_32(&scratch[4]) - 16; + film_header_size = _X_BE_32(&scratch[4]) - 16; film_header = xine_xmalloc(film_header_size); if (!film_header) return 0; @@ -180,8 +180,8 @@ static int open_film_file(demux_film_t *film) { /* traverse the FILM header */ i = 0; while (i < film_header_size) { - chunk_type = BE_32(&film_header[i]); - chunk_size = BE_32(&film_header[i + 4]); + chunk_type = _X_BE_32(&film_header[i]); + chunk_size = _X_BE_32(&film_header[i + 4]); /* sanity check the chunk size */ if (i + chunk_size > film_header_size) { @@ -197,8 +197,8 @@ static int open_film_file(demux_film_t *film) { llprintf(DEBUG_FILM_LOAD, "parsing FDSC chunk\n"); /* always fetch the video information */ - film->bih.biWidth = BE_32(&film_header[i + 16]); - film->bih.biHeight = BE_32(&film_header[i + 12]); + film->bih.biWidth = _X_BE_32(&film_header[i + 16]); + film->bih.biHeight = _X_BE_32(&film_header[i + 12]); film->video_codec = *(uint32_t *)&film_header[i + 8]; film->video_type = _x_fourcc_to_buf_video(*(uint32_t *)&film_header[i + 8]); @@ -209,7 +209,7 @@ static int open_film_file(demux_film_t *film) { if (chunk_size == 32) { film->audio_channels = film_header[21]; film->audio_bits = film_header[22]; - film->sample_rate = BE_16(&film_header[24]); + film->sample_rate = _X_BE_16(&film_header[24]); } else { /* If the FDSC chunk is not 32 bytes long, this is an early FILM * file. Make a few assumptions about the audio parms based on the @@ -255,21 +255,21 @@ static int open_film_file(demux_film_t *film) { /* load the sample table */ if (film->sample_table) free(film->sample_table); - film->frequency = BE_32(&film_header[i + 8]); - film->sample_count = BE_32(&film_header[i + 12]); + film->frequency = _X_BE_32(&film_header[i + 8]); + film->sample_count = _X_BE_32(&film_header[i + 12]); film->sample_table = xine_xmalloc(film->sample_count * sizeof(film_sample_t)); for (j = 0; j < film->sample_count; j++) { film->sample_table[j].sample_offset = - BE_32(&film_header[(i + 16) + j * 16 + 0]) + _X_BE_32(&film_header[(i + 16) + j * 16 + 0]) + film_header_size + 16; film->sample_table[j].sample_size = - BE_32(&film_header[(i + 16) + j * 16 + 4]); + _X_BE_32(&film_header[(i + 16) + j * 16 + 4]); pts = - BE_32(&film_header[(i + 16) + j * 16 + 8]); + _X_BE_32(&film_header[(i + 16) + j * 16 + 8]); film->sample_table[j].duration = - BE_32(&film_header[(i + 16) + j * 16 + 12]); + _X_BE_32(&film_header[(i + 16) + j * 16 + 12]); if (pts == 0xFFFFFFFF) { diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index 9b4914b5e..c1dedb6ce 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -140,11 +140,11 @@ static int open_flac_file(demux_flac_t *flac) { flac->streaminfo + sizeof(xine_waveformatex), FLAC_STREAMINFO_SIZE) != FLAC_STREAMINFO_SIZE) return 0; - flac->sample_rate = BE_32(&streaminfo[10]); + flac->sample_rate = _X_BE_32(&streaminfo[10]); flac->channels = ((flac->sample_rate >> 9) & 0x07) + 1; flac->bits_per_sample = ((flac->sample_rate >> 4) & 0x1F) + 1; flac->sample_rate >>= 12; - flac->total_samples = BE_64(&streaminfo[10]) & UINT64_C(0x0FFFFFFFFF); /* 36 bits */ + flac->total_samples = _X_BE_64(&streaminfo[10]) & UINT64_C(0x0FFFFFFFFF); /* 36 bits */ lprintf ("%d Hz, %d bits, %d channels, %"PRId64" total samples\n", flac->sample_rate, flac->bits_per_sample, flac->channels, flac->total_samples); @@ -171,10 +171,10 @@ static int open_flac_file(demux_flac_t *flac) { for (i = 0; i < flac->seekpoint_count; i++) { if (flac->input->read(flac->input, buffer, FLAC_SEEKPOINT_SIZE) != FLAC_SEEKPOINT_SIZE) return 0; - flac->seekpoints[i].sample_number = BE_64(&buffer[0]); + flac->seekpoints[i].sample_number = _X_BE_64(&buffer[0]); lprintf (" %d: sample %"PRId64", ", i, flac->seekpoints[i].sample_number); - flac->seekpoints[i].offset = BE_64(&buffer[8]); - flac->seekpoints[i].size = BE_16(&buffer[16]); + flac->seekpoints[i].offset = _X_BE_64(&buffer[8]); + flac->seekpoints[i].size = _X_BE_16(&buffer[16]); lprintf ("@ 0x%"PRIX64", size = %d bytes, ", flac->seekpoints[i].offset, flac->seekpoints[i].size); flac->seekpoints[i].pts = flac->seekpoints[i].sample_number; @@ -202,15 +202,15 @@ static int open_flac_file(demux_flac_t *flac) { int tracknumber = -1; int tracktotal = -1; - length = LE_32(ptr); + length = _X_LE_32(ptr); ptr += 4 + length; - user_comment_list_length = LE_32(ptr); + user_comment_list_length = _X_LE_32(ptr); ptr += 4; cn = 0; for (; cn < user_comment_list_length; cn++) { - length = LE_32(ptr); + length = _X_LE_32(ptr); ptr += 4; comment = (char*) ptr; diff --git a/src/demuxers/demux_fli.c b/src/demuxers/demux_fli.c index c9cc26cf1..921f08294 100644 --- a/src/demuxers/demux_fli.c +++ b/src/demuxers/demux_fli.c @@ -86,7 +86,7 @@ static int open_fli_file(demux_fli_t *this) { return 0; /* validate the file */ - this->magic_number = LE_16(&this->fli_header[4]); + this->magic_number = _X_LE_16(&this->fli_header[4]); if ((this->magic_number != FLI_FILE_MAGIC_1) && (this->magic_number != FLI_FILE_MAGIC_2)) return 0; @@ -95,7 +95,7 @@ static int open_fli_file(demux_fli_t *this) { this->input->seek(this->input, FLI_HEADER_SIZE, SEEK_SET); /* check if this is a special FLI file from Magic Carpet game */ - if (LE_16(&this->fli_header[16]) == FLI_CHUNK_MAGIC_1) { + if (_X_LE_16(&this->fli_header[16]) == FLI_CHUNK_MAGIC_1) { /* if the input is non-seekable, do not bother with playing the * special file type */ if (INPUT_IS_SEEKABLE(this->input)) { @@ -108,11 +108,11 @@ static int open_fli_file(demux_fli_t *this) { this->magic_number = FLI_FILE_MAGIC_3; } - this->frame_count = LE_16(&this->fli_header[6]); - this->bih.biWidth = LE_16(&this->fli_header[8]); - this->bih.biHeight = LE_16(&this->fli_header[10]); + this->frame_count = _X_LE_16(&this->fli_header[6]); + this->bih.biWidth = _X_LE_16(&this->fli_header[8]); + this->bih.biHeight = _X_LE_16(&this->fli_header[10]); - this->speed = LE_32(&this->fli_header[16]); + this->speed = _X_LE_32(&this->fli_header[16]); if (this->magic_number == FLI_FILE_MAGIC_1) { /* * in this case, the speed (n) is number of 1/70s ticks between frames: @@ -169,8 +169,8 @@ static int demux_fli_send_chunk(demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; return this->status; } - chunk_size = LE_32(&fli_buf[0]); - chunk_magic = LE_16(&fli_buf[4]); + chunk_size = _X_LE_32(&fli_buf[0]); + chunk_magic = _X_LE_16(&fli_buf[4]); if ((chunk_magic == FLI_CHUNK_MAGIC_1) || (chunk_magic == FLI_CHUNK_MAGIC_2)) { diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 0588b408e..598f7d95e 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -180,7 +180,7 @@ static int open_flv_file(demux_flv_t *this) { return 0; } - this->start = BE_32(&buffer[5]); + this->start = _X_BE_32(&buffer[5]); this->size = this->input->get_length(this->input); if (INPUT_IS_SEEKABLE(this->input)) @@ -196,7 +196,7 @@ static int open_flv_file(demux_flv_t *this) { #define BE_F64(buf) ({\ union { uint64_t q; double d; } _tmp;\ - _tmp.q = BE_64(buf);\ + _tmp.q = _X_BE_64(buf);\ _tmp.d;\ })\ @@ -244,11 +244,11 @@ static int parse_flv_var(demux_flv_t *this, break; case FLV_DATA_TYPE_STRING: lprintf(" got string (%s)\n", tmp+2); - len = BE_16(tmp); + len = _X_BE_16(tmp); tmp += len + 2; break; case FLV_DATA_TYPE_OBJECT: - while ((len = BE_16(tmp)) && tmp < end) { + while ((len = _X_BE_16(tmp)) && tmp < end) { lprintf(" got object var (%s)\n", tmp+2); str = tmp + 2; tmp += len + 2; @@ -259,12 +259,12 @@ static int parse_flv_var(demux_flv_t *this, return 0; break; case FLV_DATA_TYPE_ECMARRAY: - lprintf(" got EMCA array (%d indices)\n", BE_32(tmp)); - num = BE_32(tmp); + lprintf(" got EMCA array (%d indices)\n", _X_BE_32(tmp)); + num = _X_BE_32(tmp); tmp += 4; while (num-- && tmp < end) { lprintf(" got array key (%s)\n", tmp+2); - len = BE_16(tmp); + len = _X_BE_16(tmp); str = tmp + 2; tmp += len + 2; len = parse_flv_var(this, tmp, end-tmp, str, len); @@ -272,8 +272,8 @@ static int parse_flv_var(demux_flv_t *this, } break; case FLV_DATA_TYPE_ARRAY: - lprintf(" got array (%d indices)\n", BE_32(tmp)); - num = BE_32(tmp); + lprintf(" got array (%d indices)\n", _X_BE_32(tmp)); + num = _X_BE_32(tmp); tmp += 4; if (key && keylen == 5 && !strncmp(key, "times", 5)) { if (this->index) @@ -307,7 +307,7 @@ static int parse_flv_var(demux_flv_t *this, } break; case FLV_DATA_TYPE_DATE: - lprintf(" got date (%"PRId64", %d)\n", BE_64(tmp), BE_16(tmp+8)); + lprintf(" got date (%"PRId64", %d)\n", _X_BE_64(tmp), _X_BE_16(tmp+8)); tmp += 10; break; default: @@ -359,8 +359,8 @@ static int read_flv_packet(demux_flv_t *this) { } tag_type = buffer[0]; - remaining_bytes = BE_24(&buffer[1]); - pts = BE_24(&buffer[4]) | (buffer[7] << 24); + remaining_bytes = _X_BE_24(&buffer[1]); + pts = _X_BE_24(&buffer[4]) | (buffer[7] << 24); lprintf(" tag_type = 0x%02X, 0x%X bytes, pts %u\n", tag_type, remaining_bytes, pts/90); @@ -577,10 +577,10 @@ static void seek_flv_file(demux_flv_t *this, int seek_pts) { break; } - ptag_size = BE_32(&buffer[0]); + ptag_size = _X_BE_32(&buffer[0]); tag_type = buffer[4]; - data_size = BE_24(&buffer[5]); - pts = BE_24(&buffer[8]) | (buffer[11] << 24); + data_size = _X_BE_24(&buffer[5]); + pts = _X_BE_24(&buffer[8]) | (buffer[11] << 24); if (do_rewind) { if (!ptag_size) break; /* beginning of movie */ diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c index 461771425..f14e36185 100644 --- a/src/demuxers/demux_idcin.c +++ b/src/demuxers/demux_idcin.c @@ -191,7 +191,7 @@ static int demux_idcin_send_chunk(demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; return this->status; } - remaining_sample_bytes = LE_32(&preamble[0]) - 4; + remaining_sample_bytes = _X_LE_32(&preamble[0]) - 4; lprintf("dispatching %d video bytes\n", remaining_sample_bytes); while (remaining_sample_bytes) { @@ -293,28 +293,28 @@ static int open_idcin_file(demux_idcin_t *this) { */ /* check the width */ - bih->biWidth = LE_32(&header[0]); + bih->biWidth = _X_LE_32(&header[0]); if ((bih->biWidth == 0) || (bih->biWidth > 1024)) return 0; /* check the height */ - bih->biHeight = LE_32(&header[4]); + bih->biHeight = _X_LE_32(&header[4]); if ((bih->biHeight == 0) || (bih->biHeight > 1024)) return 0; /* check the audio sample rate */ - this->wave.nSamplesPerSec = LE_32(&header[8]); + this->wave.nSamplesPerSec = _X_LE_32(&header[8]); if ((this->wave.nSamplesPerSec != 0) && ((this->wave.nSamplesPerSec < 8000) || (this->wave.nSamplesPerSec > 48000))) return 0; /* check the audio bytes/sample */ - this->wave.wBitsPerSample = LE_32(&header[12]) * 8; + this->wave.wBitsPerSample = _X_LE_32(&header[12]) * 8; if (this->wave.wBitsPerSample > 16) return 0; /* check the audio channels */ - this->wave.nChannels = LE_32(&header[16]); + this->wave.nChannels = _X_LE_32(&header[16]); if (this->wave.nChannels > 2) return 0; diff --git a/src/demuxers/demux_iff.c b/src/demuxers/demux_iff.c index 7ca851718..7323c061d 100644 --- a/src/demuxers/demux_iff.c +++ b/src/demuxers/demux_iff.c @@ -187,8 +187,8 @@ static int read_iff_chunk(demux_iff_t *this) { if (this->input->read(this->input, &signature[7], 1) != 1) return 0; } - junk_size = BE_32(&signature[4]); - switch( BE_32(&signature[0]) ) { + junk_size = _X_BE_32(&signature[4]); + switch( _X_BE_32(&signature[0]) ) { case IFF_CMAP_CHUNK: case IFF_BODY_CHUNK: case IFF_DLTA_CHUNK: @@ -206,19 +206,19 @@ static int read_iff_chunk(demux_iff_t *this) { break; } - switch( BE_32(&signature[0]) ) { + switch( _X_BE_32(&signature[0]) ) { case IFF_FORM_CHUNK: if (this->input->read(this->input, buffer, 4) != 4) return 0; - this->iff_sub_type = BE_32(&buffer[0]); + this->iff_sub_type = _X_BE_32(&buffer[0]); break; case IFF_VHDR_CHUNK: if( this->vhdr == NULL ) this->vhdr = (Voice8Header *)xine_xmalloc(sizeof(Voice8Header)); - this->vhdr->oneShotHiSamples = BE_32(&buffer[0]); - this->vhdr->repeatHiSamples = BE_32(&buffer[4]); - this->vhdr->samplesPerHiCycle = BE_32(&buffer[8]); - this->vhdr->samplesPerSec = BE_16(&buffer[12]); + this->vhdr->oneShotHiSamples = _X_BE_32(&buffer[0]); + this->vhdr->repeatHiSamples = _X_BE_32(&buffer[4]); + this->vhdr->samplesPerHiCycle = _X_BE_32(&buffer[8]); + this->vhdr->samplesPerSec = _X_BE_16(&buffer[12]); this->vhdr->ctOctave = buffer[14]; this->vhdr->sCompression = buffer[15]; this->audio_channels = 1; @@ -237,7 +237,7 @@ static int read_iff_chunk(demux_iff_t *this) { return 0; break; } - this->vhdr->volume = BE_32(&buffer[16]); + this->vhdr->volume = _X_BE_32(&buffer[16]); if (this->vhdr->volume > max_volume) this->vhdr->volume = max_volume; xprintf (this->stream->xine, XINE_VERBOSITY_LOG, "vhdr->oneShotHiSamples %d\n", @@ -300,7 +300,7 @@ static int read_iff_chunk(demux_iff_t *this) { /* not yet implemented */ break; case IFF_CHAN_CHUNK: - this->chan_settings = BE_32(&buffer[0]); + this->chan_settings = _X_BE_32(&buffer[0]); switch( this->chan_settings ) { case STEREO: this->audio_volume_left = this->vhdr->volume; @@ -325,7 +325,7 @@ static int read_iff_chunk(demux_iff_t *this) { break; case IFF_PAN_CHUNK: this->chan_settings = PAN; - this->pan_sposition = BE_32(&buffer[0]); + this->pan_sposition = _X_BE_32(&buffer[0]); this->audio_channels = 2; this->audio_volume_left = this->vhdr->volume / (max_volume / this->pan_sposition); this->audio_volume_right = this->vhdr->volume - this->audio_volume_left; @@ -333,19 +333,19 @@ static int read_iff_chunk(demux_iff_t *this) { case IFF_BMHD_CHUNK: if( this->bmhd == NULL ) this->bmhd = (BitMapHeader *)xine_xmalloc(sizeof(BitMapHeader)); - this->bmhd->w = BE_16(&buffer[0]); - this->bmhd->h = BE_16(&buffer[2]); - this->bmhd->x = BE_16(&buffer[4]); - this->bmhd->y = BE_16(&buffer[6]); + this->bmhd->w = _X_BE_16(&buffer[0]); + this->bmhd->h = _X_BE_16(&buffer[2]); + this->bmhd->x = _X_BE_16(&buffer[4]); + this->bmhd->y = _X_BE_16(&buffer[6]); this->bmhd->nplanes = buffer[8]; this->bmhd->masking = buffer[9]; this->bmhd->compression = buffer[10]; this->bmhd->pad1 = buffer[11]; - this->bmhd->transparentColor = BE_16(&buffer[12]); + this->bmhd->transparentColor = _X_BE_16(&buffer[12]); this->bmhd->xaspect = buffer[14]; this->bmhd->yaspect = buffer[15]; - this->bmhd->pagewidth = BE_16(&buffer[16]); - this->bmhd->pageheight = BE_16(&buffer[18]); + this->bmhd->pagewidth = _X_BE_16(&buffer[16]); + this->bmhd->pageheight = _X_BE_16(&buffer[18]); if (this->bmhd->w > 0) this->bih.biWidth = this->bmhd->w; @@ -409,25 +409,25 @@ static int read_iff_chunk(demux_iff_t *this) { case IFF_GRAB_CHUNK: if( this->grab == NULL ) this->grab = (Point2D *)xine_xmalloc(sizeof(Point2D)); - this->grab->x = BE_16(&buffer[0]); - this->grab->y = BE_16(&buffer[2]); + this->grab->x = _X_BE_16(&buffer[0]); + this->grab->y = _X_BE_16(&buffer[2]); break; case IFF_DEST_CHUNK: if( this->dest == NULL ) this->dest = (DestMerge *)xine_xmalloc(sizeof(DestMerge)); this->dest->depth = buffer[0]; this->dest->pad1 = buffer[1]; - this->dest->plane_pick = BE_16(&buffer[2]); - this->dest->plane_onoff = BE_16(&buffer[4]); - this->dest->plane_mask = BE_16(&buffer[6]); + this->dest->plane_pick = _X_BE_16(&buffer[2]); + this->dest->plane_onoff = _X_BE_16(&buffer[4]); + this->dest->plane_mask = _X_BE_16(&buffer[6]); break; case IFF_SPRT_CHUNK: - this->sprt = BE_16(&buffer[0]); + this->sprt = _X_BE_16(&buffer[0]); break; case IFF_CAMG_CHUNK: if( this->camg == NULL ) this->camg = (CamgChunk *)xine_xmalloc(sizeof(CamgChunk)); - this->camg->view_modes = BE_32(&buffer[0]); + this->camg->view_modes = _X_BE_32(&buffer[0]); this->bih.biCompression = this->camg->view_modes; if( this->camg->view_modes & CAMG_PAL && this->video_pts_inc == 4500 ) @@ -435,9 +435,9 @@ static int read_iff_chunk(demux_iff_t *this) { break; case IFF_CRNG_CHUNK: if (this->crng_used < 256) { - this->crng[this->crng_used].pad1 = BE_16(&buffer[0]); - this->crng[this->crng_used].rate = BE_16(&buffer[2]); - this->crng[this->crng_used].active = BE_16(&buffer[4]); + this->crng[this->crng_used].pad1 = _X_BE_16(&buffer[0]); + this->crng[this->crng_used].rate = _X_BE_16(&buffer[2]); + this->crng[this->crng_used].active = _X_BE_16(&buffer[4]); this->crng[this->crng_used].low = buffer[6]; this->crng[this->crng_used].high = buffer[7]; this->crng_used++; @@ -446,33 +446,33 @@ static int read_iff_chunk(demux_iff_t *this) { case IFF_CCRT_CHUNK: if( this->ccrt == NULL ) this->ccrt = (CcrtChunk *)xine_xmalloc(sizeof(CcrtChunk)); - this->ccrt->direction = BE_16(&buffer[0]); + this->ccrt->direction = _X_BE_16(&buffer[0]); this->ccrt->start = buffer[2]; this->ccrt->end = buffer[3]; - this->ccrt->seconds = BE_32(&buffer[4]); - this->ccrt->microseconds = BE_32(&buffer[8]); - this->ccrt->pad = BE_16(&buffer[12]); + this->ccrt->seconds = _X_BE_32(&buffer[4]); + this->ccrt->microseconds = _X_BE_32(&buffer[8]); + this->ccrt->pad = _X_BE_16(&buffer[12]); break; case IFF_DPI_CHUNK: if( this->dpi == NULL ) this->dpi = (DPIHeader *)xine_xmalloc(sizeof(DPIHeader)); - this->dpi->x = BE_16(&buffer[0]); - this->dpi->y = BE_16(&buffer[0]); + this->dpi->x = _X_BE_16(&buffer[0]); + this->dpi->y = _X_BE_16(&buffer[0]); break; case IFF_ANHD_CHUNK: if( this->anhd == NULL ) this->anhd = (AnimHeader *)xine_xmalloc(sizeof(AnimHeader)); this->anhd->operation = buffer[0]; this->anhd->mask = buffer[1]; - this->anhd->w = BE_16(&buffer[2]); - this->anhd->h = BE_16(&buffer[4]); - this->anhd->x = BE_16(&buffer[6]); - this->anhd->y = BE_16(&buffer[8]); - this->anhd->abs_time = BE_32(&buffer[10]); - this->anhd->rel_time = BE_32(&buffer[14]); + this->anhd->w = _X_BE_16(&buffer[2]); + this->anhd->h = _X_BE_16(&buffer[4]); + this->anhd->x = _X_BE_16(&buffer[6]); + this->anhd->y = _X_BE_16(&buffer[8]); + this->anhd->abs_time = _X_BE_32(&buffer[10]); + this->anhd->rel_time = _X_BE_32(&buffer[14]); this->anhd->interleave = buffer[18]; this->anhd->pad0 = buffer[19]; - this->anhd->bits = BE_32(&buffer[20]); + this->anhd->bits = _X_BE_32(&buffer[20]); /* Using rel_time deaktivated, seems to be broken in most animations */ /*if( this->dpan == NULL ) this->video_pts += this->video_pts_inc * @@ -503,8 +503,8 @@ static int read_iff_chunk(demux_iff_t *this) { case IFF_DPAN_CHUNK: if( this->dpan == NULL ) this->dpan = (DPAnimChunk *)xine_xmalloc(sizeof(DPAnimChunk)); - this->dpan->version = BE_16(&buffer[0]); - this->dpan->nframes = BE_16(&buffer[2]); + this->dpan->version = _X_BE_16(&buffer[0]); + this->dpan->nframes = _X_BE_16(&buffer[2]); this->dpan->fps = buffer[4]; this->dpan->unused1 = buffer[5]; this->dpan->unused2 = buffer[6]; @@ -626,7 +626,7 @@ static int open_iff_file(demux_iff_t *this) { this->anhd = NULL; this->dpan = NULL; - this->iff_type = BE_32(&signature[8]); + this->iff_type = _X_BE_32(&signature[8]); this->iff_sub_type = this->iff_type; this->video_type = 0; @@ -647,7 +647,7 @@ static int open_iff_file(demux_iff_t *this) { this->bih.biClrImportant = 0; /* check the signature */ - if (BE_32(&signature[0]) == IFF_FORM_CHUNK) + if (_X_BE_32(&signature[0]) == IFF_FORM_CHUNK) { switch( this->iff_type ) { @@ -827,13 +827,13 @@ static int demux_iff_send_chunk(demux_plugin_t *this_gen) { } } else { for (j = 0, k = (interleave_index / 2); j < (buf->size / 2); j += this->audio_channels) { - zw_16 = BE_16(&pointer16_from[k]); + zw_16 = _X_BE_16(&pointer16_from[k]); k++; zw_rescale = zw_16; zw_rescale *= this->audio_volume_left; zw_rescale /= max_volume; zw_16 = (zw_rescale>32767) ? 32767 : ((zw_rescale<-32768) ? -32768 : zw_rescale); - pointer16_to[j] = BE_16(&zw_16); + pointer16_to[j] = _X_BE_16(&zw_16); } } } else { @@ -857,13 +857,13 @@ static int demux_iff_send_chunk(demux_plugin_t *this_gen) { } } else { for (j = 1; j < (buf->size / 2); j += this->audio_channels) { - zw_16 = BE_16(&pointer16_from[k]); + zw_16 = _X_BE_16(&pointer16_from[k]); k++; zw_rescale = zw_16; zw_rescale *= this->audio_volume_left; zw_rescale /= max_volume; zw_16 = (zw_rescale>32767) ? 32767 : ((zw_rescale<-32768) ? -32768 : zw_rescale); - pointer16_to[j] = BE_16(&zw_16); + pointer16_to[j] = _X_BE_16(&zw_16); } } } else if (this->chan_settings == LEFT) { diff --git a/src/demuxers/demux_image.c b/src/demuxers/demux_image.c index d799c2324..629299281 100644 --- a/src/demuxers/demux_image.c +++ b/src/demuxers/demux_image.c @@ -168,7 +168,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, } if (memcmp (header, "GIF", 3) == 0 /* GIF */ || memcmp (header, "\377\330\377", 3) == 0 /* JPEG */ - || (BE_16(&header[0]) == 0xffd8) /* another JPEG */ + || (_X_BE_16(&header[0]) == 0xffd8) /* another JPEG */ || memcmp (header, "\x89PNG", 4) == 0) { /* PNG */ break; } diff --git a/src/demuxers/demux_ipmovie.c b/src/demuxers/demux_ipmovie.c index 6fe185b1a..26392c73b 100644 --- a/src/demuxers/demux_ipmovie.c +++ b/src/demuxers/demux_ipmovie.c @@ -144,8 +144,8 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { if (this->input->read(this->input, chunk_preamble, CHUNK_PREAMBLE_SIZE) != CHUNK_PREAMBLE_SIZE) return CHUNK_BAD; - chunk_size = LE_16(&chunk_preamble[0]); - chunk_type = LE_16(&chunk_preamble[2]); + chunk_size = _X_LE_16(&chunk_preamble[0]); + chunk_type = _X_LE_16(&chunk_preamble[2]); lprintf("chunk type 0x%04X, 0x%04X bytes:\n", chunk_type, chunk_size); @@ -191,7 +191,7 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { break; } - opcode_size = LE_16(&opcode_preamble[0]); + opcode_size = _X_LE_16(&opcode_preamble[0]); opcode_type = opcode_preamble[2]; opcode_version = opcode_preamble[3]; @@ -228,10 +228,10 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { chunk_type = CHUNK_BAD; break; } - this->fps = 1000000.0 / (LE_32(&scratch[0]) * LE_16(&scratch[4])); + this->fps = 1000000.0 / (_X_LE_32(&scratch[0]) * _X_LE_16(&scratch[4])); this->frame_pts_inc = (int)(90000.0 / this->fps); lprintf("%.1f frames/second (timer div = %d, subdiv = %d)\n", - this->fps, LE_32(&scratch[0]), LE_16(&scratch[4])); + this->fps, _X_LE_32(&scratch[0]), _X_LE_16(&scratch[4])); break; case OPCODE_INIT_AUDIO_BUFFERS: @@ -246,8 +246,8 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { chunk_type = CHUNK_BAD; break; } - this->wave.nSamplesPerSec = LE_16(&scratch[4]); - audio_flags = LE_16(&scratch[2]); + this->wave.nSamplesPerSec = _X_LE_16(&scratch[4]); + audio_flags = _X_LE_16(&scratch[2]); /* bit 0 of the flags: 0 = mono, 1 = stereo */ this->wave.nChannels = (audio_flags & 1) + 1; /* bit 1 of the flags: 0 = 8 bit, 1 = 16 bit */ @@ -282,8 +282,8 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { chunk_type = CHUNK_BAD; break; } - this->bih.biWidth = LE_16(&scratch[0]) * 8; - this->bih.biHeight = LE_16(&scratch[2]) * 8; + this->bih.biWidth = _X_LE_16(&scratch[0]) * 8; + this->bih.biHeight = _X_LE_16(&scratch[2]) * 8; /* set up staging area for decode map */ this->decode_map_size = (this->bih.biWidth * this->bih.biHeight) / (8 * 8) / 2; @@ -392,8 +392,8 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { } /* load the palette into internal data structure */ - first_color = LE_16(&scratch[0]); - color_count = LE_16(&scratch[2]); + first_color = _X_LE_16(&scratch[0]); + color_count = _X_LE_16(&scratch[2]); /* sanity check (since they are 16 bit values) */ if ((first_color > 0xFF) || (first_color + color_count > 0x100)) { lprintf("set_palette indices out of range (%d -> %d)\n", diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 2bd8f3540..1c285a353 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -1850,7 +1850,7 @@ static int parse_block (demux_matroska_t *this, uint64_t block_size, return 0; data += num_len; - timecode_diff = (int)BE_16(data); + timecode_diff = (int)_X_BE_16(data); data += 2; flags = *data; diff --git a/src/demuxers/demux_mod.c b/src/demuxers/demux_mod.c index 37e066b13..f1b3cdd37 100644 --- a/src/demuxers/demux_mod.c +++ b/src/demuxers/demux_mod.c @@ -109,7 +109,7 @@ static int probe_mod_file(demux_mod_t *this) { return 0; /* Magic numbers taken from GNU file's magic description */ - switch( ABE_32(header.values + (1080/sizeof(uint32_t))) ) { + switch( _X_ABE_32(header.values + (1080/sizeof(uint32_t))) ) { case FOURCC_32('M', '.', 'K', '.'): /* 4-channel Protracker module sound data */ case FOURCC_32('M', '!', 'K', '!'): /* 4-channel Protracker module sound data */ case FOURCC_32('F', 'L', 'T', '4'): /* 4-channel Startracker module sound data */ diff --git a/src/demuxers/demux_mpc.c b/src/demuxers/demux_mpc.c index e1a3f28b9..86eb7bf3a 100644 --- a/src/demuxers/demux_mpc.c +++ b/src/demuxers/demux_mpc.c @@ -128,11 +128,11 @@ static int open_mpc_file(demux_mpc_t *this) { /* Get frame count */ this->current_frame = 0; - this->frames = LE_32(&this->header[4]); + this->frames = _X_LE_32(&this->header[4]); lprintf("number of frames: %u\n", this->frames); /* Get sample rate */ - switch ((LE_32(&this->header[8]) >> 16) & 0x3) { + switch ((_X_LE_32(&this->header[8]) >> 16) & 0x3) { case 0: this->samplerate = 44.1; break; @@ -155,7 +155,7 @@ static int open_mpc_file(demux_mpc_t *this) { lprintf("stream length: %d ms\n", this->length); /* Calculate the number of bits of the first frame that are still be sent */ - first_frame_size = (LE_32(&this->header[24]) >> 4) & 0xFFFFF; + first_frame_size = (_X_LE_32(&this->header[24]) >> 4) & 0xFFFFF; this->next_frame_bits = first_frame_size - 4; lprintf("first frame size: %u\n", first_frame_size); @@ -164,7 +164,7 @@ static int open_mpc_file(demux_mpc_t *this) { /* Set stream info */ _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, ME_32(this->header)); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, _X_ME_32(this->header)); return 1; } @@ -229,10 +229,10 @@ static int demux_mpc_send_chunk(demux_plugin_t *this_gen) { extra_bits_read = bits_to_read - (this->next_frame_bits+20); if(extra_bits_read <= 12) - next_frame_size = (LE_32(&buf->content[bytes_to_read-4]) >> extra_bits_read) & 0xFFFFF; + next_frame_size = (_X_LE_32(&buf->content[bytes_to_read-4]) >> extra_bits_read) & 0xFFFFF; else - next_frame_size = ((LE_32(&buf->content[bytes_to_read-8]) << (32-extra_bits_read)) | - (LE_32(&buf->content[bytes_to_read-4]) >> extra_bits_read)) & 0xFFFFF; + next_frame_size = ((_X_LE_32(&buf->content[bytes_to_read-8]) << (32-extra_bits_read)) | + (_X_LE_32(&buf->content[bytes_to_read-4]) >> extra_bits_read)) & 0xFFFFF; lprintf("next frame size: %u\n", next_frame_size); diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index c9d49efa2..145721ce3 100644 --- a/src/demuxers/demux_mpeg.c +++ b/src/demuxers/demux_mpeg.c @@ -140,8 +140,8 @@ static void find_mdat_atom(input_plugin_t *input, off_t *mdat_offset, ATOM_PREAMBLE_SIZE) break; - atom_size = BE_32(&atom_preamble[0]); - atom = BE_32(&atom_preamble[4]); + atom_size = _X_BE_32(&atom_preamble[0]); + atom = _X_BE_32(&atom_preamble[4]); if (atom == MDAT_ATOM) { *mdat_offset = input->get_current_pos(input) - ATOM_PREAMBLE_SIZE; @@ -165,9 +165,9 @@ static void find_mdat_atom(input_plugin_t *input, off_t *mdat_offset, ATOM_PREAMBLE_SIZE) break; - atom_size = BE_32(&atom_preamble[0]); + atom_size = _X_BE_32(&atom_preamble[0]); atom_size <<= 32; - atom_size |= BE_32(&atom_preamble[4]); + atom_size |= _X_BE_32(&atom_preamble[4]); atom_size -= ATOM_PREAMBLE_SIZE * 2; } else atom_size -= ATOM_PREAMBLE_SIZE; @@ -1157,7 +1157,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str } /* special case for MPEG streams with a RIFF header */ - fourcc_tag = BE_32(&buf[0]); + fourcc_tag = _X_BE_32(&buf[0]); if (fourcc_tag == RIFF_TAG) { uint8_t large_buf[1024]; @@ -1165,7 +1165,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str free(this); return NULL; } - fourcc_tag = BE_32(&large_buf[8]); + fourcc_tag = _X_BE_32(&large_buf[8]); /* disregard the RIFF file if it is certainly a better known * format like AVI or WAVE */ if ((fourcc_tag == WAVE_TAG) || @@ -1185,7 +1185,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str if (input->read(input, large_buf, 1024) != 1024) break; for (j = 0; j < 1024 - 4; j++) { - if (BE_32(&large_buf[j]) == MPEG_MARKER) { + if (_X_BE_32(&large_buf[j]) == MPEG_MARKER) { ok = 1; break; } diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index f675e227a..78b81a1d4 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -205,7 +205,7 @@ static int parse_frame_header(mpg_audio_frame_t *const frame, const uint8_t *con #endif } frame_header; - const uint32_t head = BE_32(buf); + const uint32_t head = _X_BE_32(buf); const uint16_t frame_sync = head >> 21; lprintf("header: %08X\n", head); @@ -324,21 +324,21 @@ static xing_header_t* parse_xing_header(mpg_audio_frame_t *frame, if (ptr >= (buf + bufsize - 4)) return 0; lprintf("checking %08X\n", *ptr); - if (BE_32(ptr) == XING_TAG) { + if (_X_BE_32(ptr) == XING_TAG) { lprintf("Xing header found\n"); ptr += 4; if (ptr >= (buf + bufsize - 4)) return 0; - xing->flags = BE_32(ptr); ptr += 4; + xing->flags = _X_BE_32(ptr); ptr += 4; if (xing->flags & XING_FRAMES_FLAG) { if (ptr >= (buf + bufsize - 4)) return 0; - xing->stream_frames = BE_32(ptr); ptr += 4; + xing->stream_frames = _X_BE_32(ptr); ptr += 4; lprintf("stream frames: %d\n", xing->stream_frames); } if (xing->flags & XING_BYTES_FLAG) { if (ptr >= (buf + bufsize - 4)) return 0; - xing->stream_size = BE_32(ptr); ptr += 4; + xing->stream_size = _X_BE_32(ptr); ptr += 4; lprintf("stream size: %d\n", xing->stream_size); } if (xing->flags & XING_TOC_FLAG) { @@ -357,7 +357,7 @@ static xing_header_t* parse_xing_header(mpg_audio_frame_t *frame, xing->vbr_scale = -1; if (xing->flags & XING_VBR_SCALE_FLAG) { if (ptr >= (buf + bufsize - 4)) return 0; - xing->vbr_scale = BE_32(ptr); + xing->vbr_scale = _X_BE_32(ptr); lprintf("vbr_scale: %d\n", xing->vbr_scale); } @@ -388,20 +388,20 @@ static vbri_header_t* parse_vbri_header(mpg_audio_frame_t *frame, if ((ptr + 4) >= (buf + bufsize)) return 0; lprintf("Checking %08X\n", *ptr); - if (BE_32(ptr) == VBRI_TAG) { + if (_X_BE_32(ptr) == VBRI_TAG) { lprintf("Vbri header found\n"); ptr += 4; if ((ptr + 22) >= (buf + bufsize)) return 0; - vbri->version = BE_16(ptr); ptr += 2; - vbri->delai = BE_16(ptr); ptr += 2; - vbri->quality = BE_16(ptr); ptr += 2; - vbri->stream_size = BE_32(ptr); ptr += 4; - vbri->stream_frames = BE_32(ptr); ptr += 4; - vbri->toc_entries = BE_16(ptr); ptr += 2; - vbri->toc_scale_factor = BE_16(ptr); ptr += 2; - vbri->entry_size = BE_16(ptr); ptr += 2; - vbri->entry_frames = BE_16(ptr); ptr += 2; + vbri->version = _X_BE_16(ptr); ptr += 2; + vbri->delai = _X_BE_16(ptr); ptr += 2; + vbri->quality = _X_BE_16(ptr); ptr += 2; + vbri->stream_size = _X_BE_32(ptr); ptr += 4; + vbri->stream_frames = _X_BE_32(ptr); ptr += 4; + vbri->toc_entries = _X_BE_16(ptr); ptr += 2; + vbri->toc_scale_factor = _X_BE_16(ptr); ptr += 2; + vbri->entry_size = _X_BE_16(ptr); ptr += 2; + vbri->entry_frames = _X_BE_16(ptr); ptr += 2; lprintf("version: %d\n", vbri->version); lprintf("delai: %d\n", vbri->delai); lprintf("quality: %d\n", vbri->quality); @@ -688,7 +688,7 @@ static int detect_mpgaudio_file(input_plugin_t *input) { lprintf("got preview %02x %02x %02x %02x\n", buf[0], buf[1], buf[2], buf[3]); - head = BE_32(buf); + head = _X_BE_32(buf); if ((head == ID3V22_TAG) || (head == ID3V23_TAG) || @@ -697,7 +697,7 @@ static int detect_mpgaudio_file(input_plugin_t *input) { * id3v2 are not specific to mp3 files, * flac files can contain id3v2 tags */ - uint32_t tag_size = BE_32_synchsafe(&buf[6]); + uint32_t tag_size = _X_BE_32_synchsafe(&buf[6]); lprintf("try to skip id3v2 tag (%d bytes)\n", tag_size); if ((10 + tag_size) >= preview_len) { lprintf("cannot skip id3v2 tag\n"); diff --git a/src/demuxers/demux_nsv.c b/src/demuxers/demux_nsv.c index 6d43b247c..4f730a935 100644 --- a/src/demuxers/demux_nsv.c +++ b/src/demuxers/demux_nsv.c @@ -172,7 +172,7 @@ static off_t nsv_read(demux_nsv_t *this, uint8_t *buffer, off_t len) { return -1; } /* read packet payload len */ - this->ultravox_size = BE_16(&ultravox_buf[5]); + this->ultravox_size = _X_BE_16(&ultravox_buf[5]); this->ultravox_pos = 0; lprintf("ultravox_size: %d\n", this->ultravox_size); } else { @@ -287,11 +287,11 @@ static int open_nsv_file(demux_nsv_t *this) { return 0; lprintf("found NSVf chunk\n"); - /* this->data_size = LE_32(&preview[8]);*/ + /* this->data_size = _X_LE_32(&preview[8]);*/ /*lprintf("data_size: %lld\n", this->data_size);*/ /* skip the rest of the data */ - chunk_size = LE_32(&preview[4]); + chunk_size = _X_LE_32(&preview[4]); nsv_seek(this, chunk_size - 28, SEEK_CUR); } break; @@ -303,21 +303,21 @@ static int open_nsv_file(demux_nsv_t *this) { if (nsv_read(this, &preview[4], 15) != 15) return 0; - this->video_fourcc = ME_32(&preview[4]); - if (BE_32(&preview[4]) == NONE_TAG) + this->video_fourcc = _X_ME_32(&preview[4]); + if (_X_BE_32(&preview[4]) == NONE_TAG) this->video_type = 0; else this->video_type = _x_fourcc_to_buf_video(this->video_fourcc); - this->audio_fourcc = ME_32(&preview[8]); - if (BE_32(&preview[8]) == NONE_TAG) + this->audio_fourcc = _X_ME_32(&preview[8]); + if (_X_BE_32(&preview[8]) == NONE_TAG) this->audio_type = 0; else this->audio_type = _x_formattag_to_buf_audio(this->audio_fourcc); this->bih.biSize = sizeof(this->bih); - this->bih.biWidth = LE_16(&preview[12]); - this->bih.biHeight = LE_16(&preview[14]); + this->bih.biWidth = _X_LE_16(&preview[12]); + this->bih.biHeight = _X_LE_16(&preview[14]); this->bih.biCompression = this->video_fourcc; this->video_pts = 0; @@ -493,10 +493,10 @@ static int demux_nsv_send_chunk(demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; return this->status; } - video_size = LE_32(&buffer[0]); + video_size = _X_LE_32(&buffer[0]); video_size >>= 4; video_size &= 0xFFFFF; - audio_size = LE_16(&buffer[3]); + audio_size = _X_LE_16(&buffer[3]); nsv_parse_payload(this, video_size, audio_size); break; diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index f868018af..a23bfa6b6 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -862,14 +862,14 @@ static void decode_video_header (demux_ogg_t *this, const int stream_num, ogg_pa locsubtype = *((uint32_t *)&op->packet[9]); /* everything else little endian */ - locsize = LE_32(&op->packet[13]); - loctime_unit = LE_64(&op->packet[17]); - locsamples_per_unit = LE_64(&op->packet[25]); - locdefault_len = LE_32(&op->packet[33]); - locbuffersize = LE_32(&op->packet[37]); - locbits_per_sample = LE_16(&op->packet[41]); - locwidth = LE_32(&op->packet[45]); - locheight = LE_32(&op->packet[49]); + locsize = _X_LE_32(&op->packet[13]); + loctime_unit = _X_LE_64(&op->packet[17]); + locsamples_per_unit = _X_LE_64(&op->packet[25]); + locdefault_len = _X_LE_32(&op->packet[33]); + locbuffersize = _X_LE_32(&op->packet[37]); + locbits_per_sample = _X_LE_16(&op->packet[41]); + locwidth = _X_LE_32(&op->packet[45]); + locheight = _X_LE_32(&op->packet[49]); lprintf ("direct show filter created stream detected, hexdump:\n"); #ifdef LOG @@ -940,15 +940,15 @@ static void decode_audio_header (demux_ogg_t *this, const int stream_num, ogg_pa int32_t locsize, locdefault_len, locbuffersize, locavgbytespersec; int64_t loctime_unit, locsamples_per_unit; - locsize = LE_32(&op->packet[13]); - loctime_unit = LE_64(&op->packet[17]); - locsamples_per_unit = LE_64(&op->packet[25]); - locdefault_len = LE_32(&op->packet[33]); - locbuffersize = LE_32(&op->packet[37]); - locbits_per_sample = LE_16(&op->packet[41]); - locchannels = LE_16(&op->packet[45]); - locblockalign = LE_16(&op->packet[47]); - locavgbytespersec= LE_32(&op->packet[49]); + locsize = _X_LE_32(&op->packet[13]); + loctime_unit = _X_LE_64(&op->packet[17]); + locsamples_per_unit = _X_LE_64(&op->packet[25]); + locdefault_len = _X_LE_32(&op->packet[33]); + locbuffersize = _X_LE_32(&op->packet[37]); + locbits_per_sample = _X_LE_16(&op->packet[41]); + locchannels = _X_LE_16(&op->packet[45]); + locblockalign = _X_LE_16(&op->packet[47]); + locavgbytespersec= _X_LE_32(&op->packet[49]); lprintf ("direct show filter created audio stream detected, hexdump:\n"); #ifdef LOG @@ -1017,7 +1017,7 @@ static void decode_dshow_header (demux_ogg_t *this, const int stream_num, ogg_pa this->si[stream_num]->headers = 0; /* header is sent below */ - if ( (LE_32(&op->packet[96]) == 0x05589f80) && (op->bytes >= 184)) { + if ( (_X_LE_32(&op->packet[96]) == 0x05589f80) && (op->bytes >= 184)) { buf_element_t *buf; xine_bmiheader bih; @@ -1036,11 +1036,11 @@ static void decode_dshow_header (demux_ogg_t *this, const int stream_num, ogg_pa this->si[stream_num]->buf_types |= channel; bih.biSize = sizeof(xine_bmiheader); - bih.biWidth = LE_32(&op->packet[176]); - bih.biHeight = LE_32(&op->packet[180]); + bih.biWidth = _X_LE_32(&op->packet[176]); + bih.biHeight = _X_LE_32(&op->packet[180]); bih.biPlanes = 0; memcpy (&bih.biCompression, op->packet+68, 4); - bih.biBitCount = LE_16(&op->packet[182]); + bih.biBitCount = _X_LE_16(&op->packet[182]); if (!bih.biBitCount) bih.biBitCount = 24; /* FIXME ? */ bih.biSizeImage = (bih.biBitCount>>3)*bih.biWidth*bih.biHeight; @@ -1076,7 +1076,7 @@ static void decode_dshow_header (demux_ogg_t *this, const int stream_num, ogg_pa this->ignore_keyframes = 1; - } else if (LE_32(&op->packet[96]) == 0x05589F81) { + } else if (_X_LE_32(&op->packet[96]) == 0x05589F81) { #if 0 /* FIXME: no test streams */ @@ -1206,7 +1206,7 @@ static void decode_flac_header (demux_ogg_t *this, const int stream_num, ogg_pac _x_assert(op->packet[5] == 1); _x_assert(op->packet[6] == 0); /* Header count */ - this->si[stream_num]->headers = 0/*BE_16(&op->packet[7]) +1*/; + this->si[stream_num]->headers = 0/*_X_BE_16(&op->packet[7]) +1*/; /* fLaC signature */ _x_assert(op->packet[9] == 'f'); _x_assert(op->packet[10] == 'L'); @@ -1269,9 +1269,9 @@ static void decode_anxdata_header (demux_ogg_t *this, const int stream_num, ogg_ lprintf("AnxData stream detected\n"); /* read granule rate */ - granule_rate_n = LE_64(&op->packet[8]); - granule_rate_d = LE_64(&op->packet[16]); - secondary_headers = LE_32(&op->packet[24]); + granule_rate_n = _X_LE_64(&op->packet[8]); + granule_rate_d = _X_LE_64(&op->packet[16]); + secondary_headers = _X_LE_32(&op->packet[24]); lprintf("granule_rate %" PRId64 "/%" PRId64 ", %d secondary headers\n", granule_rate_n, granule_rate_d, secondary_headers); @@ -1327,8 +1327,8 @@ static void decode_cmml_header (demux_ogg_t *this, const int stream_num, ogg_pac this->si[stream_num]->headers = 0; this->si[stream_num]->buf_types = BUF_SPU_CMML | channel; - this->si[stream_num]->factor = 90000 * LE_64(&op->packet[20]); - this->si[stream_num]->quotient = LE_64(&op->packet[12]); + this->si[stream_num]->factor = 90000 * _X_LE_64(&op->packet[20]); + this->si[stream_num]->quotient = _X_LE_64(&op->packet[12]); this->si[stream_num]->granuleshift = (int)op->packet[28]; } diff --git a/src/demuxers/demux_pva.c b/src/demuxers/demux_pva.c index 55b1f7644..1b358eb1f 100644 --- a/src/demuxers/demux_pva.c +++ b/src/demuxers/demux_pva.c @@ -145,7 +145,7 @@ static int demux_pva_send_chunk(demux_plugin_t *this_gen) { return this->status; } - chunk_size = BE_16(&preamble[6]); + chunk_size = _X_BE_16(&preamble[6]); current_file_pos = this->input->get_current_pos(this->input); @@ -160,7 +160,7 @@ static int demux_pva_send_chunk(demux_plugin_t *this_gen) { return this->status; } chunk_size -= 4; - pts = BE_32(&pts_buf[0]); + pts = _X_BE_32(&pts_buf[0]); check_newpts( this, pts, PTS_VIDEO ); } else pts = 0; @@ -207,11 +207,11 @@ static int demux_pva_send_chunk(demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; return this->status; } - if (BE_32(&preamble[0]) != 0x000001C0) { + if (_X_BE_32(&preamble[0]) != 0x000001C0) { this->status = DEMUX_FINISHED; return this->status; } - chunk_size = BE_16(&preamble[4]); + chunk_size = _X_BE_16(&preamble[4]); /* get next 3 header bytes */ if (this->input->read(this->input, preamble, 3) != 3) { @@ -234,8 +234,8 @@ static int demux_pva_send_chunk(demux_plugin_t *this_gen) { } pts = (int64_t)(preamble[0] & 0x0e) << 29 ; - pts |= (BE_16(&preamble[1]) & 0xFFFE) << 14; - pts |= (BE_16(&preamble[3]) & 0xFFFE) >> 1; + pts |= (_X_BE_16(&preamble[1]) & 0xFFFE) << 14; + pts |= (_X_BE_16(&preamble[3]) & 0xFFFE) >> 1; header_len -= 5 ; diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 23a45c792..1e0bdebab 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -501,8 +501,8 @@ static void find_moov_atom(input_plugin_t *input, off_t *moov_offset, ATOM_PREAMBLE_SIZE) break; - atom_size = BE_32(&atom_preamble[0]); - atom = BE_32(&atom_preamble[4]); + atom_size = _X_BE_32(&atom_preamble[0]); + atom = _X_BE_32(&atom_preamble[4]); /* Special case alert: 'free' atoms sometimes masquerade as 'moov' * atoms. If this is a free atom, check for 'cmov' or 'mvhd' immediately @@ -516,8 +516,8 @@ static void find_moov_atom(input_plugin_t *input, off_t *moov_offset, /* if there is a cmov, qualify this free atom as the 'moov' atom * if no actual 'moov' atom is found. */ - if ((BE_32(&atom_preamble[4]) == CMOV_ATOM) || - (BE_32(&atom_preamble[4]) == MVHD_ATOM)) { + if ((_X_BE_32(&atom_preamble[4]) == CMOV_ATOM) || + (_X_BE_32(&atom_preamble[4]) == MVHD_ATOM)) { /* pos = current pos minus 2 atom preambles */ free_moov_offset = input->get_current_pos(input) - ATOM_PREAMBLE_SIZE * 2; free_moov_size = atom_size; @@ -561,9 +561,9 @@ static void find_moov_atom(input_plugin_t *input, off_t *moov_offset, ATOM_PREAMBLE_SIZE) break; - atom_size = BE_32(&atom_preamble[0]); + atom_size = _X_BE_32(&atom_preamble[0]); atom_size <<= 32; - atom_size |= BE_32(&atom_preamble[4]); + atom_size |= _X_BE_32(&atom_preamble[4]); atom_size -= ATOM_PREAMBLE_SIZE * 2; } else atom_size -= ATOM_PREAMBLE_SIZE; @@ -688,20 +688,20 @@ static int is_qt_file(input_plugin_t *qt_file) { if ((qt_file->get_capabilities(qt_file) & INPUT_CAP_SEEKABLE) == 0) { memset (&preview, 0, MAX_PREVIEW_SIZE); len = qt_file->get_optional_data(qt_file, preview, INPUT_OPTIONAL_DATA_PREVIEW); - if (BE_32(&preview[4]) == MOOV_ATOM) + if (_X_BE_32(&preview[4]) == MOOV_ATOM) return 1; else { - if (BE_32(&preview[4]) == FTYP_ATOM) { + if (_X_BE_32(&preview[4]) == FTYP_ATOM) { /* show some lenience if the first atom is 'ftyp'; the second atom * could be 'moov' */ - moov_atom_size = BE_32(&preview[0]); + moov_atom_size = _X_BE_32(&preview[0]); /* compute the size of the current atom plus the preamble of the * next atom; if the size is within the range on the preview buffer * then the next atom's preamble is in the preview buffer */ i = moov_atom_size + ATOM_PREAMBLE_SIZE; if (i >= MAX_PREVIEW_SIZE) return 0; - if (BE_32(&preview[i - 4]) == MOOV_ATOM) + if (_X_BE_32(&preview[i - 4]) == MOOV_ATOM) return 1; else return 0; @@ -732,45 +732,45 @@ static int is_qt_file(input_plugin_t *qt_file) { /* parse out a meta data atom */ static void parse_meta_atom(qt_info *info, unsigned char *meta_atom) { int i; - unsigned int meta_atom_size = BE_32(&meta_atom[0]); + unsigned int meta_atom_size = _X_BE_32(&meta_atom[0]); qt_atom current_atom; int string_size; for (i = 0; i < meta_atom_size - 4; i++) { - current_atom = BE_32(&meta_atom[i]); + current_atom = _X_BE_32(&meta_atom[i]); if (current_atom == ART_ATOM) { - string_size = BE_32(&meta_atom[i + 4]) - 16 + 1; + string_size = _X_BE_32(&meta_atom[i + 4]) - 16 + 1; info->artist = xine_xmalloc(string_size); strncpy(info->artist, &meta_atom[i + 20], string_size - 1); info->artist[string_size - 1] = 0; } else if (current_atom == NAM_ATOM) { - string_size = BE_32(&meta_atom[i + 4]) - 16 + 1; + string_size = _X_BE_32(&meta_atom[i + 4]) - 16 + 1; info->name = xine_xmalloc(string_size); strncpy(info->name, &meta_atom[i + 20], string_size - 1); info->name[string_size - 1] = 0; } else if (current_atom == ALB_ATOM) { - string_size = BE_32(&meta_atom[i + 4]) - 16 + 1; + string_size = _X_BE_32(&meta_atom[i + 4]) - 16 + 1; info->album = xine_xmalloc(string_size); strncpy(info->album, &meta_atom[i + 20], string_size - 1); info->album[string_size - 1] = 0; } else if (current_atom == GEN_ATOM) { - string_size = BE_32(&meta_atom[i + 4]) - 16 + 1; + string_size = _X_BE_32(&meta_atom[i + 4]) - 16 + 1; info->genre = xine_xmalloc(string_size); strncpy(info->genre, &meta_atom[i + 20], string_size - 1); info->genre[string_size - 1] = 0; } else if (current_atom == TOO_ATOM) { - string_size = BE_32(&meta_atom[i + 4]) - 16 + 1; + string_size = _X_BE_32(&meta_atom[i + 4]) - 16 + 1; info->comment = xine_xmalloc(string_size); strncpy(info->comment, &meta_atom[i + 20], string_size - 1); info->comment[string_size - 1] = 0; } else if (current_atom == WRT_ATOM) { - string_size = BE_32(&meta_atom[i + 4]) - 16 + 1; + string_size = _X_BE_32(&meta_atom[i + 4]) - 16 + 1; info->composer = xine_xmalloc(string_size); strncpy(info->composer, &meta_atom[i + 20], string_size - 1); info->composer[string_size - 1] = 0; } else if (current_atom == DAY_ATOM) { - string_size = BE_32(&meta_atom[i + 4]) - 16 + 1; + string_size = _X_BE_32(&meta_atom[i + 4]) - 16 + 1; info->year = xine_xmalloc(string_size); strncpy(info->year, &meta_atom[i + 20], string_size - 1); info->year[string_size - 1] = 0; @@ -782,10 +782,10 @@ static void parse_meta_atom(qt_info *info, unsigned char *meta_atom) { /* fetch interesting information from the movie header atom */ static void parse_mvhd_atom(qt_info *info, unsigned char *mvhd_atom) { - info->creation_time = BE_32(&mvhd_atom[0x0C]); - info->modification_time = BE_32(&mvhd_atom[0x10]); - info->timescale = BE_32(&mvhd_atom[0x14]); - info->duration = BE_32(&mvhd_atom[0x18]); + info->creation_time = _X_BE_32(&mvhd_atom[0x0C]); + info->modification_time = _X_BE_32(&mvhd_atom[0x10]); + info->timescale = _X_BE_32(&mvhd_atom[0x14]); + info->duration = _X_BE_32(&mvhd_atom[0x18]); debug_atom_load(" qt: timescale = %d, duration = %d (%d seconds)\n", info->timescale, info->duration, @@ -816,7 +816,7 @@ static qt_error parse_trak_atom (qt_trak *trak, unsigned char *trak_atom) { int i, j, k; - unsigned int trak_atom_size = BE_32(&trak_atom[0]); + unsigned int trak_atom_size = _X_BE_32(&trak_atom[0]); qt_atom current_atom; unsigned int current_atom_size; unsigned int atom_pos; @@ -865,7 +865,7 @@ static qt_error parse_trak_atom (qt_trak *trak, /* search for media type atoms */ for (i = ATOM_PREAMBLE_SIZE; i < trak_atom_size - 4; i++) { - current_atom = BE_32(&trak_atom[i]); + current_atom = _X_BE_32(&trak_atom[i]); if (current_atom == VMHD_ATOM) { trak->type = MEDIA_VIDEO; @@ -882,11 +882,11 @@ static qt_error parse_trak_atom (qt_trak *trak, /* search for the useful atoms */ for (i = ATOM_PREAMBLE_SIZE; i < trak_atom_size - 4; i++) { - current_atom_size = BE_32(&trak_atom[i - 4]); - current_atom = BE_32(&trak_atom[i]); + current_atom_size = _X_BE_32(&trak_atom[i - 4]); + current_atom = _X_BE_32(&trak_atom[i]); if (current_atom == TKHD_ATOM) { - trak->flags = BE_16(&trak_atom[i + 6]); + trak->flags = _X_BE_16(&trak_atom[i + 6]); } else if (current_atom == ELST_ATOM) { /* there should only be one edit list table */ @@ -895,7 +895,7 @@ static qt_error parse_trak_atom (qt_trak *trak, goto free_trak; } - trak->edit_list_count = BE_32(&trak_atom[i + 8]); + trak->edit_list_count = _X_BE_32(&trak_atom[i + 8]); debug_atom_load(" qt elst atom (edit list atom): %d entries\n", trak->edit_list_count); @@ -910,9 +910,9 @@ static qt_error parse_trak_atom (qt_trak *trak, /* load the edit list table */ for (j = 0; j < trak->edit_list_count; j++) { trak->edit_list_table[j].track_duration = - BE_32(&trak_atom[i + 12 + j * 12 + 0]); + _X_BE_32(&trak_atom[i + 12 + j * 12 + 0]); trak->edit_list_table[j].media_time = - BE_32(&trak_atom[i + 12 + j * 12 + 4]); + _X_BE_32(&trak_atom[i + 12 + j * 12 + 4]); debug_atom_load(" %d: track duration = %d, media time = %d\n", j, trak->edit_list_table[j].track_duration, @@ -926,7 +926,7 @@ static qt_error parse_trak_atom (qt_trak *trak, version = trak_atom[i+4]; if ( version > 1 ) continue; /* unsupported, undocumented */ - trak->timescale = BE_32(&trak_atom[i + (version == 0 ? 0x10 : 0x18) ]); + trak->timescale = _X_BE_32(&trak_atom[i + (version == 0 ? 0x10 : 0x18) ]); } else if (current_atom == STSD_ATOM) { debug_atom_load ("demux_qt: stsd atom\n"); @@ -935,7 +935,7 @@ static qt_error parse_trak_atom (qt_trak *trak, #endif /* allocate space for each of the properties unions */ - trak->stsd_atoms_count = BE_32(&trak_atom[i + 8]); + trak->stsd_atoms_count = _X_BE_32(&trak_atom[i + 8]); trak->stsd_atoms = xine_xmalloc(trak->stsd_atoms_count * sizeof(properties_t)); if (!trak->stsd_atoms) { last_error = QT_NO_MEMORY; @@ -947,7 +947,7 @@ static qt_error parse_trak_atom (qt_trak *trak, properties_offset = 0x0C; for (k = 0; k < trak->stsd_atoms_count; k++) { - current_stsd_atom_size = BE_32(&trak_atom[atom_pos - 4]); + current_stsd_atom_size = _X_BE_32(&trak_atom[atom_pos - 4]); if (trak->type == MEDIA_VIDEO) { @@ -970,15 +970,15 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->stsd_atoms[k].video.palette_count = 0; /* fetch video parameters */ - if( BE_16(&trak_atom[atom_pos + 0x1C]) && - BE_16(&trak_atom[atom_pos + 0x1E]) ) { + if( _X_BE_16(&trak_atom[atom_pos + 0x1C]) && + _X_BE_16(&trak_atom[atom_pos + 0x1E]) ) { trak->stsd_atoms[k].video.width = - BE_16(&trak_atom[atom_pos + 0x1C]); + _X_BE_16(&trak_atom[atom_pos + 0x1C]); trak->stsd_atoms[k].video.height = - BE_16(&trak_atom[atom_pos + 0x1E]); + _X_BE_16(&trak_atom[atom_pos + 0x1E]); } trak->stsd_atoms[k].video.codec_fourcc = - ME_32(&trak_atom[atom_pos + 0x00]); + _X_ME_32(&trak_atom[atom_pos + 0x00]); /* figure out the palette situation */ color_depth = trak_atom[atom_pos + 0x4F]; @@ -989,7 +989,7 @@ static qt_error parse_trak_atom (qt_trak *trak, /* if the depth is 2, 4, or 8 bpp, file is palettized */ if ((color_depth == 2) || (color_depth == 4) || (color_depth == 8)) { - color_flag = BE_16(&trak_atom[atom_pos + 0x50]); + color_flag = _X_BE_16(&trak_atom[atom_pos + 0x50]); if (color_greyscale) { @@ -1041,15 +1041,15 @@ static qt_error parse_trak_atom (qt_trak *trak, } else { /* load the palette from the file */ - color_start = BE_32(&trak_atom[atom_pos + 0x52]); - color_count = BE_16(&trak_atom[atom_pos + 0x56]); - color_end = BE_16(&trak_atom[atom_pos + 0x58]); + color_start = _X_BE_32(&trak_atom[atom_pos + 0x52]); + color_count = _X_BE_16(&trak_atom[atom_pos + 0x56]); + color_end = _X_BE_16(&trak_atom[atom_pos + 0x58]); trak->stsd_atoms[k].video.palette_count = color_end + 1; for (j = color_start; j <= color_end; j++) { - color_index = BE_16(&trak_atom[atom_pos + 0x5A + j * 8]); + color_index = _X_BE_16(&trak_atom[atom_pos + 0x5A + j * 8]); if (color_count & 0x8000) color_index = j; if (color_index < @@ -1102,9 +1102,9 @@ static qt_error parse_trak_atom (qt_trak *trak, /* fetch audio parameters */ trak->stsd_atoms[k].audio.codec_fourcc = - ME_32(&trak_atom[atom_pos + 0x0]); + _X_ME_32(&trak_atom[atom_pos + 0x0]); trak->stsd_atoms[k].audio.sample_rate = - BE_16(&trak_atom[atom_pos + 0x1C]); + _X_BE_16(&trak_atom[atom_pos + 0x1C]); trak->stsd_atoms[k].audio.channels = trak_atom[atom_pos + 0x15]; trak->stsd_atoms[k].audio.bits = trak_atom[atom_pos + 0x17]; @@ -1176,18 +1176,18 @@ static qt_error parse_trak_atom (qt_trak *trak, (trak->stsd_atoms[k].audio.codec_fourcc != SOWT_FOURCC) && (trak->stsd_atoms[k].audio.codec_fourcc != RAW_FOURCC)) { - if (BE_32(&trak_atom[atom_pos + 0x20])) + if (_X_BE_32(&trak_atom[atom_pos + 0x20])) trak->stsd_atoms[k].audio.samples_per_packet = - BE_32(&trak_atom[atom_pos + 0x20]); - if (BE_32(&trak_atom[atom_pos + 0x24])) + _X_BE_32(&trak_atom[atom_pos + 0x20]); + if (_X_BE_32(&trak_atom[atom_pos + 0x24])) trak->stsd_atoms[k].audio.bytes_per_packet = - BE_32(&trak_atom[atom_pos + 0x24]); - if (BE_32(&trak_atom[atom_pos + 0x28])) + _X_BE_32(&trak_atom[atom_pos + 0x24]); + if (_X_BE_32(&trak_atom[atom_pos + 0x28])) trak->stsd_atoms[k].audio.bytes_per_frame = - BE_32(&trak_atom[atom_pos + 0x28]); - if (BE_32(&trak_atom[atom_pos + 0x2C])) + _X_BE_32(&trak_atom[atom_pos + 0x28]); + if (_X_BE_32(&trak_atom[atom_pos + 0x2C])) trak->stsd_atoms[k].audio.bytes_per_sample = - BE_32(&trak_atom[atom_pos + 0x2C]); + _X_BE_32(&trak_atom[atom_pos + 0x2C]); trak->stsd_atoms[k].audio.samples_per_frame = (trak->stsd_atoms[k].audio.bytes_per_frame / trak->stsd_atoms[k].audio.bytes_per_packet) * @@ -1195,7 +1195,7 @@ static qt_error parse_trak_atom (qt_trak *trak, } /* see if the trak deserves a promotion to VBR */ - if (BE_16(&trak_atom[atom_pos + 0x18]) == 0xFFFE) + if (_X_BE_16(&trak_atom[atom_pos + 0x18]) == 0xFFFE) trak->stsd_atoms[k].audio.vbr = 1; else trak->stsd_atoms[k].audio.vbr = 0; @@ -1225,10 +1225,10 @@ static qt_error parse_trak_atom (qt_trak *trak, /* check for a MS-style WAVE format header */ if ((current_atom_size >= 0x4C) && - (BE_32(&trak_atom[atom_pos + 0x34]) == WAVE_ATOM) && - (BE_32(&trak_atom[atom_pos + 0x3C]) == FRMA_ATOM) && - (ME_32(&trak_atom[atom_pos + 0x48]) == trak->stsd_atoms[k].audio.codec_fourcc)) { - int wave_size = BE_32(&trak_atom[atom_pos + 0x44]) - 8; + (_X_BE_32(&trak_atom[atom_pos + 0x34]) == WAVE_ATOM) && + (_X_BE_32(&trak_atom[atom_pos + 0x3C]) == FRMA_ATOM) && + (_X_ME_32(&trak_atom[atom_pos + 0x48]) == trak->stsd_atoms[k].audio.codec_fourcc)) { + int wave_size = _X_BE_32(&trak_atom[atom_pos + 0x44]) - 8; if ((wave_size >= sizeof(xine_waveformatex)) && (current_atom_size >= (0x4C + wave_size))) { @@ -1326,8 +1326,8 @@ static qt_error parse_trak_atom (qt_trak *trak, goto free_trak; } - trak->sample_size = BE_32(&trak_atom[i + 8]); - trak->sample_size_count = BE_32(&trak_atom[i + 12]); + trak->sample_size = _X_BE_32(&trak_atom[i + 8]); + trak->sample_size_count = _X_BE_32(&trak_atom[i + 12]); debug_atom_load(" qt stsz atom (sample size atom): sample size = %d, %d entries\n", trak->sample_size, trak->sample_size_count); @@ -1343,7 +1343,7 @@ static qt_error parse_trak_atom (qt_trak *trak, /* load the sample size table */ for (j = 0; j < trak->sample_size_count; j++) { trak->sample_size_table[j] = - BE_32(&trak_atom[i + 16 + j * 4]); + _X_BE_32(&trak_atom[i + 16 + j * 4]); debug_atom_load(" sample size %d: %d\n", j, trak->sample_size_table[j]); } @@ -1360,7 +1360,7 @@ static qt_error parse_trak_atom (qt_trak *trak, goto free_trak; } - trak->sync_sample_count = BE_32(&trak_atom[i + 8]); + trak->sync_sample_count = _X_BE_32(&trak_atom[i + 8]); debug_atom_load(" qt stss atom (sample sync atom): %d sync samples\n", trak->sync_sample_count); @@ -1375,7 +1375,7 @@ static qt_error parse_trak_atom (qt_trak *trak, /* load the sync sample table */ for (j = 0; j < trak->sync_sample_count; j++) { trak->sync_sample_table[j] = - BE_32(&trak_atom[i + 12 + j * 4]); + _X_BE_32(&trak_atom[i + 12 + j * 4]); debug_atom_load(" sync sample %d: sample %d (%d) is a keyframe\n", j, trak->sync_sample_table[j], trak->sync_sample_table[j] - 1); @@ -1389,7 +1389,7 @@ static qt_error parse_trak_atom (qt_trak *trak, goto free_trak; } - trak->chunk_offset_count = BE_32(&trak_atom[i + 8]); + trak->chunk_offset_count = _X_BE_32(&trak_atom[i + 8]); debug_atom_load(" qt stco atom (32-bit chunk offset atom): %d chunk offsets\n", trak->chunk_offset_count); @@ -1404,7 +1404,7 @@ static qt_error parse_trak_atom (qt_trak *trak, /* load the chunk offset table */ for (j = 0; j < trak->chunk_offset_count; j++) { trak->chunk_offset_table[j] = - BE_32(&trak_atom[i + 12 + j * 4]); + _X_BE_32(&trak_atom[i + 12 + j * 4]); debug_atom_load(" chunk %d @ 0x%"PRIX64"\n", j, trak->chunk_offset_table[j]); } @@ -1417,7 +1417,7 @@ static qt_error parse_trak_atom (qt_trak *trak, goto free_trak; } - trak->chunk_offset_count = BE_32(&trak_atom[i + 8]); + trak->chunk_offset_count = _X_BE_32(&trak_atom[i + 8]); debug_atom_load(" qt co64 atom (64-bit chunk offset atom): %d chunk offsets\n", trak->chunk_offset_count); @@ -1432,10 +1432,10 @@ static qt_error parse_trak_atom (qt_trak *trak, /* load the 64-bit chunk offset table */ for (j = 0; j < trak->chunk_offset_count; j++) { trak->chunk_offset_table[j] = - BE_32(&trak_atom[i + 12 + j * 8 + 0]); + _X_BE_32(&trak_atom[i + 12 + j * 8 + 0]); trak->chunk_offset_table[j] <<= 32; trak->chunk_offset_table[j] |= - BE_32(&trak_atom[i + 12 + j * 8 + 4]); + _X_BE_32(&trak_atom[i + 12 + j * 8 + 4]); debug_atom_load(" chunk %d @ 0x%"PRIX64"\n", j, trak->chunk_offset_table[j]); } @@ -1448,7 +1448,7 @@ static qt_error parse_trak_atom (qt_trak *trak, goto free_trak; } - trak->sample_to_chunk_count = BE_32(&trak_atom[i + 8]); + trak->sample_to_chunk_count = _X_BE_32(&trak_atom[i + 8]); debug_atom_load(" qt stsc atom (sample-to-chunk atom): %d entries\n", trak->sample_to_chunk_count); @@ -1463,11 +1463,11 @@ static qt_error parse_trak_atom (qt_trak *trak, /* load the sample to chunk table */ for (j = 0; j < trak->sample_to_chunk_count; j++) { trak->sample_to_chunk_table[j].first_chunk = - BE_32(&trak_atom[i + 12 + j * 12 + 0]); + _X_BE_32(&trak_atom[i + 12 + j * 12 + 0]); trak->sample_to_chunk_table[j].samples_per_chunk = - BE_32(&trak_atom[i + 12 + j * 12 + 4]); + _X_BE_32(&trak_atom[i + 12 + j * 12 + 4]); trak->sample_to_chunk_table[j].media_id = - BE_32(&trak_atom[i + 12 + j * 12 + 8]); + _X_BE_32(&trak_atom[i + 12 + j * 12 + 8]); debug_atom_load(" %d: %d samples/chunk starting at chunk %d (%d) for media id %d\n", j, trak->sample_to_chunk_table[j].samples_per_chunk, trak->sample_to_chunk_table[j].first_chunk, @@ -1483,7 +1483,7 @@ static qt_error parse_trak_atom (qt_trak *trak, goto free_trak; } - trak->time_to_sample_count = BE_32(&trak_atom[i + 8]); + trak->time_to_sample_count = _X_BE_32(&trak_atom[i + 8]); debug_atom_load(" qt stts atom (time-to-sample atom): %d entries\n", trak->time_to_sample_count); @@ -1498,9 +1498,9 @@ static qt_error parse_trak_atom (qt_trak *trak, /* load the time to sample table */ for (j = 0; j < trak->time_to_sample_count; j++) { trak->time_to_sample_table[j].count = - BE_32(&trak_atom[i + 12 + j * 8 + 0]); + _X_BE_32(&trak_atom[i + 12 + j * 8 + 0]); trak->time_to_sample_table[j].duration = - BE_32(&trak_atom[i + 12 + j * 8 + 4]); + _X_BE_32(&trak_atom[i + 12 + j * 8 + 4]); debug_atom_load(" %d: count = %d, duration = %d\n", j, trak->time_to_sample_table[j].count, trak->time_to_sample_table[j].duration); @@ -1536,7 +1536,7 @@ static qt_error parse_reference_atom (reference_t *ref, char *base_mrl) { int i, j; - unsigned int ref_atom_size = BE_32(&ref_atom[0]); + unsigned int ref_atom_size = _X_BE_32(&ref_atom[0]); qt_atom current_atom; unsigned int current_atom_size; @@ -1548,8 +1548,8 @@ static qt_error parse_reference_atom (reference_t *ref, /* traverse through the atom looking for the key atoms */ for (i = ATOM_PREAMBLE_SIZE; i < ref_atom_size - 4; i++) { - current_atom_size = BE_32(&ref_atom[i - 4]); - current_atom = BE_32(&ref_atom[i]); + current_atom_size = _X_BE_32(&ref_atom[i - 4]); + current_atom = _X_BE_32(&ref_atom[i]); if (current_atom == RDRF_ATOM) { @@ -1558,24 +1558,24 @@ static qt_error parse_reference_atom (reference_t *ref, || strncmp(&ref_atom[i + 16], "rtsp://", 7) == 0) { /* URL is spec'd to terminate with a NULL; don't trust it */ - ref->url = xine_xmalloc(BE_32(&ref_atom[i + 12]) + 1); - strncpy(ref->url, &ref_atom[i + 16], BE_32(&ref_atom[i + 12])); - ref->url[BE_32(&ref_atom[i + 12]) - 1] = '\0'; + ref->url = xine_xmalloc(_X_BE_32(&ref_atom[i + 12]) + 1); + strncpy(ref->url, &ref_atom[i + 16], _X_BE_32(&ref_atom[i + 12])); + ref->url[_X_BE_32(&ref_atom[i + 12]) - 1] = '\0'; } else { int string_size; if (base_mrl) - string_size = strlen(base_mrl) + BE_32(&ref_atom[i + 12]) + 1; + string_size = strlen(base_mrl) + _X_BE_32(&ref_atom[i + 12]) + 1; else - string_size = BE_32(&ref_atom[i + 12]) + 1; + string_size = _X_BE_32(&ref_atom[i + 12]) + 1; /* otherwise, append relative URL to base MRL */ ref->url = xine_xmalloc(string_size); if (base_mrl) strcpy(ref->url, base_mrl); - strncat(ref->url, &ref_atom[i + 16], BE_32(&ref_atom[i + 12])); + strncat(ref->url, &ref_atom[i + 16], _X_BE_32(&ref_atom[i + 12])); ref->url[string_size - 1] = '\0'; } @@ -1584,7 +1584,7 @@ static qt_error parse_reference_atom (reference_t *ref, } else if (current_atom == RMDR_ATOM) { /* load the data rate */ - ref->data_rate = BE_32(&ref_atom[i + 8]); + ref->data_rate = _X_BE_32(&ref_atom[i + 8]); ref->data_rate *= 10; debug_atom_load(" qt rmdr data rate = %"PRId64"\n", ref->data_rate); @@ -1597,9 +1597,9 @@ static qt_error parse_reference_atom (reference_t *ref, * chars so only search to 6 bytes to the end */ for (j = 4; j < current_atom_size - 6; j++) { - if (BE_32(&ref_atom[i + j]) == QTIM_ATOM) { + if (_X_BE_32(&ref_atom[i + j]) == QTIM_ATOM) { - ref->qtim_version = BE_16(&ref_atom[i + j + 4]); + ref->qtim_version = _X_BE_16(&ref_atom[i + j + 4]); debug_atom_load(" qtim version = %04X\n", ref->qtim_version); } } @@ -1917,7 +1917,7 @@ static qt_error build_frame_table(qt_trak *trak, static void parse_moov_atom(qt_info *info, unsigned char *moov_atom, int64_t bandwidth) { int i, j; - unsigned int moov_atom_size = BE_32(&moov_atom[0]); + unsigned int moov_atom_size = _X_BE_32(&moov_atom[0]); qt_atom current_atom; int string_size, error; unsigned int max_video_frames = 0; @@ -1925,15 +1925,15 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom, /* make sure this is actually a moov atom (will also accept 'free' as * a special case) */ - if ((BE_32(&moov_atom[4]) != MOOV_ATOM) && - (BE_32(&moov_atom[4]) != FREE_ATOM)) { + if ((_X_BE_32(&moov_atom[4]) != MOOV_ATOM) && + (_X_BE_32(&moov_atom[4]) != FREE_ATOM)) { info->last_error = QT_NO_MOOV_ATOM; return; } /* prowl through the moov atom looking for very specific targets */ - for (i = ATOM_PREAMBLE_SIZE + 4; i < moov_atom_size - 4; i += BE_32(&moov_atom[i - 4])) { - current_atom = BE_32(&moov_atom[i]); + for (i = ATOM_PREAMBLE_SIZE + 4; i < moov_atom_size - 4; i += _X_BE_32(&moov_atom[i - 4])) { + current_atom = _X_BE_32(&moov_atom[i]); if (current_atom == MVHD_ATOM) { parse_mvhd_atom(info, &moov_atom[i - 4]); @@ -1962,28 +1962,28 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom, } else if (current_atom == NAM_ATOM) { - string_size = BE_16(&moov_atom[i + 4]) + 1; + string_size = _X_BE_16(&moov_atom[i + 4]) + 1; info->name = realloc (info->name, string_size); strncpy(info->name, &moov_atom[i + 8], string_size - 1); info->name[string_size - 1] = 0; } else if (current_atom == CPY_ATOM) { - string_size = BE_16(&moov_atom[i + 4]) + 1; + string_size = _X_BE_16(&moov_atom[i + 4]) + 1; info->copyright = realloc (info->copyright, string_size); strncpy(info->copyright, &moov_atom[i + 8], string_size - 1); info->copyright[string_size - 1] = 0; } else if (current_atom == DES_ATOM) { - string_size = BE_16(&moov_atom[i + 4]) + 1; + string_size = _X_BE_16(&moov_atom[i + 4]) + 1; info->description = realloc (info->description, string_size); strncpy(info->description, &moov_atom[i + 8], string_size - 1); info->description[string_size - 1] = 0; } else if (current_atom == CMT_ATOM) { - string_size = BE_16(&moov_atom[i + 4]) + 1; + string_size = _X_BE_16(&moov_atom[i + 4]) + 1; info->comment = realloc (info->comment, string_size); strncpy(info->comment, &moov_atom[i + 8], string_size - 1); info->comment[string_size - 1] = 0; @@ -2100,24 +2100,24 @@ static qt_error open_qt_file(qt_info *info, input_plugin_t *input, else { memset (&preview, 0, MAX_PREVIEW_SIZE); input->get_optional_data(input, preview, INPUT_OPTIONAL_DATA_PREVIEW); - if (BE_32(&preview[4]) != MOOV_ATOM) { + if (_X_BE_32(&preview[4]) != MOOV_ATOM) { /* special case if there is an ftyp atom first */ - if (BE_32(&preview[4]) == FTYP_ATOM) { - moov_atom_size = BE_32(&preview[0]); + if (_X_BE_32(&preview[4]) == FTYP_ATOM) { + moov_atom_size = _X_BE_32(&preview[0]); if ((moov_atom_size + ATOM_PREAMBLE_SIZE >= MAX_PREVIEW_SIZE) || - (BE_32(&preview[moov_atom_size + 4]) != MOOV_ATOM)) { + (_X_BE_32(&preview[moov_atom_size + 4]) != MOOV_ATOM)) { info->last_error = QT_NO_MOOV_ATOM; return info->last_error; } moov_atom_offset = moov_atom_size; - moov_atom_size = BE_32(&preview[moov_atom_offset]); + moov_atom_size = _X_BE_32(&preview[moov_atom_offset]); } else { info->last_error = QT_NO_MOOV_ATOM; return info->last_error; } } else { moov_atom_offset = 0; - moov_atom_size = BE_32(&preview[0]); + moov_atom_size = _X_BE_32(&preview[0]); } } @@ -2148,14 +2148,14 @@ static qt_error open_qt_file(qt_info *info, input_plugin_t *input, } /* check if moov is compressed */ - if (BE_32(&moov_atom[12]) == CMOV_ATOM) { + if (_X_BE_32(&moov_atom[12]) == CMOV_ATOM) { info->compressed_header = 1; z_state.next_in = &moov_atom[0x28]; z_state.avail_in = moov_atom_size - 0x28; - z_state.avail_out = BE_32(&moov_atom[0x24]); - unzip_buffer = (unsigned char *)malloc(BE_32(&moov_atom[0x24])); + z_state.avail_out = _X_BE_32(&moov_atom[0x24]); + unzip_buffer = (unsigned char *)malloc(_X_BE_32(&moov_atom[0x24])); if (!unzip_buffer) { free(moov_atom); info->last_error = QT_NO_MEMORY; @@ -2194,7 +2194,7 @@ static qt_error open_qt_file(qt_info *info, input_plugin_t *input, /* replace the compressed moov atom with the decompressed atom */ free (moov_atom); moov_atom = unzip_buffer; - moov_atom_size = BE_32(&moov_atom[0]); + moov_atom_size = _X_BE_32(&moov_atom[0]); } if (!moov_atom) { diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 11b0dbf38..b58366e91 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -194,11 +194,11 @@ static void real_parse_index(demux_real_t *this) { } /* Check chunk is actually an index chunk */ - if(BE_32(&index_chunk_header[0]) == INDX_TAG) { + if(_X_BE_32(&index_chunk_header[0]) == INDX_TAG) { unsigned short version; /* Check version */ - version = BE_16(&index_chunk_header[8]); + version = _X_BE_16(&index_chunk_header[8]); if(version != 0) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_real: unknown object version in INDX: 0x%04x\n", version); @@ -206,9 +206,9 @@ static void real_parse_index(demux_real_t *this) { } /* Read data from header */ - entries = BE_32(&index_chunk_header[10]); - stream_num = BE_16(&index_chunk_header[14]); - next_index_chunk = BE_32(&index_chunk_header[16]); + entries = _X_BE_32(&index_chunk_header[10]); + stream_num = _X_BE_16(&index_chunk_header[14]); + next_index_chunk = _X_BE_32(&index_chunk_header[16]); /* Find which stream this index is for */ index = NULL; @@ -246,9 +246,9 @@ static void real_parse_index(demux_real_t *this) { break; } - (*index)[i].timestamp = BE_32(&index_record[2]); - (*index)[i].offset = BE_32(&index_record[6]); - (*index)[i].packetno = BE_32(&index_record[10]); + (*index)[i].timestamp = _X_BE_32(&index_record[2]); + (*index)[i].offset = _X_BE_32(&index_record[6]); + (*index)[i].packetno = _X_BE_32(&index_record[10]); } } else { lprintf("unused index chunk with %d entries for stream num %d\n", @@ -267,14 +267,14 @@ static void real_parse_index(demux_real_t *this) { static mdpr_t *real_parse_mdpr(const char *data) { mdpr_t *mdpr=malloc(sizeof(mdpr_t)); - mdpr->stream_number=BE_16(&data[2]); - mdpr->max_bit_rate=BE_32(&data[4]); - mdpr->avg_bit_rate=BE_32(&data[8]); - mdpr->max_packet_size=BE_32(&data[12]); - mdpr->avg_packet_size=BE_32(&data[16]); - mdpr->start_time=BE_32(&data[20]); - mdpr->preroll=BE_32(&data[24]); - mdpr->duration=BE_32(&data[28]); + mdpr->stream_number=_X_BE_16(&data[2]); + mdpr->max_bit_rate=_X_BE_32(&data[4]); + mdpr->avg_bit_rate=_X_BE_32(&data[8]); + mdpr->max_packet_size=_X_BE_32(&data[12]); + mdpr->avg_packet_size=_X_BE_32(&data[16]); + mdpr->start_time=_X_BE_32(&data[20]); + mdpr->preroll=_X_BE_32(&data[24]); + mdpr->duration=_X_BE_32(&data[28]); mdpr->stream_name_size=data[32]; mdpr->stream_name=malloc(sizeof(char)*(mdpr->stream_name_size+1)); @@ -286,7 +286,7 @@ static mdpr_t *real_parse_mdpr(const char *data) { memcpy(mdpr->mime_type, &data[34+mdpr->stream_name_size], mdpr->mime_type_size); mdpr->mime_type[(int)mdpr->mime_type_size]=0; - mdpr->type_specific_len=BE_32(&data[34+mdpr->stream_name_size+mdpr->mime_type_size]); + mdpr->type_specific_len=_X_BE_32(&data[34+mdpr->stream_name_size+mdpr->mime_type_size]); mdpr->type_specific_data=malloc(sizeof(char)*(mdpr->type_specific_len)); memcpy(mdpr->type_specific_data, &data[38+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len); @@ -345,14 +345,14 @@ static void real_parse_headers (demux_real_t *this) { return; } - if (BE_32(signature) != RMF_TAG) { + if (_X_BE_32(signature) != RMF_TAG) { this->status = DEMUX_FINISHED; lprintf ("signature not found '%.4s'\n", signature); return; } /* skip to the start of the first chunk and start traversing */ - chunk_size = BE_32(&signature[4]); + chunk_size = _X_BE_32(&signature[4]); this->input->seek(this->input, chunk_size-8, SEEK_CUR); /* iterate through chunks and gather information until the first DATA @@ -364,8 +364,8 @@ static void real_parse_headers (demux_real_t *this) { this->status = DEMUX_FINISHED; return; } - chunk_type = BE_32(&preamble[0]); - chunk_size = BE_32(&preamble[4]); + chunk_type = _X_BE_32(&preamble[0]); + chunk_size = _X_BE_32(&preamble[4]); lprintf ("chunktype %.4s len %d\n", (char *) &chunk_type, chunk_size); switch (chunk_type) { @@ -383,7 +383,7 @@ static void real_parse_headers (demux_real_t *this) { return; } - version = BE_16(&chunk_buffer[0]); + version = _X_BE_16(&chunk_buffer[0]); if (chunk_type == PROP_TAG) { @@ -395,10 +395,10 @@ static void real_parse_headers (demux_real_t *this) { return; } - this->duration = BE_32(&chunk_buffer[22]); - this->index_start = BE_32(&chunk_buffer[30]); - this->data_start = BE_32(&chunk_buffer[34]); - this->avg_bitrate = BE_32(&chunk_buffer[6]); + this->duration = _X_BE_32(&chunk_buffer[22]); + this->index_start = _X_BE_32(&chunk_buffer[30]); + this->data_start = _X_BE_32(&chunk_buffer[34]); + this->avg_bitrate = _X_BE_32(&chunk_buffer[6]); lprintf("PROP: duration: %d ms\n", this->duration); lprintf("PROP: index start: %"PRIX64"\n", this->index_start); @@ -427,7 +427,7 @@ static void real_parse_headers (demux_real_t *this) { lprintf ("parsing type specific data...\n"); - if(BE_32(mdpr->type_specific_data) == RA_TAG) { + if(_X_BE_32(mdpr->type_specific_data) == RA_TAG) { int version, len; if(this->num_audio_streams == MAX_AUDIO_STREAMS) { @@ -436,7 +436,7 @@ static void real_parse_headers (demux_real_t *this) { goto unknown; } - version = BE_16(mdpr->type_specific_data + 4); + version = _X_BE_16(mdpr->type_specific_data + 4); lprintf("audio version %d detected\n", version); @@ -444,14 +444,14 @@ static void real_parse_headers (demux_real_t *this) { case 3: /* Version 3 header stores fourcc after meta info - cheat by reading backwards from the * end of the header instead of having to parse it all */ - fourcc = ME_32(mdpr->type_specific_data + mdpr->type_specific_len - 5); + fourcc = _X_ME_32(mdpr->type_specific_data + mdpr->type_specific_len - 5); break; case 4: len = *(mdpr->type_specific_data + 56); - fourcc = ME_32(mdpr->type_specific_data + 58 + len); + fourcc = _X_ME_32(mdpr->type_specific_data + 58 + len); break; case 5: - fourcc = ME_32(mdpr->type_specific_data + 66); + fourcc = _X_ME_32(mdpr->type_specific_data + 66); break; default: lprintf("unsupported audio header version %d\n", version); @@ -467,7 +467,7 @@ static void real_parse_headers (demux_real_t *this) { this->num_audio_streams++; - } else if(BE_32(mdpr->type_specific_data + 4) == VIDO_TAG) { + } else if(_X_BE_32(mdpr->type_specific_data + 4) == VIDO_TAG) { if(this->num_video_streams == MAX_VIDEO_STREAMS) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, @@ -476,12 +476,12 @@ static void real_parse_headers (demux_real_t *this) { } lprintf ("video detected\n"); - fourcc = ME_32(mdpr->type_specific_data + 8); + fourcc = _X_ME_32(mdpr->type_specific_data + 8); lprintf("fourcc = %.4s\n", (char *) &fourcc); this->video_streams[this->num_video_streams].fourcc = fourcc; this->video_streams[this->num_video_streams].buf_type = _x_fourcc_to_buf_video(fourcc); - this->video_streams[this->num_video_streams].format = BE_32(mdpr->type_specific_data + 30); + this->video_streams[this->num_video_streams].format = _X_BE_32(mdpr->type_specific_data + 30); this->video_streams[this->num_video_streams].index = NULL; this->video_streams[this->num_video_streams].mdpr = mdpr; @@ -506,28 +506,28 @@ unknown: stream_ptr = 2; /* load the title string */ - field_size = BE_16(&chunk_buffer[stream_ptr]); + field_size = _X_BE_16(&chunk_buffer[stream_ptr]); stream_ptr += 2; _x_meta_info_n_set(this->stream, XINE_META_INFO_TITLE, &chunk_buffer[stream_ptr], field_size); stream_ptr += field_size; /* load the author string */ - field_size = BE_16(&chunk_buffer[stream_ptr]); + field_size = _X_BE_16(&chunk_buffer[stream_ptr]); stream_ptr += 2; _x_meta_info_n_set(this->stream, XINE_META_INFO_ARTIST, &chunk_buffer[stream_ptr], field_size); stream_ptr += field_size; /* load the copyright string as the year */ - field_size = BE_16(&chunk_buffer[stream_ptr]); + field_size = _X_BE_16(&chunk_buffer[stream_ptr]); stream_ptr += 2; _x_meta_info_n_set(this->stream, XINE_META_INFO_YEAR, &chunk_buffer[stream_ptr], field_size); stream_ptr += field_size; /* load the comment string */ - field_size = BE_16(&chunk_buffer[stream_ptr]); + field_size = _X_BE_16(&chunk_buffer[stream_ptr]); stream_ptr += 2; _x_meta_info_n_set(this->stream, XINE_META_INFO_COMMENT, &chunk_buffer[stream_ptr], field_size); @@ -545,7 +545,7 @@ unknown: } /* check version */ - version = BE_16(&data_chunk_header[0]); + version = _X_BE_16(&data_chunk_header[0]); if(version != 0) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_real: unknown object version in DATA: 0x%04x\n", version); @@ -553,8 +553,8 @@ unknown: return; } - this->current_data_chunk_packet_count = BE_32(&data_chunk_header[2]); - this->next_data_chunk_offset = BE_32(&data_chunk_header[6]); + this->current_data_chunk_packet_count = _X_BE_32(&data_chunk_header[2]); + this->next_data_chunk_offset = _X_BE_32(&data_chunk_header[6]); this->data_chunk_size = chunk_size; break; @@ -625,11 +625,11 @@ unknown: int i, stream; /* Check for end of the data chunk */ - if(((id = BE_32(&search_buffer[offset])) == DATA_TAG) || + if(((id = _X_BE_32(&search_buffer[offset])) == DATA_TAG) || (id == INDX_TAG)) break; - stream = BE_16(&search_buffer[offset + 4]); + stream = _X_BE_16(&search_buffer[offset + 4]); for(i = 0; !this->video_stream && (i < this->num_video_streams); i++) { if(stream == this->video_streams[i].mdpr->stream_number) { @@ -645,7 +645,7 @@ unknown: } } - offset += BE_16(&search_buffer[offset + 2]); + offset += _X_BE_16(&search_buffer[offset + 2]); } if(INPUT_IS_SEEKABLE(this->input)) @@ -716,7 +716,7 @@ unknown: * The second is the codec initialisation data found at the end of * the type specific data for the audio stream */ if(buf->type == BUF_AUDIO_AAC) { - int version = BE_16(mdpr->type_specific_data + 4); + int version = _X_BE_16(mdpr->type_specific_data + 4); if(version != 5) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, @@ -725,9 +725,9 @@ unknown: goto unsupported; } - buf->decoder_info[1] = BE_16(mdpr->type_specific_data + 54); - buf->decoder_info[2] = BE_16(mdpr->type_specific_data + 58); - buf->decoder_info[3] = BE_16(mdpr->type_specific_data + 60); + buf->decoder_info[1] = _X_BE_16(mdpr->type_specific_data + 54); + buf->decoder_info[2] = _X_BE_16(mdpr->type_specific_data + 58); + buf->decoder_info[3] = _X_BE_16(mdpr->type_specific_data + 60); buf->decoder_flags |= BUF_FLAG_STDHEADER; buf->content = NULL; @@ -740,7 +740,7 @@ unknown: buf->type = this->audio_stream->buf_type; buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_FRAME_END|BUF_FLAG_SPECIAL; buf->decoder_info[1] = BUF_SPECIAL_DECODER_CONFIG; - buf->decoder_info[2] = BE_32(mdpr->type_specific_data + 74) - 1; + buf->decoder_info[2] = _X_BE_32(mdpr->type_specific_data + 74) - 1; buf->decoder_info_ptr[2] = buf->content; buf->size = 0; @@ -952,7 +952,7 @@ static int stream_read_char (demux_real_t *this) { static int stream_read_word (demux_real_t *this) { uint16_t ret; this->input->read (this->input, (char *) &ret, 2); - return BE_16(&ret); + return _X_BE_16(&ret); } static int demux_real_send_chunk(demux_plugin_t *this_gen) { @@ -981,7 +981,7 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { } /* Check to see if we've gone past the end of the data chunk */ - if(((id = BE_32(&header[0])) == DATA_TAG) || + if(((id = _X_BE_32(&header[0])) == DATA_TAG) || (id == INDX_TAG)) { lprintf("finished reading data chunk\n"); this->status = DEMUX_FINISHED; @@ -989,7 +989,7 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { } /* check version */ - version = BE_16(&header[0]); + version = _X_BE_16(&header[0]); if(version > 1) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_real: unknown object version in data packet: 0x%04x\n", version); @@ -998,10 +998,10 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { } /* read the packet information */ - stream = BE_16(&header[4]); + stream = _X_BE_16(&header[4]); offset = this->input->get_current_pos(this->input); - size = BE_16(&header[2]) - DATA_PACKET_HEADER_SIZE; - timestamp= BE_32(&header[6]); + size = _X_BE_16(&header[2]) - DATA_PACKET_HEADER_SIZE; + timestamp= _X_BE_32(&header[6]); pts = (int64_t) timestamp * 90; /* Data packet header with version 1 contains 1 extra byte */ @@ -1355,8 +1355,8 @@ discard: return this->status; } lprintf ("**** found next DATA tag\n"); - this->current_data_chunk_packet_count = BE_32(&data_chunk_header[2]); - this->next_data_chunk_offset = BE_32(&data_chunk_header[6]); + this->current_data_chunk_packet_count = _X_BE_32(&data_chunk_header[2]); + this->next_data_chunk_offset = _X_BE_32(&data_chunk_header[6]); } if (!this->current_data_chunk_packet_count) { diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c index bf8de0dad..139ad24f4 100644 --- a/src/demuxers/demux_realaudio.c +++ b/src/demuxers/demux_realaudio.c @@ -90,13 +90,13 @@ static int open_ra_file(demux_ra_t *this) { return 0; /* read version */ - version = BE_16(&file_header[0x04]); + version = _X_BE_16(&file_header[0x04]); /* read header size according to version */ if (version == 3) - this->header_size = BE_16(&file_header[0x06]) + 8; + this->header_size = _X_BE_16(&file_header[0x06]) + 8; else if (version == 4) - this->header_size = BE_32(&file_header[0x12]) + 16; + this->header_size = _X_BE_32(&file_header[0x12]) + 16; else { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: unknown version number %d\n", version); return 0; @@ -113,18 +113,18 @@ static int open_ra_file(demux_ra_t *this) { /* read header data according to version */ if((version == 3) && (this->header_size >= 32)) { - this->data_size = BE_32(&this->header[0x12]); + this->data_size = _X_BE_32(&this->header[0x12]); this->block_align = 240; offset = 0x16; } else if(this->header_size >= 72) { - this->data_size = BE_32(&this->header[0x1C]); + this->data_size = _X_BE_32(&this->header[0x1C]); - this->block_align = BE_16(&this->header[0x2A]); + this->block_align = _X_BE_16(&this->header[0x2A]); if(this->header[0x3D] == 4) - this->fourcc = ME_32(&this->header[0x3E]); + this->fourcc = _X_ME_32(&this->header[0x3E]); else { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: invalid fourcc size %d\n", this->header[0x3D]); @@ -169,7 +169,7 @@ static int open_ra_file(demux_ra_t *this) { /* Fourcc for version 3 comes after meta info */ if((version == 3) && ((offset+7) <= this->header_size)) { if(this->header[offset+2] == 4) - this->fourcc = ME_32(&this->header[offset+3]); + this->fourcc = _X_ME_32(&this->header[offset+3]); else { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: invalid fourcc size %d\n", this->header[offset+2]); diff --git a/src/demuxers/demux_roq.c b/src/demuxers/demux_roq.c index 0e7c93b97..10137be7f 100644 --- a/src/demuxers/demux_roq.c +++ b/src/demuxers/demux_roq.c @@ -95,8 +95,8 @@ static int open_roq_file(demux_roq_t *this) { return 0; /* check for the RoQ magic numbers */ - if ((LE_16(&preamble[0]) != RoQ_MAGIC_NUMBER) || - (LE_32(&preamble[2]) != 0xFFFFFFFF)) + if ((_X_LE_16(&preamble[0]) != RoQ_MAGIC_NUMBER) || + (_X_LE_32(&preamble[2]) != 0xFFFFFFFF)) return 0; this->bih.biSize = sizeof(xine_bmiheader); @@ -112,7 +112,7 @@ static int open_roq_file(demux_roq_t *this) { * * therefore, the frame pts increment is 90000 / fps */ - fps = LE_16(&preamble[6]); + fps = _X_LE_16(&preamble[6]); this->frame_pts_inc = 90000 / fps; /* iterate through the first 2 seconds worth of chunks searching for @@ -124,16 +124,16 @@ static int open_roq_file(demux_roq_t *this) { if (this->input->read(this->input, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) break; - chunk_type = LE_16(&preamble[0]); - chunk_size = LE_32(&preamble[2]); + chunk_type = _X_LE_16(&preamble[0]); + chunk_size = _X_LE_32(&preamble[2]); if (chunk_type == RoQ_INFO) { /* fetch the width and height; reuse the preamble bytes */ if (this->input->read(this->input, preamble, 8) != 8) break; - this->bih.biWidth = LE_16(&preamble[0]); - this->bih.biHeight = LE_16(&preamble[2]); + this->bih.biWidth = _X_LE_16(&preamble[0]); + this->bih.biHeight = _X_LE_16(&preamble[2]); /* if an audio chunk was already found, search is done */ if (this->wave.nChannels) @@ -188,8 +188,8 @@ static int demux_roq_send_chunk(demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; return this->status; } - chunk_type = LE_16(&preamble[0]); - chunk_size = LE_32(&preamble[2]); + chunk_type = _X_LE_16(&preamble[0]); + chunk_size = _X_LE_32(&preamble[2]); /* if the chunk is an audio chunk, route it to the audio fifo */ if ((chunk_type == RoQ_SOUND_MONO) || (chunk_type == RoQ_SOUND_STEREO)) { diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c index 9c86314c5..8601d3cbc 100644 --- a/src/demuxers/demux_smjpeg.c +++ b/src/demuxers/demux_smjpeg.c @@ -119,7 +119,7 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { this->input->seek(this->input, SMJPEG_SIGNATURE_SIZE + 4, SEEK_SET); if (this->input->read(this->input, header_chunk, 4) != 4) return 0; - this->duration = BE_32(&header_chunk[0]); + this->duration = _X_BE_32(&header_chunk[0]); /* initial state: no video and no audio (until headers found) */ this->video_type = this->audio_type = 0; @@ -131,7 +131,7 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { if (this->input->read(this->input, header_chunk, 4) != 4) return 0; - chunk_tag = BE_32(&header_chunk[0]); + chunk_tag = _X_BE_32(&header_chunk[0]); switch(chunk_tag) { @@ -145,8 +145,8 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { SMJPEG_VIDEO_HEADER_SIZE) != SMJPEG_VIDEO_HEADER_SIZE) return 0; - this->bih.biWidth = BE_16(&header_chunk[8]); - this->bih.biHeight = BE_16(&header_chunk[10]); + this->bih.biWidth = _X_BE_16(&header_chunk[8]); + this->bih.biHeight = _X_BE_16(&header_chunk[10]); this->bih.biCompression = *(uint32_t *)&header_chunk[12]; this->video_type = _x_fourcc_to_buf_video(this->bih.biCompression); break; @@ -156,13 +156,13 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { SMJPEG_AUDIO_HEADER_SIZE) != SMJPEG_AUDIO_HEADER_SIZE) return 0; - this->audio_sample_rate = BE_16(&header_chunk[4]); + this->audio_sample_rate = _X_BE_16(&header_chunk[4]); this->audio_bits = header_chunk[6]; this->audio_channels = header_chunk[7]; /* ADPCM in these files is ID'd by 'APCM' which is used in other * files to denote a slightly different format; thus, use the * following special case */ - if (BE_32(&header_chunk[8]) == APCM_TAG) { + if (_X_BE_32(&header_chunk[8]) == APCM_TAG) { audio_codec = be2me_32(APCM_TAG); this->audio_type = BUF_AUDIO_SMJPEG_IMA; } else { @@ -176,7 +176,7 @@ static int open_smjpeg_file(demux_smjpeg_t *this) { * of the chunk */ if (this->input->read(this->input, header_chunk, 4) != 4) return 0; - this->input->seek(this->input, BE_32(&header_chunk[0]), SEEK_CUR); + this->input->seek(this->input, _X_BE_32(&header_chunk[0]), SEEK_CUR); break; } } @@ -210,8 +210,8 @@ static int demux_smjpeg_send_chunk(demux_plugin_t *this_gen) { return this->status; /* skip to next while() iteration to bail out */ } - chunk_tag = BE_32(&preamble[0]); - remaining_sample_bytes = BE_32(&preamble[8]); + chunk_tag = _X_BE_32(&preamble[0]); + remaining_sample_bytes = _X_BE_32(&preamble[8]); /* * Each sample has an absolute timestamp in millisecond units: @@ -238,7 +238,7 @@ static int demux_smjpeg_send_chunk(demux_plugin_t *this_gen) { pts /= (this->audio_sample_rate * this->audio_channels); audio_frame_count += ((remaining_sample_bytes - 4) * 2); } else { - pts = BE_32(&preamble[4]); + pts = _X_BE_32(&preamble[4]); pts *= 90; } diff --git a/src/demuxers/demux_snd.c b/src/demuxers/demux_snd.c index 99415890a..0f28d81cf 100644 --- a/src/demuxers/demux_snd.c +++ b/src/demuxers/demux_snd.c @@ -85,17 +85,17 @@ static int open_snd_file(demux_snd_t *this) { return 0; /* check the signature */ - if (BE_32(&header[0]) != snd_TAG) + if (_X_BE_32(&header[0]) != snd_TAG) return 0; /* file is qualified; skip over the header bytes in the stream */ this->input->seek(this->input, SND_HEADER_SIZE, SEEK_SET); - this->data_start = BE_32(&header[0x04]); - this->data_size = BE_32(&header[0x08]); - encoding = BE_32(&header[0x0C]); - this->audio_sample_rate = BE_32(&header[0x10]); - this->audio_channels = BE_32(&header[0x14]); + this->data_start = _X_BE_32(&header[0x04]); + this->data_size = _X_BE_32(&header[0x08]); + encoding = _X_BE_32(&header[0x0C]); + this->audio_sample_rate = _X_BE_32(&header[0x10]); + this->audio_channels = _X_BE_32(&header[0x14]); /* basic sanity checks on the loaded audio parameters */ if ((!this->audio_sample_rate) || diff --git a/src/demuxers/demux_str.c b/src/demuxers/demux_str.c index 90dbf2117..6f3556dd4 100644 --- a/src/demuxers/demux_str.c +++ b/src/demuxers/demux_str.c @@ -202,8 +202,8 @@ static int open_str_file(demux_str_t *this) { } /* check for STR with a RIFF header */ - if ((BE_32(&check_bytes[0]) == RIFF_TAG) && - (BE_32(&check_bytes[8]) == CDXA_TAG)) + if ((_X_BE_32(&check_bytes[0]) == RIFF_TAG) && + (_X_BE_32(&check_bytes[8]) == CDXA_TAG)) local_offset = 0x2C; else local_offset = 0; @@ -220,16 +220,16 @@ static int open_str_file(demux_str_t *this) { check_bytes[local_offset + 0x13]); /* check for 12-byte sync marker */ - if ((BE_32(&check_bytes[local_offset + 0]) != 0x00FFFFFF) || - (BE_32(&check_bytes[local_offset + 4]) != 0xFFFFFFFF) || - (BE_32(&check_bytes[local_offset + 8]) != 0xFFFFFF00)) { + if ((_X_BE_32(&check_bytes[local_offset + 0]) != 0x00FFFFFF) || + (_X_BE_32(&check_bytes[local_offset + 4]) != 0xFFFFFFFF) || + (_X_BE_32(&check_bytes[local_offset + 8]) != 0xFFFFFF00)) { lprintf("sector %d sync error\n", sector); return 0; } /* the 32 bits starting at 0x10 and at 0x14 should be the same */ - if (BE_32(&check_bytes[local_offset + 0x10]) != - BE_32(&check_bytes[local_offset + 0x14])) { + if (_X_BE_32(&check_bytes[local_offset + 0x10]) != + _X_BE_32(&check_bytes[local_offset + 0x14])) { lprintf("sector %d control bits copy error\n", sector); return 0; } @@ -248,15 +248,15 @@ static int open_str_file(demux_str_t *this) { case CDXA_TYPE_VIDEO: /* first time we have seen video/data in this channel? */ if ((!(this->channel_type[channel] & CDXA_TYPE_DATA)) && - (LE_32(&check_bytes[local_offset + 0x18]) == STR_MAGIC)) { + (_X_LE_32(&check_bytes[local_offset + 0x18]) == STR_MAGIC)) { /* mark this channel as having video data */ this->channel_type[channel] |= CDXA_TYPE_VIDEO; this->bih[channel].biWidth = - LE_16(&check_bytes[local_offset + 0x18 + 0x10]); + _X_LE_16(&check_bytes[local_offset + 0x18 + 0x10]); this->bih[channel].biHeight = - LE_16(&check_bytes[local_offset + 0x18 + 0x12]); + _X_LE_16(&check_bytes[local_offset + 0x18 + 0x12]); } break; @@ -349,12 +349,12 @@ static int demux_str_send_chunk(demux_plugin_t *this_gen) { case CDXA_TYPE_DATA: /* video chunk */ - if (LE_32(§or[0x18]) != STR_MAGIC || + if (_X_LE_32(§or[0x18]) != STR_MAGIC || channel != this->default_video_channel) { return 0; } - frame_number = LE_32(§or[0x18 + 0x08]); + frame_number = _X_LE_32(§or[0x18 + 0x08]); buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->pts = frame_number * FRAME_DURATION; @@ -365,7 +365,7 @@ static int demux_str_send_chunk(demux_plugin_t *this_gen) { /* first chunk of frame? sync forthcoming audio packets */ /* FIXME */ - /*if (LE_16(§or[0x18+0x04]) == 0) { + /*if (_X_LE_16(§or[0x18+0x04]) == 0) { * int i; * for (i = 0; i < STR_MAX_CHANNELS; i++) this->audio_pts[i] = buf->pts; *} @@ -385,7 +385,7 @@ static int demux_str_send_chunk(demux_plugin_t *this_gen) { /* if the current chunk is 1 less than the chunk count, this is the * last chunk of the frame */ - if ((LE_16(§or[0x18+0x04]) + 1) == LE_16(§or[0x18+0x06])) + if ((_X_LE_16(§or[0x18+0x04]) + 1) == _X_LE_16(§or[0x18+0x06])) buf->decoder_flags |= BUF_FLAG_FRAME_END; buf->type = BUF_VIDEO_PSX_MDEC | channel; diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 2e4808b9c..ab0936d88 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -74,7 +74,7 @@ static int open_tta_file(demux_tta_t *this) { if (_x_demux_read_header(this->input, peek, 4) != 4) return 0; - if ( BE_32(peek) != FOURCC_32('T', 'T', 'A', '1') ) + if ( _X_BE_32(peek) != FOURCC_32('T', 'T', 'A', '1') ) return 0; if ( this->input->read(this->input, this->header.buffer, sizeof(this->header)) != sizeof(this->header) ) diff --git a/src/demuxers/demux_vmd.c b/src/demuxers/demux_vmd.c index e2b68fbb1..fd6900ec0 100644 --- a/src/demuxers/demux_vmd.c +++ b/src/demuxers/demux_vmd.c @@ -115,7 +115,7 @@ static int open_vmd_file(demux_vmd_t *this) { VMD_HEADER_SIZE) return 0; - if (LE_16(&vmd_header[0]) != VMD_HEADER_SIZE - 2) + if (_X_LE_16(&vmd_header[0]) != VMD_HEADER_SIZE - 2) return 0; /* file is minimally qualified at this point, proceed to load */ @@ -125,11 +125,11 @@ static int open_vmd_file(demux_vmd_t *this) { this->data_size = 1; bih->biSize = sizeof(xine_bmiheader) + VMD_HEADER_SIZE; - bih->biWidth = LE_16(&vmd_header[12]); - bih->biHeight = LE_16(&vmd_header[14]); - this->wave.nSamplesPerSec = LE_16(&vmd_header[804]); + bih->biWidth = _X_LE_16(&vmd_header[12]); + bih->biHeight = _X_LE_16(&vmd_header[14]); + this->wave.nSamplesPerSec = _X_LE_16(&vmd_header[804]); this->wave.nChannels = (vmd_header[811] & 0x80) ? 2 : 1; - this->wave.nBlockAlign = LE_16(&vmd_header[806]); + this->wave.nBlockAlign = _X_LE_16(&vmd_header[806]); if (this->wave.nBlockAlign & 0x8000) { this->wave.nBlockAlign -= 0x8000; this->wave.wBitsPerSample = 16; @@ -149,8 +149,8 @@ static int open_vmd_file(demux_vmd_t *this) { /* skip over the offset table and load the table of contents; don't * care about the offset table since demuxer will calculate those * independently */ - toc_offset = LE_32(&vmd_header[812]); - this->frame_count = LE_16(&vmd_header[6]); + toc_offset = _X_LE_32(&vmd_header[812]); + this->frame_count = _X_LE_16(&vmd_header[6]); this->input->seek(this->input, toc_offset + this->frame_count * 6, SEEK_SET); /* while we have the toal number of blocks, calculate the total running @@ -172,7 +172,7 @@ static int open_vmd_file(demux_vmd_t *this) { this->frame_table = xine_xmalloc(this->frame_count * sizeof(vmd_frame_t)); - current_offset = this->data_start = LE_32(&vmd_header[20]); + current_offset = this->data_start = _X_LE_32(&vmd_header[20]); this->data_size = toc_offset - this->data_start; current_frame_record = raw_frame_table; total_frames = this->frame_count; @@ -180,7 +180,7 @@ static int open_vmd_file(demux_vmd_t *this) { while (total_frames--) { /* if the frame size is 0, do not count the frame and bring the * total frame count down */ - this->frame_table[i].frame_size = LE_32(¤t_frame_record[2]); + this->frame_table[i].frame_size = _X_LE_32(¤t_frame_record[2]); /* this logic is present so that 0-length audio chunks are not * accounted */ diff --git a/src/demuxers/demux_voc.c b/src/demuxers/demux_voc.c index 1c1675b92..bb0cfc16d 100644 --- a/src/demuxers/demux_voc.c +++ b/src/demuxers/demux_voc.c @@ -91,7 +91,7 @@ static int open_voc_file(demux_voc_t *this) { return 0; /* file is qualified */ - first_block_offset = LE_16(&header[0x14]); + first_block_offset = _X_LE_16(&header[0x14]); this->input->seek(this->input, first_block_offset, SEEK_SET); /* load the block preamble */ diff --git a/src/demuxers/demux_vqa.c b/src/demuxers/demux_vqa.c index 56fbde7d1..987114793 100644 --- a/src/demuxers/demux_vqa.c +++ b/src/demuxers/demux_vqa.c @@ -98,8 +98,8 @@ static int open_vqa_file(demux_vqa_t *this) { return 0; /* check for the VQA signatures */ - if ((BE_32(&scratch[0]) != FORM_TAG) || - (BE_32(&scratch[8]) != WVQA_TAG)) + if ((_X_BE_32(&scratch[0]) != FORM_TAG) || + (_X_BE_32(&scratch[8]) != WVQA_TAG)) return 0; /* file is qualified; skip to the start of the VQA header */ @@ -115,9 +115,9 @@ static int open_vqa_file(demux_vqa_t *this) { return 0; bih->biSize = sizeof(xine_bmiheader) + VQA_HEADER_SIZE; - bih->biWidth = LE_16(&vqa_header[6]); - bih->biHeight = LE_16(&vqa_header[8]); - this->wave.nSamplesPerSec = LE_16(&vqa_header[24]); + bih->biWidth = _X_LE_16(&vqa_header[6]); + bih->biHeight = _X_LE_16(&vqa_header[8]); + this->wave.nSamplesPerSec = _X_LE_16(&vqa_header[24]); this->wave.nChannels = vqa_header[26]; this->wave.wBitsPerSample = 16; @@ -125,7 +125,7 @@ static int open_vqa_file(demux_vqa_t *this) { if (this->input->read(this->input, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) return 0; - chunk_size = BE_32(&scratch[4]); + chunk_size = _X_BE_32(&scratch[4]); this->input->seek(this->input, chunk_size, SEEK_CUR); this->video_pts = this->audio_frames = 0; @@ -152,7 +152,7 @@ static int demux_vqa_send_chunk(demux_plugin_t *this_gen) { } current_file_pos = this->input->get_current_pos(this->input); - chunk_size = BE_32(&preamble[4]); + chunk_size = _X_BE_32(&preamble[4]); skip_byte = chunk_size & 0x1; audio_pts = this->audio_frames; audio_pts *= 90000; @@ -204,7 +204,7 @@ static int demux_vqa_send_chunk(demux_plugin_t *this_gen) { } current_file_pos = this->input->get_current_pos(this->input); - chunk_size = BE_32(&preamble[4]); + chunk_size = _X_BE_32(&preamble[4]); while (chunk_size) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = BUF_VIDEO_VQA; diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c index 1e46d8526..d7f8f9f9c 100644 --- a/src/demuxers/demux_wav.c +++ b/src/demuxers/demux_wav.c @@ -123,8 +123,8 @@ static int open_wav_file(demux_wav_t *this) { free (this->wave); return 0; } - chunk_tag = LE_32(&chunk_preamble[0]); - chunk_size = LE_32(&chunk_preamble[4]); + chunk_tag = _X_LE_32(&chunk_preamble[0]); + chunk_size = _X_LE_32(&chunk_preamble[4]); if (chunk_tag == data_TAG) { this->data_start = this->input->get_current_pos(this->input); diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c index fa1cfb17d..7ab10c0aa 100644 --- a/src/demuxers/demux_wc3movie.c +++ b/src/demuxers/demux_wc3movie.c @@ -159,9 +159,9 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) { PREAMBLE_SIZE) this->status = DEMUX_FINISHED; else { - chunk_tag = BE_32(&preamble[0]); + chunk_tag = _X_BE_32(&preamble[0]); /* round up to the nearest even size */ - chunk_size = (BE_32(&preamble[4]) + 1) & (~1); + chunk_size = (_X_BE_32(&preamble[4]) + 1) & (~1); if (chunk_tag == BRCH_TAG) { /* empty chunk; do nothing */ @@ -185,7 +185,7 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) { this->status = DEMUX_FINISHED; return this->status; } - palette_number = LE_32(&preamble[0]); + palette_number = _X_LE_32(&preamble[0]); if (palette_number >= this->number_of_shots) { xine_log(this->stream->xine, XINE_LOG_MSG, @@ -359,9 +359,9 @@ static int open_mve_file(demux_mve_t *this) { if (_x_demux_read_header(this->input, header, WC3_HEADER_SIZE) != WC3_HEADER_SIZE) return 0; - if ((BE_32(&header[0]) != FORM_TAG) || - (BE_32(&header[8]) != MOVE_TAG) || - (BE_32(&header[12]) != PC_TAG)) + if ((_X_BE_32(&header[0]) != FORM_TAG) || + (_X_BE_32(&header[8]) != MOVE_TAG) || + (_X_BE_32(&header[12]) != PC_TAG)) return 0; /* file is qualified */ @@ -377,7 +377,7 @@ static int open_mve_file(demux_mve_t *this) { this->input->seek(this->input, 0x1C, SEEK_SET); if (this->input->read(this->input, preamble, 4) != 4) return 0; - this->number_of_shots = LE_32(&preamble[0]); + this->number_of_shots = _X_LE_32(&preamble[0]); /* allocate space for the shot offset index and set offsets to 0 */ this->shot_offsets = xine_xmalloc(this->number_of_shots * sizeof(off_t)); @@ -400,8 +400,8 @@ static int open_mve_file(demux_mve_t *this) { return 0; } - if ((BE_32(&preamble[0]) != PALT_TAG) || - (BE_32(&preamble[4]) != PALETTE_CHUNK_SIZE)) { + if ((_X_BE_32(&preamble[0]) != PALT_TAG) || + (_X_BE_32(&preamble[4]) != PALETTE_CHUNK_SIZE)) { xine_log(this->stream->xine, XINE_LOG_MSG, _("demux_wc3movie: There was a problem while loading palette chunks\n")); free (this->palettes); @@ -450,9 +450,9 @@ static int open_mve_file(demux_mve_t *this) { return 0; } - chunk_tag = BE_32(&preamble[0]); + chunk_tag = _X_BE_32(&preamble[0]); /* round up to the nearest even size */ - chunk_size = (BE_32(&preamble[4]) + 1) & (~1); + chunk_size = (_X_BE_32(&preamble[4]) + 1) & (~1); switch (chunk_tag) { @@ -481,8 +481,8 @@ static int open_mve_file(demux_mve_t *this) { free (this->shot_offsets); return 0; } - this->bih.biWidth = BE_32(&preamble[0]); - this->bih.biHeight = BE_32(&preamble[4]); + this->bih.biWidth = _X_BE_32(&preamble[0]); + this->bih.biHeight = _X_BE_32(&preamble[4]); break; case INDX_TAG: @@ -558,9 +558,9 @@ static int demux_mve_seek (demux_plugin_t *this_gen, return this->status; } - chunk_tag = BE_32(&preamble[0]); + chunk_tag = _X_BE_32(&preamble[0]); /* round up to the nearest even size */ - chunk_size = (BE_32(&preamble[4]) + 1) & (~1); + chunk_size = (_X_BE_32(&preamble[4]) + 1) & (~1); if (chunk_tag == SHOT_TAG) { this->shot_offsets[0] = @@ -599,9 +599,9 @@ static int demux_mve_seek (demux_plugin_t *this_gen, return this->status; } - chunk_tag = BE_32(&preamble[0]); + chunk_tag = _X_BE_32(&preamble[0]); /* round up to the nearest even size */ - chunk_size = (BE_32(&preamble[4]) + 1) & (~1); + chunk_size = (_X_BE_32(&preamble[4]) + 1) & (~1); if (chunk_tag == SHOT_TAG) { this->shot_offsets[i + 1] = diff --git a/src/demuxers/ebml.c b/src/demuxers/ebml.c index 88492dde6..487344316 100644 --- a/src/demuxers/ebml.c +++ b/src/demuxers/ebml.c @@ -297,12 +297,12 @@ int ebml_read_float (ebml_parser_t *ebml, ebml_elem_t *elem, double *num) { if (size == 4) { float f; - *((uint32_t *) &f) = BE_32(data); + *((uint32_t *) &f) = _X_BE_32(data); *num = f; } else { double d; - *((uint64_t *) &d) = BE_64(data); + *((uint64_t *) &d) = _X_BE_64(data); *num = d; } return 1; diff --git a/src/demuxers/flacutils.h b/src/demuxers/flacutils.h index 67f5d66c9..c95f87519 100644 --- a/src/demuxers/flacutils.h +++ b/src/demuxers/flacutils.h @@ -73,19 +73,19 @@ static inline void _x_parse_flac_metadata_header(uint8_t *buffer, xine_flac_meta parsed->last = buffer[0] & 0x80 ? 1 : 0; parsed->blocktype = buffer[0] & 0x7f; - parsed->length = BE_24(&buffer[1]); + parsed->length = _X_BE_24(&buffer[1]); } static inline void _x_parse_flac_streaminfo_block(uint8_t *buffer, xine_flac_streaminfo_block *parsed) { - parsed->blocksize_min = BE_16(&buffer[0]); - parsed->blocksize_max = BE_16(&buffer[2]); - parsed->framesize_min = BE_24(&buffer[4]); - parsed->framesize_max = BE_24(&buffer[7]); - parsed->samplerate = BE_32(&buffer[10]); + parsed->blocksize_min = _X_BE_16(&buffer[0]); + parsed->blocksize_max = _X_BE_16(&buffer[2]); + parsed->framesize_min = _X_BE_24(&buffer[4]); + parsed->framesize_max = _X_BE_24(&buffer[7]); + parsed->samplerate = _X_BE_32(&buffer[10]); parsed->channels = ((parsed->samplerate >> 9) & 0x07) + 1; parsed->bits_per_sample = ((parsed->samplerate >> 4) & 0x1F) + 1; parsed->samplerate >>= 12; - parsed->total_samples = BE_64(&buffer[10]) & UINT64_C(0x0FFFFFFFFF); /* 36 bits */ + parsed->total_samples = _X_BE_64(&buffer[10]) & UINT64_C(0x0FFFFFFFFF); /* 36 bits */ } #endif diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index a59eb6259..bc7902168 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -231,11 +231,11 @@ static int id3v2_parse_header(input_plugin_t *input, uint8_t *mp3_frame_header, id3v2_header_t *tag_header) { uint8_t buf[6]; - tag_header->id = BE_32(mp3_frame_header); + tag_header->id = _X_BE_32(mp3_frame_header); if (input->read (input, buf, 6) == 6) { tag_header->revision = buf[0]; tag_header->flags = buf[1]; - tag_header->size = BE_32_synchsafe(&buf[2]); + tag_header->size = _X_BE_32_synchsafe(&buf[2]); lprintf("tag: ID3 v2.%d.%d\n", mp3_frame_header[3], tag_header->revision); lprintf("flags: %d\n", tag_header->flags); @@ -257,7 +257,7 @@ static int id3v22_parse_frame_header(input_plugin_t *input, if (len == ID3V22_FRAME_HEADER_SIZE) { frame_header->id = (buf[0] << 16) + (buf[1] << 8) + buf[2]; - frame_header->size = BE_24_synchsafe(&buf[3]); + frame_header->size = _X_BE_24_synchsafe(&buf[3]); lprintf("frame: %c%c%c: size: %d\n", buf[0], buf[1], buf[2], frame_header->size); @@ -409,9 +409,9 @@ static int id3v23_parse_frame_header(input_plugin_t *input, len = input->read (input, buf, ID3V23_FRAME_HEADER_SIZE); if (len == ID3V23_FRAME_HEADER_SIZE) { - frame_header->id = BE_32(buf); - frame_header->size = BE_32(&buf[4]); - frame_header->flags = BE_16(buf + 8); + frame_header->id = _X_BE_32(buf); + frame_header->size = _X_BE_32(&buf[4]); + frame_header->flags = _X_BE_16(buf + 8); lprintf("frame: %c%c%c%c, size: %d, flags: %X\n", buf[0], buf[1], buf[2], buf[3], frame_header->size, frame_header->flags); @@ -428,12 +428,12 @@ static int id3v23_parse_frame_ext_header(input_plugin_t *input, if (input->read (input, buf, 4) == 4) { - frame_ext_header->size = BE_32_synchsafe(&buf[0]); + frame_ext_header->size = _X_BE_32_synchsafe(&buf[0]); if (frame_ext_header->size == 6) { if (input->read (input, buf + 4, 6) == 6) { - frame_ext_header->flags = BE_16(buf + 4); - frame_ext_header->padding_size = BE_32(buf + 6); + frame_ext_header->flags = _X_BE_16(buf + 4); + frame_ext_header->padding_size = _X_BE_32(buf + 6); frame_ext_header->crc = 0; } else { return 0; @@ -441,9 +441,9 @@ static int id3v23_parse_frame_ext_header(input_plugin_t *input, } else if (frame_ext_header->size == 10) { if (input->read (input, buf + 4, 10) == 10) { - frame_ext_header->flags = BE_16(buf + 4); - frame_ext_header->padding_size = BE_32(buf + 6); - frame_ext_header->crc = BE_32(buf + 10); + frame_ext_header->flags = _X_BE_16(buf + 4); + frame_ext_header->padding_size = _X_BE_32(buf + 6); + frame_ext_header->crc = _X_BE_32(buf + 10); } else { return 0; } @@ -618,9 +618,9 @@ static int id3v24_parse_frame_header(input_plugin_t *input, len = input->read (input, buf, ID3V24_FRAME_HEADER_SIZE); if (len == ID3V24_FRAME_HEADER_SIZE) { - frame_header->id = BE_32(buf); - frame_header->size = BE_32_synchsafe(&buf[4]); - frame_header->flags = BE_16(&buf[8]); + frame_header->id = _X_BE_32(buf); + frame_header->size = _X_BE_32_synchsafe(&buf[4]); + frame_header->flags = _X_BE_16(&buf[8]); lprintf("frame: %c%c%c%c, size: %d, flags: %X\n", buf[0], buf[1], buf[2], buf[3], frame_header->size, frame_header->flags); @@ -637,7 +637,7 @@ static int id3v24_parse_ext_header(input_plugin_t *input, if (input->read (input, buf, 4) == 4) { - frame_ext_header->size = BE_32_synchsafe(&buf[0]); + frame_ext_header->size = _X_BE_32_synchsafe(&buf[0]); if (input->read (input, buf, 2) == 2) { uint8_t flags_size = buf[0]; diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h index b8f0984b1..a5ab0bd1d 100644 --- a/src/demuxers/id3.h +++ b/src/demuxers/id3.h @@ -183,21 +183,21 @@ static inline int id3v2_istag(uint8_t *ptr) { #if 0 /* parse an unsynchronized 16bits integer */ -static inline uint16_t BE_16_synchsafe(uint8_t buf[2]) { +static inline uint16_t _X_BE_16_synchsafe(uint8_t buf[2]) { return ((uint16_t)(buf[0] & 0x7F) << 7) | (uint16_t)(buf[1] & 0x7F); } #endif /* parse an unsynchronized 24bits integer */ -static inline uint32_t BE_24_synchsafe(uint8_t buf[3]) { +static inline uint32_t _X_BE_24_synchsafe(uint8_t buf[3]) { return ((uint32_t)(buf[0] & 0x7F) << 14) | ((uint32_t)(buf[1] & 0x7F) << 7) | (uint32_t)(buf[2] & 0x7F); } /* parse an unsynchronized 32bits integer */ -static inline uint32_t BE_32_synchsafe(uint8_t buf[4]) { +static inline uint32_t _X_BE_32_synchsafe(uint8_t buf[4]) { return ((uint32_t)(buf[0] & 0x7F) << 21) | ((uint32_t)(buf[1] & 0x7F) << 14) | ((uint32_t)(buf[2] & 0x7F) << 7) | diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c index dc0c001bd..07805729f 100644 --- a/src/input/libreal/real.c +++ b/src/input/libreal/real.c @@ -48,8 +48,8 @@ static const unsigned char xor_table[] = { 0x63, 0x11, 0x03, 0x71, 0x08, 0x08, 0x70, 0x02, 0x10, 0x57, 0x05, 0x18, 0x54, 0x00, 0x00, 0x00 }; -#define BE_32C(x,y) do { *(uint32_t *)(x) = be2me_32((y)); } while(0) -#define LE_32C(x,y) do { *(uint32_t *)(x) = le2me_32((y)); } while(0) +#define _X_BE_32C(x,y) do { *(uint32_t *)(x) = be2me_32((y)); } while(0) +#define _X_LE_32C(x,y) do { *(uint32_t *)(x) = le2me_32((y)); } while(0) #define MAX(x,y) ((x>y) ? x : y) @@ -60,10 +60,10 @@ static void hash(char *field, char *param) { /* fill variables */ - a = LE_32(field); - b = LE_32(field+4); - c = LE_32(field+8); - d = LE_32(field+12); + a = _X_LE_32(field); + b = _X_LE_32(field+4); + c = _X_LE_32(field+8); + d = _X_LE_32(field+12); lprintf("hash input: %x %x %x %x\n", a, b, c, d); lprintf("hash parameter:\n"); @@ -71,149 +71,149 @@ static void hash(char *field, char *param) { xine_hexdump(param, 64); #endif - a = ((b & c) | (~b & d)) + LE_32((param+0x00)) + a - 0x28955B88; + a = ((b & c) | (~b & d)) + _X_LE_32((param+0x00)) + a - 0x28955B88; a = ((a << 0x07) | (a >> 0x19)) + b; - d = ((a & b) | (~a & c)) + LE_32((param+0x04)) + d - 0x173848AA; + d = ((a & b) | (~a & c)) + _X_LE_32((param+0x04)) + d - 0x173848AA; d = ((d << 0x0c) | (d >> 0x14)) + a; - c = ((d & a) | (~d & b)) + LE_32((param+0x08)) + c + 0x242070DB; + c = ((d & a) | (~d & b)) + _X_LE_32((param+0x08)) + c + 0x242070DB; c = ((c << 0x11) | (c >> 0x0f)) + d; - b = ((c & d) | (~c & a)) + LE_32((param+0x0c)) + b - 0x3E423112; + b = ((c & d) | (~c & a)) + _X_LE_32((param+0x0c)) + b - 0x3E423112; b = ((b << 0x16) | (b >> 0x0a)) + c; - a = ((b & c) | (~b & d)) + LE_32((param+0x10)) + a - 0x0A83F051; + a = ((b & c) | (~b & d)) + _X_LE_32((param+0x10)) + a - 0x0A83F051; a = ((a << 0x07) | (a >> 0x19)) + b; - d = ((a & b) | (~a & c)) + LE_32((param+0x14)) + d + 0x4787C62A; + d = ((a & b) | (~a & c)) + _X_LE_32((param+0x14)) + d + 0x4787C62A; d = ((d << 0x0c) | (d >> 0x14)) + a; - c = ((d & a) | (~d & b)) + LE_32((param+0x18)) + c - 0x57CFB9ED; + c = ((d & a) | (~d & b)) + _X_LE_32((param+0x18)) + c - 0x57CFB9ED; c = ((c << 0x11) | (c >> 0x0f)) + d; - b = ((c & d) | (~c & a)) + LE_32((param+0x1c)) + b - 0x02B96AFF; + b = ((c & d) | (~c & a)) + _X_LE_32((param+0x1c)) + b - 0x02B96AFF; b = ((b << 0x16) | (b >> 0x0a)) + c; - a = ((b & c) | (~b & d)) + LE_32((param+0x20)) + a + 0x698098D8; + a = ((b & c) | (~b & d)) + _X_LE_32((param+0x20)) + a + 0x698098D8; a = ((a << 0x07) | (a >> 0x19)) + b; - d = ((a & b) | (~a & c)) + LE_32((param+0x24)) + d - 0x74BB0851; + d = ((a & b) | (~a & c)) + _X_LE_32((param+0x24)) + d - 0x74BB0851; d = ((d << 0x0c) | (d >> 0x14)) + a; - c = ((d & a) | (~d & b)) + LE_32((param+0x28)) + c - 0x0000A44F; + c = ((d & a) | (~d & b)) + _X_LE_32((param+0x28)) + c - 0x0000A44F; c = ((c << 0x11) | (c >> 0x0f)) + d; - b = ((c & d) | (~c & a)) + LE_32((param+0x2C)) + b - 0x76A32842; + b = ((c & d) | (~c & a)) + _X_LE_32((param+0x2C)) + b - 0x76A32842; b = ((b << 0x16) | (b >> 0x0a)) + c; - a = ((b & c) | (~b & d)) + LE_32((param+0x30)) + a + 0x6B901122; + a = ((b & c) | (~b & d)) + _X_LE_32((param+0x30)) + a + 0x6B901122; a = ((a << 0x07) | (a >> 0x19)) + b; - d = ((a & b) | (~a & c)) + LE_32((param+0x34)) + d - 0x02678E6D; + d = ((a & b) | (~a & c)) + _X_LE_32((param+0x34)) + d - 0x02678E6D; d = ((d << 0x0c) | (d >> 0x14)) + a; - c = ((d & a) | (~d & b)) + LE_32((param+0x38)) + c - 0x5986BC72; + c = ((d & a) | (~d & b)) + _X_LE_32((param+0x38)) + c - 0x5986BC72; c = ((c << 0x11) | (c >> 0x0f)) + d; - b = ((c & d) | (~c & a)) + LE_32((param+0x3c)) + b + 0x49B40821; + b = ((c & d) | (~c & a)) + _X_LE_32((param+0x3c)) + b + 0x49B40821; b = ((b << 0x16) | (b >> 0x0a)) + c; - a = ((b & d) | (~d & c)) + LE_32((param+0x04)) + a - 0x09E1DA9E; + a = ((b & d) | (~d & c)) + _X_LE_32((param+0x04)) + a - 0x09E1DA9E; a = ((a << 0x05) | (a >> 0x1b)) + b; - d = ((a & c) | (~c & b)) + LE_32((param+0x18)) + d - 0x3FBF4CC0; + d = ((a & c) | (~c & b)) + _X_LE_32((param+0x18)) + d - 0x3FBF4CC0; d = ((d << 0x09) | (d >> 0x17)) + a; - c = ((d & b) | (~b & a)) + LE_32((param+0x2c)) + c + 0x265E5A51; + c = ((d & b) | (~b & a)) + _X_LE_32((param+0x2c)) + c + 0x265E5A51; c = ((c << 0x0e) | (c >> 0x12)) + d; - b = ((c & a) | (~a & d)) + LE_32((param+0x00)) + b - 0x16493856; + b = ((c & a) | (~a & d)) + _X_LE_32((param+0x00)) + b - 0x16493856; b = ((b << 0x14) | (b >> 0x0c)) + c; - a = ((b & d) | (~d & c)) + LE_32((param+0x14)) + a - 0x29D0EFA3; + a = ((b & d) | (~d & c)) + _X_LE_32((param+0x14)) + a - 0x29D0EFA3; a = ((a << 0x05) | (a >> 0x1b)) + b; - d = ((a & c) | (~c & b)) + LE_32((param+0x28)) + d + 0x02441453; + d = ((a & c) | (~c & b)) + _X_LE_32((param+0x28)) + d + 0x02441453; d = ((d << 0x09) | (d >> 0x17)) + a; - c = ((d & b) | (~b & a)) + LE_32((param+0x3c)) + c - 0x275E197F; + c = ((d & b) | (~b & a)) + _X_LE_32((param+0x3c)) + c - 0x275E197F; c = ((c << 0x0e) | (c >> 0x12)) + d; - b = ((c & a) | (~a & d)) + LE_32((param+0x10)) + b - 0x182C0438; + b = ((c & a) | (~a & d)) + _X_LE_32((param+0x10)) + b - 0x182C0438; b = ((b << 0x14) | (b >> 0x0c)) + c; - a = ((b & d) | (~d & c)) + LE_32((param+0x24)) + a + 0x21E1CDE6; + a = ((b & d) | (~d & c)) + _X_LE_32((param+0x24)) + a + 0x21E1CDE6; a = ((a << 0x05) | (a >> 0x1b)) + b; - d = ((a & c) | (~c & b)) + LE_32((param+0x38)) + d - 0x3CC8F82A; + d = ((a & c) | (~c & b)) + _X_LE_32((param+0x38)) + d - 0x3CC8F82A; d = ((d << 0x09) | (d >> 0x17)) + a; - c = ((d & b) | (~b & a)) + LE_32((param+0x0c)) + c - 0x0B2AF279; + c = ((d & b) | (~b & a)) + _X_LE_32((param+0x0c)) + c - 0x0B2AF279; c = ((c << 0x0e) | (c >> 0x12)) + d; - b = ((c & a) | (~a & d)) + LE_32((param+0x20)) + b + 0x455A14ED; + b = ((c & a) | (~a & d)) + _X_LE_32((param+0x20)) + b + 0x455A14ED; b = ((b << 0x14) | (b >> 0x0c)) + c; - a = ((b & d) | (~d & c)) + LE_32((param+0x34)) + a - 0x561C16FB; + a = ((b & d) | (~d & c)) + _X_LE_32((param+0x34)) + a - 0x561C16FB; a = ((a << 0x05) | (a >> 0x1b)) + b; - d = ((a & c) | (~c & b)) + LE_32((param+0x08)) + d - 0x03105C08; + d = ((a & c) | (~c & b)) + _X_LE_32((param+0x08)) + d - 0x03105C08; d = ((d << 0x09) | (d >> 0x17)) + a; - c = ((d & b) | (~b & a)) + LE_32((param+0x1c)) + c + 0x676F02D9; + c = ((d & b) | (~b & a)) + _X_LE_32((param+0x1c)) + c + 0x676F02D9; c = ((c << 0x0e) | (c >> 0x12)) + d; - b = ((c & a) | (~a & d)) + LE_32((param+0x30)) + b - 0x72D5B376; + b = ((c & a) | (~a & d)) + _X_LE_32((param+0x30)) + b - 0x72D5B376; b = ((b << 0x14) | (b >> 0x0c)) + c; - a = (b ^ c ^ d) + LE_32((param+0x14)) + a - 0x0005C6BE; + a = (b ^ c ^ d) + _X_LE_32((param+0x14)) + a - 0x0005C6BE; a = ((a << 0x04) | (a >> 0x1c)) + b; - d = (a ^ b ^ c) + LE_32((param+0x20)) + d - 0x788E097F; + d = (a ^ b ^ c) + _X_LE_32((param+0x20)) + d - 0x788E097F; d = ((d << 0x0b) | (d >> 0x15)) + a; - c = (d ^ a ^ b) + LE_32((param+0x2c)) + c + 0x6D9D6122; + c = (d ^ a ^ b) + _X_LE_32((param+0x2c)) + c + 0x6D9D6122; c = ((c << 0x10) | (c >> 0x10)) + d; - b = (c ^ d ^ a) + LE_32((param+0x38)) + b - 0x021AC7F4; + b = (c ^ d ^ a) + _X_LE_32((param+0x38)) + b - 0x021AC7F4; b = ((b << 0x17) | (b >> 0x09)) + c; - a = (b ^ c ^ d) + LE_32((param+0x04)) + a - 0x5B4115BC; + a = (b ^ c ^ d) + _X_LE_32((param+0x04)) + a - 0x5B4115BC; a = ((a << 0x04) | (a >> 0x1c)) + b; - d = (a ^ b ^ c) + LE_32((param+0x10)) + d + 0x4BDECFA9; + d = (a ^ b ^ c) + _X_LE_32((param+0x10)) + d + 0x4BDECFA9; d = ((d << 0x0b) | (d >> 0x15)) + a; - c = (d ^ a ^ b) + LE_32((param+0x1c)) + c - 0x0944B4A0; + c = (d ^ a ^ b) + _X_LE_32((param+0x1c)) + c - 0x0944B4A0; c = ((c << 0x10) | (c >> 0x10)) + d; - b = (c ^ d ^ a) + LE_32((param+0x28)) + b - 0x41404390; + b = (c ^ d ^ a) + _X_LE_32((param+0x28)) + b - 0x41404390; b = ((b << 0x17) | (b >> 0x09)) + c; - a = (b ^ c ^ d) + LE_32((param+0x34)) + a + 0x289B7EC6; + a = (b ^ c ^ d) + _X_LE_32((param+0x34)) + a + 0x289B7EC6; a = ((a << 0x04) | (a >> 0x1c)) + b; - d = (a ^ b ^ c) + LE_32((param+0x00)) + d - 0x155ED806; + d = (a ^ b ^ c) + _X_LE_32((param+0x00)) + d - 0x155ED806; d = ((d << 0x0b) | (d >> 0x15)) + a; - c = (d ^ a ^ b) + LE_32((param+0x0c)) + c - 0x2B10CF7B; + c = (d ^ a ^ b) + _X_LE_32((param+0x0c)) + c - 0x2B10CF7B; c = ((c << 0x10) | (c >> 0x10)) + d; - b = (c ^ d ^ a) + LE_32((param+0x18)) + b + 0x04881D05; + b = (c ^ d ^ a) + _X_LE_32((param+0x18)) + b + 0x04881D05; b = ((b << 0x17) | (b >> 0x09)) + c; - a = (b ^ c ^ d) + LE_32((param+0x24)) + a - 0x262B2FC7; + a = (b ^ c ^ d) + _X_LE_32((param+0x24)) + a - 0x262B2FC7; a = ((a << 0x04) | (a >> 0x1c)) + b; - d = (a ^ b ^ c) + LE_32((param+0x30)) + d - 0x1924661B; + d = (a ^ b ^ c) + _X_LE_32((param+0x30)) + d - 0x1924661B; d = ((d << 0x0b) | (d >> 0x15)) + a; - c = (d ^ a ^ b) + LE_32((param+0x3c)) + c + 0x1fa27cf8; + c = (d ^ a ^ b) + _X_LE_32((param+0x3c)) + c + 0x1fa27cf8; c = ((c << 0x10) | (c >> 0x10)) + d; - b = (c ^ d ^ a) + LE_32((param+0x08)) + b - 0x3B53A99B; + b = (c ^ d ^ a) + _X_LE_32((param+0x08)) + b - 0x3B53A99B; b = ((b << 0x17) | (b >> 0x09)) + c; - a = ((~d | b) ^ c) + LE_32((param+0x00)) + a - 0x0BD6DDBC; + a = ((~d | b) ^ c) + _X_LE_32((param+0x00)) + a - 0x0BD6DDBC; a = ((a << 0x06) | (a >> 0x1a)) + b; - d = ((~c | a) ^ b) + LE_32((param+0x1c)) + d + 0x432AFF97; + d = ((~c | a) ^ b) + _X_LE_32((param+0x1c)) + d + 0x432AFF97; d = ((d << 0x0a) | (d >> 0x16)) + a; - c = ((~b | d) ^ a) + LE_32((param+0x38)) + c - 0x546BDC59; + c = ((~b | d) ^ a) + _X_LE_32((param+0x38)) + c - 0x546BDC59; c = ((c << 0x0f) | (c >> 0x11)) + d; - b = ((~a | c) ^ d) + LE_32((param+0x14)) + b - 0x036C5FC7; + b = ((~a | c) ^ d) + _X_LE_32((param+0x14)) + b - 0x036C5FC7; b = ((b << 0x15) | (b >> 0x0b)) + c; - a = ((~d | b) ^ c) + LE_32((param+0x30)) + a + 0x655B59C3; + a = ((~d | b) ^ c) + _X_LE_32((param+0x30)) + a + 0x655B59C3; a = ((a << 0x06) | (a >> 0x1a)) + b; - d = ((~c | a) ^ b) + LE_32((param+0x0C)) + d - 0x70F3336E; + d = ((~c | a) ^ b) + _X_LE_32((param+0x0C)) + d - 0x70F3336E; d = ((d << 0x0a) | (d >> 0x16)) + a; - c = ((~b | d) ^ a) + LE_32((param+0x28)) + c - 0x00100B83; + c = ((~b | d) ^ a) + _X_LE_32((param+0x28)) + c - 0x00100B83; c = ((c << 0x0f) | (c >> 0x11)) + d; - b = ((~a | c) ^ d) + LE_32((param+0x04)) + b - 0x7A7BA22F; + b = ((~a | c) ^ d) + _X_LE_32((param+0x04)) + b - 0x7A7BA22F; b = ((b << 0x15) | (b >> 0x0b)) + c; - a = ((~d | b) ^ c) + LE_32((param+0x20)) + a + 0x6FA87E4F; + a = ((~d | b) ^ c) + _X_LE_32((param+0x20)) + a + 0x6FA87E4F; a = ((a << 0x06) | (a >> 0x1a)) + b; - d = ((~c | a) ^ b) + LE_32((param+0x3c)) + d - 0x01D31920; + d = ((~c | a) ^ b) + _X_LE_32((param+0x3c)) + d - 0x01D31920; d = ((d << 0x0a) | (d >> 0x16)) + a; - c = ((~b | d) ^ a) + LE_32((param+0x18)) + c - 0x5CFEBCEC; + c = ((~b | d) ^ a) + _X_LE_32((param+0x18)) + c - 0x5CFEBCEC; c = ((c << 0x0f) | (c >> 0x11)) + d; - b = ((~a | c) ^ d) + LE_32((param+0x34)) + b + 0x4E0811A1; + b = ((~a | c) ^ d) + _X_LE_32((param+0x34)) + b + 0x4E0811A1; b = ((b << 0x15) | (b >> 0x0b)) + c; - a = ((~d | b) ^ c) + LE_32((param+0x10)) + a - 0x08AC817E; + a = ((~d | b) ^ c) + _X_LE_32((param+0x10)) + a - 0x08AC817E; a = ((a << 0x06) | (a >> 0x1a)) + b; - d = ((~c | a) ^ b) + LE_32((param+0x2c)) + d - 0x42C50DCB; + d = ((~c | a) ^ b) + _X_LE_32((param+0x2c)) + d - 0x42C50DCB; d = ((d << 0x0a) | (d >> 0x16)) + a; - c = ((~b | d) ^ a) + LE_32((param+0x08)) + c + 0x2AD7D2BB; + c = ((~b | d) ^ a) + _X_LE_32((param+0x08)) + c + 0x2AD7D2BB; c = ((c << 0x0f) | (c >> 0x11)) + d; - b = ((~a | c) ^ d) + LE_32((param+0x24)) + b - 0x14792C6F; + b = ((~a | c) ^ d) + _X_LE_32((param+0x24)) + b - 0x14792C6F; b = ((b << 0x15) | (b >> 0x0b)) + c; lprintf("hash output: %x %x %x %x\n", a, b, c, d); - a += LE_32(field); - b += LE_32(field+4); - c += LE_32(field+8); - d += LE_32(field+12); - - LE_32C(field, a); - LE_32C(field+4, b); - LE_32C(field+8, c); - LE_32C(field+12, d); + a += _X_LE_32(field); + b += _X_LE_32(field+4); + c += _X_LE_32(field+8); + d += _X_LE_32(field+12); + + _X_LE_32C(field, a); + _X_LE_32C(field+4, b); + _X_LE_32C(field+8, c); + _X_LE_32C(field+12, d); } static void call_hash (char *key, char *challenge, unsigned int len) { @@ -224,10 +224,10 @@ static void call_hash (char *key, char *challenge, unsigned int len) { ptr1=(key+16); ptr2=(key+20); - a = LE_32(ptr1); + a = _X_LE_32(ptr1); b = (a >> 3) & 0x3f; a += len * 8; - LE_32C(ptr1, a); + _X_LE_32C(ptr1, a); if (a < (len << 3)) { @@ -235,8 +235,8 @@ static void call_hash (char *key, char *challenge, unsigned int len) { ptr2 += 4; } - tmp = LE_32(ptr2) + (len >> 0x1d); - LE_32C(ptr2, tmp); + tmp = _X_LE_32(ptr2) + (len >> 0x1d); + _X_LE_32C(ptr2, tmp); a = 64 - b; c = 0; if (a <= len) @@ -270,7 +270,7 @@ static void calc_response (char *result, char *field) { memcpy (buf2, field+16, 8); - i = ( LE_32((buf2)) >> 3 ) & 0x3f; + i = ( _X_LE_32((buf2)) >> 3 ) & 0x3f; if (i < 56) { i = 56 - i; @@ -328,9 +328,9 @@ void real_calc_response_and_checksum (char *response, char *chksum, char *challe /* initialize buffer */ memset(buf, 0, 128); ptr=buf; - BE_32C(ptr, 0xa1e9149d); + _X_BE_32C(ptr, 0xa1e9149d); ptr+=4; - BE_32C(ptr, 0x0e6b3b59); + _X_BE_32C(ptr, 0x0e6b3b59); ptr+=4; /* some (length) checks */ @@ -390,7 +390,7 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection mlti_chunk+=4; /* next 16 bits are the number of rules */ - numrules=BE_16(mlti_chunk); + numrules=_X_BE_16(mlti_chunk); if (selection >= numrules) return 0; /* now indices of codecs follows */ @@ -398,13 +398,13 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection mlti_chunk+=(selection+1)*2; /* get our index */ - codec=BE_16(mlti_chunk); + codec=_X_BE_16(mlti_chunk); /* skip to number of codecs */ mlti_chunk+=(numrules-selection)*2; /* get number of codecs */ - numrules=BE_16(mlti_chunk); + numrules=_X_BE_16(mlti_chunk); if (codec >= numrules) { lprintf("codec index >= number of codecs. %i %i\n", codec, numrules); @@ -415,11 +415,11 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection /* now seek to selected codec */ for (i=0; iobject_id=BE_32(&fileheader->object_id); - fileheader->size=BE_32(&fileheader->size); - fileheader->object_version=BE_16(&fileheader->object_version); - fileheader->file_version=BE_32(&fileheader->file_version); - fileheader->num_headers=BE_32(&fileheader->num_headers); + fileheader->object_id=_X_BE_32(&fileheader->object_id); + fileheader->size=_X_BE_32(&fileheader->size); + fileheader->object_version=_X_BE_16(&fileheader->object_version); + fileheader->file_version=_X_BE_32(&fileheader->file_version); + fileheader->num_headers=_X_BE_32(&fileheader->num_headers); memcpy(buffer, fileheader, 8); memcpy(&buffer[8], &fileheader->object_version, 2); memcpy(&buffer[10], &fileheader->file_version, 8); - fileheader->size=BE_32(&fileheader->size); - fileheader->object_version=BE_16(&fileheader->object_version); - fileheader->file_version=BE_32(&fileheader->file_version); - fileheader->num_headers=BE_32(&fileheader->num_headers); - fileheader->object_id=BE_32(&fileheader->object_id); + fileheader->size=_X_BE_32(&fileheader->size); + fileheader->object_version=_X_BE_16(&fileheader->object_version); + fileheader->file_version=_X_BE_32(&fileheader->file_version); + fileheader->num_headers=_X_BE_32(&fileheader->num_headers); + fileheader->object_id=_X_BE_32(&fileheader->object_id); } static void rmff_dump_prop(rmff_prop_t *prop, char *buffer) { if (!prop) return; - prop->object_id=BE_32(&prop->object_id); - prop->size=BE_32(&prop->size); - prop->object_version=BE_16(&prop->object_version); - prop->max_bit_rate=BE_32(&prop->max_bit_rate); - prop->avg_bit_rate=BE_32(&prop->avg_bit_rate); - prop->max_packet_size=BE_32(&prop->max_packet_size); - prop->avg_packet_size=BE_32(&prop->avg_packet_size); - prop->num_packets=BE_32(&prop->num_packets); - prop->duration=BE_32(&prop->duration); - prop->preroll=BE_32(&prop->preroll); - prop->index_offset=BE_32(&prop->index_offset); - prop->data_offset=BE_32(&prop->data_offset); - prop->num_streams=BE_16(&prop->num_streams); - prop->flags=BE_16(&prop->flags); + prop->object_id=_X_BE_32(&prop->object_id); + prop->size=_X_BE_32(&prop->size); + prop->object_version=_X_BE_16(&prop->object_version); + prop->max_bit_rate=_X_BE_32(&prop->max_bit_rate); + prop->avg_bit_rate=_X_BE_32(&prop->avg_bit_rate); + prop->max_packet_size=_X_BE_32(&prop->max_packet_size); + prop->avg_packet_size=_X_BE_32(&prop->avg_packet_size); + prop->num_packets=_X_BE_32(&prop->num_packets); + prop->duration=_X_BE_32(&prop->duration); + prop->preroll=_X_BE_32(&prop->preroll); + prop->index_offset=_X_BE_32(&prop->index_offset); + prop->data_offset=_X_BE_32(&prop->data_offset); + prop->num_streams=_X_BE_16(&prop->num_streams); + prop->flags=_X_BE_16(&prop->flags); memcpy(buffer, prop, 8); memcpy(&buffer[8], &prop->object_version, 2); @@ -81,20 +81,20 @@ static void rmff_dump_prop(rmff_prop_t *prop, char *buffer) { memcpy(&buffer[46], &prop->num_streams, 2); memcpy(&buffer[48], &prop->flags, 2); - prop->size=BE_32(&prop->size); - prop->object_version=BE_16(&prop->object_version); - prop->max_bit_rate=BE_32(&prop->max_bit_rate); - prop->avg_bit_rate=BE_32(&prop->avg_bit_rate); - prop->max_packet_size=BE_32(&prop->max_packet_size); - prop->avg_packet_size=BE_32(&prop->avg_packet_size); - prop->num_packets=BE_32(&prop->num_packets); - prop->duration=BE_32(&prop->duration); - prop->preroll=BE_32(&prop->preroll); - prop->index_offset=BE_32(&prop->index_offset); - prop->data_offset=BE_32(&prop->data_offset); - prop->num_streams=BE_16(&prop->num_streams); - prop->flags=BE_16(&prop->flags); - prop->object_id=BE_32(&prop->object_id); + prop->size=_X_BE_32(&prop->size); + prop->object_version=_X_BE_16(&prop->object_version); + prop->max_bit_rate=_X_BE_32(&prop->max_bit_rate); + prop->avg_bit_rate=_X_BE_32(&prop->avg_bit_rate); + prop->max_packet_size=_X_BE_32(&prop->max_packet_size); + prop->avg_packet_size=_X_BE_32(&prop->avg_packet_size); + prop->num_packets=_X_BE_32(&prop->num_packets); + prop->duration=_X_BE_32(&prop->duration); + prop->preroll=_X_BE_32(&prop->preroll); + prop->index_offset=_X_BE_32(&prop->index_offset); + prop->data_offset=_X_BE_32(&prop->data_offset); + prop->num_streams=_X_BE_16(&prop->num_streams); + prop->flags=_X_BE_16(&prop->flags); + prop->object_id=_X_BE_32(&prop->object_id); } static void rmff_dump_mdpr(rmff_mdpr_t *mdpr, char *buffer) { @@ -102,17 +102,17 @@ static void rmff_dump_mdpr(rmff_mdpr_t *mdpr, char *buffer) { int s1, s2, s3; if (!mdpr) return; - mdpr->object_id=BE_32(&mdpr->object_id); - mdpr->size=BE_32(&mdpr->size); - mdpr->object_version=BE_16(&mdpr->object_version); - mdpr->stream_number=BE_16(&mdpr->stream_number); - mdpr->max_bit_rate=BE_32(&mdpr->max_bit_rate); - mdpr->avg_bit_rate=BE_32(&mdpr->avg_bit_rate); - mdpr->max_packet_size=BE_32(&mdpr->max_packet_size); - mdpr->avg_packet_size=BE_32(&mdpr->avg_packet_size); - mdpr->start_time=BE_32(&mdpr->start_time); - mdpr->preroll=BE_32(&mdpr->preroll); - mdpr->duration=BE_32(&mdpr->duration); + mdpr->object_id=_X_BE_32(&mdpr->object_id); + mdpr->size=_X_BE_32(&mdpr->size); + mdpr->object_version=_X_BE_16(&mdpr->object_version); + mdpr->stream_number=_X_BE_16(&mdpr->stream_number); + mdpr->max_bit_rate=_X_BE_32(&mdpr->max_bit_rate); + mdpr->avg_bit_rate=_X_BE_32(&mdpr->avg_bit_rate); + mdpr->max_packet_size=_X_BE_32(&mdpr->max_packet_size); + mdpr->avg_packet_size=_X_BE_32(&mdpr->avg_packet_size); + mdpr->start_time=_X_BE_32(&mdpr->start_time); + mdpr->preroll=_X_BE_32(&mdpr->preroll); + mdpr->duration=_X_BE_32(&mdpr->duration); memcpy(buffer, mdpr, 8); memcpy(&buffer[8], &mdpr->object_version, 2); @@ -126,22 +126,22 @@ static void rmff_dump_mdpr(rmff_mdpr_t *mdpr, char *buffer) { s2=mdpr->mime_type_size; memcpy(&buffer[42+s1], mdpr->mime_type, s2); - mdpr->type_specific_len=BE_32(&mdpr->type_specific_len); + mdpr->type_specific_len=_X_BE_32(&mdpr->type_specific_len); memcpy(&buffer[42+s1+s2], &mdpr->type_specific_len, 4); - mdpr->type_specific_len=BE_32(&mdpr->type_specific_len); + mdpr->type_specific_len=_X_BE_32(&mdpr->type_specific_len); s3=mdpr->type_specific_len; memcpy(&buffer[46+s1+s2], mdpr->type_specific_data, s3); - mdpr->size=BE_32(&mdpr->size); - mdpr->stream_number=BE_16(&mdpr->stream_number); - mdpr->max_bit_rate=BE_32(&mdpr->max_bit_rate); - mdpr->avg_bit_rate=BE_32(&mdpr->avg_bit_rate); - mdpr->max_packet_size=BE_32(&mdpr->max_packet_size); - mdpr->avg_packet_size=BE_32(&mdpr->avg_packet_size); - mdpr->start_time=BE_32(&mdpr->start_time); - mdpr->preroll=BE_32(&mdpr->preroll); - mdpr->duration=BE_32(&mdpr->duration); - mdpr->object_id=BE_32(&mdpr->object_id); + mdpr->size=_X_BE_32(&mdpr->size); + mdpr->stream_number=_X_BE_16(&mdpr->stream_number); + mdpr->max_bit_rate=_X_BE_32(&mdpr->max_bit_rate); + mdpr->avg_bit_rate=_X_BE_32(&mdpr->avg_bit_rate); + mdpr->max_packet_size=_X_BE_32(&mdpr->max_packet_size); + mdpr->avg_packet_size=_X_BE_32(&mdpr->avg_packet_size); + mdpr->start_time=_X_BE_32(&mdpr->start_time); + mdpr->preroll=_X_BE_32(&mdpr->preroll); + mdpr->duration=_X_BE_32(&mdpr->duration); + mdpr->object_id=_X_BE_32(&mdpr->object_id); } @@ -150,59 +150,59 @@ static void rmff_dump_cont(rmff_cont_t *cont, char *buffer) { int p; if (!cont) return; - cont->object_id=BE_32(&cont->object_id); - cont->size=BE_32(&cont->size); - cont->object_version=BE_16(&cont->object_version); + cont->object_id=_X_BE_32(&cont->object_id); + cont->size=_X_BE_32(&cont->size); + cont->object_version=_X_BE_16(&cont->object_version); memcpy(buffer, cont, 8); memcpy(&buffer[8], &cont->object_version, 2); - cont->title_len=BE_16(&cont->title_len); + cont->title_len=_X_BE_16(&cont->title_len); memcpy(&buffer[10], &cont->title_len, 2); - cont->title_len=BE_16(&cont->title_len); + cont->title_len=_X_BE_16(&cont->title_len); memcpy(&buffer[12], cont->title, cont->title_len); p=12+cont->title_len; - cont->author_len=BE_16(&cont->author_len); + cont->author_len=_X_BE_16(&cont->author_len); memcpy(&buffer[p], &cont->author_len, 2); - cont->author_len=BE_16(&cont->author_len); + cont->author_len=_X_BE_16(&cont->author_len); memcpy(&buffer[p+2], cont->author, cont->author_len); p+=2+cont->author_len; - cont->copyright_len=BE_16(&cont->copyright_len); + cont->copyright_len=_X_BE_16(&cont->copyright_len); memcpy(&buffer[p], &cont->copyright_len, 2); - cont->copyright_len=BE_16(&cont->copyright_len); + cont->copyright_len=_X_BE_16(&cont->copyright_len); memcpy(&buffer[p+2], cont->copyright, cont->copyright_len); p+=2+cont->copyright_len; - cont->comment_len=BE_16(&cont->comment_len); + cont->comment_len=_X_BE_16(&cont->comment_len); memcpy(&buffer[p], &cont->comment_len, 2); - cont->comment_len=BE_16(&cont->comment_len); + cont->comment_len=_X_BE_16(&cont->comment_len); memcpy(&buffer[p+2], cont->comment, cont->comment_len); - cont->size=BE_32(&cont->size); - cont->object_version=BE_16(&cont->object_version); - cont->object_id=BE_32(&cont->object_id); + cont->size=_X_BE_32(&cont->size); + cont->object_version=_X_BE_16(&cont->object_version); + cont->object_id=_X_BE_32(&cont->object_id); } static void rmff_dump_dataheader(rmff_data_t *data, char *buffer) { if (!data) return; - data->object_id=BE_32(&data->object_id); - data->size=BE_32(&data->size); - data->object_version=BE_16(&data->object_version); - data->num_packets=BE_32(&data->num_packets); - data->next_data_header=BE_32(&data->next_data_header); + data->object_id=_X_BE_32(&data->object_id); + data->size=_X_BE_32(&data->size); + data->object_version=_X_BE_16(&data->object_version); + data->num_packets=_X_BE_32(&data->num_packets); + data->next_data_header=_X_BE_32(&data->next_data_header); memcpy(buffer, data, 8); memcpy(&buffer[8], &data->object_version, 2); memcpy(&buffer[10], &data->num_packets, 8); - data->num_packets=BE_32(&data->num_packets); - data->next_data_header=BE_32(&data->next_data_header); - data->size=BE_32(&data->size); - data->object_version=BE_16(&data->object_version); - data->object_id=BE_32(&data->object_id); + data->num_packets=_X_BE_32(&data->num_packets); + data->next_data_header=_X_BE_32(&data->next_data_header); + data->size=_X_BE_32(&data->size); + data->object_version=_X_BE_16(&data->object_version); + data->object_id=_X_BE_32(&data->object_id); } int rmff_dump_header(rmff_header_t *h, char *buffer, int max) { @@ -252,15 +252,15 @@ static rmff_fileheader_t *rmff_scan_fileheader(const char *data) { rmff_fileheader_t *fileheader = malloc(sizeof(rmff_fileheader_t)); - fileheader->object_id=BE_32(data); - fileheader->size=BE_32(&data[4]); - fileheader->object_version=BE_16(&data[8]); + fileheader->object_id=_X_BE_32(data); + fileheader->size=_X_BE_32(&data[4]); + fileheader->object_version=_X_BE_16(&data[8]); if (fileheader->object_version != 0) { lprintf("warning: unknown object version in .RMF: 0x%04x\n", fileheader->object_version); } - fileheader->file_version=BE_32(&data[10]); - fileheader->num_headers=BE_32(&data[14]); + fileheader->file_version=_X_BE_32(&data[10]); + fileheader->num_headers=_X_BE_32(&data[14]); return fileheader; } @@ -269,24 +269,24 @@ static rmff_prop_t *rmff_scan_prop(const char *data) { rmff_prop_t *prop = malloc(sizeof(rmff_prop_t)); - prop->object_id=BE_32(data); - prop->size=BE_32(&data[4]); - prop->object_version=BE_16(&data[8]); + prop->object_id=_X_BE_32(data); + prop->size=_X_BE_32(&data[4]); + prop->object_version=_X_BE_16(&data[8]); if (prop->object_version != 0) { lprintf("warning: unknown object version in PROP: 0x%04x\n", prop->object_version); } - prop->max_bit_rate=BE_32(&data[10]); - prop->avg_bit_rate=BE_32(&data[14]); - prop->max_packet_size=BE_32(&data[18]); - prop->avg_packet_size=BE_32(&data[22]); - prop->num_packets=BE_32(&data[26]); - prop->duration=BE_32(&data[30]); - prop->preroll=BE_32(&data[34]); - prop->index_offset=BE_32(&data[38]); - prop->data_offset=BE_32(&data[42]); - prop->num_streams=BE_16(&data[46]); - prop->flags=BE_16(&data[48]); + prop->max_bit_rate=_X_BE_32(&data[10]); + prop->avg_bit_rate=_X_BE_32(&data[14]); + prop->max_packet_size=_X_BE_32(&data[18]); + prop->avg_packet_size=_X_BE_32(&data[22]); + prop->num_packets=_X_BE_32(&data[26]); + prop->duration=_X_BE_32(&data[30]); + prop->preroll=_X_BE_32(&data[34]); + prop->index_offset=_X_BE_32(&data[38]); + prop->data_offset=_X_BE_32(&data[42]); + prop->num_streams=_X_BE_16(&data[46]); + prop->flags=_X_BE_16(&data[48]); return prop; } @@ -295,21 +295,21 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) { rmff_mdpr_t *mdpr = malloc(sizeof(rmff_mdpr_t)); - mdpr->object_id=BE_32(data); - mdpr->size=BE_32(&data[4]); - mdpr->object_version=BE_16(&data[8]); + mdpr->object_id=_X_BE_32(data); + mdpr->size=_X_BE_32(&data[4]); + mdpr->object_version=_X_BE_16(&data[8]); if (mdpr->object_version != 0) { lprintf("warning: unknown object version in MDPR: 0x%04x\n", mdpr->object_version); } - mdpr->stream_number=BE_16(&data[10]); - mdpr->max_bit_rate=BE_32(&data[12]); - mdpr->avg_bit_rate=BE_32(&data[16]); - mdpr->max_packet_size=BE_32(&data[20]); - mdpr->avg_packet_size=BE_32(&data[24]); - mdpr->start_time=BE_32(&data[28]); - mdpr->preroll=BE_32(&data[32]); - mdpr->duration=BE_32(&data[36]); + mdpr->stream_number=_X_BE_16(&data[10]); + mdpr->max_bit_rate=_X_BE_32(&data[12]); + mdpr->avg_bit_rate=_X_BE_32(&data[16]); + mdpr->max_packet_size=_X_BE_32(&data[20]); + mdpr->avg_packet_size=_X_BE_32(&data[24]); + mdpr->start_time=_X_BE_32(&data[28]); + mdpr->preroll=_X_BE_32(&data[32]); + mdpr->duration=_X_BE_32(&data[36]); mdpr->stream_name_size=data[40]; mdpr->stream_name = malloc(sizeof(char)*(mdpr->stream_name_size+1)); @@ -321,7 +321,7 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) { memcpy(mdpr->mime_type, &data[42+mdpr->stream_name_size], mdpr->mime_type_size); mdpr->mime_type[mdpr->mime_type_size]=0; - mdpr->type_specific_len=BE_32(&data[42+mdpr->stream_name_size+mdpr->mime_type_size]); + mdpr->type_specific_len=_X_BE_32(&data[42+mdpr->stream_name_size+mdpr->mime_type_size]); mdpr->type_specific_data = malloc(sizeof(char)*(mdpr->type_specific_len)); memcpy(mdpr->type_specific_data, &data[46+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len); @@ -334,29 +334,29 @@ static rmff_cont_t *rmff_scan_cont(const char *data) { rmff_cont_t *cont = malloc(sizeof(rmff_cont_t)); int pos; - cont->object_id=BE_32(data); - cont->size=BE_32(&data[4]); - cont->object_version=BE_16(&data[8]); + cont->object_id=_X_BE_32(data); + cont->size=_X_BE_32(&data[4]); + cont->object_version=_X_BE_16(&data[8]); if (cont->object_version != 0) { lprintf("warning: unknown object version in CONT: 0x%04x\n", cont->object_version); } - cont->title_len=BE_16(&data[10]); + cont->title_len=_X_BE_16(&data[10]); cont->title = malloc(sizeof(char)*(cont->title_len+1)); memcpy(cont->title, &data[12], cont->title_len); cont->title[cont->title_len]=0; pos=cont->title_len+12; - cont->author_len=BE_16(&data[pos]); + cont->author_len=_X_BE_16(&data[pos]); cont->author = malloc(sizeof(char)*(cont->author_len+1)); memcpy(cont->author, &data[pos+2], cont->author_len); cont->author[cont->author_len]=0; pos=pos+2+cont->author_len; - cont->copyright_len=BE_16(&data[pos]); + cont->copyright_len=_X_BE_16(&data[pos]); cont->copyright = malloc(sizeof(char)*(cont->copyright_len+1)); memcpy(cont->copyright, &data[pos+2], cont->copyright_len); cont->copyright[cont->copyright_len]=0; pos=pos+2+cont->copyright_len; - cont->comment_len=BE_16(&data[pos]); + cont->comment_len=_X_BE_16(&data[pos]); cont->comment = malloc(sizeof(char)*(cont->comment_len+1)); memcpy(cont->comment, &data[pos+2], cont->comment_len); cont->comment[cont->comment_len]=0; @@ -368,15 +368,15 @@ static rmff_data_t *rmff_scan_dataheader(const char *data) { rmff_data_t *dh = malloc(sizeof(rmff_data_t)); - dh->object_id=BE_32(data); - dh->size=BE_32(&data[4]); - dh->object_version=BE_16(&data[8]); + dh->object_id=_X_BE_32(data); + dh->size=_X_BE_32(&data[4]); + dh->object_version=_X_BE_16(&data[8]); if (dh->object_version != 0) { lprintf("warning: unknown object version in DATA: 0x%04x\n", dh->object_version); } - dh->num_packets=BE_32(&data[10]); - dh->next_data_header=BE_32(&data[14]); + dh->num_packets=_X_BE_32(&data[10]); + dh->next_data_header=_X_BE_32(&data[14]); return dh; } @@ -395,7 +395,7 @@ rmff_header_t *rmff_scan_header(const char *data) { header->cont=NULL; header->data=NULL; - chunk_type = BE_32(ptr); + chunk_type = _X_BE_32(ptr); if (chunk_type != RMF_TAG) { lprintf("rmff: not an real media file header (.RMF tag not found).\n"); @@ -411,7 +411,7 @@ rmff_header_t *rmff_scan_header(const char *data) { } for (i=1; ifileheader->num_headers; i++) { - chunk_type = BE_32(ptr); + chunk_type = _X_BE_32(ptr); if (ptr[0] == 0) { @@ -463,8 +463,8 @@ rmff_header_t *rmff_scan_header_stream(int fd) { do { xine_buffer_ensure_size(buf, index+8); read(fd, buf+index, 8); - chunk_type=BE_32(buf+index); index+=4; - chunk_size=BE_32(buf+index); index+=4; + chunk_type=_X_BE_32(buf+index); index+=4; + chunk_size=_X_BE_32(buf+index); index+=4; switch (chunk_type) { case DATA_TAG: @@ -495,10 +495,10 @@ rmff_header_t *rmff_scan_header_stream(int fd) { void rmff_scan_pheader(rmff_pheader_t *h, char *data) { - h->object_version=BE_16(data); - h->length=BE_16(data+2); - h->stream_number=BE_16(data+4); - h->timestamp=BE_32(data+6); + h->object_version=_X_BE_16(data); + h->length=_X_BE_16(data+2); + h->stream_number=_X_BE_16(data+4); + h->timestamp=_X_BE_32(data+6); h->reserved=(uint8_t)data[10]; h->flags=(uint8_t)data[11]; } diff --git a/src/input/mms.c b/src/input/mms.c index 74087f7c5..db7007e49 100644 --- a/src/input/mms.c +++ b/src/input/mms.c @@ -208,8 +208,8 @@ static void print_command (char *data, int len) { #ifdef LOG int i; - int dir = LE_32 (data + 36) >> 16; - int comm = LE_32 (data + 36) & 0xFFFF; + int dir = _X_LE_32 (data + 36) >> 16; + int comm = _X_LE_32 (data + 36) & 0xFFFF; printf ("----------------------------------------------\n"); if (dir == 3) { @@ -217,18 +217,18 @@ static void print_command (char *data, int len) { } else { printf ("receive command 0x%02x, %d bytes\n", comm, len); } - printf (" start sequence %08x\n", LE_32 (data + 0)); - printf (" command id %08x\n", LE_32 (data + 4)); - printf (" length %8x \n", LE_32 (data + 8)); - printf (" protocol %08x\n", LE_32 (data + 12)); - printf (" len8 %8x \n", LE_32 (data + 16)); - printf (" sequence # %08x\n", LE_32 (data + 20)); - printf (" len8 (II) %8x \n", LE_32 (data + 32)); - printf (" dir | comm %08x\n", LE_32 (data + 36)); + printf (" start sequence %08x\n", _X_LE_32 (data + 0)); + printf (" command id %08x\n", _X_LE_32 (data + 4)); + printf (" length %8x \n", _X_LE_32 (data + 8)); + printf (" protocol %08x\n", _X_LE_32 (data + 12)); + printf (" len8 %8x \n", _X_LE_32 (data + 16)); + printf (" sequence # %08x\n", _X_LE_32 (data + 20)); + printf (" len8 (II) %8x \n", _X_LE_32 (data + 32)); + printf (" dir | comm %08x\n", _X_LE_32 (data + 36)); if (len >= 4) - printf (" prefix1 %08x\n", LE_32 (data + 40)); + printf (" prefix1 %08x\n", _X_LE_32 (data + 40)); if (len >= 8) - printf (" prefix2 %08x\n", LE_32 (data + 44)); + printf (" prefix2 %08x\n", _X_LE_32 (data + 44)); for (i = (CMD_HEADER_LEN + CMD_PREFIX_LEN); i < (CMD_HEADER_LEN + CMD_PREFIX_LEN + len); i += 1) { unsigned char c = data[i]; @@ -355,14 +355,14 @@ static int get_packet_header (mms_t *this, mms_packet_header_t *header) { if (len != 8) goto error; - if (LE_32(this->buf + 4) == 0xb00bface) { + if (_X_LE_32(this->buf + 4) == 0xb00bface) { /* command packet */ header->flags = this->buf[3]; len = _x_io_tcp_read (this->stream, this->s, (char*)(this->buf + 8), 4); if (len != 4) goto error; - header->packet_len = LE_32(this->buf + 8) + 4; + header->packet_len = _X_LE_32(this->buf + 8) + 4; if (header->packet_len > BUF_SIZE - 12) { header->packet_len = 0; goto error; @@ -370,10 +370,10 @@ static int get_packet_header (mms_t *this, mms_packet_header_t *header) { lprintf("mms command\n"); packet_type = MMS_PACKET_COMMAND; } else { - header->packet_seq = LE_32(this->buf); + header->packet_seq = _X_LE_32(this->buf); header->packet_id_type = this->buf[4]; header->flags = this->buf[5]; - header->packet_len = (LE_16(this->buf + 6) - 8) & 0xffff; + header->packet_len = (_X_LE_16(this->buf + 6) - 8) & 0xffff; if (header->packet_id_type == ASF_HEADER_PACKET_ID_TYPE) { lprintf("asf header\n"); packet_type = MMS_PACKET_ASF_HEADER; @@ -407,14 +407,14 @@ static int get_packet_command (mms_t *this, uint32_t packet_len) { print_command ((char*)this->buf, len); /* check protocol type ("MMS ") */ - if (LE_32(this->buf + 12) != 0x20534D4D) { + if (_X_LE_32(this->buf + 12) != 0x20534D4D) { lprintf("unknown protocol type: %c%c%c%c (0x%08X)\n", this->buf[12], this->buf[13], this->buf[14], this->buf[15], - LE_32(this->buf + 12)); + _X_LE_32(this->buf + 12)); return 0; } - command = LE_32 (this->buf + 36) & 0xFFFF; + command = _X_LE_32 (this->buf + 36) & 0xFFFF; lprintf("command = 0x%2x\n", command); return command; @@ -937,7 +937,7 @@ static int get_media_packet (mms_t *this) { uint32_t error_code; /* Warning: sdp is incomplete. Do not stop if error_code==1 */ - error_code = LE_32(this->buf + CMD_HEADER_LEN); + error_code = _X_LE_32(this->buf + CMD_HEADER_LEN); lprintf ("End of the current stream. Continue=%d\n", error_code); if (error_code == 0) { diff --git a/src/input/mmsh.c b/src/input/mmsh.c index 30c16001d..df8d0441f 100644 --- a/src/input/mmsh.c +++ b/src/input/mmsh.c @@ -316,8 +316,8 @@ static int get_chunk_header (mmsh_t *this) { "libmmsh: chunk header read failed, %d != %d\n", read_len, CHUNK_HEADER_LENGTH); return 0; } - this->chunk_type = LE_16 (&chunk_header[0]); - this->chunk_length = LE_16 (&chunk_header[2]); + this->chunk_type = _X_LE_16 (&chunk_header[0]); + this->chunk_length = _X_LE_16 (&chunk_header[2]); switch (this->chunk_type) { case CHUNK_TYPE_DATA: @@ -347,16 +347,16 @@ static int get_chunk_header (mmsh_t *this) { switch (this->chunk_type) { case CHUNK_TYPE_DATA: - this->chunk_seq_number = LE_32 (&ext_header[0]); + this->chunk_seq_number = _X_LE_32 (&ext_header[0]); lprintf ("chunk type: CHUNK_TYPE_DATA\n"); lprintf ("chunk length: %d\n", this->chunk_length); lprintf ("chunk seq: %d\n", this->chunk_seq_number); lprintf ("unknown: %d\n", ext_header[4]); lprintf ("mmsh seq: %d\n", ext_header[5]); - lprintf ("len2: %d\n", LE_16(&ext_header[6])); + lprintf ("len2: %d\n", _X_LE_16(&ext_header[6])); break; case CHUNK_TYPE_END: - this->chunk_seq_number = LE_32 (&ext_header[0]); + this->chunk_seq_number = _X_LE_32 (&ext_header[0]); lprintf ("chunk type: CHUNK_TYPE_END\n"); lprintf ("continue: %d\n", this->chunk_seq_number); break; @@ -366,7 +366,7 @@ static int get_chunk_header (mmsh_t *this) { lprintf ("unknown: %2X %2X %2X %2X %2X %2X\n", ext_header[0], ext_header[1], ext_header[2], ext_header[3], ext_header[4], ext_header[5]); - lprintf ("len2: %d\n", LE_16(&ext_header[6])); + lprintf ("len2: %d\n", _X_LE_16(&ext_header[6])); break; case CHUNK_TYPE_RESET: lprintf ("chunk type: CHUNK_TYPE_RESET\n"); diff --git a/src/libffmpeg/ff_audio_decoder.c b/src/libffmpeg/ff_audio_decoder.c index e0d6e5cab..8ebb5ce64 100644 --- a/src/libffmpeg/ff_audio_decoder.c +++ b/src/libffmpeg/ff_audio_decoder.c @@ -198,21 +198,21 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) this->context->block_align = 240; break; case BUF_AUDIO_28_8: - this->audio_sample_rate = BE_16(&this->buf[0x30]); + this->audio_sample_rate = _X_BE_16(&this->buf[0x30]); this->audio_channels = this->buf[0x37]; /* this->audio_bits = buf->content[0x35] */ - this->context->block_align = BE_16(&this->buf[0x2A]); + this->context->block_align = _X_BE_16(&this->buf[0x2A]); this->context->extradata_size = 5*sizeof(short); this->context->extradata = xine_xmalloc(this->context->extradata_size); ptr = (short *) this->context->extradata; - ptr[0] = BE_16(&this->buf[0x2C]); /* subpacket size */ - ptr[1] = BE_16(&this->buf[0x28]); /* subpacket height */ - ptr[2] = BE_16(&this->buf[0x16]); /* subpacket flavour */ - ptr[3] = BE_32(&this->buf[0x18]); /* coded frame size */ + ptr[0] = _X_BE_16(&this->buf[0x2C]); /* subpacket size */ + ptr[1] = _X_BE_16(&this->buf[0x28]); /* subpacket height */ + ptr[2] = _X_BE_16(&this->buf[0x16]); /* subpacket flavour */ + ptr[3] = _X_BE_32(&this->buf[0x18]); /* coded frame size */ ptr[4] = 0; /* codec's data length */ break; default: diff --git a/src/libffmpeg/ff_video_decoder.c b/src/libffmpeg/ff_video_decoder.c index 3943fd05d..66cbc7d75 100644 --- a/src/libffmpeg/ff_video_decoder.c +++ b/src/libffmpeg/ff_video_decoder.c @@ -880,10 +880,10 @@ static void ff_handle_header_buffer (ff_video_decoder_t *this, buf_element_t *bu switch (codec_type) { case BUF_VIDEO_RV10: case BUF_VIDEO_RV20: - this->bih.biWidth = BE_16(&this->buf[12]); - this->bih.biHeight = BE_16(&this->buf[14]); + this->bih.biWidth = _X_BE_16(&this->buf[12]); + this->bih.biHeight = _X_BE_16(&this->buf[14]); - this->context->sub_id = BE_32(&this->buf[30]); + this->context->sub_id = _X_BE_32(&this->buf[30]); this->context->slice_offset = xine_xmalloc(sizeof(int)*SLICE_OFFSET_SIZE); this->slice_offset_size = SLICE_OFFSET_SIZE; diff --git a/src/libreal/xine_real_audio_decoder.c b/src/libreal/xine_real_audio_decoder.c index d1bb94230..46974ec8b 100644 --- a/src/libreal/xine_real_audio_decoder.c +++ b/src/libreal/xine_real_audio_decoder.c @@ -163,27 +163,27 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { * extract header data */ - version = BE_16 (buf->content+4); + version = _X_BE_16 (buf->content+4); lprintf ("header buffer detected, header version %d\n", version); #ifdef LOG xine_hexdump (buf->content, buf->size); #endif - flavor = BE_16 (buf->content+22); - coded_frame_size = BE_32 (buf->content+24); - codec_data_length= BE_16 (buf->content+40); - coded_frame_size2= BE_16 (buf->content+42); - subpacket_size = BE_16 (buf->content+44); + flavor = _X_BE_16 (buf->content+22); + coded_frame_size = _X_BE_32 (buf->content+24); + codec_data_length= _X_BE_16 (buf->content+40); + coded_frame_size2= _X_BE_16 (buf->content+42); + subpacket_size = _X_BE_16 (buf->content+44); this->sps = subpacket_size; this->w = coded_frame_size2; this->h = codec_data_length; if (version == 4) { - samples_per_sec = BE_16 (buf->content+48); - bits_per_sample = BE_16 (buf->content+52); - num_channels = BE_16 (buf->content+54); + samples_per_sec = _X_BE_16 (buf->content+48); + bits_per_sample = _X_BE_16 (buf->content+52); + num_channels = _X_BE_16 (buf->content+54); /* FIXME: */ if (buf->type==BUF_AUDIO_COOK) { @@ -196,10 +196,10 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { extras = buf->content+71; } else { - samples_per_sec = BE_16 (buf->content+54); - bits_per_sample = BE_16 (buf->content+58); - num_channels = BE_16 (buf->content+60); - data_len = BE_32 (buf->content+74); + samples_per_sec = _X_BE_16 (buf->content+54); + bits_per_sample = _X_BE_16 (buf->content+58); + num_channels = _X_BE_16 (buf->content+60); + data_len = _X_BE_32 (buf->content+74); extras = buf->content+78; } diff --git a/src/libreal/xine_real_video_decoder.c b/src/libreal/xine_real_video_decoder.c index ea1fc8c54..7985fdc8f 100644 --- a/src/libreal/xine_real_video_decoder.c +++ b/src/libreal/xine_real_video_decoder.c @@ -194,8 +194,8 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { _x_abort(); } - init_data.w = BE_16(&buf->content[12]); - init_data.h = BE_16(&buf->content[14]); + init_data.w = _X_BE_16(&buf->content[12]); + init_data.h = _X_BE_16(&buf->content[14]); this->width = (init_data.w + 1) & (~1); this->height = (init_data.h + 1) & (~1); @@ -209,8 +209,8 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { * much resemblence to the actual frequency of frames in the file. Hence * it's better to just let the engine estimate the frame duration for us */ #if 0 - this->fps = (double) BE_16(&buf->content[22]) + - ((double) BE_16(&buf->content[24]) / 65536.0); + this->fps = (double) _X_BE_16(&buf->content[22]) + + ((double) _X_BE_16(&buf->content[24]) / 65536.0); this->duration = 90000.0 / this->fps; #endif @@ -227,8 +227,8 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_RATIO, this->ratio*10000); _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->duration); - init_data.subformat = BE_32(&buf->content[26]); - init_data.format = BE_32(&buf->content[30]); + init_data.subformat = _X_BE_32(&buf->content[26]); + init_data.format = _X_BE_32(&buf->content[30]); #ifdef LOG printf ("libreal: init_data for rvyuv_init:\n"); diff --git a/src/libw32dll/qt_decoder.c b/src/libw32dll/qt_decoder.c index 95a0a79fd..c1672d142 100644 --- a/src/libw32dll/qt_decoder.c +++ b/src/libw32dll/qt_decoder.c @@ -860,20 +860,20 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { id=malloc (8+stdata_len) ; /* trak->stdata_len); */ id->idSize = 4+stdata_len; id->cType = FOUR_CHAR_CODE('S','V','Q','3'); - id->version = BE_16 (stdata+0x08); - id->revisionLevel = BE_16 (stdata+0x0C); - id->vendor = BE_32 (stdata+0x10); - id->temporalQuality = BE_32 (stdata+0x14); - id->spatialQuality = BE_32 (stdata+0x18); - id->width = BE_16 (stdata+0x1C); - id->height = BE_16 (stdata+0x1E); - id->hRes = BE_32 (stdata+0x20); - id->vRes = BE_32 (stdata+0x24); - id->dataSize = BE_32 (stdata+0x28); - id->frameCount = BE_16 (stdata+0x2C); + id->version = _X_BE_16 (stdata+0x08); + id->revisionLevel = _X_BE_16 (stdata+0x0C); + id->vendor = _X_BE_32 (stdata+0x10); + id->temporalQuality = _X_BE_32 (stdata+0x14); + id->spatialQuality = _X_BE_32 (stdata+0x18); + id->width = _X_BE_16 (stdata+0x1C); + id->height = _X_BE_16 (stdata+0x1E); + id->hRes = _X_BE_32 (stdata+0x20); + id->vRes = _X_BE_32 (stdata+0x24); + id->dataSize = _X_BE_32 (stdata+0x28); + id->frameCount = _X_BE_16 (stdata+0x2C); memcpy(&id->name,stdata+0x2D,32); - id->depth = BE_16 (stdata+0x4E); - id->clutID = BE_16 (stdata+0x50); + id->depth = _X_BE_16 (stdata+0x4E); + id->clutID = _X_BE_16 (stdata+0x50); if (stdata_len>0x56) memcpy (((char*)&id->clutID)+2, stdata+0x52, stdata_len-0x52); diff --git a/src/libxineadec/nsf.c b/src/libxineadec/nsf.c index e646ca873..08a4f1814 100644 --- a/src/libxineadec/nsf.c +++ b/src/libxineadec/nsf.c @@ -91,7 +91,7 @@ static void nsf_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->song_number = buf->content[4]; /* allocate a buffer for the file */ - this->nsf_size = BE_32(&buf->content[0]); + this->nsf_size = _X_BE_32(&buf->content[0]); this->nsf_file = xine_xmalloc(this->nsf_size); this->nsf_index = 0; diff --git a/src/libxinevdec/bitplane.c b/src/libxinevdec/bitplane.c index 373d5d8b1..033ce1392 100644 --- a/src/libxinevdec/bitplane.c +++ b/src/libxinevdec/bitplane.c @@ -433,15 +433,15 @@ static void bitplane_sdelta_opt_3 (bitplane_decoder_t *this) { /* data starts at beginn of delta-Buffer + offset of the first */ /* 32 Bit long word in the buffer. The buffer starts with 8 */ /* of this Offset, for every bitplane (max 8) one */ - data = (uint16_t *)(&this->buf[BE_32(&deltadata[palette_index])]); + data = (uint16_t *)(&this->buf[_X_BE_32(&deltadata[palette_index])]); if( data != (uint16_t *)this->buf ) { /* This 8 Pointers are followd by another 8 */ - ptr = (uint16_t *)(&this->buf[BE_32(&deltadata[(palette_index+8)])]); + ptr = (uint16_t *)(&this->buf[_X_BE_32(&deltadata[(palette_index+8)])]); /* in this case, I think big/little endian is not important ;-) */ while( *data != 0xFFFF) { row_ptr = 0; - size = BE_16(data); + size = _X_BE_16(data); data++; if( size >= 0 ) { rowworkptr = planeptr + size; @@ -460,7 +460,7 @@ static void bitplane_sdelta_opt_3 (bitplane_decoder_t *this) { size = 0 - size + 2; rowworkptr = planeptr + size; pixel_ptr_bit = size * 16; - s = BE_16(data); + s = _X_BE_16(data); data++; while( s--) { if( this->is_ham ) { @@ -480,7 +480,7 @@ static void bitplane_sdelta_opt_3 (bitplane_decoder_t *this) { - size = BE_16(ptr); + size = _X_BE_16(ptr); ptr++; if (size < 0) { for (s = size; s < 0; s++) { @@ -553,19 +553,19 @@ static void bitplane_set_dlta_short (bitplane_decoder_t *this) { /* data starts at beginn of delta-Buffer + offset of the first */ /* 32 Bit long word in the buffer. The buffer starts with 8 */ /* of this Offset, for every bitplane (max 8) one */ - data = (uint16_t *)(&this->buf[BE_32(&deltadata[palette_index])]); + data = (uint16_t *)(&this->buf[_X_BE_32(&deltadata[palette_index])]); if( data != (uint16_t *)this->buf ) { /* This 8 Pointers are followd by another 8 */ - ptr = (uint16_t *)(&this->buf[BE_32(&deltadata[(palette_index+8)])]); + ptr = (uint16_t *)(&this->buf[_X_BE_32(&deltadata[(palette_index+8)])]); /* in this case, I think big/little endian is not important ;-) */ while( *ptr != 0xFFFF) { - pixel_ptr = BE_16(ptr); + pixel_ptr = _X_BE_16(ptr); pixel_ptr_bit = pixel_ptr * 16; row_ptr = 0; rowworkptr = planeptr + pixel_ptr; ptr++; - size = BE_16(ptr); + size = _X_BE_16(ptr); ptr++; if (size < 0) { for (s = size; s < 0; s++) { @@ -638,7 +638,7 @@ static void bitplane_dlta_5 (bitplane_decoder_t *this) { /* data starts at beginn of delta-Buffer + offset of the first */ /* 32 Bit long word in the buffer. The buffer starts with 8 */ /* of this Offset, for every bitplane (max 8) one */ - delta_offset = BE_32(&deltadata[palette_index]); + delta_offset = _X_BE_32(&deltadata[palette_index]); if (delta_offset > 0) { data = this->buf + delta_offset; @@ -731,8 +731,8 @@ static void bitplane_dlta_7_short (bitplane_decoder_t *this) { planeptr = &this->buf_uk[(palette_index * rowsize * 2)]; /* find opcode and data offset (up to 8 pointers, one for every bitplane */ - opcode_offset = BE_32(&deltadata[palette_index]); - data_offset = BE_32(&deltadata[palette_index + 8]); + opcode_offset = _X_BE_32(&deltadata[palette_index]); + data_offset = _X_BE_32(&deltadata[palette_index + 8]); if (opcode_offset > 0 && data_offset > 0) { data = (uint16_t *)(&this->buf[data_offset]); @@ -825,8 +825,8 @@ static void bitplane_dlta_7_long (bitplane_decoder_t *this) { for(palette_index = 0; palette_index < this->num_bitplanes; palette_index++) { planeptr = &this->buf_uk[(palette_index * rowsize * 4)]; /* find opcode and data offset (up to 8 pointers, one for every bitplane */ - opcode_offset = BE_32(&deltadata[palette_index]); - data_offset = BE_32(&deltadata[palette_index + 8]); + opcode_offset = _X_BE_32(&deltadata[palette_index]); + data_offset = _X_BE_32(&deltadata[palette_index + 8]); if (opcode_offset > 0 && data_offset > 0) { data = (uint32_t *)(&this->buf[data_offset]); @@ -920,7 +920,7 @@ static void bitplane_dlta_8_short (bitplane_decoder_t *this) { /* data starts at beginn of delta-Buffer + offset of the first */ /* 32 Bit long word in the buffer. The buffer starts with 8 */ /* of this Offset, for every bitplane (max 8) one */ - delta_offset = BE_32(&deltadata[palette_index]); + delta_offset = _X_BE_32(&deltadata[palette_index]); if (delta_offset > 0) { data = (uint16_t *)(&this->buf[delta_offset]); @@ -929,10 +929,10 @@ static void bitplane_dlta_8_short (bitplane_decoder_t *this) { pixel_ptr_bit = pixel_ptr * 16; row_ptr = 0; /* execute ops */ - op_count = BE_16(data); + op_count = _X_BE_16(data); data++; for( ; op_count; op_count--) { - op = BE_16(data); + op = _X_BE_16(data); data++; if (op & 0x8000) { /* Uniq ops */ @@ -957,7 +957,7 @@ static void bitplane_dlta_8_short (bitplane_decoder_t *this) { } else { if (op == 0) { /* Same ops */ - count = BE_16(data); + count = _X_BE_16(data); data++; while(count--) { if (data > data_end || rowworkptr > picture_end) @@ -1017,7 +1017,7 @@ static void bitplane_dlta_8_long (bitplane_decoder_t *this) { /* data starts at beginn of delta-Buffer + offset of the first */ /* 32 Bit long word in the buffer. The buffer starts with 8 */ /* of this Offset, for every bitplane (max 8) one */ - delta_offset = BE_32(&deltadata[palette_index]); + delta_offset = _X_BE_32(&deltadata[palette_index]); if (delta_offset > 0) { data = (uint32_t *)(&this->buf[delta_offset]); @@ -1026,10 +1026,10 @@ static void bitplane_dlta_8_long (bitplane_decoder_t *this) { pixel_ptr_bit = pixel_ptr * 32; row_ptr = 0; /* execute ops */ - op_count = BE_32(data); + op_count = _X_BE_32(data); data++; for( ; op_count; op_count--) { - op = BE_32(data); + op = _X_BE_32(data); data++; if (op & 0x80000000) { /* Uniq ops */ @@ -1054,7 +1054,7 @@ static void bitplane_dlta_8_long (bitplane_decoder_t *this) { } else { if (op == 0) { /* Same ops */ - count = BE_32(data); + count = _X_BE_32(data); data++; while(count--) { if (data <= data_end && rowworkptr <= picture_end) { diff --git a/src/libxinevdec/rgb.c b/src/libxinevdec/rgb.c index 662df01de..32d809061 100644 --- a/src/libxinevdec/rgb.c +++ b/src/libxinevdec/rgb.c @@ -203,7 +203,7 @@ static void rgb_decode_data (video_decoder_t *this_gen, } else if (this->bytes_per_pixel == 2) { /* ABGR1555 format, little-endian order */ - packed_pixel = LE_16(&this->buf[buf_ptr]); + packed_pixel = _X_LE_16(&this->buf[buf_ptr]); buf_ptr += 2; UNPACK_BGR15(packed_pixel, r, g, b); @@ -315,7 +315,7 @@ static void rgb_decode_data (video_decoder_t *this_gen, } else if (this->bytes_per_pixel == 2) { /* ARGB1555 format, big-endian order */ - packed_pixel = BE_16(&this->buf[buf_ptr]); + packed_pixel = _X_BE_16(&this->buf[buf_ptr]); buf_ptr += 2; UNPACK_RGB15(packed_pixel, r, g, b); diff --git a/src/xine-engine/bswap.h b/src/xine-engine/bswap.h index 3415a09b4..28b22cb71 100644 --- a/src/xine-engine/bswap.h +++ b/src/xine-engine/bswap.h @@ -28,23 +28,23 @@ #include "ffmpeg_bswap.h" /* These are the Aligned variants */ -#define ABE_16(x) (be2me_16(*(uint16_t*)(x))) -#define ABE_32(x) (be2me_32(*(uint32_t*)(x))) -#define ABE_64(x) (be2me_64(*(uint64_t*)(x))) -#define ALE_16(x) (le2me_16(*(uint16_t*)(x))) -#define ALE_32(x) (le2me_32(*(uint32_t*)(x))) -#define ALE_64(x) (le2me_64(*(uint64_t*)(x))) +#define _X_ABE_16(x) (be2me_16(*(uint16_t*)(x))) +#define _X_ABE_32(x) (be2me_32(*(uint32_t*)(x))) +#define _X_ABE_64(x) (be2me_64(*(uint64_t*)(x))) +#define _X_ALE_16(x) (le2me_16(*(uint16_t*)(x))) +#define _X_ALE_32(x) (le2me_32(*(uint32_t*)(x))) +#define _X_ALE_64(x) (le2me_64(*(uint64_t*)(x))) -#define BE_16(x) (((uint16_t)(((uint8_t*)(x))[0]) << 8) | \ +#define _X_BE_16(x) (((uint16_t)(((uint8_t*)(x))[0]) << 8) | \ ((uint16_t)((uint8_t*)(x))[1])) -#define BE_24(x) (((uint32_t)(((uint8_t*)(x))[0]) << 16) | \ +#define _X_BE_24(x) (((uint32_t)(((uint8_t*)(x))[0]) << 16) | \ ((uint32_t)(((uint8_t*)(x))[1]) << 8) | \ ((uint32_t)(((uint8_t*)(x))[2]))) -#define BE_32(x) (((uint32_t)(((uint8_t*)(x))[0]) << 24) | \ +#define _X_BE_32(x) (((uint32_t)(((uint8_t*)(x))[0]) << 24) | \ ((uint32_t)(((uint8_t*)(x))[1]) << 16) | \ ((uint32_t)(((uint8_t*)(x))[2]) << 8) | \ ((uint32_t)((uint8_t*)(x))[3])) -#define BE_64(x) (((uint64_t)(((uint8_t*)(x))[0]) << 56) | \ +#define _X_BE_64(x) (((uint64_t)(((uint8_t*)(x))[0]) << 56) | \ ((uint64_t)(((uint8_t*)(x))[1]) << 48) | \ ((uint64_t)(((uint8_t*)(x))[2]) << 40) | \ ((uint64_t)(((uint8_t*)(x))[3]) << 32) | \ @@ -53,16 +53,16 @@ ((uint64_t)(((uint8_t*)(x))[6]) << 8) | \ ((uint64_t)((uint8_t*)(x))[7])) -#define LE_16(x) (((uint16_t)(((uint8_t*)(x))[1]) << 8) | \ +#define _X_LE_16(x) (((uint16_t)(((uint8_t*)(x))[1]) << 8) | \ ((uint16_t)((uint8_t*)(x))[0])) -#define LE_24(x) (((uint32_t)(((uint8_t*)(x))[2]) << 16) | \ +#define _X_LE_24(x) (((uint32_t)(((uint8_t*)(x))[2]) << 16) | \ ((uint32_t)(((uint8_t*)(x))[1]) << 8) | \ ((uint32_t)(((uint8_t*)(x))[0]))) -#define LE_32(x) (((uint32_t)(((uint8_t*)(x))[3]) << 24) | \ +#define _X_LE_32(x) (((uint32_t)(((uint8_t*)(x))[3]) << 24) | \ ((uint32_t)(((uint8_t*)(x))[2]) << 16) | \ ((uint32_t)(((uint8_t*)(x))[1]) << 8) | \ ((uint32_t)((uint8_t*)(x))[0])) -#define LE_64(x) (((uint64_t)(((uint8_t*)(x))[7]) << 56) | \ +#define _X_LE_64(x) (((uint64_t)(((uint8_t*)(x))[7]) << 56) | \ ((uint64_t)(((uint8_t*)(x))[6]) << 48) | \ ((uint64_t)(((uint8_t*)(x))[5]) << 40) | \ ((uint64_t)(((uint8_t*)(x))[4]) << 32) | \ @@ -72,19 +72,19 @@ ((uint64_t)((uint8_t*)(x))[0])) #ifdef WORDS_BIGENDIAN -#define ME_16(x) BE_16(x) -#define ME_32(x) BE_32(x) -#define ME_64(x) BE_64(x) -#define AME_16(x) ABE_16(x) -#define AME_32(x) ABE_32(x) -#define AME_64(x) ABE_64(x) +#define _X_ME_16(x) _X_BE_16(x) +#define _X_ME_32(x) _X_BE_32(x) +#define _X_ME_64(x) _X_BE_64(x) +#define _X_AME_16(x) _X_ABE_16(x) +#define _X_AME_32(x) _X_ABE_32(x) +#define _X_AME_64(x) _X_ABE_64(x) #else -#define ME_16(x) LE_16(x) -#define ME_32(x) LE_32(x) -#define ME_64(x) LE_64(x) -#define AME_16(x) ALE_16(x) -#define AME_32(x) ALE_32(x) -#define AME_64(x) ALE_64(x) +#define _X_ME_16(x) _X_LE_16(x) +#define _X_ME_32(x) _X_LE_32(x) +#define _X_ME_64(x) _X_LE_64(x) +#define _X_AME_16(x) _X_ALE_16(x) +#define _X_AME_32(x) _X_ALE_32(x) +#define _X_AME_64(x) _X_ALE_64(x) #endif #define BE_FOURCC( ch0, ch1, ch2, ch3 ) \ -- cgit v1.2.3