]> git.sesse.net Git - ffmpeg/commitdiff
Always use av_set_pts_info to set the stream time base.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Mon, 31 Jan 2011 19:08:56 +0000 (20:08 +0100)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sat, 5 Feb 2011 08:55:53 +0000 (09:55 +0100)
libavformat/c93.c
libavformat/oggparsedirac.c
libavformat/oggparseflac.c
libavformat/oggparseogm.c
libavformat/oggparseskeleton.c
libavformat/oggparsespeex.c
libavformat/oggparsetheora.c
libavformat/oggparsevorbis.c

index dbb2bf389ec8f6b2d24bee73216576b333a6c8ab..0c6e4e5f5148f153eab39f54e04e3bda5da5a71c 100644 (file)
@@ -89,7 +89,7 @@ static int read_header(AVFormatContext *s,
     video->codec->height = 192;
     /* 4:3 320x200 with 8 empty lines */
     video->sample_aspect_ratio = (AVRational) { 5, 6 };
-    video->time_base = (AVRational) { 2, 25 };
+    av_set_pts_info(video, 64, 2, 25);
     video->nb_frames = framecount;
     video->duration = framecount;
     video->start_time = 0;
index a7f0401f29aed72ab79a9cfb8ce66f5ff0f798d1..b8ce4fe2918f8cad80a771f3b688055708856d1b 100644 (file)
@@ -42,7 +42,7 @@ static int dirac_header(AVFormatContext *s, int idx)
     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     st->codec->codec_id = CODEC_ID_DIRAC;
     // dirac in ogg always stores timestamps as though the video were interlaced
-    st->time_base = (AVRational){st->codec->time_base.num, 2*st->codec->time_base.den};
+    av_set_pts_info(st, 64, st->codec->time_base.num, 2*st->codec->time_base.den);
     return 1;
 }
 
@@ -79,8 +79,7 @@ static int old_dirac_header(AVFormatContext *s, int idx)
 
     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
     st->codec->codec_id = CODEC_ID_DIRAC;
-    st->time_base.den = AV_RB32(buf+8);
-    st->time_base.num = AV_RB32(buf+12);
+    av_set_pts_info(st, 64, AV_RB32(buf+12), AV_RB32(buf+8));
     return 1;
 }
 
index e5034af3a033c0ed51aa26e5c160250b6b4431df..a51a85545c043a538e462c7152db9ac0ac19a7e6 100644 (file)
@@ -65,8 +65,7 @@ flac_header (AVFormatContext * s, int idx)
         memcpy(st->codec->extradata, streaminfo_start, FLAC_STREAMINFO_SIZE);
         st->codec->extradata_size = FLAC_STREAMINFO_SIZE;
 
-        st->time_base.num = 1;
-        st->time_base.den = st->codec->sample_rate;
+        av_set_pts_info(st, 64, 1, st->codec->sample_rate);
     } else if (mdt == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
         ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 4, os->psize - 4);
     }
index e1d046f28ff4cea9c2d0904bfbba8f9a16827e23..dda5be601a4ab52008d11e1a4d8d134392768260 100644 (file)
@@ -83,14 +83,13 @@ ogm_header(AVFormatContext *s, int idx)
             st->codec->height = bytestream_get_le32(&p);
             st->codec->time_base.den = spu * 10000000;
             st->codec->time_base.num = time_unit;
-            st->time_base = st->codec->time_base;
+            av_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
         } else {
             st->codec->channels = bytestream_get_le16(&p);
             p += 2;                 /* block_align */
             st->codec->bit_rate = bytestream_get_le32(&p) * 8;
             st->codec->sample_rate = spu * 10000000 / time_unit;
-            st->time_base.num = 1;
-            st->time_base.den = st->codec->sample_rate;
+            av_set_pts_info(st, 64, 1, st->codec->sample_rate);
         }
     } else if (*p == 3) {
         if (os->psize > 8)
index ad0dded0d7cb1a1f474ae32d38cd8890ec60c9ca..f0e17f9cf59f21e5e2d6830a84b3083b60bdd4ec 100644 (file)
@@ -60,8 +60,9 @@ static int skeleton_header(AVFormatContext *s, int idx)
         start_den = AV_RL64(buf+20);
 
         if (start_den) {
-            av_reduce(&start_time, &st->time_base.den, start_num, start_den, INT_MAX);
-            st->time_base.num = 1;
+            int64_t base_den;
+            av_reduce(&start_time, &base_den, start_num, start_den, INT_MAX);
+            av_set_pts_info(st, 64, 1, base_den);
             os->lastpts =
             st->start_time = start_time;
         }
index 936b37e952e50478c331f6d1ccf67981b4cb957a..80b2001ddf55dd27b7d30ffb592a8028dca75ccb 100644 (file)
@@ -72,8 +72,7 @@ static int speex_header(AVFormatContext *s, int idx) {
                                          + FF_INPUT_BUFFER_PADDING_SIZE);
         memcpy(st->codec->extradata, p, st->codec->extradata_size);
 
-        st->time_base.num = 1;
-        st->time_base.den = st->codec->sample_rate;
+        av_set_pts_info(st, 64, 1, st->codec->sample_rate);
     } else
         ff_vorbis_comment(s, &st->metadata, p, os->psize);
 
index 2299f5507c1b11f505b633e9acf54f463193e3b7..d02781f2fa3a37e3a6142c0dd787ad28ab2bba1e 100644 (file)
@@ -91,7 +91,7 @@ theora_header (AVFormatContext * s, int idx)
             st->codec->time_base.num = 1;
             st->codec->time_base.den = 25;
         }
-        st->time_base = st->codec->time_base;
+        av_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
 
         st->sample_aspect_ratio.num = get_bits_long(&gb, 24);
         st->sample_aspect_ratio.den = get_bits_long(&gb, 24);
index 34ae2fc4f0a1d355d05bee7dea11a45018fa89d8..b915fffb03bd33953c49bdc961d2802cabdb1238 100644 (file)
@@ -252,8 +252,7 @@ vorbis_header (AVFormatContext * s, int idx)
 
         if (srate > 0) {
             st->codec->sample_rate = srate;
-            st->time_base.num = 1;
-            st->time_base.den = srate;
+            av_set_pts_info(st, 64, 1, srate);
         }
     } else if (os->buf[os->pstart] == 3) {
         if (os->psize > 8 &&