[vlc-devel] [PATCH] TS demux: get time and length
Naohiro KORIYAMA
nkoriyama at gmail.com
Wed Sep 21 15:41:30 CEST 2011
Hi,
2011/9/21 Laurent Aimar <fenrir at elivagar.org>:
>> + i_time = (p_sys->i_current_pcr - p_sys->i_first_pcr) * 100 / 9;
>> + i_length = (p_sys->i_last_pcr - p_sys->i_first_pcr) * 100 / 9;
>> + *pf = (double)i_time/(double)i_length;
>> + }
> You don't really need the 100/9 factor as they cancel out.
I have forgotten to get rid of them.
>> +static mtime_t FixPCRWrapAround( mtime_t i_pcr )
>> +{
>> + /*
>> + * PCR is 33bit. If PCR reaches to 0x1FFFFFFFF, resset from 0.
>> + * So, need to add 0x1FFFFFFFF, when calculation duration or current position.
>> + */
>> + return i_pcr + 0x1FFFFFFFF; /* 33bit */
>> +}
> I think you could merge the check against i_first_pcr into it (to simplify
> the code).
I add a argument i_ref_pcr and the test to the function.
>> +static int Seek( demux_t *p_demux, double f_percent )
> I think you could simplify it by using a binary search algorithm.
I rewrite the funciton using a binary search algolithm, and it's very simple.
>> +static void GetFirstPCR( demux_t *p_demux )
> I don't think you need all that. A simple (pseudo code):
> should be enough.
It works. I can get rid of dvbpsi function from GetFIrstPCR().
> I don't think you need to check for i_pmt_es.
I remove all the check for i_pmt_es from the functions I added.
Thank you for reviewing.
--
KORIYAMA, Naohiro
nkoriyama at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-TS-demux-2985-Enhance-TS-demuxer-to-support-duration.patch
Type: application/octet-stream
Size: 16201 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110921/6cd51ca2/attachment.obj>
More information about the vlc-devel
mailing list