summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThibaut Mattern <tmattern@users.sourceforge.net>2004-03-08 23:54:39 +0000
committerThibaut Mattern <tmattern@users.sourceforge.net>2004-03-08 23:54:39 +0000
commita4940f08b672530a217518d1fbcea4c2ea2428db (patch)
tree779ba7d10f496d1c6e58c9805be8cb7f8f311024 /src
parent4dbf2ce2355be911aafc6230382dc3b93952a98b (diff)
downloadxine-lib-a4940f08b672530a217518d1fbcea4c2ea2428db.tar.gz
xine-lib-a4940f08b672530a217518d1fbcea4c2ea2428db.tar.bz2
Fix the framerate estimation.
Mike: the revolver rotation is perfect now ;-) CVS patchset: 6236 CVS date: 2004/03/08 23:54:39
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_asf.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c
index 959a1f281..ed7fa233b 100644
--- a/src/demuxers/demux_asf.c
+++ b/src/demuxers/demux_asf.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_asf.c,v 1.149 2004/03/07 20:02:40 tmattern Exp $
+ * $Id: demux_asf.c,v 1.150 2004/03/08 23:54:39 tmattern Exp $
*
* demultiplexer for asf streams
*
@@ -143,6 +143,7 @@ typedef struct demux_asf_s {
int32_t frame_duration;
int send_newpts;
int64_t last_frame_pts;
+ int last_frame_cpt;
/* only for reading */
uint32_t packet_padsize;
@@ -741,8 +742,7 @@ static void check_newpts (demux_asf_t *this, int64_t pts, int video, int frame_e
}
}
#endif
-
- if (pts && (this->send_newpts || (this->last_pts[video] && abs(diff)>WRAP_THRESHOLD)) ) {
+ if (pts && (this->send_newpts || (this->last_pts[video] && abs(diff) > WRAP_THRESHOLD))) {
lprintf ("sending newpts %lld (video = %d diff = %lld)\n", pts, video, diff);
@@ -753,8 +753,10 @@ static void check_newpts (demux_asf_t *this, int64_t pts, int video, int frame_e
_x_demux_control_newpts(this->stream, pts, 0);
}
- this->send_newpts = 0;
- this->last_pts[1-video] = 0;
+ this->send_newpts = 0;
+ this->last_pts[1 - video] = 0;
+ this->last_frame_pts = 0;
+ this->last_frame_cpt = 0;
}
if (pts)
@@ -767,20 +769,19 @@ static void check_newpts (demux_asf_t *this, int64_t pts, int video, int frame_e
if (this->last_frame_pts) {
- diff = pts - this->last_frame_pts;
-
- if ( (diff>0) && (diff < MAX_FRAME_DUR) ) {
- lprintf ("last_frame_pts = %8lld, diff=%8lld\n",
- this->last_frame_pts, diff);
+ diff = (pts - this->last_frame_pts) / this->last_frame_cpt;
- this->frame_duration = (15*this->frame_duration + diff) / 16;
-
- lprintf ("frame_duration is %d\n", this->frame_duration);
+ if ( (diff > 0) && (diff < MAX_FRAME_DUR) ) {
+ lprintf ("last_frame_pts = %8lld, diff=%8lld\n",
+ this->last_frame_pts, diff);
+ this->frame_duration = (9 * this->frame_duration + diff) / 10;
+ this->last_frame_cpt = 0;
}
}
-
this->last_frame_pts = pts;
}
+ if (video && frame_end)
+ this->last_frame_cpt++;
}