[FFmpeg-cvslog] Always use av_set_pts_info to set the stream time base.

Reimar Döffinger git
Sat Feb 5 10:08:29 CET 2011


ffmpeg | branch: master | Reimar D?ffinger <Reimar.Doeffinger at gmx.de> | Mon Jan 31 20:08:56 2011 +0100| [5603df39df36d9de713732da06fe183b188ec963] | committer: Reimar D?ffinger

Always use av_set_pts_info to set the stream time base.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5603df39df36d9de713732da06fe183b188ec963
---

 libavformat/c93.c              |    2 +-
 libavformat/oggparsedirac.c    |    5 ++---
 libavformat/oggparseflac.c     |    3 +--
 libavformat/oggparseogm.c      |    5 ++---
 libavformat/oggparseskeleton.c |    5 +++--
 libavformat/oggparsespeex.c    |    3 +--
 libavformat/oggparsetheora.c   |    2 +-
 libavformat/oggparsevorbis.c   |    3 +--
 8 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/libavformat/c93.c b/libavformat/c93.c
index dbb2bf3..0c6e4e5 100644
--- a/libavformat/c93.c
+++ b/libavformat/c93.c
@@ -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;
diff --git a/libavformat/oggparsedirac.c b/libavformat/oggparsedirac.c
index a7f0401..b8ce4fe 100644
--- a/libavformat/oggparsedirac.c
+++ b/libavformat/oggparsedirac.c
@@ -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;
 }
 
diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c
index e5034af..a51a855 100644
--- a/libavformat/oggparseflac.c
+++ b/libavformat/oggparseflac.c
@@ -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);
     }
diff --git a/libavformat/oggparseogm.c b/libavformat/oggparseogm.c
index e1d046f..dda5be6 100644
--- a/libavformat/oggparseogm.c
+++ b/libavformat/oggparseogm.c
@@ -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)
diff --git a/libavformat/oggparseskeleton.c b/libavformat/oggparseskeleton.c
index ad0dded..f0e17f9 100644
--- a/libavformat/oggparseskeleton.c
+++ b/libavformat/oggparseskeleton.c
@@ -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;
         }
diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c
index 936b37e..80b2001 100644
--- a/libavformat/oggparsespeex.c
+++ b/libavformat/oggparsespeex.c
@@ -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);
 
diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
index 2299f55..d02781f 100644
--- a/libavformat/oggparsetheora.c
+++ b/libavformat/oggparsetheora.c
@@ -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);
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index 34ae2fc..b915fff 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -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 &&




More information about the ffmpeg-cvslog mailing list