gst/avi/gstavidemux.c: The index reading was broken. The rest worked fine, but the whole goal of my rewrite was to ma...

Original commit message from CVS:
2004-01-25  Ronald Bultje  <rbultje@ronald.bitfreak.net>

* gst/avi/gstavidemux.c: (gst_avi_demux_stream_avih),
(gst_avi_demux_stream_odml), (gst_avi_demux_stream_index):
The index reading was broken. The rest worked fine, but the whole
goal of my rewrite was to make avidemux readable, and this was
not at all readable. Please use typed variables.
This commit is contained in:
Ronald S. Bultje 2004-01-25 00:43:16 +00:00
parent 9e67f9a283
commit 2c82da7073
2 changed files with 33 additions and 26 deletions

View file

@ -1,3 +1,11 @@
2004-01-25 Ronald Bultje <rbultje@ronald.bitfreak.net>
* gst/avi/gstavidemux.c: (gst_avi_demux_stream_avih),
(gst_avi_demux_stream_odml), (gst_avi_demux_stream_index):
The index reading was broken. The rest worked fine, but the whole
goal of my rewrite was to make avidemux readable, and this was
not at all readable. Please use typed variables.
2004-01-25 Ronald Bultje <rbultje@ronald.bitfreak.net> 2004-01-25 Ronald Bultje <rbultje@ronald.bitfreak.net>
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_info): * gst-libs/gst/riff/riff-read.c: (gst_riff_read_info):

View file

@ -705,8 +705,7 @@ gst_avi_demux_stream_avih (GstAviDemux *avi,
GstRiffRead *riff = GST_RIFF_READ (avi); GstRiffRead *riff = GST_RIFF_READ (avi);
guint32 tag; guint32 tag;
GstBuffer *buf; GstBuffer *buf;
gst_riff_avih avih; gst_riff_avih avih, *_avih;
guint32 *data;
if (!gst_riff_read_data (riff, &tag, &buf)) if (!gst_riff_read_data (riff, &tag, &buf))
return FALSE; return FALSE;
@ -723,21 +722,21 @@ gst_avi_demux_stream_avih (GstAviDemux *avi,
return FALSE; return FALSE;
} }
data = (guint32 *) GST_BUFFER_DATA (buf); _avih = (gst_riff_avih *) GST_BUFFER_DATA (buf);
avih.us_frame = GUINT32_FROM_LE (*data); data++; avih.us_frame = GUINT32_FROM_LE (_avih->us_frame);
avih.max_bps = GUINT32_FROM_LE (*data); data++; avih.max_bps = GUINT32_FROM_LE (_avih->max_bps);
avih.pad_gran = GUINT32_FROM_LE (*data); data++; avih.pad_gran = GUINT32_FROM_LE (_avih->pad_gran);
avih.flags = GUINT32_FROM_LE (*data); data++; avih.flags = GUINT32_FROM_LE (_avih->flags);
avih.tot_frames = GUINT32_FROM_LE (*data); data++; avih.tot_frames = GUINT32_FROM_LE (_avih->tot_frames);
avih.init_frames = GUINT32_FROM_LE (*data); data++; avih.init_frames = GUINT32_FROM_LE (_avih->init_frames);
avih.streams = GUINT32_FROM_LE (*data); data++; avih.streams = GUINT32_FROM_LE (_avih->streams);
avih.bufsize = GUINT32_FROM_LE (*data); data++; avih.bufsize = GUINT32_FROM_LE (_avih->bufsize);
avih.width = GUINT32_FROM_LE (*data); data++; avih.width = GUINT32_FROM_LE (_avih->width);
avih.height = GUINT32_FROM_LE (*data); data++; avih.height = GUINT32_FROM_LE (_avih->height);
avih.scale = GUINT32_FROM_LE (*data); data++; avih.scale = GUINT32_FROM_LE (_avih->scale);
avih.rate = GUINT32_FROM_LE (*data); data++; avih.rate = GUINT32_FROM_LE (_avih->rate);
avih.start = GUINT32_FROM_LE (*data); data++; avih.start = GUINT32_FROM_LE (_avih->start);
avih.length = GUINT32_FROM_LE (*data); data++; avih.length = GUINT32_FROM_LE (_avih->length);
/* debug stuff */ /* debug stuff */
GST_INFO ("avih tag found:"); GST_INFO ("avih tag found:");
@ -958,7 +957,7 @@ gst_avi_demux_stream_odml (GstAviDemux *avi)
switch (tag) { switch (tag) {
case GST_RIFF_TAG_dmlh: { case GST_RIFF_TAG_dmlh: {
gst_riff_dmlh dmlh; gst_riff_dmlh dmlh, *_dmlh;
GstBuffer *buf; GstBuffer *buf;
if (!gst_riff_read_data (riff, &tag, &buf)) if (!gst_riff_read_data (riff, &tag, &buf))
@ -969,7 +968,8 @@ gst_avi_demux_stream_odml (GstAviDemux *avi)
gst_buffer_unref (buf); gst_buffer_unref (buf);
break; break;
} }
dmlh.totalframes = GUINT32_FROM_LE (*((guint32 *) GST_BUFFER_DATA (buf))); _dmlh = (gst_riff_dmlh *) GST_BUFFER_DATA (buf);
dmlh.totalframes = GUINT32_FROM_LE (_dmlh->totalframes);
GST_INFO ("dmlh tag found:"); GST_INFO ("dmlh tag found:");
GST_INFO (" totalframes: %u", dmlh.totalframes); GST_INFO (" totalframes: %u", dmlh.totalframes);
@ -1048,18 +1048,17 @@ gst_avi_demux_stream_index (GstAviDemux *avi)
GST_INFO ("%u index entries", avi->index_size); GST_INFO ("%u index entries", avi->index_size);
for (i = 0; i < avi->index_size; i++) { for (i = 0; i < avi->index_size; i++) {
gst_riff_index_entry entry; gst_riff_index_entry entry, *_entry;
avi_stream_context *stream; avi_stream_context *stream;
gint stream_nr; gint stream_nr;
gst_avi_index_entry *target; gst_avi_index_entry *target;
GstFormat format; GstFormat format;
guint32 *data;
data = &((guint32 *) GST_BUFFER_DATA (buf))[i * 4]; _entry = &((gst_riff_index_entry *) GST_BUFFER_DATA (buf))[i];
entry.id = GUINT32_FROM_LE (data); entry.id = GUINT32_FROM_LE (_entry->id);
entry.offset = GUINT32_FROM_LE (data + 1); entry.offset = GUINT32_FROM_LE (_entry->offset);
entry.flags = GUINT32_FROM_LE (data + 2); entry.flags = GUINT32_FROM_LE (_entry->flags);
entry.size = GUINT32_FROM_LE (data + 3); entry.size = GUINT32_FROM_LE (_entry->size);
target = &avi->index_entries[i]; target = &avi->index_entries[i];
stream_nr = CHUNKID_TO_STREAMNR (entry.id); stream_nr = CHUNKID_TO_STREAMNR (entry.id);