From: Wim T. <wt...@us...> - 2002-09-23 20:05:18
|
CVS Root: /cvsroot/gstreamer Module: gst-plugins Changes by: wtay Date: Mon Sep 23 2002 13:05:17 PDT Log message: Fix various overflow cases, this should fix seeking on very large files. Modified files: gst/avi : gstavidemux.c gstavidemux.h Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/avi/gstavidemux.c.diff?r1=1.44&r2=1.45 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/avi/gstavidemux.h.diff?r1=1.9&r2=1.10 ====Begin Diffs==== Index: gstavidemux.c =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/gst/avi/gstavidemux.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- gstavidemux.c 18 Sep 2002 19:02:31 -0000 1.44 +++ gstavidemux.c 23 Sep 2002 20:05:04 -0000 1.45 @@ -839,19 +839,10 @@ } break; 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: switch (*dest_format) { 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; default: res = FALSE; @@ -892,7 +883,7 @@ *format = GST_FORMAT_TIME; /* fall through */ 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; case GST_FORMAT_BYTES: if (stream->strh.type == GST_RIFF_FCC_auds) { @@ -921,10 +912,10 @@ /* fall through */ case GST_FORMAT_TIME: 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 { - *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; case GST_FORMAT_BYTES: Index: gstavidemux.h =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/gst/avi/gstavidemux.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- gstavidemux.h 18 Jun 2002 19:17:04 -0000 1.9 +++ gstavidemux.h 23 Sep 2002 20:05:04 -0000 1.10 @@ -76,7 +76,7 @@ guint32 av_bps; guint64 total_bytes; - gint32 total_frames; + guint32 total_frames; guint32 skip; |