[vlc-devel] [PATCH] TS demux: get time and length

Naohiro KORIYAMA nkoriyama at gmail.com
Mon Sep 19 02:06:21 CEST 2011


>From last change, I  reflected your check points and added a new function.
Seek(p_demux, f_percent) for seeking a time position not a byte position.

2011/9/18 Laurent Aimar <fenrir at elivagar.org>:
>> +    mtime_t     i_time;
>  I don't think you need i_time (it will simplify a bit without).
>> +    int         i_mux_rate;

I deleted both i_time and i_mux_rate.

>  After looking at the full patch, I don't think i_mux_rate is usefull:
> GET_TIME/POSITION/LENGTH can be computed from i_first_pcr/i_last_pcr and it
> will be more precise than using the byte position I think (it will prevents
> having weird results with VBR streams).

GET_TIME/POSITION/LENGTH now is computed from
Also SET_POSITION use a new function Seek(p_demux, f_percent).
Using this function, we can seek precise time position.
Without this function, seeking a byte position, it is a mess :-)

> A PCR of 0 is perfectly valid.
> static mtime_t GetPCR(block_t *p_pkt) returning -1 on error would fix that
> and be easier to use IMHO.

OK. If it fails, returns -1.

>  I think that simply calling GetPCR() on every packet until you actually get
> a PCR would achieve the same thing and be simpler.

I think so,  and I changed.

>> +    int64_t i_pos = i_last_pos - p_sys->i_packet_size * 1000; /* FIXME how many packets to get last pcr? */
>  The specs says that a PCR should be found every 100ms at most (some streams
> goes a bit beyong that).
>  If you plan for 62 mbit/s (DVB-S I think), you need 4122 so ~4500 with a
> margin.
>  When STREAM_CAN_FASTSEEK is true, it might be better to look at the end with
> a slower value, and if nothing is found, going back a bit further. But I am
> not sure it's worthwhile, and it can always be added later.

I cannot exactly decide how many packets now, but change this value to 4500.

>  You can simply test PIDGet( p_pkt ) == p_sys->i_pid_first_pcr and if true,
> then call GetPCR();


Thank you for your review.


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: 18521 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110919/db77698b/attachment.obj>

More information about the vlc-devel mailing list