summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin KAY <komadori@users.sourceforge.net>2002-10-05 14:39:24 +0000
committerRobin KAY <komadori@users.sourceforge.net>2002-10-05 14:39:24 +0000
commitd7dfcbeb67a733508efe3029bfcf13d3ac53c033 (patch)
treec71272b312d356ef776e5f862f9fec5294bc14bc
parent6905b22fbc581c8b518853d3e2edef52f50be1a8 (diff)
downloadxine-lib-d7dfcbeb67a733508efe3029bfcf13d3ac53c033.tar.gz
xine-lib-d7dfcbeb67a733508efe3029bfcf13d3ac53c033.tar.bz2
Fixed segmentation faults in endian translation macros (SPARC, gcc 3.2)
CVS patchset: 2785 CVS date: 2002/10/05 14:39:24
-rw-r--r--src/demuxers/demux_aiff.c22
-rw-r--r--src/demuxers/demux_film.c32
-rw-r--r--src/demuxers/demux_fli.c22
-rw-r--r--src/demuxers/demux_idcin.c28
-rw-r--r--src/demuxers/demux_mpeg.c20
-rw-r--r--src/demuxers/demux_mpgaudio.c6
-rw-r--r--src/demuxers/demux_qt.c140
-rw-r--r--src/demuxers/demux_roq.c26
-rw-r--r--src/demuxers/demux_smjpeg.c26
-rw-r--r--src/demuxers/demux_snd.c18
-rw-r--r--src/demuxers/demux_voc.c8
-rw-r--r--src/demuxers/demux_vqa.c28
-rw-r--r--src/demuxers/demux_wav.c10
-rw-r--r--src/demuxers/demux_wc3movie.c44
14 files changed, 215 insertions, 215 deletions
diff --git a/src/demuxers/demux_aiff.c b/src/demuxers/demux_aiff.c
index 7bf2c5b8d..16300915b 100644
--- a/src/demuxers/demux_aiff.c
+++ b/src/demuxers/demux_aiff.c
@@ -19,7 +19,7 @@
*
* AIFF File Demuxer by Mike Melanson (melanson@pcisys.net)
*
- * $Id: demux_aiff.c,v 1.7 2002/10/03 00:08:47 tmmm Exp $
+ * $Id: demux_aiff.c,v 1.8 2002/10/05 14:39:24 komadori Exp $
*
*/
@@ -41,8 +41,8 @@
#include "buffer.h"
#include "bswap.h"
-#define BE_16(x) (be2me_16(*(unsigned short *)(x)))
-#define BE_32(x) (be2me_32(*(unsigned int *)(x)))
+#define BE_16(x) (be2me_16((uint32_t)(x)))
+#define BE_32(x) (be2me_32((uint32_t)(x)))
#define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \
( (long)(unsigned char)(ch3) | \
@@ -219,8 +219,8 @@ static int load_aiff_and_send_headers(demux_aiff_t *this) {
pthread_mutex_lock(&this->mutex);
return DEMUX_CANNOT_HANDLE;
}
- chunk_type = BE_32(&preamble[0]);
- chunk_size = BE_32(&preamble[4]);
+ chunk_type = BE_32(preamble[0]);
+ chunk_size = BE_32(preamble[4]);
if (chunk_type == COMM_TAG) {
if (this->input->read(this->input, buffer, chunk_size) !=
@@ -230,10 +230,10 @@ static int load_aiff_and_send_headers(demux_aiff_t *this) {
return DEMUX_CANNOT_HANDLE;
}
- 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 = 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_bytes_per_second = this->audio_channels *
(this->audio_bits / 8) * this->audio_sample_rate;
@@ -299,8 +299,8 @@ static int demux_aiff_open(demux_plugin_t *this_gen,
return DEMUX_CANNOT_HANDLE;
/* check the signature */
- if ((BE_32(&signature[0]) == FORM_TAG) &&
- (BE_32(&signature[8]) == AIFF_TAG))
+ if ((BE_32(signature[0]) == FORM_TAG) &&
+ (BE_32(signature[8]) == AIFF_TAG))
return load_aiff_and_send_headers(this);
return DEMUX_CANNOT_HANDLE;
diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c
index f08bbc92d..a4c6c3038 100644
--- a/src/demuxers/demux_film.c
+++ b/src/demuxers/demux_film.c
@@ -21,7 +21,7 @@
* For more information on the FILM file format, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: demux_film.c,v 1.28 2002/10/01 04:33:35 tmmm Exp $
+ * $Id: demux_film.c,v 1.29 2002/10/05 14:39:24 komadori Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -41,8 +41,8 @@
#include "demux.h"
#include "bswap.h"
-#define BE_16(x) (be2me_16(*(unsigned short *)(x)))
-#define BE_32(x) (be2me_32(*(unsigned int *)(x)))
+#define BE_16(x) (be2me_16((uint16_t)(x)))
+#define BE_32(x) (be2me_32((uint32_t)(x)))
#define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \
( (long)(unsigned char)(ch3) | ( (long)(unsigned char)(ch2) << 8 ) | \
@@ -143,7 +143,7 @@ static int open_film_file(demux_film_t *film) {
}
/* header size = header size - 16-byte FILM signature */
- film_header_size = BE_32(&scratch[4]) - 16;
+ film_header_size = BE_32(scratch[4]) - 16;
film_header = xine_xmalloc(film_header_size);
if (!film_header)
return 0;
@@ -162,8 +162,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 = BE_32(film_header[i]);
+ chunk_size = BE_32(film_header[i + 4]);
/* sanity check the chunk size */
if (i + chunk_size > film_header_size) {
@@ -175,16 +175,16 @@ static int open_film_file(demux_film_t *film) {
switch(chunk_type) {
case FDSC_TAG:
/* always fetch the video information */
- film->bih.biWidth = BE_32(&film_header[i + 16]);
- film->bih.biHeight = BE_32(&film_header[i + 12]);
- film->video_codec = BE_32(&film_header[i + 8]);
+ film->bih.biWidth = BE_32(film_header[i + 16]);
+ film->bih.biHeight = BE_32(film_header[i + 12]);
+ film->video_codec = BE_32(film_header[i + 8]);
film->video_type = fourcc_to_buf_video(*(uint32_t *)&film_header[i + 8]);
/* fetch the audio information if the chunk size checks out */
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 = BE_16(film_header[24]);
} else {
/* otherwise, make a few assumptions about the audio parms */
film->audio_channels = 1;
@@ -201,20 +201,20 @@ 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 = BE_32(film_header[i + 8]);
+ film->sample_count = 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])
+ 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]);
+ BE_32(film_header[(i + 16) + j * 16 + 4]);
film->sample_table[j].syncinfo1 =
- BE_32(&film_header[(i + 16) + j * 16 + 8]);
+ BE_32(film_header[(i + 16) + j * 16 + 8]);
film->sample_table[j].syncinfo2 =
- BE_32(&film_header[(i + 16) + j * 16 + 12]);
+ BE_32(film_header[(i + 16) + j * 16 + 12]);
/* figure out the pts */
if (film->sample_table[j].syncinfo1 == 0xFFFFFFFF) {
diff --git a/src/demuxers/demux_fli.c b/src/demuxers/demux_fli.c
index 99e880711..f841283f4 100644
--- a/src/demuxers/demux_fli.c
+++ b/src/demuxers/demux_fli.c
@@ -22,7 +22,7 @@
* avoid while programming a FLI decoder, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: demux_fli.c,v 1.11 2002/09/21 19:47:11 tmmm Exp $
+ * $Id: demux_fli.c,v 1.12 2002/10/05 14:39:24 komadori Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -42,8 +42,8 @@
#include "demux.h"
#include "bswap.h"
-#define LE_16(x) (le2me_16(*(unsigned short *)(x)))
-#define LE_32(x) (le2me_32(*(unsigned int *)(x)))
+#define LE_16(x) (le2me_16((uint16_t)(x)))
+#define LE_32(x) (le2me_32((uint32_t)(x)))
#define VALID_ENDS "fli,flc"
@@ -120,8 +120,8 @@ static void *demux_fli_loop (void *this_gen) {
this->status = DEMUX_FINISHED;
break;
}
- chunk_size = LE_32(&fli_buf[0]);
- chunk_magic = LE_16(&fli_buf[4]);
+ chunk_size = LE_32(fli_buf[0]);
+ chunk_magic = LE_16(fli_buf[4]);
/* rewind over the size and packetize the chunk */
this->input->seek(this->input, -6, SEEK_CUR);
@@ -202,11 +202,11 @@ static int load_fli_and_send_headers(demux_fli_t *this) {
return DEMUX_CANNOT_HANDLE;
}
- this->magic_number = LE_16(&this->fli_header[4]);
- this->frame_count = LE_16(&this->fli_header[6]);
- this->width = LE_16(&this->fli_header[8]);
- this->height = LE_16(&this->fli_header[10]);
- this->speed = LE_32(&this->fli_header[16]);
+ this->magic_number = LE_16(this->fli_header[4]);
+ this->frame_count = LE_16(this->fli_header[6]);
+ this->width = LE_16(this->fli_header[8]);
+ this->height = LE_16(this->fli_header[10]);
+ this->speed = LE_32(this->fli_header[16]);
if (this->magic_number == 0xAF11) {
/*
* in this case, the speed (n) is number of 1/70s ticks between frames:
@@ -260,7 +260,7 @@ static int demux_fli_open(demux_plugin_t *this_gen, input_plugin_t *input,
if (input->read(input, sig, 2) != 2) {
return DEMUX_CANNOT_HANDLE;
}
- magic_number = LE_16(&sig[0]);
+ magic_number = LE_16(sig[0]);
if ((magic_number == FLI_FILE_MAGIC_1) ||
(magic_number == FLI_FILE_MAGIC_2))
return load_fli_and_send_headers(this);
diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c
index 8106842cf..5a0b88f70 100644
--- a/src/demuxers/demux_idcin.c
+++ b/src/demuxers/demux_idcin.c
@@ -63,7 +63,7 @@
* - if any bytes exceed 63, do not shift the bytes at all before
* transmitting them to the video decoder
*
- * $Id: demux_idcin.c,v 1.11 2002/09/21 19:18:37 tmmm Exp $
+ * $Id: demux_idcin.c,v 1.12 2002/10/05 14:39:24 komadori Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -83,8 +83,8 @@
#include "demux.h"
#include "bswap.h"
-#define LE_16(x) (le2me_16(*(unsigned short *)(x)))
-#define LE_32(x) (le2me_32(*(unsigned int *)(x)))
+#define LE_16(x) (le2me_16((uint16_t)(x)))
+#define LE_32(x) (le2me_32((uint32_t)(x)))
#define VALID_ENDS "cin"
#define IDCIN_HEADER_SIZE 20
@@ -214,7 +214,7 @@ static void *demux_idcin_loop (void *this_gen) {
pthread_mutex_unlock(&this->mutex);
break;
}
- remaining_sample_bytes = LE_32(&preamble[0]) - 4;
+ remaining_sample_bytes = LE_32(preamble[0]) - 4;
while (remaining_sample_bytes) {
buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
@@ -330,11 +330,11 @@ static int load_idcin_and_send_headers(demux_idcin_t *this) {
return DEMUX_CANNOT_HANDLE;
}
- this->video_width = LE_32(&header[0]);
- this->video_height = LE_32(&header[4]);
- this->audio_sample_rate = LE_32(&header[8]);
- this->audio_bytes_per_sample = LE_32(&header[12]);
- this->audio_channels = LE_32(&header[16]);
+ this->video_width = LE_32(header[0]);
+ this->video_height = LE_32(header[4]);
+ this->audio_sample_rate = LE_32(header[8]);
+ this->audio_bytes_per_sample = LE_32(header[12]);
+ this->audio_channels = LE_32(header[16]);
this->filesize = this->input->get_length(this->input);
/* read the Huffman table */
@@ -394,27 +394,27 @@ static int demux_idcin_open(demux_plugin_t *this_gen,
*/
/* check the width */
- current_value = LE_32(&header[0]);
+ current_value = LE_32(header[0]);
if ((current_value == 0) || (current_value > 1024))
return DEMUX_CANNOT_HANDLE;
/* check the height */
- current_value = LE_32(&header[4]);
+ current_value = LE_32(header[4]);
if ((current_value == 0) || (current_value > 1024))
return DEMUX_CANNOT_HANDLE;
/* check the audio sample rate */
- current_value = LE_32(&header[8]);
+ current_value = LE_32(header[8]);
if ((current_value < 8000) || (current_value > 48000))
return DEMUX_CANNOT_HANDLE;
/* check the audio bytes/sample */
- current_value = LE_32(&header[12]);
+ current_value = LE_32(header[12]);
if (current_value > 2)
return DEMUX_CANNOT_HANDLE;
/* check the audio channels */
- current_value = LE_32(&header[16]);
+ current_value = LE_32(header[16]);
if (current_value > 2)
return DEMUX_CANNOT_HANDLE;
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c
index f2273febd..fbaaf5dd0 100644
--- a/src/demuxers/demux_mpeg.c
+++ b/src/demuxers/demux_mpeg.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_mpeg.c,v 1.77 2002/09/18 22:12:16 guenter Exp $
+ * $Id: demux_mpeg.c,v 1.78 2002/10/05 14:39:24 komadori Exp $
*
* demultiplexer for mpeg 1/2 program streams
* reads streams of variable blocksizes
@@ -89,8 +89,8 @@ typedef struct demux_mpeg_s {
*/
#include "bswap.h"
-#define BE_16(x) (be2me_16(*(uint16_t *)(x)))
-#define BE_32(x) (be2me_32(*(uint32_t *)(x)))
+#define BE_16(x) (be2me_16((uint16_t)(x)))
+#define BE_32(x) (be2me_32((uint32_t)(x)))
#define QT_ATOM( ch0, ch1, ch2, ch3 ) \
( (long)(unsigned char)(ch3) | ( (long)(unsigned char)(ch2) << 8 ) | \
( (long)(unsigned char)(ch1) << 16 ) | ( (long)(unsigned char)(ch0) << 24 ) )
@@ -152,8 +152,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 = BE_32(atom_preamble[0]);
+ atom = BE_32(atom_preamble[4]);
if (atom == MDAT_ATOM) {
*mdat_offset = input->get_current_pos(input) - ATOM_PREAMBLE_SIZE;
@@ -177,9 +177,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 = BE_32(atom_preamble[0]);
atom_size <<= 32;
- atom_size |= BE_32(&atom_preamble[4]);
+ atom_size |= BE_32(atom_preamble[4]);
atom_size -= ATOM_PREAMBLE_SIZE * 2;
} else
atom_size -= ATOM_PREAMBLE_SIZE;
@@ -1023,9 +1023,9 @@ static int demux_mpeg_open(demux_plugin_t *this_gen,
}
/* special case for MPEG streams with a RIFF header */
- fourcc_tag = BE_32(&buf[0]);
+ fourcc_tag = BE_32(buf[0]);
if (fourcc_tag == RIFF_TAG) {
- fourcc_tag = BE_32(&buf[8]);
+ fourcc_tag = BE_32(buf[8]);
/* disregard the RIFF file if it is certainly a better known
* format like AVI or WAVE */
if ((fourcc_tag == WAVE_TAG) ||
@@ -1043,7 +1043,7 @@ static int demux_mpeg_open(demux_plugin_t *this_gen,
return DEMUX_CANNOT_HANDLE;
for (j = 0; j < 1024 - 4; j++) {
- if (BE_32(&buf[j]) == MPEG_MARKER) {
+ if (BE_32(buf[j]) == MPEG_MARKER) {
this->input = input;
return demux_mpeg_send_headers (this);
}
diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c
index 6c1289834..437c28bb0 100644
--- a/src/demuxers/demux_mpgaudio.c
+++ b/src/demuxers/demux_mpgaudio.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_mpgaudio.c,v 1.63 2002/10/02 15:54:51 mroi Exp $
+ * $Id: demux_mpgaudio.c,v 1.64 2002/10/05 14:39:24 komadori Exp $
*
* demultiplexer for mpeg audio (i.e. mp3) streams
*
@@ -556,7 +556,7 @@ static int demux_mpgaudio_open(demux_plugin_t *this_gen,
if (input->read(input, riff_check, 4) != 4)
return DEMUX_CANNOT_HANDLE;
/* head gets to be a generic variable in this case */
- head = le2me_32(*(unsigned int *)&riff_check[0]);
+ head = le2me_32((uint32_t)riff_check[0]);
/* skip over the chunk and the 'data' tag and length */
input->seek(input, head + 8, SEEK_CUR);
@@ -567,7 +567,7 @@ static int demux_mpgaudio_open(demux_plugin_t *this_gen,
return DEMUX_CANNOT_HANDLE;
for (i = 0; i < RIFF_CHECK_BYTES - 4; i++) {
- head = be2me_32(*(unsigned int *)&riff_check[i]);
+ head = be2me_32((uint32_t)riff_check[i]);
#ifdef LOG
printf ("demux_mpgaudio: **** mpg123: checking %08X\n", head);
#endif
diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c
index 940187e1e..812b97052 100644
--- a/src/demuxers/demux_qt.c
+++ b/src/demuxers/demux_qt.c
@@ -30,7 +30,7 @@
* build_frame_table
* free_qt_info
*
- * $Id: demux_qt.c,v 1.90 2002/10/01 03:52:53 tmmm Exp $
+ * $Id: demux_qt.c,v 1.91 2002/10/05 14:39:24 komadori Exp $
*
*/
@@ -57,8 +57,8 @@
typedef unsigned int qt_atom;
-#define BE_16(x) (be2me_16(*(uint16_t *)(x)))
-#define BE_32(x) (be2me_32(*(uint32_t *)(x)))
+#define BE_16(x) (be2me_16((uint16_t)(x)))
+#define BE_32(x) (be2me_32((uint32_t)(x)))
#define QT_ATOM( ch0, ch1, ch2, ch3 ) \
( (long)(unsigned char)(ch3) | ( (long)(unsigned char)(ch2) << 8 ) | \
@@ -330,8 +330,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 = BE_32(atom_preamble[0]);
+ atom = BE_32(atom_preamble[4]);
if (atom == MOOV_ATOM) {
*moov_offset = input->get_current_pos(input) - ATOM_PREAMBLE_SIZE;
@@ -345,9 +345,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 = BE_32(atom_preamble[0]);
atom_size <<= 32;
- atom_size |= BE_32(&atom_preamble[4]);
+ atom_size |= BE_32(atom_preamble[4]);
atom_size -= ATOM_PREAMBLE_SIZE * 2;
} else
atom_size -= ATOM_PREAMBLE_SIZE;
@@ -432,10 +432,10 @@ static int is_qt_file(input_plugin_t *qt_file) {
/* 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 = 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]);
}
@@ -464,7 +464,7 @@ static qt_error parse_trak_atom(qt_sample_table *sample_table,
unsigned char *trak_atom) {
int i, j;
- unsigned int trak_atom_size = BE_32(&trak_atom[0]);
+ unsigned int trak_atom_size = BE_32(trak_atom[0]);
qt_atom current_atom;
qt_error last_error = QT_OK;
@@ -501,7 +501,7 @@ static qt_error parse_trak_atom(qt_sample_table *sample_table,
/* 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 = BE_32(trak_atom[i]);
if (current_atom == VMHD_ATOM) {
sample_table->type = MEDIA_VIDEO;
@@ -514,10 +514,10 @@ static qt_error parse_trak_atom(qt_sample_table *sample_table,
/* search for the useful atoms */
for (i = ATOM_PREAMBLE_SIZE; i < trak_atom_size - 4; i++) {
- current_atom = BE_32(&trak_atom[i]);
+ current_atom = BE_32(trak_atom[i]);
if (current_atom == TKHD_ATOM) {
- sample_table->flags = BE_16(&trak_atom[i + 6]);
+ sample_table->flags = BE_16(trak_atom[i + 6]);
if (sample_table->type == MEDIA_VIDEO) {
/* fetch display parameters */
@@ -525,9 +525,9 @@ static qt_error parse_trak_atom(qt_sample_table *sample_table,
!sample_table->media_description.video.height ) {
sample_table->media_description.video.width =
- BE_16(&trak_atom[i + 0x50]);
+ BE_16(trak_atom[i + 0x50]);
sample_table->media_description.video.height =
- BE_16(&trak_atom[i + 0x54]);
+ BE_16(trak_atom[i + 0x54]);
}
}
} else if (current_atom == ELST_ATOM) {
@@ -538,7 +538,7 @@ static qt_error parse_trak_atom(qt_sample_table *sample_table,
goto free_sample_table;
}
- sample_table->edit_list_count = BE_32(&trak_atom[i + 8]);
+ sample_table->edit_list_count = BE_32(trak_atom[i + 8]);
sample_table->edit_list_table = (edit_list_table_t *)malloc(
sample_table->edit_list_count * sizeof(edit_list_table_t));
@@ -550,23 +550,23 @@ static qt_error parse_trak_atom(qt_sample_table *sample_table,
/* load the edit list table */
for (j = 0; j < sample_table->edit_list_count; j++) {
sample_table->edit_list_table[j].track_duration =
- BE_32(&trak_atom[i + 12 + j * 12 + 0]);
+ BE_32(trak_atom[i + 12 + j * 12 + 0]);
sample_table->edit_list_table[j].media_time =
- BE_32(&trak_atom[i + 12 + j * 12 + 4]);
+ BE_32(trak_atom[i + 12 + j * 12 + 4]);
}
} else if (current_atom == MDHD_ATOM)
- sample_table->timescale = BE_32(&trak_atom[i + 0x10]);
+ sample_table->timescale = BE_32(trak_atom[i + 0x10]);
else if (current_atom == STSD_ATOM) {
if (sample_table->type == MEDIA_VIDEO) {
/* fetch video parameters */
- if( BE_16(&trak_atom[i + 0x2C]) && BE_16(&trak_atom[i + 0x2E]) ) {
+ if( BE_16(trak_atom[i + 0x2C]) && BE_16(trak_atom[i + 0x2E]) ) {
sample_table->media_description.video.width =
- BE_16(&trak_atom[i + 0x2C]);
+ BE_16(trak_atom[i + 0x2C]);
sample_table->media_description.video.height =
- BE_16(&trak_atom[i + 0x2E]);
+ BE_16(trak_atom[i + 0x2E]);
}
sample_table->media_description.video.codec_format =
*(uint32_t *)&trak_atom[i + 0x10];
@@ -580,7 +580,7 @@ static qt_error parse_trak_atom(qt_sample_table *sample_table,
/* 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[i + 0x60]);
+ color_flag = BE_16(trak_atom[i + 0x60]);
if (color_greyscale) {
@@ -632,15 +632,15 @@ static qt_error parse_trak_atom(qt_sample_table *sample_table,
} else {
/* load the palette from the file */
- color_start = BE_32(&trak_atom[i + 0x62]);
- color_count = BE_16(&trak_atom[i + 0x66]);
- color_end = BE_16(&trak_atom[i + 0x68]);
+ color_start = BE_32(trak_atom[i + 0x62]);
+ color_count = BE_16(trak_atom[i + 0x66]);
+ color_end = BE_16(trak_atom[i + 0x68]);
sample_table->media_description.video.palette_count =
color_end + 1;
for (j = color_start; j <= color_end; j++) {
- color_index = BE_16(&trak_atom[i + 0x6A + j * 8]);
+ color_index = BE_16(trak_atom[i + 0x6A + j * 8]);
if (color_count & 0x8000)
color_index = j;
if (color_index <
@@ -663,7 +663,7 @@ static qt_error parse_trak_atom(qt_sample_table *sample_table,
sample_table->media_description.audio.codec_format =
*(uint32_t *)&trak_atom[i + 0x10];
sample_table->media_description.audio.sample_rate =
- BE_16(&trak_atom[i + 0x2C]);
+ BE_16(trak_atom[i + 0x2C]);
sample_table->media_description.audio.channels = trak_atom[i + 0x25];
sample_table->media_description.audio.bits = trak_atom[i + 0x27];
@@ -679,7 +679,7 @@ static qt_error parse_trak_atom(qt_sample_table *sample_table,
/* special case time: some ima4-encoded files don't have the
* extra header; compensate */
- if (BE_32(&trak_atom[i + 0x10]) == IMA4_FOURCC) {
+ if (BE_32(trak_atom[i + 0x10]) == IMA4_FOURCC) {
sample_table->samples_per_packet = 64;
sample_table->bytes_per_packet = 34;
sample_table->bytes_per_frame = 34 *
@@ -693,16 +693,16 @@ static qt_error parse_trak_atom(qt_sample_table *sample_table,
* properties; if a the stsd compressor atom has 0x24 bytes, it
* appears to be a handler for uncompressed data; if there are an
* extra 0x10 bytes, there are some more useful decoding params */
- if (BE_32(&trak_atom[i + 0x0C]) > 0x24) {
-
- if (BE_32(&trak_atom[i + 0x30]))
- sample_table->samples_per_packet = BE_32(&trak_atom[i + 0x30]);
- if (BE_32(&trak_atom[i + 0x34]))
- sample_table->bytes_per_packet = BE_32(&trak_atom[i + 0x34]);
- if (BE_32(&trak_atom[i + 0x38]))
- sample_table->bytes_per_frame = BE_32(&trak_atom[i + 0x38]);
- if (BE_32(&trak_atom[i + 0x3C]))
- sample_table->bytes_per_sample = BE_32(&trak_atom[i + 0x3C]);
+ if (BE_32(trak_atom[i + 0x0C]) > 0x24) {
+
+ if (BE_32(trak_atom[i + 0x30]))
+ sample_table->samples_per_packet = BE_32(trak_atom[i + 0x30]);
+ if (BE_32(trak_atom[i + 0x34]))
+ sample_table->bytes_per_packet = BE_32(trak_atom[i + 0x34]);
+ if (BE_32(trak_atom[i + 0x38]))
+ sample_table->bytes_per_frame = BE_32(trak_atom[i + 0x38]);
+ if (BE_32(trak_atom[i + 0x3C]))
+ sample_table->bytes_per_sample = BE_32(trak_atom[i + 0x3C]);
sample_table->samples_per_frame =
(sample_table->bytes_per_frame / sample_table->bytes_per_packet) *
sample_table->samples_per_packet;
@@ -758,8 +758,8 @@ printf("*** audio: %d bits, %d channels, %d Hz\n" \
goto free_sample_table;
}
- sample_table->sample_size = BE_32(&trak_atom[i + 8]);
- sample_table->sample_size_count = BE_32(&trak_atom[i + 12]);
+ sample_table->sample_size = BE_32(trak_atom[i + 8]);
+ sample_table->sample_size_count = BE_32(trak_atom[i + 12]);
/* allocate space and load table only if sample size is 0 */
if (sample_table->sample_size == 0) {
@@ -772,7 +772,7 @@ printf("*** audio: %d bits, %d channels, %d Hz\n" \
/* load the sample size table */
for (j = 0; j < sample_table->sample_size_count; j++)
sample_table->sample_size_table[j] =
- BE_32(&trak_atom[i + 16 + j * 4]);
+ BE_32(trak_atom[i + 16 + j * 4]);
} else
/* set the pointer to non-NULL to indicate that the atom type has
* already been seen for this trak atom */
@@ -786,7 +786,7 @@ printf("*** audio: %d bits, %d channels, %d Hz\n" \
goto free_sample_table;
}
- sample_table->sync_sample_count = BE_32(&trak_atom[i + 8]);
+ sample_table->sync_sample_count = BE_32(trak_atom[i + 8]);
sample_table->sync_sample_table = (unsigned int *)malloc(
sample_table->sync_sample_count * sizeof(unsigned int));
@@ -798,7 +798,7 @@ printf("*** audio: %d bits, %d channels, %d Hz\n" \
/* load the sync sample table */
for (j = 0; j < sample_table->sync_sample_count; j++)
sample_table->sync_sample_table[j] =
- BE_32(&trak_atom[i + 12 + j * 4]);
+ BE_32(trak_atom[i + 12 + j * 4]);
} else if (current_atom == STCO_ATOM) {
@@ -808,7 +808,7 @@ printf("*** audio: %d bits, %d channels, %d Hz\n" \
goto free_sample_table;
}
- sample_table->chunk_offset_count = BE_32(&trak_atom[i + 8]);
+ sample_table->chunk_offset_count = BE_32(trak_atom[i + 8]);
sample_table->chunk_offset_table = (int64_t *)malloc(
sample_table->chunk_offset_count * sizeof(int64_t));
@@ -820,7 +820,7 @@ printf("*** audio: %d bits, %d channels, %d Hz\n" \
/* load the chunk offset table */
for (j = 0; j < sample_table->chunk_offset_count; j++)
sample_table->chunk_offset_table[j] =
- BE_32(&trak_atom[i + 12 + j * 4]);
+ BE_32(trak_atom[i + 12 + j * 4]);
} else if (current_atom == CO64_ATOM) {
@@ -830,7 +830,7 @@ printf("*** audio: %d bits, %d channels, %d Hz\n" \
goto free_sample_table;
}
- sample_table->chunk_offset_count = BE_32(&trak_atom[i + 8]);
+ sample_table->chunk_offset_count = BE_32(trak_atom[i + 8]);
sample_table->chunk_offset_table = (int64_t *)malloc(
sample_table->chunk_offset_count * sizeof(int64_t));
@@ -842,10 +842,10 @@ printf("*** audio: %d bits, %d channels, %d Hz\n" \
/* load the 64-bit chunk offset table */
for (j = 0; j < sample_table->chunk_offset_count; j++) {
sample_table->chunk_offset_table[j] =
- BE_32(&trak_atom[i + 12 + j * 8 + 0]);
+ BE_32(trak_atom[i + 12 + j * 8 + 0]);
sample_table->chunk_offset_table[j] <<= 32;
sample_table->chunk_offset_table[j] |=
- BE_32(&trak_atom[i + 12 + j * 8 + 4]);
+ BE_32(trak_atom[i + 12 + j * 8 + 4]);
}
} else if (current_atom == STSC_ATOM) {
@@ -856,7 +856,7 @@ printf("*** audio: %d bits, %d channels, %d Hz\n" \
goto free_sample_table;
}
- sample_table->sample_to_chunk_count = BE_32(&trak_atom[i + 8]);
+ sample_table->sample_to_chunk_count = BE_32(trak_atom[i + 8]);
sample_table->sample_to_chunk_table = (sample_to_chunk_table_t *)malloc(
sample_table->sample_to_chunk_count * sizeof(sample_to_chunk_table_t));
@@ -868,9 +868,9 @@ printf("*** audio: %d bits, %d channels, %d Hz\n" \
/* load the sample to chunk table */
for (j = 0; j < sample_table->sample_to_chunk_count; j++) {
sample_table->sample_to_chunk_table[j].first_chunk =
- BE_32(&trak_atom[i + 12 + j * 12 + 0]);
+ BE_32(trak_atom[i + 12 + j * 12 + 0]);
sample_table->sample_to_chunk_table[j].samples_per_chunk =
- BE_32(&trak_atom[i + 12 + j * 12 + 4]);
+ BE_32(trak_atom[i + 12 + j * 12 + 4]);
}
} else if (current_atom == STTS_ATOM) {
@@ -881,7 +881,7 @@ printf("*** audio: %d bits, %d channels, %d Hz\n" \
goto free_sample_table;
}
- sample_table->time_to_sample_count = BE_32(&trak_atom[i + 8]);
+ sample_table->time_to_sample_count = BE_32(trak_atom[i + 8]);
sample_table->time_to_sample_table = (time_to_sample_table_t *)malloc(
sample_table->time_to_sample_count * sizeof(time_to_sample_table_t));
@@ -893,9 +893,9 @@ printf("*** audio: %d bits, %d channels, %d Hz\n" \
/* load the time to sample table */
for (j = 0; j < sample_table->time_to_sample_count; j++) {
sample_table->time_to_sample_table[j].count =
- BE_32(&trak_atom[i + 12 + j * 8 + 0]);
+ BE_32(trak_atom[i + 12 + j * 8 + 0]);
sample_table->time_to_sample_table[j].duration =
- BE_32(&trak_atom[i + 12 + j * 8 + 4]);
+ BE_32(trak_atom[i + 12 + j * 8 + 4]);
}
}
}
@@ -1180,7 +1180,7 @@ printf ("bits = %d, channels = %d, audio_frame_counter = %d, pts = %lld\n",
*/
static void parse_moov_atom(qt_info *info, unsigned char *moov_atom) {
int i, j;
- unsigned int moov_atom_size = BE_32(&moov_atom[0]);
+ unsigned int moov_atom_size = BE_32(moov_atom[0]);
unsigned int sample_table_count = 0;
qt_sample_table *sample_tables = NULL;
qt_atom current_atom;
@@ -1189,20 +1189,20 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom) {
int64_t min_offset;
/* make sure this is actually a moov atom */
- if (BE_32(&moov_atom[4]) != MOOV_ATOM) {
+ if (BE_32(moov_atom[4]) != MOOV_ATOM) {
info->last_error = QT_NO_MOOV_ATOM;
return;
}
/* prowl through the moov atom looking for very specific targets */
for (i = ATOM_PREAMBLE_SIZE; i < moov_atom_size - 4; i++) {
- current_atom = BE_32(&moov_atom[i]);
+ current_atom = BE_32(moov_atom[i]);
if (current_atom == MVHD_ATOM) {
parse_mvhd_atom(info, &moov_atom[i - 4]);
if (info->last_error != QT_OK)
return;
- i += BE_32(&moov_atom[i - 4]) - 4;
+ i += BE_32(moov_atom[i - 4]) - 4;
} else if (current_atom == TRAK_ATOM) {
/* make a new sample temporary sample table */
@@ -1214,7 +1214,7 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom) {
&moov_atom[i - 4]);
if (info->last_error != QT_OK)
return;
- i += BE_32(&moov_atom[i - 4]) - 4;
+ i += BE_32(moov_atom[i - 4]) - 4;
}
}
@@ -1358,8 +1358,8 @@ static qt_error open_qt_file(qt_info *info, input_plugin_t *input) {
return info->last_error;
}
- top_level_atom_size = BE_32(&atom_preamble[0]);
- top_level_atom = BE_32(&atom_preamble[4]);
+ top_level_atom_size = BE_32(atom_preamble[0]);
+ top_level_atom = BE_32(atom_preamble[4]);
/* 64-bit length special case */
if (top_level_atom_size == 1) {
preseek_pos = input->get_current_pos(input);
@@ -1367,9 +1367,9 @@ static qt_error open_qt_file(qt_info *info, input_plugin_t *input) {
info->last_error = QT_FILE_READ_ERROR;
return info->last_error;
}
- top_level_atom_size = BE_32(&atom_preamble[0]);
+ top_level_atom_size = BE_32(atom_preamble[0]);
top_level_atom_size <<= 32;
- top_level_atom_size |= BE_32(&atom_preamble[4]);
+ top_level_atom_size |= BE_32(atom_preamble[4]);
/* rewind 8 bytes */
if (input->seek(input, preseek_pos, SEEK_SET) != preseek_pos) {
@@ -1403,14 +1403,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 (BE_32(moov_atom[12]) == CMOV_ATOM) {
info->compressed_header = 1;
z_state.next_in = &moov_atom[0x28];
z_state.avail_in = top_level_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 = BE_32(moov_atom[0x24]);
+ unzip_buffer = (unsigned char *)malloc(BE_32(moov_atom[0x24]));
if (!unzip_buffer) {
info->last_error = QT_NO_MEMORY;
return info->last_error;
@@ -1442,7 +1442,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;
- top_level_atom_size = BE_32 (&moov_atom[0]);
+ top_level_atom_size = BE_32(moov_atom[0]);
}
} else {
input->seek(input, top_level_atom_size - ATOM_PREAMBLE_SIZE, SEEK_CUR);
diff --git a/src/demuxers/demux_roq.c b/src/demuxers/demux_roq.c
index c0904acc2..f1b59a93c 100644
--- a/src/demuxers/demux_roq.c
+++ b/src/demuxers/demux_roq.c
@@ -21,7 +21,7 @@
* For more information regarding the RoQ file format, visit:
* http://www.csse.monash.edu.au/~timf/
*
- * $Id: demux_roq.c,v 1.15 2002/09/21 19:47:11 tmmm Exp $
+ * $Id: demux_roq.c,v 1.16 2002/10/05 14:39:24 komadori Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -41,8 +41,8 @@
#include "demux.h"
#include "bswap.h"
-#define LE_16(x) (le2me_16(*(unsigned short *)(x)))
-#define LE_32(x) (le2me_32(*(unsigned int *)(x)))
+#define LE_16(x) (le2me_16((uint16_t)(x)))
+#define LE_32(x) (le2me_32((uint32_t)(x)))
#define RoQ_MAGIC_NUMBER 0x1084
#define RoQ_CHUNK_PREAMBLE_SIZE 8
@@ -113,8 +113,8 @@ static void *demux_roq_loop (void *this_gen) {
this->status = DEMUX_FINISHED;
break;
}
- chunk_type = LE_16(&preamble[0]);
- chunk_size = LE_32(&preamble[2]);
+ chunk_type = LE_16(preamble[0]);
+ chunk_size = 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)) {
@@ -185,7 +185,7 @@ static void *demux_roq_loop (void *this_gen) {
this->input->seek(this->input, current_file_pos, SEEK_SET);
/* figure out the total video chunk size */
- chunk_size += (2 * RoQ_CHUNK_PREAMBLE_SIZE) + LE_32(&preamble[2]);
+ chunk_size += (2 * RoQ_CHUNK_PREAMBLE_SIZE) + LE_32(preamble[2]);
}
/* packetize the video chunk and route it to the video fifo */
@@ -279,7 +279,7 @@ static int load_roq_and_send_headers(demux_roq_t *this) {
*
* therefore, the frame pts increment is 90000 / fps
*/
- this->fps = LE_16(&preamble[6]);
+ this->fps = LE_16(preamble[6]);
this->frame_pts_inc = 90000 / this->fps;
/* iterate through the first 2 seconds worth of chunks searching for
@@ -291,16 +291,16 @@ static int load_roq_and_send_headers(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 = LE_16(preamble[0]);
+ chunk_size = 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->width = LE_16(&preamble[0]);
- this->height = LE_16(&preamble[2]);
+ this->width = LE_16(preamble[0]);
+ this->height = LE_16(preamble[2]);
/* if an audio chunk was already found, search is done */
if (this->audio_channels)
@@ -370,8 +370,8 @@ static int demux_roq_open(demux_plugin_t *this_gen, input_plugin_t *input,
return DEMUX_CANNOT_HANDLE;
/* check for the RoQ magic numbers */
- if ((LE_16(&preamble[0]) == RoQ_MAGIC_NUMBER) &&
- (LE_32(&preamble[2]) == 0xFFFFFFFF))
+ if ((LE_16(preamble[0]) == RoQ_MAGIC_NUMBER) &&
+ (LE_32(preamble[2]) == 0xFFFFFFFF))
return load_roq_and_send_headers(this);
return DEMUX_CANNOT_HANDLE;
diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c
index ad3301bb2..65e809651 100644
--- a/src/demuxers/demux_smjpeg.c
+++ b/src/demuxers/demux_smjpeg.c
@@ -21,7 +21,7 @@
* For more information on the SMJPEG file format, visit:
* http://www.lokigames.com/development/smjpeg.php3
*
- * $Id: demux_smjpeg.c,v 1.15 2002/09/21 20:27:02 tmmm Exp $
+ * $Id: demux_smjpeg.c,v 1.16 2002/10/05 14:39:24 komadori Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -41,8 +41,8 @@
#include "demux.h"
#include "bswap.h"
-#define BE_16(x) (be2me_16(*(unsigned short *)(x)))
-#define BE_32(x) (be2me_32(*(unsigned int *)(x)))
+#define BE_16(x) (be2me_16((uint16_t)(x)))
+#define BE_32(x) (be2me_32((uint32_t)(x)))
#define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \
( (long)(unsigned char)(ch3) | ( (long)(unsigned char)(ch2) << 8 ) | \
@@ -136,8 +136,8 @@ static void *demux_smjpeg_loop (void *this_gen) {
continue; /* skip to next while() iteration to bail out */
}
- chunk_tag = BE_32(&preamble[0]);
- remaining_sample_bytes = BE_32(&preamble[8]);
+ chunk_tag = BE_32(preamble[0]);
+ remaining_sample_bytes = BE_32(preamble[8]);
/*
* Each sample has an absolute timestamp in millisecond units:
@@ -164,7 +164,7 @@ static void *demux_smjpeg_loop (void *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 = BE_32(preamble[4]);
pts *= 90;
}
@@ -272,7 +272,7 @@ static int load_smjpeg_and_send_headers(demux_smjpeg_t *this) {
pthread_mutex_unlock(&this->mutex);
return DEMUX_CANNOT_HANDLE;
}
- this->duration = BE_32(&header_chunk[0]);
+ this->duration = BE_32(header_chunk[0]);
/* traverse the header chunks until the HEND tag is found */
chunk_tag = 0;
@@ -283,7 +283,7 @@ static int load_smjpeg_and_send_headers(demux_smjpeg_t *this) {
pthread_mutex_unlock(&this->mutex);
return DEMUX_FINISHED;
}
- chunk_tag = BE_32(&header_chunk[0]);
+ chunk_tag = BE_32(header_chunk[0]);
switch(chunk_tag) {
@@ -300,8 +300,8 @@ static int load_smjpeg_and_send_headers(demux_smjpeg_t *this) {
return DEMUX_CANNOT_HANDLE;
}
- this->bih.biWidth = BE_16(&header_chunk[8]);
- this->bih.biHeight = BE_16(&header_chunk[10]);
+ this->bih.biWidth = BE_16(header_chunk[8]);
+ this->bih.biHeight = BE_16(header_chunk[10]);
this->bih.biCompression = *(uint32_t *)&header_chunk[12];
this->video_type = fourcc_to_buf_video(this->bih.biCompression);
break;
@@ -314,13 +314,13 @@ static int load_smjpeg_and_send_headers(demux_smjpeg_t *this) {
return DEMUX_CANNOT_HANDLE;
}
- this->audio_sample_rate = BE_16(&header_chunk[4]);
+ this->audio_sample_rate = 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 (BE_32(header_chunk[8]) == APCM_TAG) {
this->audio_codec = be2me_32(APCM_TAG);
this->audio_type = BUF_AUDIO_SMJPEG_IMA;
} else {
@@ -337,7 +337,7 @@ static int load_smjpeg_and_send_headers(demux_smjpeg_t *this) {
pthread_mutex_unlock(&this->mutex);
return DEMUX_CANNOT_HANDLE;
}
- this->input->seek(this->input, BE_32(&header_chunk[0]), SEEK_CUR);
+ this->input->seek(this->input, BE_32(header_chunk[0]), SEEK_CUR);
break;
}
}
diff --git a/src/demuxers/demux_snd.c b/src/demuxers/demux_snd.c
index edb46bb1b..3eb6dd87b 100644
--- a/src/demuxers/demux_snd.c
+++ b/src/demuxers/demux_snd.c
@@ -19,7 +19,7 @@
*
* SND/AU File Demuxer by Mike Melanson (melanson@pcisys.net)
*
- * $Id: demux_snd.c,v 1.8 2002/10/03 00:08:47 tmmm Exp $
+ * $Id: demux_snd.c,v 1.9 2002/10/05 14:39:24 komadori Exp $
*
*/
@@ -41,8 +41,8 @@
#include "buffer.h"
#include "bswap.h"
-#define BE_16(x) (be2me_16(*(unsigned short *)(x)))
-#define BE_32(x) (be2me_32(*(unsigned int *)(x)))
+#define BE_16(x) (be2me_16((uint16_t)(x)))
+#define BE_32(x) (be2me_32((uint32_t)(x)))
#define SND_HEADER_SIZE 24
#define PCM_BLOCK_ALIGN 1024
@@ -196,11 +196,11 @@ static int load_snd_and_send_headers(demux_snd_t *this) {
return DEMUX_CANNOT_HANDLE;
}
- 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 = 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]);
/* basic sanity checks on the loaded audio parameters */
if ((!this->audio_sample_rate) ||
@@ -285,7 +285,7 @@ static int demux_snd_open(demux_plugin_t *this_gen,
return DEMUX_CANNOT_HANDLE;
/* check the signature */
- if (BE_32(&header[0]) == snd_TAG)
+ if (BE_32(header[0]) == snd_TAG)
return load_snd_and_send_headers(this);
return DEMUX_CANNOT_HANDLE;
diff --git a/src/demuxers/demux_voc.c b/src/demuxers/demux_voc.c
index d18f445f9..d10c29c9b 100644
--- a/src/demuxers/demux_voc.c
+++ b/src/demuxers/demux_voc.c
@@ -23,7 +23,7 @@
* It will only play that block if it is PCM data. More variations will be
* supported as they are encountered.
*
- * $Id: demux_voc.c,v 1.8 2002/10/03 00:08:47 tmmm Exp $
+ * $Id: demux_voc.c,v 1.9 2002/10/05 14:39:24 komadori Exp $
*
*/
@@ -45,8 +45,8 @@
#include "buffer.h"
#include "bswap.h"
-#define LE_16(x) (le2me_16(*(uint16_t *)(x)))
-#define LE_32(x) (le2me_32(*(uint32_t *)(x)))
+#define LE_16(x) (le2me_16((uint16_t)(x)))
+#define LE_32(x) (le2me_32((uint32_t)(x)))
#define VALID_ENDS "voc"
#define PCM_BLOCK_ALIGN 1024
@@ -201,7 +201,7 @@ static int load_voc_and_send_headers(demux_voc_t *this) {
return DEMUX_CANNOT_HANDLE;
}
- first_block_offset = LE_16(&header[0x14]);
+ first_block_offset = 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 75ec52679..6d77a875f 100644
--- a/src/demuxers/demux_vqa.c
+++ b/src/demuxers/demux_vqa.c
@@ -27,7 +27,7 @@
* block needs information from the previous audio block in order to be
* decoded, thus making random seeking difficult.
*
- * $Id: demux_vqa.c,v 1.8 2002/09/24 03:09:09 tmmm Exp $
+ * $Id: demux_vqa.c,v 1.9 2002/10/05 14:39:24 komadori Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -47,10 +47,10 @@
#include "demux.h"
#include "bswap.h"
-#define BE_16(x) (be2me_16(*(unsigned short *)(x)))
-#define BE_32(x) (be2me_32(*(unsigned int *)(x)))
-#define LE_16(x) (le2me_16(*(unsigned short *)(x)))
-#define LE_32(x) (le2me_32(*(unsigned int *)(x)))
+#define BE_16(x) (be2me_16((uint16_t)(x)))
+#define BE_32(x) (be2me_32((uint32_t)(x)))
+#define LE_16(x) (le2me_16((uint16_t)(x)))
+#define LE_32(x) (le2me_32((uint32_t)(x)))
#define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \
( (long)(unsigned char)(ch3) | \
@@ -136,7 +136,7 @@ static void *demux_vqa_loop (void *this_gen) {
}
current_file_pos = this->input->get_current_pos(this->input);
- chunk_size = BE_32(&preamble[4]);
+ chunk_size = BE_32(preamble[4]);
skip_byte = chunk_size & 0x1;
audio_pts = audio_frames;
audio_pts *= 90000;
@@ -182,7 +182,7 @@ static void *demux_vqa_loop (void *this_gen) {
}
current_file_pos = this->input->get_current_pos(this->input);
- chunk_size = BE_32(&preamble[4]);
+ chunk_size = BE_32(preamble[4]);
while (chunk_size) {
buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
buf->type = BUF_VIDEO_VQA;
@@ -261,7 +261,7 @@ static int load_vqa_and_send_headers(demux_vqa_t *this) {
pthread_mutex_unlock(&this->mutex);
return DEMUX_CANNOT_HANDLE;
}
- last_offset = BE_32(&header[0]);
+ last_offset = BE_32(header[0]);
/* get the actual filesize */
this->filesize = this->input->get_length(this->input);
@@ -276,11 +276,11 @@ static int load_vqa_and_send_headers(demux_vqa_t *this) {
}
/* fetch the interesting information */
- this->video_width = LE_16(&header[6]);
- this->video_height = LE_16(&header[8]);
+ this->video_width = LE_16(header[6]);
+ this->video_height = LE_16(header[8]);
this->vector_width = header[10];
this->vector_height = header[11];
- this->audio_sample_rate = LE_16(&header[24]);
+ this->audio_sample_rate = LE_16(header[24]);
this->audio_channels = header[26];
/* skip the FINF chunk */
@@ -290,7 +290,7 @@ static int load_vqa_and_send_headers(demux_vqa_t *this) {
pthread_mutex_unlock(&this->mutex);
return DEMUX_CANNOT_HANDLE;
}
- chunk_size = BE_32(&preamble[4]);
+ chunk_size = BE_32(preamble[4]);
this->input->seek(this->input, chunk_size, SEEK_CUR);
/* load stream information */
@@ -327,8 +327,8 @@ static int demux_vqa_open(demux_plugin_t *this_gen, input_plugin_t *input,
return DEMUX_CANNOT_HANDLE;
/* check for the VQA signatures */
- if ((BE_32(&header[0]) == FORM_TAG) &&
- (BE_32(&header[8]) == WVQA_TAG))
+ if ((BE_32(header[0]) == FORM_TAG) &&
+ (BE_32(header[8]) == WVQA_TAG))
return load_vqa_and_send_headers(this);
return DEMUX_CANNOT_HANDLE;
diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c
index 1e3ab75dd..a9a20e37b 100644
--- a/src/demuxers/demux_wav.c
+++ b/src/demuxers/demux_wav.c
@@ -20,7 +20,7 @@
* MS WAV File Demuxer by Mike Melanson (melanson@pcisys.net)
* based on WAV specs that are available far and wide
*
- * $Id: demux_wav.c,v 1.14 2002/10/03 00:08:47 tmmm Exp $
+ * $Id: demux_wav.c,v 1.15 2002/10/05 14:39:25 komadori Exp $
*
*/
@@ -42,8 +42,8 @@
#include "buffer.h"
#include "bswap.h"
-#define LE_16(x) (le2me_16(*(uint16_t *)(x)))
-#define LE_32(x) (le2me_32(*(uint32_t *)(x)))
+#define LE_16(x) (le2me_16((uint16_t)(x)))
+#define LE_32(x) (le2me_32((uint32_t)(x)))
#define VALID_ENDS "wav"
#define WAV_SIGNATURE_SIZE 16
@@ -219,8 +219,8 @@ static int load_wav_and_send_headers(demux_wav_t *this) {
pthread_mutex_unlock(&this->mutex);
return DEMUX_CANNOT_HANDLE;
}
- chunk_tag = LE_32(&chunk_preamble[0]);
- chunk_size = LE_32(&chunk_preamble[4]);
+ chunk_tag = LE_32(chunk_preamble[0]);
+ chunk_size = 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 29e35d680..4bce47bfe 100644
--- a/src/demuxers/demux_wc3movie.c
+++ b/src/demuxers/demux_wc3movie.c
@@ -22,7 +22,7 @@
* For more information on the MVE file format, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: demux_wc3movie.c,v 1.13 2002/10/02 15:54:52 mroi Exp $
+ * $Id: demux_wc3movie.c,v 1.14 2002/10/05 14:39:25 komadori Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -42,10 +42,10 @@
#include "demux.h"
#include "bswap.h"
-#define BE_16(x) (be2me_16(*(unsigned short *)(x)))
-#define BE_32(x) (be2me_32(*(unsigned int *)(x)))
-#define LE_16(x) (le2me_16(*(unsigned short *)(x)))
-#define LE_32(x) (le2me_32(*(unsigned int *)(x)))
+#define BE_16(x) (be2me_16((uint16_t)(x)))
+#define BE_32(x) (be2me_32((uint32_t)(x)))
+#define LE_16(x) (le2me_16((uint16_t)(x)))
+#define LE_32(x) (le2me_32((uint32_t)(x)))
#define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \
( (long)(unsigned char)(ch3) | \
@@ -185,9 +185,9 @@ static void *demux_mve_loop (void *this_gen) {
PREAMBLE_SIZE)
this->status = DEMUX_FINISHED;
else {
- chunk_tag = BE_32(&preamble[0]);
+ chunk_tag = BE_32(preamble[0]);
/* round up to the nearest even size */
- chunk_size = (BE_32(&preamble[4]) + 1) & (~1);
+ chunk_size = (BE_32(preamble[4]) + 1) & (~1);
if (chunk_tag == BRCH_TAG) {
@@ -216,7 +216,7 @@ static void *demux_mve_loop (void *this_gen) {
this->status = DEMUX_FINISHED;
break;
}
- palette_number = LE_32(&preamble[0]);
+ palette_number = LE_32(preamble[0]);
if (palette_number >= this->number_of_shots) {
xine_log(this->xine, XINE_LOG_MSG,
@@ -375,7 +375,7 @@ static int load_mve_and_send_headers(demux_mve_t *this) {
pthread_mutex_unlock(&this->mutex);
return DEMUX_CANNOT_HANDLE;
}
- this->number_of_shots = LE_32(&preamble[0]);
+ this->number_of_shots = 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));
@@ -398,8 +398,8 @@ static int load_mve_and_send_headers(demux_mve_t *this) {
return DEMUX_CANNOT_HANDLE;
}
- if ((BE_32(&preamble[0]) != PALT_TAG) ||
- (BE_32(&preamble[4]) != PALETTE_CHUNK_SIZE)) {
+ if ((BE_32(preamble[0]) != PALT_TAG) ||
+ (BE_32(preamble[4]) != PALETTE_CHUNK_SIZE)) {
xine_log(this->xine, XINE_LOG_MSG,
_("demux_wc3movie: There was a problem while loading palette chunks\n"));
this->status = DEMUX_FINISHED;
@@ -446,9 +446,9 @@ static int load_mve_and_send_headers(demux_mve_t *this) {
return DEMUX_CANNOT_HANDLE;
}
- chunk_tag = BE_32(&preamble[0]);
+ chunk_tag = BE_32(preamble[0]);
/* round up to the nearest even size */
- chunk_size = (BE_32(&preamble[4]) + 1) & (~1);
+ chunk_size = (BE_32(preamble[4]) + 1) & (~1);
switch (chunk_tag) {
@@ -477,8 +477,8 @@ static int load_mve_and_send_headers(demux_mve_t *this) {
pthread_mutex_unlock(&this->mutex);
return DEMUX_CANNOT_HANDLE;
}
- this->video_width = BE_32(&preamble[0]);
- this->video_height = BE_32(&preamble[4]);
+ this->video_width = BE_32(preamble[0]);
+ this->video_height = BE_32(preamble[4]);
break;
case INDX_TAG:
@@ -537,9 +537,9 @@ static int demux_mve_open(demux_plugin_t *this_gen, input_plugin_t *input,
if (input->read(input, header, 16) != 16)
return DEMUX_CANNOT_HANDLE;
- if ((BE_32(&header[0]) == FORM_TAG) &&
- (BE_32(&header[8]) == MOVE_TAG) &&
- (BE_32(&header[12]) == PC_TAG))
+ if ((BE_32(header[0]) == FORM_TAG) &&
+ (BE_32(header[8]) == MOVE_TAG) &&
+ (BE_32(header[12]) == PC_TAG))
return load_mve_and_send_headers(this);
return DEMUX_CANNOT_HANDLE;
@@ -688,9 +688,9 @@ static int demux_mve_seek (demux_plugin_t *this_gen,
return 1;
}
- chunk_tag = BE_32(&preamble[0]);
+ chunk_tag = BE_32(preamble[0]);
/* round up to the nearest even size */
- chunk_size = (BE_32(&preamble[4]) + 1) & (~1);
+ chunk_size = (BE_32(preamble[4]) + 1) & (~1);
if (chunk_tag == SHOT_TAG) {
this->shot_offsets[0] =
@@ -721,9 +721,9 @@ static int demux_mve_seek (demux_plugin_t *this_gen,
return 1;
}
- chunk_tag = BE_32(&preamble[0]);
+ chunk_tag = BE_32(preamble[0]);
/* round up to the nearest even size */
- chunk_size = (BE_32(&preamble[4]) + 1) & (~1);
+ chunk_size = (BE_32(preamble[4]) + 1) & (~1);
if (chunk_tag == SHOT_TAG) {
this->shot_offsets[i + 1] =