[MPlayer-users] Feature Request: Get OSD Time as a Slave Command

mplayer mplayer at 2ndage.com
Tue Nov 15 20:34:30 CET 2011


> > ISSUE: 
> > The slave command get_time_pos returns the file timestamp, but for some
file
> > formats the timestamp resets.  
> > 
> > SOLUTION (proposed): 
> > However, I noticed that the OSD time displayed is always good.  So why
not
> > add a slave command 'get_osd_time' to expose the value the OSD is using
to
> > display -- it appears to me that OSD just asks the demuxer for the
current
> > time.
> > 
> > So this is what I think we'd need to add;
> > 
> > input.h
> >   MP_CMD_GET_OSD_TIME,
> > 
> > input.c
> >   { MP_CMD_GET_OSD_TIME, "get_osd_time", 0, { {-1,{0}} } },
> > 
> > command.c
> >   case MP_CMD_GET_OSD_TIME:
> >     mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_OSD_TIME=%d\n", 
> >       demuxer_get_current_time(mpctx->demuxer));
>
> There is no need to add anything. All that demuxer_get_current_time
> does is prefer the stream time over pts.
> You will get the same by just using
> get_property stream_time_pos
> and only falling back to
> get_property time_pos
> when it is not available.

Something is not adding up.

OSD is using 'demuxer_get_current_time' which implements;
    if (demuxer->stream_pts != MP_NOPTS_VALUE)
        get_time_ans = demuxer->stream_pts;
    else if (sh_video)
        get_time_ans = sh_video->pts;

Which returns the RIGHT answer.

And the slave command 'time_get_pos' is using;
    if (sh_video)
        pos = sh_video->pts;
    ...

Which returns the WRONG answer.

And 'get_property stream_time_pos' is using;
    if (!mpctx->demuxer || mpctx->demuxer->stream_pts == MP_NOPTS_VALUE)
        return M_PROPERTY_UNAVAILABLE;
    return m_property_time_ro(prop, action, arg,
mpctx->demuxer->stream_pts);

But when I try calling the slave command: 'get_property stream_time_pos' I
get the following;
  Failed to get value of property 'stream_time_pos'.
  ANS_ERROR=PROPERTY_UNKNOWN

It's pretty frustrating seeing the OSD display 1:15:23 while time_get_pos
returns 3:15.

Could we change the 'time_get_pos' to use the same logic as the OSD and give
preference to the stream pts;
    if (demuxer->stream_pts != MP_NOPTS_VALUE)
        pos = demuxer->stream_pts;
    else if (sh_video)
        pos = sh_video->pts;
    ...





More information about the MPlayer-users mailing list