[MPlayer-users] DVD lengths reported as 0 in pre6
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Jan 9 20:24:50 CET 2005
Hi,
On Sun, Jan 09, 2005 at 11:38:33AM -0600, Ben Nemec wrote:
> Hmm, tried it and got the following error when compiling. Did I mess up?
Ok, next try. I actually tested this one ;-)
I can't promise it will fix the problem as I have no samples that show
the problem...
Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpdemux/demux_asf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_asf.c,v
retrieving revision 1.30
diff -d -u -r1.30 demux_asf.c
--- libmpdemux/demux_asf.c 11 Sep 2004 09:40:34 -0000 1.30
+++ libmpdemux/demux_asf.c 9 Jan 2005 10:03:07 -0000
@@ -423,11 +423,7 @@
return DEMUXER_CTRL_OK;
case DEMUXER_CTRL_GET_PERCENT_POS:
- if (demuxer->movi_end==demuxer->movi_start) {
return DEMUXER_CTRL_DONTKNOW;
- }
- *((int *)arg)=(int)((demuxer->filepos-demuxer->movi_start)/((demuxer->movi_end-demuxer->movi_start)/100));
- return DEMUXER_CTRL_OK;
default:
return DEMUXER_CTRL_NOTIMPL;
Index: libmpdemux/demux_avi.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_avi.c,v
retrieving revision 1.61
diff -d -u -r1.61 demux_avi.c
--- libmpdemux/demux_avi.c 17 Mar 2004 14:50:36 -0000 1.61
+++ libmpdemux/demux_avi.c 9 Jan 2005 10:03:11 -0000
@@ -846,9 +846,7 @@
case DEMUXER_CTRL_GET_PERCENT_POS:
if (!priv->numberofframes) {
- if (demuxer->movi_end==demuxer->movi_start) return DEMUXER_CTRL_DONTKNOW;
- *((int *)arg)=(int)((demuxer->filepos-demuxer->movi_start)/((demuxer->movi_end-demuxer->movi_start)/100));
- return DEMUXER_CTRL_OK;
+ return DEMUXER_CTRL_DONTKNOW;
}
*((int *)arg)=(int)(priv->video_pack_no*100/priv->numberofframes);
if (sh_video->video.dwLength<=1) return DEMUXER_CTRL_GUESS;
Index: libmpdemux/demux_mkv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mkv.c,v
retrieving revision 1.30
diff -d -u -r1.30 demux_mkv.c
--- libmpdemux/demux_mkv.c 28 Nov 2004 21:08:46 -0000 1.30
+++ libmpdemux/demux_mkv.c 9 Jan 2005 10:03:23 -0000
@@ -3314,12 +3314,7 @@
case DEMUXER_CTRL_GET_PERCENT_POS:
if (mkv_d->duration == 0)
{
- if (demuxer->movi_start == demuxer->movi_end)
return DEMUXER_CTRL_DONTKNOW;
-
- *((int *)arg) = (int)((demuxer->filepos - demuxer->movi_start) /
- ((demuxer->movi_end-demuxer->movi_start)/100));
- return DEMUXER_CTRL_OK;
}
*((int *) arg) = (int) (100 * mkv_d->last_pts / mkv_d->duration);
Index: libmpdemux/demux_mpg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mpg.c,v
retrieving revision 1.53
diff -d -u -r1.53 demux_mpg.c
--- libmpdemux/demux_mpg.c 8 Jan 2005 10:05:44 -0000 1.53
+++ libmpdemux/demux_mpg.c 9 Jan 2005 10:03:31 -0000
@@ -520,20 +520,14 @@
*((unsigned long *)arg)=(long)mpg_d->final_pts;
return DEMUXER_CTRL_GUESS;
}
- if(!sh_video || !sh_video->i_bps) // unspecified or VBR
return DEMUXER_CTRL_DONTKNOW;
- *((unsigned long *)arg)=(demuxer->movi_end-demuxer->movi_start)/sh_video->i_bps;
- return DEMUXER_CTRL_GUESS;
case DEMUXER_CTRL_GET_PERCENT_POS:
- if (demuxer->movi_end==demuxer->movi_start)
- return DEMUXER_CTRL_DONTKNOW;
if (mpg_d && mpg_d->has_valid_timestamps && mpg_d->final_pts > 0.0) {
*((int *)arg)=(int)(100 * mpg_d->last_pts / mpg_d->final_pts);
return DEMUXER_CTRL_OK;
}
- *((int *)arg)=(int)((demuxer->filepos-demuxer->movi_start)/((demuxer->movi_end-demuxer->movi_start)/100));
- return DEMUXER_CTRL_OK;
+ return DEMUXER_CTRL_DONTKNOW;
default:
return DEMUXER_CTRL_NOTIMPL;
Index: libmpdemux/demux_ty.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_ty.c,v
retrieving revision 1.3
diff -d -u -r1.3 demux_ty.c
--- libmpdemux/demux_ty.c 19 Jul 2004 23:17:37 -0000 1.3
+++ libmpdemux/demux_ty.c 9 Jan 2005 10:03:54 -0000
@@ -1027,12 +1027,7 @@
return DEMUXER_CTRL_GUESS;
case DEMUXER_CTRL_GET_PERCENT_POS:
- if (demuxer->movi_end==demuxer->movi_start)
return DEMUXER_CTRL_DONTKNOW;
- *((int *)arg)=
- (int)((demuxer->filepos-demuxer->movi_start)/
- ((demuxer->movi_end-demuxer->movi_start)/100));
- return DEMUXER_CTRL_OK;
default:
return DEMUXER_CTRL_NOTIMPL;
}
Index: libmpdemux/demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.180
diff -d -u -r1.180 demuxer.c
--- libmpdemux/demuxer.c 29 Dec 2004 19:51:56 -0000 1.180
+++ libmpdemux/demuxer.c 9 Jan 2005 10:04:04 -0000
@@ -1717,7 +1717,12 @@
unsigned long demuxer_get_time_length(demuxer_t *demuxer){
unsigned long get_time_ans;
+ sh_video_t *sh_video = demuxer->video->sh;
+ // <= 0 means DEMUXER_CTRL_NOTIMPL or DEMUXER_CTRL_DONTKNOW
if (demux_control(demuxer, DEMUXER_CTRL_GET_TIME_LENGTH,(void *)&get_time_ans)<=0) {
+ if (sh_video && sh_video->i_bps)
+ get_time_ans = (demuxer->movi_end-demuxer->movi_start)/sh_video->i_bps;
+ else
get_time_ans=0;
}
return get_time_ans;
@@ -1727,9 +1731,14 @@
int ans = 0;
int res = demux_control(demuxer, DEMUXER_CTRL_GET_PERCENT_POS, &ans);
int len = (demuxer->movi_end - demuxer->movi_start) / 100;
- if (res == DEMUXER_CTRL_NOTIMPL && len > 0)
+ if (res <= 0) {
+ if (len > 0)
ans = (demuxer->filepos - demuxer->movi_start) / len;
- if (ans>100 || ans<0) ans=0;
+ else
+ ans = 0;
+ }
+ if (ans < 0) ans = 0;
+ if (ans > 100) ans = 100;
return ans;
}
More information about the MPlayer-users
mailing list