[vlc-devel] [PATCH] demux: ts: support get length for non fastseekable

Zhao Zhili wantlamy at gmail.com
Thu Mar 10 02:15:32 CET 2016


Please ignore this patch, I will send a new version.

On Wed, Mar 9, 2016 at 11:09 PM, Zhao Zhili <wantlamy at gmail.com> wrote:

>
> ---
>  modules/demux/mpeg/ts.c     | 6 +++++-
>  modules/demux/mpeg/ts_psi.c | 2 +-
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
> index f70844b..e673cc7 100644
> --- a/modules/demux/mpeg/ts.c
> +++ b/modules/demux/mpeg/ts.c
> @@ -1976,10 +1976,14 @@ int ProbeEnd( demux_t *p_demux, int i_program )
>      int64_t i_stream_size = stream_Size( p_sys->stream );
>
>      int i_probe_count = PROBE_CHUNK_COUNT;
> +    const int i_probe_max = 5 * PROBE_CHUNK_COUNT;
>      int64_t i_pos;
>      mtime_t i_pcr = -1;
>      bool b_found = false;
>
> +    if ( p_sys->b_canfastseek == false )
> +        i_probe_count = i_probe_max;
> +
>      do
>      {
>          i_pos = i_stream_size - (p_sys->i_packet_size * i_probe_count);
> @@ -1992,7 +1996,7 @@ int ProbeEnd( demux_t *p_demux, int i_program )
>
>          /* Go ahead one more chunk if end of file contained only stuffing
> packets */
>          i_probe_count += PROBE_CHUNK_COUNT;
> -    } while( i_pos > 0 && (i_pcr == -1 || !b_found) && i_probe_count < (6
> * PROBE_CHUNK_COUNT) );
> +    } while( i_pos > 0 && (i_pcr == -1 || !b_found) && i_probe_count <=
> i_probe_max );
>
>      if( stream_Seek( p_sys->stream, i_initial_pos ) )
>          return VLC_EGENERIC;
> diff --git a/modules/demux/mpeg/ts_psi.c b/modules/demux/mpeg/ts_psi.c
> index ac14b79..05623ac 100644
> --- a/modules/demux/mpeg/ts_psi.c
> +++ b/modules/demux/mpeg/ts_psi.c
> @@ -1714,7 +1714,7 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t
> *p_dvbpsipmt )
>      }
>
>      /* Probe Boundaries */
> -    if( p_sys->b_canfastseek && p_pmt->i_last_dts == -1 )
> +    if( p_sys->b_canseek && p_pmt->i_last_dts == -1 )
>      {
>          p_pmt->i_last_dts = 0;
>          ProbeStart( p_demux, p_pmt->i_number );
> --
> 1.9.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160310/93df4bec/attachment.html>


More information about the vlc-devel mailing list