mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
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.
This commit is contained in:
parent
6b32ca5b1a
commit
bb23b9a3a2
5 changed files with 16 additions and 16 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue