Fix various overflow cases, this should fix seeking on very large files.

Original commit message from CVS:
Fix various overflow cases, this should fix seeking on very large
files.
This commit is contained in:
Wim Taymans 2002-09-23 20:05:04 +00:00
parent e8d014fc2a
commit ef399ccaf4
2 changed files with 5 additions and 14 deletions

View file

@ -839,19 +839,10 @@ gst_avi_demux_src_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
} }
break; break;
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
switch (*dest_format) {
case GST_FORMAT_TIME:
*dest_value = src_value * GST_SECOND * stream->strh.scale / stream->strh.rate;
break;
default:
res = FALSE;
break;
}
break;
case GST_FORMAT_UNITS: case GST_FORMAT_UNITS:
switch (*dest_format) { switch (*dest_format) {
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
*dest_value = src_value * GST_SECOND * stream->strh.scale / stream->strh.rate; *dest_value = ((((gfloat)src_value) * stream->strh.scale) / stream->strh.rate) * GST_SECOND;
break; break;
default: default:
res = FALSE; res = FALSE;
@ -892,7 +883,7 @@ gst_avi_demux_handle_src_query (GstPad *pad, GstPadQueryType type,
*format = GST_FORMAT_TIME; *format = GST_FORMAT_TIME;
/* fall through */ /* fall through */
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
*value = GST_SECOND * stream->strh.scale * stream->strh.length / stream->strh.rate; *value = (((gfloat)stream->strh.scale) * stream->strh.length / stream->strh.rate) * GST_SECOND;
break; break;
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
if (stream->strh.type == GST_RIFF_FCC_auds) { if (stream->strh.type == GST_RIFF_FCC_auds) {
@ -921,10 +912,10 @@ gst_avi_demux_handle_src_query (GstPad *pad, GstPadQueryType type,
/* fall through */ /* fall through */
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
if (stream->strh.samplesize) { if (stream->strh.samplesize) {
*value = stream->current_byte * GST_SECOND * stream->strh.scale / stream->strh.rate; *value = (((gfloat)stream->current_byte) * stream->strh.scale / stream->strh.rate) * GST_SECOND;
} }
else { else {
*value = stream->current_frame * GST_SECOND * stream->strh.scale / stream->strh.rate; *value = (((gfloat)stream->current_frame) * stream->strh.scale / stream->strh.rate) * GST_SECOND;
} }
break; break;
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:

View file

@ -76,7 +76,7 @@ typedef struct
guint32 av_bps; guint32 av_bps;
guint64 total_bytes; guint64 total_bytes;
gint32 total_frames; guint32 total_frames;
guint32 skip; guint32 skip;