* fix for integer overflow
authorRoman Shaposhnik <roman@shaposhnik.org>
Mon, 22 Sep 2003 18:17:45 +0000 (18:17 +0000)
committerRoman Shaposhnik <roman@shaposhnik.org>
Mon, 22 Sep 2003 18:17:45 +0000 (18:17 +0000)
Originally committed as revision 2297 to svn://svn.ffmpeg.org/ffmpeg/trunk

ffmpeg.c

index 34958ab..9784b52 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1125,11 +1125,11 @@ static int av_encode(AVFormatContext **output_files,
             switch (ist->st->codec.codec_type) {
             case CODEC_TYPE_AUDIO:
                 av_frac_init(&ist->next_pts, 
-                             0, 0, is->pts_num * ist->st->codec.sample_rate);
+                             0, 0, (uint64_t)is->pts_num * ist->st->codec.sample_rate);
                 break;
             case CODEC_TYPE_VIDEO:
                 av_frac_init(&ist->next_pts, 
-                             0, 0, is->pts_num * ist->st->codec.frame_rate);
+                             0, 0, (uint64_t)is->pts_num * ist->st->codec.frame_rate);
                 break;
             default:
                 break;
@@ -1275,7 +1275,7 @@ static int av_encode(AVFormatContext **output_files,
                     }
                     data_buf = (uint8_t *)samples;
                    av_frac_add(&ist->next_pts, 
-                               is->pts_den * data_size / (2 * ist->st->codec.channels));
+                               (uint64_t)is->pts_den * data_size / (2 * ist->st->codec.channels));
                     break;
                 case CODEC_TYPE_VIDEO:
                     {
@@ -1300,7 +1300,7 @@ static int av_encode(AVFormatContext **output_files,
                             continue;
                         }
                         av_frac_add(&ist->next_pts, 
-                                   is->pts_den * ist->st->codec.frame_rate_base);          
+                                   (uint64_t)is->pts_den * ist->st->codec.frame_rate_base);          
                     }
                     break;
                 default: