diff options
author | ods15 <ods15@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-09-02 08:32:32 +0000 |
---|---|---|
committer | ods15 <ods15@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-09-02 08:32:32 +0000 |
commit | d620029e4b448882df613813c1f718e5a36973fd (patch) | |
tree | 35a5ebed18591f65ef9f6561d31f73ccb1c4fffa /libmpdemux | |
parent | 43844d090c5580b71228c7a13efa7ce13b37cab8 (diff) |
Make -identify's 'ID_LENGTH=' print a float and not an integer.. The
accuracey may be totally fake for some demuxers (mpg), but accurate for
others.. (avi)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16347 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/demux_asf.c | 2 | ||||
-rw-r--r-- | libmpdemux/demux_audio.c | 2 | ||||
-rw-r--r-- | libmpdemux/demux_avi.c | 2 | ||||
-rw-r--r-- | libmpdemux/demux_avs.c | 2 | ||||
-rw-r--r-- | libmpdemux/demux_lavf.c | 2 | ||||
-rw-r--r-- | libmpdemux/demux_mkv.c | 2 | ||||
-rw-r--r-- | libmpdemux/demux_mov.c | 2 | ||||
-rw-r--r-- | libmpdemux/demux_mpg.c | 2 | ||||
-rw-r--r-- | libmpdemux/demux_ogg.c | 2 | ||||
-rw-r--r-- | libmpdemux/demux_rawdv.c | 2 | ||||
-rw-r--r-- | libmpdemux/demux_real.c | 2 | ||||
-rw-r--r-- | libmpdemux/demux_ty.c | 4 | ||||
-rw-r--r-- | libmpdemux/demux_xmms.c | 2 | ||||
-rw-r--r-- | libmpdemux/demuxer.c | 6 | ||||
-rw-r--r-- | libmpdemux/demuxer.h | 2 |
15 files changed, 18 insertions, 18 deletions
diff --git a/libmpdemux/demux_asf.c b/libmpdemux/demux_asf.c index 48408dd2d4..dc8783aab5 100644 --- a/libmpdemux/demux_asf.c +++ b/libmpdemux/demux_asf.c @@ -422,7 +422,7 @@ static int demux_asf_control(demuxer_t *demuxer,int cmd, void *arg){ */ switch(cmd) { case DEMUXER_CTRL_GET_TIME_LENGTH: - *((unsigned long *)arg)=(unsigned long)(asf_movielength); + *((double *)arg)=(double)(asf_movielength); return DEMUXER_CTRL_OK; case DEMUXER_CTRL_GET_PERCENT_POS: diff --git a/libmpdemux/demux_audio.c b/libmpdemux/demux_audio.c index 3b0ec6c5ad..b747e5e1ec 100644 --- a/libmpdemux/demux_audio.c +++ b/libmpdemux/demux_audio.c @@ -543,7 +543,7 @@ static int demux_audio_control(demuxer_t *demuxer,int cmd, void *arg){ switch(cmd) { case DEMUXER_CTRL_GET_TIME_LENGTH: if (audio_length<=0) return DEMUXER_CTRL_DONTKNOW; - *((unsigned long *)arg)=(unsigned long)audio_length; + *((double *)arg)=(double)audio_length; return DEMUXER_CTRL_GUESS; case DEMUXER_CTRL_GET_PERCENT_POS: diff --git a/libmpdemux/demux_avi.c b/libmpdemux/demux_avi.c index 2c93fc2ddb..44d49a40de 100644 --- a/libmpdemux/demux_avi.c +++ b/libmpdemux/demux_avi.c @@ -850,7 +850,7 @@ static int demux_avi_control(demuxer_t *demuxer,int cmd, void *arg){ switch(cmd) { case DEMUXER_CTRL_GET_TIME_LENGTH: if (!priv->numberofframes) return DEMUXER_CTRL_DONTKNOW; - *((unsigned long *)arg)=priv->numberofframes/sh_video->fps; + *((double *)arg)=(double)priv->numberofframes/sh_video->fps; if (sh_video->video.dwLength<=1) return DEMUXER_CTRL_GUESS; return DEMUXER_CTRL_OK; diff --git a/libmpdemux/demux_avs.c b/libmpdemux/demux_avs.c index 97d8766287..bc3829da4d 100644 --- a/libmpdemux/demux_avs.c +++ b/libmpdemux/demux_avs.c @@ -343,7 +343,7 @@ static int demux_avs_control(demuxer_t *demuxer, int cmd, void *arg) case DEMUXER_CTRL_GET_TIME_LENGTH: { if (!AVS->video_info->num_frames) return DEMUXER_CTRL_DONTKNOW; - *((unsigned long *)arg) = AVS->video_info->num_frames / sh_video->fps; + *((double *)arg) = (double)AVS->video_info->num_frames / sh_video->fps; return DEMUXER_CTRL_OK; } case DEMUXER_CTRL_GET_PERCENT_POS: diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 11cc84cf63..8588e0918b 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -402,7 +402,7 @@ static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg) if (priv->avfc->duration == 0) return DEMUXER_CTRL_DONTKNOW; - *((unsigned long *)arg) = priv->avfc->duration / AV_TIME_BASE; + *((double *)arg) = (double)priv->avfc->duration / AV_TIME_BASE; return DEMUXER_CTRL_OK; case DEMUXER_CTRL_GET_PERCENT_POS: diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c index d362ec0d79..7d710cd2c9 100644 --- a/libmpdemux/demux_mkv.c +++ b/libmpdemux/demux_mkv.c @@ -3280,7 +3280,7 @@ demux_mkv_control (demuxer_t *demuxer, int cmd, void *arg) if (mkv_d->duration == 0) return DEMUXER_CTRL_DONTKNOW; - *((unsigned long *)arg) = (unsigned long)mkv_d->duration; + *((double *)arg) = (double)mkv_d->duration; return DEMUXER_CTRL_OK; case DEMUXER_CTRL_GET_PERCENT_POS: diff --git a/libmpdemux/demux_mov.c b/libmpdemux/demux_mov.c index 1ba42c7ad7..91072648eb 100644 --- a/libmpdemux/demux_mov.c +++ b/libmpdemux/demux_mov.c @@ -2016,7 +2016,7 @@ static int demux_mov_control(demuxer_t *demuxer, int cmd, void *arg){ case DEMUXER_CTRL_GET_TIME_LENGTH: if (!track->timescale) return DEMUXER_CTRL_DONTKNOW; - *((unsigned long *)arg) = track->length / track->timescale; + *((double *)arg) = (double)track->length / track->timescale; return DEMUXER_CTRL_OK; case DEMUXER_CTRL_GET_PERCENT_POS: diff --git a/libmpdemux/demux_mpg.c b/libmpdemux/demux_mpg.c index fff4aa417f..a04ec2c50b 100644 --- a/libmpdemux/demux_mpg.c +++ b/libmpdemux/demux_mpg.c @@ -751,7 +751,7 @@ int demux_mpg_control(demuxer_t *demuxer,int cmd, void *arg){ switch(cmd) { case DEMUXER_CTRL_GET_TIME_LENGTH: if (mpg_d && mpg_d->has_valid_timestamps) { - *((unsigned long *)arg)=(long)mpg_d->final_pts; + *((double *)arg)=(double)mpg_d->final_pts; return DEMUXER_CTRL_GUESS; } return DEMUXER_CTRL_DONTKNOW; diff --git a/libmpdemux/demux_ogg.c b/libmpdemux/demux_ogg.c index d20b65849f..71653f83d5 100644 --- a/libmpdemux/demux_ogg.c +++ b/libmpdemux/demux_ogg.c @@ -1605,7 +1605,7 @@ static int demux_ogg_control(demuxer_t *demuxer,int cmd, void *arg){ switch(cmd) { case DEMUXER_CTRL_GET_TIME_LENGTH: if (ogg_d->final_granulepos<=0) return DEMUXER_CTRL_DONTKNOW; - *((unsigned long *)arg)=ogg_d->final_granulepos / rate; + *((double *)arg)=(double)ogg_d->final_granulepos / rate; return DEMUXER_CTRL_GUESS; case DEMUXER_CTRL_GET_PERCENT_POS: diff --git a/libmpdemux/demux_rawdv.c b/libmpdemux/demux_rawdv.c index d5d4c5761d..1248b468c9 100644 --- a/libmpdemux/demux_rawdv.c +++ b/libmpdemux/demux_rawdv.c @@ -234,7 +234,7 @@ static int demux_rawdv_control(demuxer_t *demuxer,int cmd, void *arg) { switch(cmd) { case DEMUXER_CTRL_GET_TIME_LENGTH: - *((unsigned long *)arg)=frames->frame_number / sh_video->fps; + *((double *)arg)=(double)frames->frame_number / sh_video->fps; return DEMUXER_CTRL_OK; case DEMUXER_CTRL_GET_PERCENT_POS: diff --git a/libmpdemux/demux_real.c b/libmpdemux/demux_real.c index c84ceabf23..0c203972ef 100644 --- a/libmpdemux/demux_real.c +++ b/libmpdemux/demux_real.c @@ -1855,7 +1855,7 @@ static int demux_real_control(demuxer_t *demuxer, int cmd, void *arg) if (priv->duration == 0) return DEMUXER_CTRL_DONTKNOW; - *((unsigned long *)arg) = priv->duration; + *((double *)arg) = (double)priv->duration; return DEMUXER_CTRL_OK; case DEMUXER_CTRL_GET_PERCENT_POS: diff --git a/libmpdemux/demux_ty.c b/libmpdemux/demux_ty.c index 6abcd33211..7a385f97c4 100644 --- a/libmpdemux/demux_ty.c +++ b/libmpdemux/demux_ty.c @@ -1350,8 +1350,8 @@ int demux_ty_control( demuxer_t *demuxer,int cmd, void *arg ) case DEMUXER_CTRL_GET_TIME_LENGTH: if(!sh_video->i_bps) // unspecified or VBR return DEMUXER_CTRL_DONTKNOW; - *((unsigned long *)arg)= - (demuxer->movi_end-demuxer->movi_start)/sh_video->i_bps; + *((double *)arg)= + ((double)demuxer->movi_end-demuxer->movi_start)/sh_video->i_bps; return DEMUXER_CTRL_GUESS; case DEMUXER_CTRL_GET_PERCENT_POS: diff --git a/libmpdemux/demux_xmms.c b/libmpdemux/demux_xmms.c index 682a86d500..3c3a06f77e 100644 --- a/libmpdemux/demux_xmms.c +++ b/libmpdemux/demux_xmms.c @@ -341,7 +341,7 @@ static int demux_xmms_control(demuxer_t *demuxer,int cmd, void *arg){ switch(cmd) { case DEMUXER_CTRL_GET_TIME_LENGTH: if (xmms_length<=0) return DEMUXER_CTRL_DONTKNOW; - *((unsigned long *)arg)=(unsigned long)xmms_length/1000; + *((double *)arg)=(double)xmms_length/1000; return DEMUXER_CTRL_GUESS; case DEMUXER_CTRL_GET_PERCENT_POS: diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index 505291a8e7..cbe89deead 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -918,13 +918,13 @@ int demux_control(demuxer_t *demuxer, int cmd, void *arg) { -unsigned long demuxer_get_time_length(demuxer_t *demuxer){ - unsigned long get_time_ans; +double demuxer_get_time_length(demuxer_t *demuxer){ + double 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; + get_time_ans = (double)(demuxer->movi_end-demuxer->movi_start)/sh_video->i_bps; else get_time_ans=0; } diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h index 1aa6e673cb..2630939207 100644 --- a/libmpdemux/demuxer.h +++ b/libmpdemux/demuxer.h @@ -320,7 +320,7 @@ char *demux_ogg_sub_lang(demuxer_t *demuxer, int index); #endif -extern unsigned long demuxer_get_time_length(demuxer_t *demuxer); +extern double demuxer_get_time_length(demuxer_t *demuxer); extern int demuxer_get_percent_pos(demuxer_t *demuxer); extern int demuxer_switch_audio(demuxer_t *demuxer, int index); |