From bb23b9a3a243290b6feabbe8c745fef97a06ea33 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Mon, 7 Apr 2003 18:43:25 +0000 Subject: Fix a bunch of endianness conversions that were done as long instead of int32. Should go into 0.6.1. Original commit message from CVS: Fix a bunch of endianness conversions that were done as long instead of int32. Should go into 0.6.1. --- ext/ivorbis/vorbis.c | 2 +- ext/tarkin/gsttarkin.c | 2 +- gst/mpeg1sys/buffer.c | 8 ++++---- gst/mpeg1videoparse/gstmp1videoparse.c | 6 +++--- gst/mpegaudioparse/gstmpegaudioparse.c | 14 +++++++------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ext/ivorbis/vorbis.c b/ext/ivorbis/vorbis.c index f6014bd8..b543f88f 100644 --- a/ext/ivorbis/vorbis.c +++ b/ext/ivorbis/vorbis.c @@ -85,7 +85,7 @@ static GstTypeDefinition vorbisdefinition = { static GstCaps* vorbis_type_find (GstBuffer *buf, gpointer private) { - gulong head = GULONG_FROM_BE (*((gulong *)GST_BUFFER_DATA (buf))); + guint32 head = GUINT32_FROM_BE (*((guint32 *)GST_BUFFER_DATA (buf))); if (head != 0x4F676753) return NULL; diff --git a/ext/tarkin/gsttarkin.c b/ext/tarkin/gsttarkin.c index 4f3a8141..fdee893a 100644 --- a/ext/tarkin/gsttarkin.c +++ b/ext/tarkin/gsttarkin.c @@ -69,7 +69,7 @@ static GstTypeDefinition tarkindefinition = static GstCaps* tarkin_type_find (GstBuffer *buf, gpointer private) { - gulong head = GULONG_FROM_BE (*((gulong *)GST_BUFFER_DATA (buf))); + guint32 head = GUINT32_FROM_BE (*((guint32 *)GST_BUFFER_DATA (buf))); /* FIXME */ return NULL; diff --git a/gst/mpeg1sys/buffer.c b/gst/mpeg1sys/buffer.c index be4d4f3f..6554f03f 100644 --- a/gst/mpeg1sys/buffer.c +++ b/gst/mpeg1sys/buffer.c @@ -353,7 +353,7 @@ static void mpeg1mux_buffer_update_video_info(Mpeg1MuxBuffer *mb) { static void mpeg1mux_buffer_update_audio_info(Mpeg1MuxBuffer *mb) { guchar *data = mb->buffer; gulong offset = mb->scan_pos; - gulong id=0; + guint32 id=0; guint padding_bit; gst_getbits_t gb; guint startup_delay = 0; @@ -364,9 +364,9 @@ static void mpeg1mux_buffer_update_audio_info(Mpeg1MuxBuffer *mb) { GST_DEBUG (0,"mpeg1mux::update_audio_info %lu %lu", mb->base, mb->scan_pos); if (mb->base == 0 && mb->scan_pos == 0) { - id = GULONG_FROM_BE(*((gulong *)(data))); + id = GUINT32_FROM_BE(*((guint32 *)(data))); - printf("MPEG audio id = %08lx\n", id); + printf("MPEG audio id = %08x\n", (unsigned int)id); if ((id & 0xfff00000) == AUDIO_SYNCWORD<<20) { /* mpegver = (header >> 19) & 0x3; don't need this for bpf */ @@ -442,7 +442,7 @@ static void mpeg1mux_buffer_update_audio_info(Mpeg1MuxBuffer *mb) { } } while (offset < mb->length-4) { - id = GULONG_FROM_BE(*((gulong *)(data+offset))); + id = GUINT32_FROM_BE(*((guint32 *)(data+offset))); /* mpegver = (header >> 19) & 0x3; don't need this for bpf */ layer_index = (id >> 17) & 0x3; diff --git a/gst/mpeg1videoparse/gstmp1videoparse.c b/gst/mpeg1videoparse/gstmp1videoparse.c index b1a2610f..da3e7059 100644 --- a/gst/mpeg1videoparse/gstmp1videoparse.c +++ b/gst/mpeg1videoparse/gstmp1videoparse.c @@ -241,7 +241,7 @@ gst_mp1videoparse_real_chain (Mp1VideoParse *mp1videoparse, GstBuffer *buf, GstP gint sync_state; gboolean have_sync; guchar sync_byte; - gulong head; + guint32 head; gint sync_pos; guint64 time_stamp; GstBuffer *temp; @@ -278,9 +278,9 @@ gst_mp1videoparse_real_chain (Mp1VideoParse *mp1videoparse, GstBuffer *buf, GstP GST_DEBUG (0,"mp1videoparse: received buffer of %ld bytes %" G_GINT64_FORMAT,size, GST_BUFFER_TIMESTAMP(buf)); - head = GULONG_FROM_BE(*((gulong *)data)); + head = GUINT32_FROM_BE(*((guint32 *)data)); - GST_DEBUG (0,"mp1videoparse: head is %08lx", head); + GST_DEBUG (0,"mp1videoparse: head is %08x", (unsigned int)head); if (!mp1videoparse_valid_sync(head) || mp1videoparse->need_resync) { sync_pos = mp1videoparse_find_next_gop(mp1videoparse, mp1videoparse->partialbuf); diff --git a/gst/mpegaudioparse/gstmpegaudioparse.c b/gst/mpegaudioparse/gstmpegaudioparse.c index f78415f1..4d0cf3a4 100644 --- a/gst/mpegaudioparse/gstmpegaudioparse.c +++ b/gst/mpegaudioparse/gstmpegaudioparse.c @@ -202,7 +202,7 @@ fprintf(stderr, "have buffer of %d bytes\n",size); while (offset < (size - 4)) { start = gst_mp3parse_next_header (data,size,offset); fprintf(stderr, "skipped %d bytes searching for the next header\n",start-offset); - header = GULONG_FROM_BE(*((guint32 *)(data+start))); + header = GUINT32_FROM_BE(*((guint32 *)(data+start))); fprintf(stderr, "header is 0x%08x\n",header); /* figure out how big the frame is supposed to be */ @@ -231,7 +231,7 @@ gst_mp3parse_chain (GstPad *pad, GstBuffer *buf) GstMPEGAudioParse *mp3parse; guchar *data; glong size,offset = 0; - unsigned long header; + guint32 header; int bpf; GstBuffer *outbuf; guint64 last_ts; @@ -282,7 +282,7 @@ gst_mp3parse_chain (GstPad *pad, GstBuffer *buf) GST_DEBUG (0,"mp3parse: **** now at %ld skipped %d bytes",offset,skipped); } /* construct the header word */ - header = GULONG_FROM_BE(*((gulong *)(data+offset))); + header = GUINT32_FROM_BE(*((guint32 *)(data+offset))); /* if it's a valid header, go ahead and send off the frame */ if (head_check(header)) { /* calculate the bpf of the frame */ @@ -301,17 +301,17 @@ gst_mp3parse_chain (GstPad *pad, GstBuffer *buf) * the frames are not independently coded. ********************************************************************************/ if ( mp3parse->in_flush ) { - unsigned long header2; + guint32 header2; if ((size-offset)<(bpf+4)) { if (mp3parse->in_flush) break; } /* wait until we have the the entire current frame as well as the next frame header */ - header2 = GULONG_FROM_BE(*((gulong *)(data+offset+bpf))); - GST_DEBUG(0,"mp3parse: header=%08lX, header2=%08lX, bpf=%d", header, header2, bpf ); + header2 = GUINT32_FROM_BE(*((guint32 *)(data+offset+bpf))); + GST_DEBUG(0,"mp3parse: header=%08X, header2=%08X, bpf=%d", (unsigned int)header, (unsigned int)header2, bpf ); #define HDRMASK ~( (0xF<<12)/*bitrate*/ | (1<<9)/*padding*/ | (3<<4)/*mode extension*/ ) /* mask the bits which are allowed to differ between frames */ if ( (header2&HDRMASK) != (header&HDRMASK) ) { /* require 2 matching headers in a row */ - GST_DEBUG(0,"mp3parse: next header doesn't match (header=%08lX, header2=%08lX, bpf=%d)", header, header2, bpf ); + GST_DEBUG(0,"mp3parse: next header doesn't match (header=%08X, header2=%08X, bpf=%d)", (unsigned int)header, (unsigned int)header2, bpf ); offset++; /* This frame is invalid. Start looking for a valid frame at the next position in the stream */ continue; } -- cgit v1.2.1