[vlc-devel] Re: [PATCH] Kasenna Trickplay support
Glen Gray
glen at lincor.com
Thu Nov 10 19:10:56 CET 2005
Oops, attached the wrong patch. This was a working global patch with
lots of stuff in it. Here is the broken down version as I descibed in
the mail below
Glen Gray wrote:
> The following patch adds support for trick play streams from Kasenna
> servers.
>
> The date in the patch refer to the SVN checkout of vlc-trunk it is
> applied against.
>
> PATCH 1:- kasenna_trickplay-20051021.diff
> The first patch adds the trickplay support. It's based off a patch
> that Dermot (dermot at lincor.com) submitted at the start of the year.
> The rc interface fastforward and rewind commands are used to set the
> rate variable to what the user inputs. e.g. "fastforward 12" or
> "rewind 12" to play y the x12 FF/RW streams from the Kasenna. If those
> values are not passed and just the commands, then the rate is set to a
> flag value of INPUT_RATE_MAX/MIN. The setting of rate triggers a
> callback in src/input/input.c as before, however, in there, I make a
> call to the demux2Control to use SET_RATE. If this fails, it falls
> back to normal behaviour of setting the rate of play from the buffer.
>
> In the modules/demux/livedotcom.cpp there's a new SET_RATE section to
> the Control function.
> This pauses the stream, then restarts the stream with the scale value
> set to what was passed in with the fastforward command. If the values
> that where passed in match INPUT_RATE_MAX/MIN then a default scale
> factor of 30 is used. The Kasenna will choose the closest matching
> scale. By default it's 12x
>
>------------------------------------------------------------------------
>
>diff -uNr vlc-trunk/include/vlc_demux.h vlc-trunk.lincor/include/vlc_demux.h
>--- vlc-trunk/include/vlc_demux.h 2005-10-10 10:27:17.000000000 +0100
>+++ vlc-trunk.lincor/include/vlc_demux.h 2005-10-28 15:12:01.000000000 +0100
>@@ -105,7 +105,9 @@
> DEMUX_CAN_PAUSE, /* arg1= vlc_bool_t* cannot fail */
> DEMUX_CAN_CONTROL_PACE, /* arg1= vlc_bool_t* cannot fail */
> DEMUX_GET_PTS_DELAY, /* arg1= int64_t* cannot fail */
>- DEMUX_SET_PAUSE_STATE /* arg1= vlc_bool_t can fail */
>+ DEMUX_SET_PAUSE_STATE, /* arg1= vlc_bool_t can fail */
>+ DEMUX_SET_RATE, /* arg1=int, arg2=vlc_bool_t *pb_recompute_pts */
>+ DEMUX_GET_SERVER_POSITION /* arg1= int64_t * res=can fail */
> };
>
> /* stream_t *s could be null and then it mean a access+demux in one */
>diff -uNr vlc-trunk/modules/control/rc.c vlc-trunk.lincor/modules/control/rc.c
>--- vlc-trunk/modules/control/rc.c 2005-10-21 09:07:02.000000000 +0100
>+++ vlc-trunk.lincor/modules/control/rc.c 2005-11-02 13:36:47.000000000 +0000
>@@ -488,6 +488,10 @@
> var_Create( p_intf, "normal", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
> var_AddCallback( p_intf, "normal", Input, NULL );
>
>+ var_Create( p_intf, "get_server_position", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
>+ var_Create( p_intf, "server_position", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
>+ var_AddCallback( p_intf, "server_position", Input, NULL );
>+
> /* audio commands */
> var_Create( p_intf, "volume", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
> var_AddCallback( p_intf, "volume", Volume, NULL );
>@@ -887,6 +891,7 @@
> msg_rc( "| ");
> msg_rc(_("| seek X . seek in seconds, for instance `seek 12'"));
> msg_rc(_("| pause . . . . . . . . . . . . . . toggle pause"));
>+ msg_rc(_("| server_position . . . . . . get server position"));
> msg_rc(_("| fastforward . . . . . . . set to maximum rate"));
> msg_rc(_("| rewind . . . . . . . . . . set to minimum rate"));
> msg_rc(_("| faster . . . . . . . . faster playing of stream"));
>@@ -1084,17 +1089,68 @@
> vlc_object_release( p_input );
> return VLC_SUCCESS;
> }
>+ else if ( !strcmp( psz_cmd, "server_position" ) )
>+ {
>+ vlc_value_t newval;
>+ int count;
>+ vlc_bool_t bFound;
>+
>+ val.f_float = 1.0;
>+ count = 0 ;
>+ bFound = VLC_FALSE;
>+
>+ var_Set( p_input, "get_server_position", val );
>+
>+ /* Don't want the rc command to return until the server_position
>+ variable has changed. Loop for a max of 1 second
>+ */
>+ var_Get( p_input, "server_position", &newval );
>+ while(newval.f_float == 0.0 && count < 10)
>+ {
>+ usleep (100000); // sleep for 100ms
>+ count++;
>+ var_Get( p_input, "server_position", &newval );
>+ if( newval.f_float > 0.0 )
>+ {
>+ bFound = VLC_TRUE;
>+ }
>+ }
>+ if( bFound == VLC_TRUE ) {
>+ msg_rc("server position: %0.2f", newval.f_float);
>+ }
>+ else
>+ {
>+ msg_rc("Not Supported");
>+ }
>+ vlc_object_release( p_input );
>+ return VLC_SUCCESS;
>+ }
> else if ( !strcmp( psz_cmd, "fastforward" ) )
> {
>- val.i_int = config_GetInt( p_intf, "key-jump+3sec" );
>- var_Set( p_intf->p_vlc, "key-pressed", val );
>+ if( strlen( newval.psz_string ))
>+ {
>+ val.i_int = atoi( newval.psz_string );
>+ }
>+ else
>+ {
>+ val.i_int = INPUT_RATE_MAX;
>+ }
>+ var_Set( p_input, "rate", val );
> vlc_object_release( p_input );
> return VLC_SUCCESS;
> }
> else if ( !strcmp( psz_cmd, "rewind" ) )
> {
>- val.i_int = config_GetInt( p_intf, "key-jump-3sec" );
>- var_Set( p_intf->p_vlc, "key-pressed", val );
>+ if( strlen( newval.psz_string ))
>+ {
>+ val.i_int = atoi( newval.psz_string );
>+ val.i_int *= -1; //Make this a negative scale value
>+ }
>+ else
>+ {
>+ val.i_int = INPUT_RATE_MIN;
>+ }
>+ var_Set( p_input, "rate", val );
> vlc_object_release( p_input );
> return VLC_SUCCESS;
> }
>diff -uNr vlc-trunk/modules/demux/livedotcom.cpp vlc-trunk.lincor/modules/demux/livedotcom.cpp
>--- vlc-trunk/modules/demux/livedotcom.cpp 2005-10-13 14:51:50.000000000 +0100
>+++ vlc-trunk.lincor/modules/demux/livedotcom.cpp 2005-11-01 08:47:04.000000000 +0000
>@@ -156,6 +156,8 @@
> /* */
> mtime_t i_length;
> mtime_t i_start;
>+ unsigned int i_server_time;
>+ mtime_t i_server_time_retrieved;
>
> /* */
> vlc_bool_t b_multicast; /* true if one of the tracks is multicasted */
>@@ -182,6 +184,10 @@
> unsigned int& configSize );
> #endif
>
>+/* Utilize the GET_PARAMETER RTSP call */
>+static char *getServerParameter (const char *, demux_t *);
>+static float getServerPosition(demux_t *);
>+
> /*****************************************************************************
> * DemuxOpen:
> *****************************************************************************/
>@@ -235,6 +241,8 @@
> p_sys->i_pcr_repeats = 0;
> p_sys->i_length = 0;
> p_sys->i_start = 0;
>+ p_sys->i_server_time = 0;
>+ p_sys->i_server_time_retrieved = 0;
> p_sys->p_out_asf = NULL;
> p_sys->b_no_data = VLC_TRUE;
> p_sys->i_no_data_ti = 0;
>@@ -849,15 +857,20 @@
> demux_sys_t *p_sys = p_demux->p_sys;
> int64_t *pi64;
> double *pf, f;
>+ double d_npt;
> vlc_bool_t *pb, b_bool;
>+ int i_rate;
>+ float *position;
>+
>+ f = d_npt = 0;
>+ i_rate = 1;
>
> switch( i_query )
> {
> case DEMUX_GET_TIME:
> pi64 = (int64_t*)va_arg( args, int64_t * );
> *pi64 = p_sys->i_pcr - p_sys->i_pcr_start + p_sys->i_start;
>- return VLC_SUCCESS;
>-
>+ return VLC_SUCCESS;
> case DEMUX_GET_LENGTH:
> pi64 = (int64_t*)va_arg( args, int64_t * );
> *pi64 = p_sys->i_length;
>@@ -878,30 +891,30 @@
>
> case DEMUX_SET_POSITION:
> {
>- float time;
>+ float start_time;
>
> f = (double)va_arg( args, double );
>- time = f * (double)p_sys->i_length / 1000000.0; /* in second */
>+ start_time = f * (double)p_sys->i_length/1000000.0; /* in second */
>
> if( p_sys->rtsp && p_sys->i_length > 0 )
> {
>- int i;
>-
>- if( !p_sys->rtsp->playMediaSession( *p_sys->ms, time ) )
>+ if( !p_sys->rtsp->pauseMediaSession( *p_sys->ms ) )
>+ {
>+ msg_Err( p_demux, "PAUSE failed %s",
>+ p_sys->env->getResultMsg() );
>+ return VLC_EGENERIC;
>+ }
>+ if( !p_sys->rtsp->playMediaSession( *p_sys->ms, start_time) )
> {
>- msg_Err( p_demux, "PLAY failed %s", p_sys->env->getResultMsg() );
>+ msg_Err( p_demux, "PLAY failed %s",
>+ p_sys->env->getResultMsg() );
> return VLC_EGENERIC;
> }
> p_sys->i_start = (mtime_t)(f * (double)p_sys->i_length);
> p_sys->i_pcr_start = 0;
> p_sys->i_pcr = 0;
>+ es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
>
>-#if 0 /* disabled. probably useless */
>- for( i = 0; i < p_sys->i_track; i++ )
>- {
>- p_sys->track[i]->i_pts = 0;
>- }
>-#endif
> return VLC_SUCCESS;
> }
> return VLC_SUCCESS;
>@@ -919,17 +932,10 @@
>
> case DEMUX_CAN_CONTROL_PACE:
> pb = (vlc_bool_t*)va_arg( args, vlc_bool_t * );
>-
>-#if 0 /* Disable for now until we have a clock synchro algo
>- * which works with something else than MPEG over UDP */
>- *pb = VLC_FALSE;
>-#else
> *pb = VLC_TRUE;
>-#endif
> return VLC_SUCCESS;
>
> case DEMUX_SET_PAUSE_STATE:
>- double d_npt;
>
> d_npt = ( (double)( p_sys->i_pcr - p_sys->i_pcr_start +
> p_sys->i_start ) ) / 1000000.00;
>@@ -942,19 +948,60 @@
> ( !b_bool && !p_sys->rtsp->playMediaSession( *p_sys->ms,
> d_npt > 0 ? d_npt : -1 ) ) )
> {
>- msg_Err( p_demux, "PLAY or PAUSE failed %s", p_sys->env->getResultMsg() );
>+ msg_Err( p_demux, "PLAY or PAUSE failed %s",
>+ p_sys->env->getResultMsg() );
> return VLC_EGENERIC;
> }
>-#if 0
>- /* reset PCR and PCR start, mmh won't work well for multi-stream I fear */
>- for( i = 0; i < p_sys->i_track; i++ )
>+
>+ return VLC_SUCCESS;
>+
>+ case DEMUX_SET_RATE:
>+ i_rate = (int)va_arg( args, int );
>+
>+ if( i_rate == INPUT_RATE_MAX )
>+ i_rate = 30;
>+ else if( i_rate == INPUT_RATE_MIN )
>+ i_rate = -30;
>+ else if( i_rate == INPUT_RATE_DEFAULT || i_rate == 0 )
>+ i_rate = 1;
>+
>+ /* Resync the stream */
>+ p_sys->i_start = (mtime_t)(f * (double)p_sys->i_length);
>+ p_sys->i_pcr_start = 0;
>+ p_sys->i_pcr = 0;
>+ es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
>+
>+ //First of all we need to Pause the stream
>+ if( !p_sys->rtsp->pauseMediaSession( *p_sys->ms ) )
> {
>- p_sys->track[i]->i_pts = 0;
>+ msg_Err( p_demux, "PAUSE failed %s",
>+ p_sys->env->getResultMsg() );
>+ return VLC_EGENERIC;
>+ }
>+
>+ d_npt = (double)getServerPosition(p_demux);
>+ if( d_npt <= 0)
>+ {
>+ d_npt = -1;
> }
>- p_sys->i_pcr_start = 0; /* FIXME Wrong */
>- p_sys->i_pcr = 0;
>-#endif
>- return VLC_SUCCESS;
>+
>+ //Passing -1 for the start and end time will mean liveMedia won't
>+ //create a Range: section for the RTSP message. Server should pick
>+ //up from current position.
>+ if( ( !p_sys->rtsp->playMediaSession( *p_sys->ms,
>+ d_npt, -1, i_rate ) ) )
>+ {
>+ msg_Err( p_demux, "PLAY with Scale %d failed %s",
>+ i_rate, p_sys->env->getResultMsg() );
>+ return VLC_EGENERIC;
>+ }
>+
>+ /* Resync the stream */
>+ p_sys->i_start = (mtime_t)(f * (double)p_sys->i_length);
>+ p_sys->i_pcr_start = 0;
>+ p_sys->i_pcr = 0;
>+ es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
>+ return VLC_SUCCESS;
>
> case DEMUX_GET_TITLE_INFO:
> case DEMUX_SET_TITLE:
>@@ -965,7 +1012,10 @@
> pi64 = (int64_t*)va_arg( args, int64_t * );
> *pi64 = (int64_t)var_GetInteger( p_demux, "rtsp-caching" ) * 1000;
> return VLC_SUCCESS;
>-
>+ case DEMUX_GET_SERVER_POSITION:
>+ position = (float*)va_arg( args, float * );
>+ *position = getServerPosition( p_demux );
>+ return VLC_SUCCESS;
> default:
> return VLC_EGENERIC;
> }
>@@ -1009,7 +1059,8 @@
> delete [] psz_options;
>
> p_sdp = (uint8_t*)p_sys->rtsp->describeURL( psz_url,
>- NULL, var_CreateGetBool( p_demux, "rtsp-kasenna" ) );
>+ NULL, var_CreateGetBool( p_demux, "rtsp-kasenna" ) );
>+
> free( psz_url );
> if( p_sdp == NULL )
> {
>@@ -1109,8 +1160,8 @@
> demux_sys_t *p_sys = p_demux->p_sys;
> block_t *p_block;
>
>- mtime_t i_pts = (uint64_t)pts.tv_sec * UI64C(1000000) +
>- (uint64_t)pts.tv_usec;
>+ mtime_t i_pts = (uint64_t)pts.tv_sec * UI64C(1000000) +
>+ (uint64_t)pts.tv_usec;
>
> /* XXX Beurk beurk beurk Avoid having negative value XXX */
> i_pts &= UI64C(0x00ffffffffffffff);
>@@ -1422,3 +1473,39 @@
>
> return dest - dest_start;
> }
>+
>+static char *getServerParameter (const char *param, demux_t *p_demux)
>+{
>+ char *value = NULL;
>+ demux_sys_t *p_sys = p_demux->p_sys;
>+
>+ if( !p_sys->rtsp->getMediaSessionParameter( *p_sys->ms,
>+ param, value ) )
>+ {
>+ msg_Err( p_demux, "GET_PARAMETER failed %s",
>+ p_sys->env->getResultMsg() );
>+ return NULL;
>+ }
>+
>+ if( value != NULL )
>+ {
>+ msg_Warn (p_demux, "getParameter \"%s\" returned %s", param, value);
>+ }
>+ return value;
>+}
>+
>+static float getServerPosition(demux_t *p_demux)
>+{
>+ char *position = NULL;
>+ float f_pos = 0.0;
>+
>+ if( ( position = getServerParameter( "position", p_demux ) ) != NULL )
>+ {
>+ f_pos = strtof (position, NULL);
>+
>+msg_Warn (p_demux, "getServerPosition got %f", f_pos);
>+ free (position);
>+ position = NULL;
>+ }
>+ return f_pos;
>+}
>diff -uNr vlc-trunk/modules/video_filter/marq.c vlc-trunk.lincor/modules/video_filter/marq.c
>--- vlc-trunk/modules/video_filter/marq.c 2005-10-13 14:51:50.000000000 +0100
>+++ vlc-trunk.lincor/modules/video_filter/marq.c 2005-10-28 15:41:25.000000000 +0100
>@@ -2,7 +2,7 @@
> * marq.c : marquee display video plugin for vlc
> *****************************************************************************
> * Copyright (C) 2003-2005 the VideoLAN team
>- * $Id: marq.c 12821 2005-10-11 17:16:13Z zorglub $
>+ * $Id: marq.c 12412 2005-08-27 16:40:23Z jpsaman $
> *
> * Authors: Mark Moriarty
> *
>@@ -115,21 +115,19 @@
> set_callbacks( CreateFilter, DestroyFilter );
> set_category( CAT_VIDEO );
> set_subcategory( SUBCAT_VIDEO_SUBPIC );
>- add_string( "marq-marquee", "VLC", NULL, MSG_TEXT, MSG_LONGTEXT,
>- VLC_FALSE );
>+ add_string( "marq-marquee", "Marquee", NULL, MSG_TEXT, MSG_LONGTEXT, VLC_FALSE );
>
> set_section( N_("Position"), NULL );
>- add_integer( "marq-x", -1, NULL, POSX_TEXT, POSX_LONGTEXT, VLC_TRUE );
>- add_integer( "marq-y", 0, NULL, POSY_TEXT, POSY_LONGTEXT, VLC_TRUE );
>- add_integer( "marq-position", 5, NULL, POS_TEXT, POS_LONGTEXT, VLC_FALSE );
>+ add_integer( "marq-x", -1, NULL, POSX_TEXT, POSX_LONGTEXT, VLC_FALSE );
>+ add_integer( "marq-y", 0, NULL, POSY_TEXT, POSY_LONGTEXT, VLC_FALSE );
>+ add_integer( "marq-position", 5, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE );
>
> set_section( N_("Font"), NULL );
> /* 5 sets the default to top [1] left [4] */
> change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
> add_integer_with_range( "marq-opacity", 255, 0, 255, NULL,
> OPACITY_TEXT, OPACITY_LONGTEXT, VLC_FALSE );
>- add_integer( "marq-color", 0xFFFFFF, NULL, COLOR_TEXT, COLOR_LONGTEXT,
>- VLC_FALSE );
>+ add_integer( "marq-color", 0xFFFFFF, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE );
> change_integer_list( pi_color_values, ppsz_color_descriptions, 0 );
> add_integer( "marq-size", -1, NULL, SIZE_TEXT, SIZE_LONGTEXT, VLC_FALSE );
>
>@@ -203,15 +201,23 @@
> filter_sys_t *p_sys = p_filter->p_sys;
> vlc_object_t *p_input;
>
>- if( p_sys->psz_marquee ) free( p_sys->psz_marquee );
>- free( p_sys );
>-
> /* Delete the marquee variables */
> p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
> if( !p_input )
> {
> return;
> }
>+
>+ var_DelCallback( p_input->p_libvlc, "marq-x", MarqueeCallback, p_sys );
>+ var_DelCallback( p_input->p_libvlc, "marq-y", MarqueeCallback, p_sys );
>+ var_DelCallback( p_input->p_libvlc, "marq-marquee", MarqueeCallback, p_sys );
>+ var_DelCallback( p_input->p_libvlc, "marq-timeout", MarqueeCallback, p_sys );
>+ var_DelCallback( p_input->p_libvlc, "marq-position", MarqueeCallback, p_sys );
>+ var_DelCallback( p_input->p_libvlc, "marq-color", MarqueeCallback, p_sys );
>+ var_DelCallback( p_input->p_libvlc, "marq-opacity", MarqueeCallback, p_sys );
>+ var_DelCallback( p_input->p_libvlc, "marq-size", MarqueeCallback, p_sys );
>+
>+
> var_Destroy( p_input->p_libvlc , "marq-marquee" );
> var_Destroy( p_input->p_libvlc , "marq-x" );
> var_Destroy( p_input->p_libvlc , "marq-y" );
>@@ -306,6 +312,7 @@
> {
> if( p_sys->psz_marquee ) free( p_sys->psz_marquee );
> p_sys->psz_marquee = strdup( newval.psz_string );
>+
> }
> else if ( !strncmp( psz_var, "marq-x", 6 ) )
> {
>diff -uNr vlc-trunk/src/input/input.c vlc-trunk.lincor/src/input/input.c
>--- vlc-trunk/src/input/input.c 2005-10-19 14:31:09.000000000 +0100
>+++ vlc-trunk.lincor/src/input/input.c 2005-10-28 21:08:18.000000000 +0100
>@@ -1377,7 +1377,7 @@
> case INPUT_CONTROL_SET_RATE_SLOWER:
> case INPUT_CONTROL_SET_RATE_FASTER:
> {
>- int i_rate;
>+ int i_rate, i_ret;
>
> if( i_type == INPUT_CONTROL_SET_RATE_SLOWER )
> i_rate = p_input->i_rate * 2;
>@@ -1386,37 +1386,43 @@
> else
> i_rate = val.i_int;
>
>- if( i_rate < INPUT_RATE_MIN )
>+ // The demuxer may be able to control the rate from the source
>+ // e.g. FastForward stream from a VOD server
>+ i_ret = demux2_Control( p_input->input.p_demux,
>+ DEMUX_SET_RATE, i_rate, VLC_TRUE );
>+ if( i_ret != VLC_SUCCESS )
> {
>- msg_Dbg( p_input, "cannot set rate faster" );
>- i_rate = INPUT_RATE_MIN;
>- }
>- else if( i_rate > INPUT_RATE_MAX )
>- {
>- msg_Dbg( p_input, "cannot set rate slower" );
>- i_rate = INPUT_RATE_MAX;
>- }
>- if( i_rate != INPUT_RATE_DEFAULT &&
>- ( !p_input->b_can_pace_control ||
>- ( p_input->p_sout && !p_input->b_out_pace_control ) ) )
>- {
>- msg_Dbg( p_input, "cannot change rate" );
>- i_rate = INPUT_RATE_DEFAULT;
>- }
>- if( i_rate != p_input->i_rate )
>- {
>- p_input->i_rate = i_rate;
>- val.i_int = i_rate;
>- var_Change( p_input, "rate", VLC_VAR_SETVALUE, &val, NULL );
>-
>- /* We haven't send data to decoder when rate != default */
>- if( i_rate == INPUT_RATE_DEFAULT )
>- input_EsOutDiscontinuity( p_input->p_es_out, VLC_TRUE );
>-
>- /* Reset clock */
>- es_out_Control( p_input->p_es_out, ES_OUT_RESET_PCR );
>+ if( i_rate < INPUT_RATE_MIN )
>+ {
>+ msg_Dbg( p_input, "cannot set rate faster" );
>+ i_rate = INPUT_RATE_MIN;
>+ }
>+ else if( i_rate > INPUT_RATE_MAX )
>+ {
>+ msg_Dbg( p_input, "cannot set rate slower" );
>+ i_rate = INPUT_RATE_MAX;
>+ }
>+ if( i_rate != INPUT_RATE_DEFAULT &&
>+ ( !p_input->b_can_pace_control ||
>+ ( p_input->p_sout && !p_input->b_out_pace_control ) ) )
>+ {
>+ msg_Dbg( p_input, "cannot change rate" );
>+ i_rate = INPUT_RATE_DEFAULT;
>+ }
>+ if( i_rate != p_input->i_rate )
>+ {
>+ p_input->i_rate = i_rate;
>+ val.i_int = i_rate;
>+ var_Change( p_input, "rate", VLC_VAR_SETVALUE, &val, NULL );
>+
>+ /* We haven't send data to decoder when rate != default */
>+ if( i_rate == INPUT_RATE_DEFAULT )
>+ input_EsOutDiscontinuity( p_input->p_es_out, VLC_TRUE );
>
>- b_force_update = VLC_TRUE;
>+ /* Reset clock */
>+ es_out_Control( p_input->p_es_out, ES_OUT_RESET_PCR );
>+ b_force_update = VLC_TRUE;
>+ }
> }
> break;
> }
>@@ -1654,7 +1660,33 @@
> free( val.psz_string );
> }
> break;
>+ case INPUT_CONTROL_GET_SERVER_POSITION:
>+ {
>+ int i_ret;
>+ float position;
>
>+ i_ret = demux2_Control( p_input->input.p_demux,
>+ DEMUX_GET_SERVER_POSITION, &position );
>+ if( i_ret )
>+ {
>+ msg_Warn( p_input, "INPUT_CONTROL_GET_SERVER_POSITION %f"
>+ " failed or not possible", position );
>+ }
>+ else
>+ {
>+ vlc_value_t old_val;
>+ var_Get( p_input, "server_position", &old_val );
>+msg_Warn ( p_input, "old_val.f_float is %f", old_val.f_float);
>+ val.f_float = position;
>+ var_Set( p_input, "server_position", val );
>+// var_Change( p_input, "server_position", VLC_VAR_SETVALUE,
>+// &val, NULL );
>+msg_Warn ( p_input, "Called var_Change");
>+ var_Get( p_input, "server_position", &old_val );
>+msg_Warn ( p_input, "old_val.f_float is %f", old_val.f_float);
>+ }
>+ break;
>+ }
> case INPUT_CONTROL_SET_BOOKMARK:
> default:
> msg_Err( p_input, "not yet implemented" );
>diff -uNr vlc-trunk/src/input/input_internal.h vlc-trunk.lincor/src/input/input_internal.h
>--- vlc-trunk/src/input/input_internal.h 2005-10-10 10:25:20.000000000 +0100
>+++ vlc-trunk.lincor/src/input/input_internal.h 2005-10-28 15:16:28.000000000 +0100
>@@ -57,6 +57,8 @@
> INPUT_CONTROL_SET_AUDIO_DELAY,
> INPUT_CONTROL_SET_SPU_DELAY,
>
>+ INPUT_CONTROL_GET_SERVER_POSITION,
>+
> INPUT_CONTROL_ADD_SLAVE,
> };
>
>diff -uNr vlc-trunk/src/input/var.c vlc-trunk.lincor/src/input/var.c
>--- vlc-trunk/src/input/var.c 2005-10-19 14:31:09.000000000 +0100
>+++ vlc-trunk.lincor/src/input/var.c 2005-10-28 21:07:58.000000000 +0100
>@@ -51,6 +51,8 @@
> vlc_value_t oldval, vlc_value_t newval, void * );
> static int TimeCallback ( vlc_object_t *p_this, char const *psz_cmd,
> vlc_value_t oldval, vlc_value_t newval, void * );
>+static int ServerPositionCallback ( vlc_object_t *p_this, char const *psz_cmd,
>+ vlc_value_t oldval, vlc_value_t newval, void * );
> static int ProgramCallback ( vlc_object_t *p_this, char const *psz_cmd,
> vlc_value_t oldval, vlc_value_t newval, void * );
> static int TitleCallback ( vlc_object_t *p_this, char const *psz_cmd,
>@@ -109,6 +111,11 @@
> var_AddCallback( p_input, "time", TimeCallback, NULL );
> var_AddCallback( p_input, "time-offset", TimeCallback, NULL );
>
>+ /* Server Position */
>+ var_Create( p_input, "server_position", VLC_VAR_TIME );
>+ var_Create( p_input, "get_server_position", VLC_VAR_TIME );
>+ var_AddCallback( p_input, "get_server_position", ServerPositionCallback, NULL );
>+
> /* Bookmark */
> var_Create( p_input, "bookmark", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE |
> VLC_VAR_ISCOMMAND );
>@@ -206,6 +213,8 @@
> var_Destroy( p_input, "position-offset" );
> var_Destroy( p_input, "time" );
> var_Destroy( p_input, "time-offset" );
>+ var_Destroy( p_input, "server_position" );
>+ var_Destroy( p_input, "get_server_position" );
>
> var_Destroy( p_input, "audio-delay" );
> var_Destroy( p_input, "spu-delay" );
>@@ -552,6 +561,15 @@
> return VLC_SUCCESS;
> }
>
>+static int ServerPositionCallback( vlc_object_t *p_this, char const *psz_cmd,
>+ vlc_value_t oldval, vlc_value_t newval, void *p_data )
>+{
>+ input_thread_t *p_input = (input_thread_t*)p_this;
>+ input_ControlPush( p_input, INPUT_CONTROL_GET_SERVER_POSITION, &newval );
>+
>+ return VLC_SUCCESS;
>+}
>+
> static int ProgramCallback( vlc_object_t *p_this, char const *psz_cmd,
> vlc_value_t oldval, vlc_value_t newval,
> void *p_data )
>
>
--
Glen Gray <glen at lincor.com> Digital Depot, Thomas Street
Senior Software Engineer Dublin 8, Ireland
Lincor Solutions Ltd. Ph: +353 (0) 1 4893682
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: kasenna_trickplay-20051021.diff
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20051110/871d995a/attachment.ksh>
More information about the vlc-devel
mailing list