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

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Nov 16 01:39:57 CET 2011


On 15 Nov 2011, at 20:51, Kevin DeKorte <kdekorte at gmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 11/15/2011 12:34 PM, mplayer wrote:
>>>> 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; ...
> 
> 
> I can confirm that get_property stream_time_pos, does not appear to work.
> 
> mplayer ~/Videos/Guilty\ Crown/\[Doki\]\ Guilty\ Crown\ -\ 01\
> \(848x480\ h264\ AAC\)\ \[0D556C93\].mkv -slave -quiet

When there are no stream time stamps then it of course is not available.
Files streams do not come with time stamps, basically only DVDs will give a result.


More information about the MPlayer-users mailing list