[vlc-devel] [PATCH] MMS stream pausing

Jean-Baptiste Kempf jb at videolan.org
Wed Jun 11 17:09:08 CEST 2008


Seems to work for me, but is anyone competent to apply this patch ?
jb

On Tue, Jun 10, 2008 at 11:31:23PM +0200, bl4 wrote :
> MMS stream pausing.
> 
> Pause is a few seconds late because the decoder has to process 
> everything in the FIFO. When I tried to change it I always ended up with 
> a lot of PTS errors.
> 
> Some urls for testing:
> mms://tov.video.t-online.de/tvision/mgm/F/wm/itv-spi-20031107-544-ver00-dieanothda-trailFW10000045131.wmv
> mms://a406.v39440a.c39440.e.vm.akamaistream.net/7/406/39440/200805211240/bbcworldservice.download.akamai.com/39440/worldservice/tx/nb/summary5min.wma
> mms://cnn-0.wmod.llnwd.net/fc/a826/e1/nascar/big/cup/2008/06/08/cup.poc.final.nascar.ws.wmv
> 
> -- 
> bl4
> 

> >From 3680fef69eb985381040793f094ac1e006ce504a Mon Sep 17 00:00:00 2001
> From: bl4 <bl4 at playker.info>
> Date: Tue, 10 Jun 2008 22:41:54 +0200
> Subject: [PATCH] MMS stream pausing
> 
> ---
>  include/vlc_access.h       |    1 +
>  modules/access/mms/mmsh.c  |   14 +++++++++++++-
>  modules/access/mms/mmstu.c |   30 +++++++++++++++++++++++++++++-
>  modules/access/mms/mmstu.h |    2 ++
>  src/input/input.c          |    5 +++++
>  5 files changed, 50 insertions(+), 2 deletions(-)
> 
> diff --git a/include/vlc_access.h b/include/vlc_access.h
> index 26a867c..b2c1e23 100644
> --- a/include/vlc_access.h
> +++ b/include/vlc_access.h
> @@ -61,6 +61,7 @@ enum access_query_e
>      ACCESS_GET_PRIVATE_ID_STATE,    /* arg1=int i_private_data arg2=bool *  res=can fail */
>  
>      ACCESS_GET_CONTENT_TYPE, /* arg1=char **ppsz_content_type */
> +    ACCESS_KEEP_ALIVE
>  };
>  
>  struct access_t
> diff --git a/modules/access/mms/mmsh.c b/modules/access/mms/mmsh.c
> index b67e7cf..d2a421e 100644
> --- a/modules/access/mms/mmsh.c
> +++ b/modules/access/mms/mmsh.c
> @@ -240,6 +240,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
>  {
>      access_sys_t *p_sys = p_access->p_sys;
>      bool   *pb_bool;
> +    bool    b_bool;
>      int          *pi_int;
>      int64_t      *pi_64;
>      int          i_int;
> @@ -253,11 +254,15 @@ static int Control( access_t *p_access, int i_query, va_list args )
>              break;
>  
>          case ACCESS_CAN_FASTSEEK:
> -        case ACCESS_CAN_PAUSE:
>              pb_bool = (bool*)va_arg( args, bool* );
>              *pb_bool = false;
>              break;
>  
> +        case ACCESS_CAN_PAUSE:
> +            pb_bool = (bool*)va_arg( args, bool* );
> +            *pb_bool = true;
> +            break;
> +
>          case ACCESS_CAN_CONTROL_PACE:
>              pb_bool = (bool*)va_arg( args, bool* );
>              *pb_bool = true;
> @@ -285,6 +290,13 @@ static int Control( access_t *p_access, int i_query, va_list args )
>  
>          /* */
>          case ACCESS_SET_PAUSE_STATE:
> +            b_bool = (bool)va_arg( args, int );
> +            if( b_bool )
> +                Stop( p_access );
> +            else
> +                Seek( p_access, p_access->info.i_pos );
> +            break;
> +
>          case ACCESS_GET_TITLE_INFO:
>          case ACCESS_SET_TITLE:
>          case ACCESS_SET_SEEKPOINT:
> diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c
> index a3867bf..c3850e7 100644
> --- a/modules/access/mms/mmstu.c
> +++ b/modules/access/mms/mmstu.c
> @@ -222,6 +222,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
>  {
>      access_sys_t *p_sys = p_access->p_sys;
>      bool   *pb_bool;
> +    bool    b_bool;
>      int          *pi_int;
>      int64_t      *pi_64;
>      int           i_int;
> @@ -236,11 +237,15 @@ static int Control( access_t *p_access, int i_query, va_list args )
>              break;
>  
>          case ACCESS_CAN_FASTSEEK:
> -        case ACCESS_CAN_PAUSE:
>              pb_bool = (bool*)va_arg( args, bool* );
>              *pb_bool = false;
>              break;
>  
> +        case ACCESS_CAN_PAUSE:
> +            pb_bool = (bool*)va_arg( args, bool* );
> +            *pb_bool = true;
> +            break;
> +
>          case ACCESS_CAN_CONTROL_PACE:
>              pb_bool = (bool*)va_arg( args, bool* );
>  
> @@ -274,6 +279,29 @@ static int Control( access_t *p_access, int i_query, va_list args )
>  
>          /* */
>          case ACCESS_SET_PAUSE_STATE:
> +            b_bool = (bool)va_arg( args, int );
> +            if( b_bool )
> +            {
> +                MMSStop( p_access );
> +                p_sys->last_ping_time = time(NULL);
> +            }
> +            else
> +            {
> +                Seek( p_access, p_access->info.i_pos );
> +                p_sys->last_ping_time = NULL;
> +            }
> +            break;
> +
> +        case ACCESS_KEEP_ALIVE:
> +            /* We don't need to wait for a ping request from the server.
> +             * Sending a ping reply every 10 seconds should be enough */
> +            if( p_sys->last_ping_time && time(NULL) > p_sys->last_ping_time + 10 )
> +            {
> +                mms_CommandSend( p_access, 0x1b, 0, 0, NULL, 0 );
> +                p_sys->last_ping_time = time(NULL);
> +            }
> +            break;
> +
>          case ACCESS_GET_TITLE_INFO:
>          case ACCESS_SET_TITLE:
>          case ACCESS_SET_SEEKPOINT:
> diff --git a/modules/access/mms/mmstu.h b/modules/access/mms/mmstu.h
> index 7da39fc..1acb4fc 100644
> --- a/modules/access/mms/mmstu.h
> +++ b/modules/access/mms/mmstu.h
> @@ -92,6 +92,8 @@ struct access_sys_t
>  
>      /* misc */
>      bool  b_seekable;
> +
> +    time_t      last_ping_time;
>  };
>  
>  #endif
> diff --git a/src/input/input.c b/src/input/input.c
> index 33f0ddd..43705b5 100644
> --- a/src/input/input.c
> +++ b/src/input/input.c
> @@ -695,6 +695,11 @@ static void MainLoop( input_thread_t *p_input )
>          }
>          else
>          {
> +            /* While inactive, prevent the server from closing the
> +             * connection */
> +            if( p_input->p->input.p_access )
> +                access_Control( p_input->p->input.p_access,
> +                                ACCESS_KEEP_ALIVE, false );
>              /* Small wait */
>              msleep( 10*1000 );
>          }
> -- 
> 1.5.3.7
> 
> 

> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel


-- 
Best Regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/



More information about the vlc-devel mailing list