mirror of https://github.com/mpv-player/mpv
try to get duration from the stream layer, if an implementation of STREAM_CTRL_GET_TIME_LENGTH is available
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17700 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
f380dd575b
commit
941b080f9c
|
@ -787,9 +787,17 @@ int demux_mpg_control(demuxer_t *demuxer,int cmd, void *arg){
|
||||||
demux_stream_t *d_video=demuxer->video;
|
demux_stream_t *d_video=demuxer->video;
|
||||||
sh_video_t *sh_video=d_video->sh;
|
sh_video_t *sh_video=d_video->sh;
|
||||||
mpg_demuxer_t *mpg_d=(mpg_demuxer_t*)demuxer->priv;
|
mpg_demuxer_t *mpg_d=(mpg_demuxer_t*)demuxer->priv;
|
||||||
|
int msec = 0;
|
||||||
|
|
||||||
switch(cmd) {
|
switch(cmd) {
|
||||||
case DEMUXER_CTRL_GET_TIME_LENGTH:
|
case DEMUXER_CTRL_GET_TIME_LENGTH:
|
||||||
|
msec = stream_control(demuxer->stream, STREAM_CTRL_GET_TIME_LENGTH, arg);
|
||||||
|
if(msec != STREAM_UNSUPORTED) {
|
||||||
|
msec = *((unsigned int*)arg);
|
||||||
|
*((double *)arg)=(double)msec/1000.0f;
|
||||||
|
mp_msg(MSGT_DEMUXER,MSGL_DBG2,"\r\nDEMUX_MPG_CTRL, stream len: %d (%.3lf)\r\n", msec, *((double*)arg));
|
||||||
|
return DEMUXER_CTRL_GUESS;
|
||||||
|
}
|
||||||
if (mpg_d && mpg_d->has_valid_timestamps) {
|
if (mpg_d && mpg_d->has_valid_timestamps) {
|
||||||
*((double *)arg)=(double)mpg_d->final_pts;
|
*((double *)arg)=(double)mpg_d->final_pts;
|
||||||
return DEMUXER_CTRL_GUESS;
|
return DEMUXER_CTRL_GUESS;
|
||||||
|
|
Loading…
Reference in New Issue