]> git.sesse.net Git - vlc/commitdiff
* include: removed a few deprecated functions.
authorLaurent Aimar <fenrir@videolan.org>
Mon, 7 Jun 2004 18:23:15 +0000 (18:23 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 7 Jun 2004 18:23:15 +0000 (18:23 +0000)
 * demux, access: change the prototype of access2_New/demux2_New.
 * control: implemented all INPUT_GET/SET.
 * src/input/*.c: removed old functions, move some of them.

include/input_ext-intf.h
include/ninput.h
include/vlc_common.h
src/input/access.c
src/input/control.c
src/input/demux.c
src/input/input.c
src/input/input_ext-intf.c
src/input/input_programs.c
src/input/stream.c

index 5c94f5203c4031b1dc8aa8f4a3166cf0af06d40e..ecbf770a541b203e9d02fef2945a37217bc2be5e 100644 (file)
@@ -218,20 +218,6 @@ struct stream_descriptor_t
     count_t                 c_packets_trashed;            /* trashed packets */
 };
 
-/*****************************************************************************
- * stream_position_t
- *****************************************************************************
- * Describes the current position in the stream.
- *****************************************************************************/
-struct stream_position_t
-{
-    off_t    i_tell;     /* actual location in the area (in arbitrary units) */
-    off_t    i_size;          /* total size of the area (in arbitrary units) */
-
-    uint32_t i_mux_rate;                /* the rate we read the stream (in
-                                         * units of 50 bytes/s) ; 0 if undef */
-};
-
 #define MUTE_NO_CHANGE      -1
 
 /*****************************************************************************
@@ -392,25 +378,9 @@ VLC_EXPORT( input_thread_t *, __input_CreateThread, ( vlc_object_t *, input_item
 VLC_EXPORT( void,             input_StopThread,     ( input_thread_t * ) );
 VLC_EXPORT( void,             input_DestroyThread,  ( input_thread_t * ) );
 
-#define input_SetStatus(a,b) __input_SetStatus(VLC_OBJECT(a),b)
-VLC_EXPORT( void, __input_SetStatus, ( vlc_object_t *, int ) );
-
-#define input_SetRate(a,b) __input_SetRate(VLC_OBJECT(a),b)
-VLC_EXPORT( void, __input_SetRate, ( vlc_object_t *, int ) );
-
-#define input_Seek(a,b,c) __input_Seek(VLC_OBJECT(a),b,c)
-VLC_EXPORT( void, __input_Seek, ( vlc_object_t *, off_t, int ) );
-
-#define input_Tell(a,b) __input_Tell(VLC_OBJECT(a),b)
-VLC_EXPORT( void, __input_Tell, ( vlc_object_t *, stream_position_t * ) );
-
-VLC_EXPORT( void, input_DumpStream, ( input_thread_t * ) );
 VLC_EXPORT( char *, input_OffsetToTime, ( input_thread_t *, char *, off_t ) );
 VLC_EXPORT( int, input_ToggleES, ( input_thread_t *, es_descriptor_t *, vlc_bool_t ) );
 VLC_EXPORT( int, input_ChangeArea, ( input_thread_t *, input_area_t * ) );
 VLC_EXPORT( int, input_ChangeProgram, ( input_thread_t *, uint16_t ) );
 
-int    input_ToggleGrayscale( input_thread_t * );
-int    input_ToggleMute     ( input_thread_t * );
-
 #endif /* "input_ext-intf.h" */
index 07f8599b40260c9672e085db3855a5c74d201113..e8f6e4d5aad7a5d9f9f331c7e70587edb9f82162 100644 (file)
@@ -289,8 +289,8 @@ struct access_t
     access_sys_t *p_sys;
 };
 
-#define access2_New( a, b ) __access2_New(VLC_OBJECT(a), b )
-VLC_EXPORT( access_t *, __access2_New,  ( vlc_object_t *p_obj, char *psz_mrl ) );
+#define access2_New( a, b, c, d ) __access2_New(VLC_OBJECT(a), b, c, d )
+VLC_EXPORT( access_t *, __access2_New,  ( vlc_object_t *p_obj, char *psz_access, char *psz_demux, char *psz_path ) );
 VLC_EXPORT( void,      access2_Delete, ( access_t * ) );
 
 static inline int access2_vaControl( access_t *p_access, int i_query, va_list args )
@@ -541,8 +541,8 @@ VLC_EXPORT( int, access_vaControlDefault,( input_thread_t *, int i_query, va_lis
 
 
 /* stream_t *s could be null and then it mean a access+demux in one */
-#define demux2_New( a, b, c, d ) __demux2_New(VLC_OBJECT(a), b, c, d)
-VLC_EXPORT( demux_t *, __demux2_New,  ( vlc_object_t *p_obj, char *psz_mrl, stream_t *s, es_out_t *out ) );
+#define demux2_New( a, b, c, d, e, f ) __demux2_New(VLC_OBJECT(a),b,c,d,e,f)
+VLC_EXPORT( demux_t *, __demux2_New,  ( vlc_object_t *p_obj, char *psz_access, char *psz_demux, char *psz_path, stream_t *s, es_out_t *out ) );
 VLC_EXPORT( void,      demux2_Delete, ( demux_t * ) );
 VLC_EXPORT( int,       demux2_vaControlHelper, ( stream_t *, int64_t i_start, int64_t i_end, int i_bitrate, int i_align, int i_query, va_list args ) );
 
@@ -579,17 +579,27 @@ VLC_EXPORT( char **, subtitles_Detect, ( input_thread_t *, char* path, char *fna
  */
 enum input_query_e
 {
+    /* input variable "position" */
     INPUT_GET_POSITION,         /* arg1= double *       res=    */
     INPUT_SET_POSITION,         /* arg1= double         res=can fail    */
 
+    /* input variable "length" */
+    INPUT_GET_LENGTH,           /* arg1= int64_t *      res=can fail    */
+
+    /* input variable "time" */
     INPUT_GET_TIME,             /* arg1= int64_t *      res=    */
     INPUT_SET_TIME,             /* arg1= int64_t        res=can fail    */
 
-    INPUT_GET_LENGTH,           /* arg1= int64_t *      res=can fail    */
+    /* input variable "rate" (1 is DEFAULT_RATE) */
+    INPUT_GET_RATE,             /* arg1= int *          res=    */
+    INPUT_SET_RATE,             /* arg1= int            res=can fail    */
+
+    /* input variable "state" */
+    INPUT_GET_STATE,            /* arg1= int *          res=    */
+    INPUT_SET_STATE,            /* arg1= int            res=can fail    */
 
-    INPUT_GET_FPS,              /* arg1= float *        res=can fail    */
-    INPUT_GET_META,             /* arg1= vlc_meta_t **  res=can fail    */
 
+    /* bookmarks */
     INPUT_GET_BOOKMARKS,   /* arg1= seekpoint_t *** arg2= int * res=can fail */
     INPUT_CLEAR_BOOKMARKS, /* res=can fail */
     INPUT_ADD_BOOKMARK,    /* arg1= seekpoint_t *  res=can fail   */
@@ -599,15 +609,15 @@ enum input_query_e
 
     INPUT_ADD_OPTION, /* arg1= char * arg2= char *  res=can fail    */
 
+    /* */
     INPUT_ADD_INFO,   /* arg1= char * arg2= char * arg3=...  res=can fail    */
     INPUT_GET_INFO,   /* arg1= char * arg2= char * arg3= char ** res=can fail*/
 
     INPUT_SET_NAME,   /* arg1= char * res=can fail    */
 
+    /* */
     INPUT_GET_SUBDELAY,    /* arg1 = int* res=can fail */
     INPUT_SET_SUBDELAY,    /* arg1 = int  res=can fail */
-
-    INPUT_GET_DIVISIONS
 };
 
 VLC_EXPORT( int, input_vaControl,( input_thread_t *, int i_query, va_list  ) );
index 148910d97093e0f34e7402caaec1de3856cc493b..3c0c4d4cf91da20ac5de5bca286aeac7be5cd528 100644 (file)
@@ -307,7 +307,6 @@ typedef struct encoder_sys_t  encoder_sys_t;
 /* Misc */
 typedef struct data_packet_t data_packet_t;
 typedef struct data_buffer_t data_buffer_t;
-typedef struct stream_position_t stream_position_t;
 typedef struct stream_ctrl_t stream_ctrl_t;
 typedef struct pes_packet_t pes_packet_t;
 typedef struct network_socket_t network_socket_t;
index 495b2de1a1e9074dafa0d64ff9e6e8c0a222f976..49c51b2c0adcc0257ff2382b8c148733cb6f0350 100644 (file)
@@ -56,59 +56,23 @@ int access_vaControlDefault( input_thread_t *p_input, int i_query, va_list args
 /*****************************************************************************
  * access2_New:
  *****************************************************************************/
-access_t *__access2_New( vlc_object_t *p_obj, char *psz_mrl )
+access_t *__access2_New( vlc_object_t *p_obj,
+                         char *psz_access, char *psz_demux, char *psz_path )
 {
     access_t *p_access = vlc_object_create( p_obj, VLC_OBJECT_ACCESS );
 
-    char    *psz_dup = strdup( psz_mrl ? psz_mrl : "" );
-    char    *psz = strchr( psz_dup, ':' );
-
     if( p_access == NULL )
     {
-        msg_Err( p_obj, "vlc_object_create( p_obj, VLC_OBJECT_ACCESS ) had failed" );
-        free( psz_dup );
+        msg_Err( p_obj, "vlc_object_create( p_obj, VLC_OBJECT_ACCESS ) failed" );
         return NULL;
     }
 
     /* Parse URL */
-    p_access->psz_access = NULL;
-    p_access->psz_path   = NULL;
-
-    if( psz )
-    {
-        *psz++ = '\0';
-
-        if( psz[0] == '/' && psz[1] == '/' )
-        {
-            psz += 2;
-        }
-        p_access->psz_path = strdup( psz );
-
-        psz = strchr( psz_dup, '/' );
-        if( psz )
-        {
-            *psz++ = '\0';
-        }
-        p_access->psz_access = strdup( psz_dup );
-    }
-    else
-    {
-        p_access->psz_path = strdup( psz_mrl );
-    }
-    free( psz_dup );
+    p_access->psz_access = strdup( psz_access );
+    p_access->psz_path   = strdup( psz_path );
+    p_access->psz_demux  = strdup( "" );
 
-
-    p_access->psz_demux = strdup( "" );
-    if( p_access->psz_access == NULL )
-    {
-        p_access->psz_access = strdup( "" );
-    }
-    if( p_access->psz_path == NULL )
-    {
-        p_access->psz_path = strdup( "" );
-    }
-    msg_Dbg( p_obj, "access2_New: '%s' -> access='%s' path='%s'",
-             psz_mrl,
+    msg_Dbg( p_obj, "access2_New: access='%s' path='%s'",
              p_access->psz_access, p_access->psz_path );
 
     p_access->pf_read    = NULL;
index 938ff5be52f79c08ec3995a0ae75f15f361d24bb..b43947049cc03fc86374c1d3ad614587fe310774 100644 (file)
@@ -71,10 +71,58 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
     int i, *pi;
     vlc_value_t val, text;
     char *psz_option, *psz_value;
+    int i_int, *pi_int;
+    double f, *pf;
+    int64_t i_64, *pi_64;
 
     vlc_mutex_lock( &p_input->stream.stream_lock );
     switch( i_query )
     {
+        case INPUT_GET_POSITION:
+            pf = (double*)va_arg( args, double * );
+            *pf = var_GetFloat( p_input, "position" );
+            i_ret = VLC_SUCCESS;
+            break;
+        case INPUT_SET_POSITION:
+            f = (double)va_arg( args, double );
+            i_ret = var_SetFloat( p_input, "position", f );
+            break;
+
+        case INPUT_GET_LENGTH:
+            pi_64 = (int64_t*)va_arg( args, int64_t * );
+            *pi_64 = var_GetTime( p_input, "length" );
+            i_ret = VLC_SUCCESS;
+            break;
+        case INPUT_GET_TIME:
+            pi_64 = (int64_t*)va_arg( args, int64_t * );
+            *pi_64 = var_GetTime( p_input, "time" );
+            i_ret = VLC_SUCCESS;
+            break;
+        case INPUT_SET_TIME:
+            i_64 = (int64_t)va_arg( args, int64_t );
+            i_ret = var_SetTime( p_input, "time", i_64 );
+            break;
+
+        case INPUT_GET_RATE:
+            pi_int = (int*)va_arg( args, int * );
+            *pi_int = var_GetInteger( p_input, "rate" );
+            i_ret = VLC_SUCCESS;
+            break;
+        case INPUT_SET_RATE:
+            i_int = (int)va_arg( args, int );
+            i_ret = var_SetInteger( p_input, "rate", i_int );
+            break;
+
+        case INPUT_GET_STATE:
+            pi_int = (int*)va_arg( args, int * );
+            *pi_int = var_GetInteger( p_input, "state" );
+            i_ret = VLC_SUCCESS;
+            break;
+        case INPUT_SET_STATE:
+            i_int = (int)va_arg( args, int );
+            i_ret = var_SetInteger( p_input, "state", i_int );
+            break;
+
         case INPUT_ADD_OPTION:
         {
             psz_option = (char *)va_arg( args, char * );
index 281ec4b092ceff07783137384b6949f2b6315083..9373953dc6a700d30308a709880fb00ee7d3ae08 100644 (file)
@@ -169,64 +169,23 @@ static void SeekOffset( input_thread_t *p_input, int64_t i_pos )
  * demux2_New:
  *****************************************************************************/
 demux_t *__demux2_New( vlc_object_t *p_obj,
-                       char *psz_mrl, stream_t *s, es_out_t *out )
+                       char *psz_access, char *psz_demux, char *psz_path,
+                       stream_t *s, es_out_t *out )
 {
     demux_t *p_demux = vlc_object_create( p_obj, VLC_OBJECT_DEMUX );
-
-    char    *psz_dup = strdup( psz_mrl ? psz_mrl : "" );
-    char    *psz = strchr( psz_dup, ':' );
-    char    *psz_module;
+    char *psz_module;
 
     if( p_demux == NULL )
     {
-        free( psz_dup );
         return NULL;
     }
 
     /* Parse URL */
-    p_demux->psz_access = NULL;
-    p_demux->psz_demux  = NULL;
-    p_demux->psz_path   = NULL;
-
-    if( psz )
-    {
-        *psz++ = '\0';
-
-        if( psz[0] == '/' && psz[1] == '/' )
-        {
-            psz += 2;
-        }
-        p_demux->psz_path = strdup( psz );
+    p_demux->psz_access = strdup( psz_access );
+    p_demux->psz_demux  = strdup( psz_demux );
+    p_demux->psz_path   = strdup( psz_path );
 
-        psz = strchr( psz_dup, '/' );
-        if( psz )
-        {
-            *psz++ = '\0';
-            p_demux->psz_demux  = strdup( psz );
-        }
-        p_demux->psz_access = strdup( psz_dup );
-    }
-    else
-    {
-        p_demux->psz_path = strdup( psz_mrl );
-    }
-    free( psz_dup );
-
-
-    if( p_demux->psz_access == NULL )
-    {
-        p_demux->psz_access = strdup( "" );
-    }
-    if( p_demux->psz_demux == NULL )
-    {
-        p_demux->psz_demux = strdup( "" );
-    }
-    if( p_demux->psz_path == NULL )
-    {
-        p_demux->psz_path = strdup( "" );
-    }
-    msg_Dbg( p_obj, "demux2_New: '%s' -> access='%s' demux='%s' path='%s'",
-             psz_mrl,
+    msg_Dbg( p_obj, "demux2_New: access='%s' demux='%s' path='%s'",
              p_demux->psz_access, p_demux->psz_demux, p_demux->psz_path );
 
     p_demux->s          = s;
index 1afa7f068bb99048bcf5f4dd4ba4545ea113377e..286322d66dc669de3af4a678fa9052a15ab003ba 100644 (file)
@@ -1198,7 +1198,7 @@ static void ErrorThread( input_thread_t *p_input )
  *****************************************************************************/
 static void EndThread( input_thread_t * p_input )
 {
-    int i;
+    int i, j;
 #ifdef HAVE_SYS_TIMES_H
     /* Display statistics */
     struct tms  cpu_usage;
@@ -1210,7 +1210,44 @@ static void EndThread( input_thread_t * p_input )
     msg_Dbg( p_input, "%ld loops", p_input->c_loops );
 #endif
 
-    input_DumpStream( p_input );
+
+    /* DumpStream: printf some info for debugging purpose */
+#define S   p_input->stream
+    msg_Dbg( p_input, "dumping stream ID 0x%x [OK:%ld/D:%ld]", S.i_stream_id,
+             S.c_packets_read, S.c_packets_trashed );
+    if( S.b_seekable )
+    {
+        char psz_time1[MSTRTIME_MAX_SIZE];
+        char psz_time2[MSTRTIME_MAX_SIZE];
+
+        msg_Dbg( p_input, "seekable stream, position: "I64Fd"/"I64Fd" (%s/%s)",
+                 S.p_selected_area->i_tell, S.p_selected_area->i_size,
+                 input_OffsetToTime( p_input, psz_time1,
+                                     S.p_selected_area->i_tell ),
+                 input_OffsetToTime( p_input, psz_time2,
+                                     S.p_selected_area->i_size ) );
+    }
+    else
+        msg_Dbg( p_input, "pace %scontrolled", S.b_pace_control ? "" : "un-" );
+#undef S
+    for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
+    {
+#define P   p_input->stream.pp_programs[i]
+        msg_Dbg( p_input, "dumping program 0x%x, version %d (%s)",
+                 P->i_number, P->i_version,
+                 P->b_is_ok ? "complete" : "partial" );
+#undef P
+        for( j = 0; j < p_input->stream.pp_programs[i]->i_es_number; j++ )
+        {
+#define ES  p_input->stream.pp_programs[i]->pp_es[j]
+            msg_Dbg( p_input, "ES 0x%x, "
+                     "stream 0x%x, fourcc `%4.4s', %s [OK:%ld/ERR:%ld]",
+                     ES->i_id, ES->i_stream_id, (char*)&ES->i_fourcc,
+                     ES->p_dec != NULL ? "selected" : "not selected",
+                     ES->c_packets, ES->c_invalid_packets );
+#undef ES
+        }
+    }
 
     /* Free demultiplexer's data */
     if( p_input->p_demux ) module_Unneed( p_input, p_input->p_demux );
@@ -1415,6 +1452,152 @@ static void ParseOption( input_thread_t *p_input, const char *psz_option )
     return;
 }
 
+/*****************************************************************************
+ * input_SetStatus: change the reading status
+ *****************************************************************************/
+static void input_SetStatus( input_thread_t *p_input, int i_mode )
+{
+    vlc_mutex_lock( &p_input->stream.stream_lock );
+
+    switch( i_mode )
+    {
+    case INPUT_STATUS_END:
+        p_input->stream.i_new_status = PLAYING_S;
+        p_input->b_eof = 1;
+        msg_Dbg( p_input, "end of stream" );
+        break;
+
+    case INPUT_STATUS_PLAY:
+        p_input->stream.i_new_status = PLAYING_S;
+        msg_Dbg( p_input, "playing at normal rate" );
+        break;
+
+    case INPUT_STATUS_PAUSE:
+        /* XXX: we don't need to check i_status, because input_clock.c
+         * does it for us */
+        p_input->stream.i_new_status = PAUSE_S;
+        msg_Dbg( p_input, "toggling pause" );
+        break;
+
+    case INPUT_STATUS_FASTER:
+        if( p_input->stream.control.i_rate * 4 <= DEFAULT_RATE )
+        {
+            msg_Dbg( p_input, "can not play any faster" );
+        }
+        else
+        {
+            p_input->stream.i_new_status = FORWARD_S;
+            p_input->stream.i_new_rate =
+                                    p_input->stream.control.i_rate / 2;
+
+            if ( p_input->stream.i_new_rate < DEFAULT_RATE )
+            {
+                msg_Dbg( p_input, "playing at %i:1 fast forward",
+                     DEFAULT_RATE / p_input->stream.i_new_rate );
+            }
+            else if ( p_input->stream.i_new_rate > DEFAULT_RATE )
+            {
+                msg_Dbg( p_input, "playing at 1:%i slow motion",
+                      p_input->stream.i_new_rate / DEFAULT_RATE );
+            }
+            else if ( p_input->stream.i_new_rate == DEFAULT_RATE )
+            {
+                p_input->stream.i_new_status = PLAYING_S;
+                msg_Dbg( p_input, "playing at normal rate" );
+            }
+        }
+        break;
+
+    case INPUT_STATUS_SLOWER:
+        if( p_input->stream.control.i_rate >= 8 * DEFAULT_RATE )
+        {
+            msg_Dbg( p_input, "can not play any slower" );
+        }
+        else
+        {
+            p_input->stream.i_new_status = FORWARD_S;
+            p_input->stream.i_new_rate =
+                                    p_input->stream.control.i_rate * 2;
+
+            if ( p_input->stream.i_new_rate < DEFAULT_RATE )
+            {
+                msg_Dbg( p_input, "playing at %i:1 fast forward",
+                     DEFAULT_RATE / p_input->stream.i_new_rate );
+            }
+            else if ( p_input->stream.i_new_rate > DEFAULT_RATE )
+            {
+                msg_Dbg( p_input, "playing at 1:%i slow motion",
+                      p_input->stream.i_new_rate / DEFAULT_RATE );
+            }
+            else if ( p_input->stream.i_new_rate == DEFAULT_RATE )
+            {
+                p_input->stream.i_new_status = PLAYING_S;
+                msg_Dbg( p_input, "playing at normal rate" );
+            }
+        }
+        break;
+
+    default:
+        break;
+    }
+
+    vlc_cond_signal( &p_input->stream.stream_wait );
+    vlc_mutex_unlock( &p_input->stream.stream_lock );
+}
+/*****************************************************************************
+ * input_SetRate:
+ *****************************************************************************/
+static void input_SetRate( vlc_object_t * p_this, int i_rate )
+{
+    input_thread_t *p_input;
+
+    p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
+
+    if( p_input == NULL )
+    {
+        msg_Err( p_this, "no input found" );
+        return;
+    }
+
+    vlc_mutex_lock( &p_input->stream.stream_lock );
+
+    if( i_rate * 8 < DEFAULT_RATE )
+    {
+        msg_Dbg( p_input, "can not play faster than 8x" );
+        vlc_mutex_unlock( &p_input->stream.stream_lock );
+        return;
+    }
+    if( i_rate > DEFAULT_RATE * 8 )
+    {
+        msg_Dbg( p_input, "can not play slower than 1/8x" );
+        vlc_mutex_unlock( &p_input->stream.stream_lock );
+        return;
+    }
+    p_input->stream.i_new_status = FORWARD_S;
+    p_input->stream.i_new_rate = i_rate;
+
+    if ( p_input->stream.i_new_rate < DEFAULT_RATE )
+    {
+        msg_Dbg( p_input, "playing at %i:1 fast forward",
+             DEFAULT_RATE / p_input->stream.i_new_rate );
+    }
+    else if ( p_input->stream.i_new_rate > DEFAULT_RATE )
+    {
+        msg_Dbg( p_input, "playing at 1:%i slow motion",
+              p_input->stream.i_new_rate / DEFAULT_RATE );
+    }
+    else if ( p_input->stream.i_new_rate == DEFAULT_RATE )
+    {
+        p_input->stream.i_new_status = PLAYING_S;
+        msg_Dbg( p_input, "playing at normal rate" );
+    }
+
+    vlc_cond_signal( &p_input->stream.stream_wait );
+    vlc_mutex_unlock( &p_input->stream.stream_lock );
+
+    vlc_object_release( p_input );
+}
+
 /*****************************************************************************
  * Callbacks  (position, time, state, rate )
  *****************************************************************************/
index 785af38b5613a92c67c0711e61bc8a3973c3c32d..9c471585fd9bdc2ad7489998c0c2e646be800664 100644 (file)
@@ -2,7 +2,7 @@
  * input_ext-intf.c: services to the interface
  *****************************************************************************
  * Copyright (C) 1998-2004 VideoLAN
- * $Id: input_ext-intf.c,v 1.56 2004/01/25 17:16:05 zorglub Exp $
+ * $Id$
  *
  * Author: Christophe Massiot <massiot@via.ecp.fr>
  *
 #include "input_ext-intf.h"
 #include "input_ext-plugins.h"
 
-/*****************************************************************************
- * input_SetStatus: change the reading status
- *****************************************************************************/
-void __input_SetStatus( vlc_object_t * p_this, int i_mode )
-{
-    input_thread_t *p_input;
-
-    p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
-
-    if( p_input == NULL )
-    {
-        msg_Err( p_this, "no input found" );
-        return;
-    }
-
-    vlc_mutex_lock( &p_input->stream.stream_lock );
-
-    switch( i_mode )
-    {
-    case INPUT_STATUS_END:
-        p_input->stream.i_new_status = PLAYING_S;
-        p_input->b_eof = 1;
-        msg_Dbg( p_input, "end of stream" );
-        break;
-
-    case INPUT_STATUS_PLAY:
-        p_input->stream.i_new_status = PLAYING_S;
-        msg_Dbg( p_input, "playing at normal rate" );
-        break;
-
-    case INPUT_STATUS_PAUSE:
-        /* XXX: we don't need to check i_status, because input_clock.c
-         * does it for us */
-        p_input->stream.i_new_status = PAUSE_S;
-        msg_Dbg( p_input, "toggling pause" );
-        break;
-
-    case INPUT_STATUS_FASTER:
-        if( p_input->stream.control.i_rate * 4 <= DEFAULT_RATE )
-        {
-            msg_Dbg( p_input, "can not play any faster" );
-        }
-        else
-        {
-            p_input->stream.i_new_status = FORWARD_S;
-            p_input->stream.i_new_rate =
-                                    p_input->stream.control.i_rate / 2;
-
-            if ( p_input->stream.i_new_rate < DEFAULT_RATE )
-            {
-                msg_Dbg( p_input, "playing at %i:1 fast forward",
-                     DEFAULT_RATE / p_input->stream.i_new_rate );
-            }
-            else if ( p_input->stream.i_new_rate > DEFAULT_RATE )
-            {
-                msg_Dbg( p_input, "playing at 1:%i slow motion",
-                      p_input->stream.i_new_rate / DEFAULT_RATE );
-            }
-            else if ( p_input->stream.i_new_rate == DEFAULT_RATE )
-            {
-                p_input->stream.i_new_status = PLAYING_S;
-                msg_Dbg( p_input, "playing at normal rate" );
-            }
-        }
-        break;
-
-    case INPUT_STATUS_SLOWER:
-        if( p_input->stream.control.i_rate >= 8 * DEFAULT_RATE )
-        {
-            msg_Dbg( p_input, "can not play any slower" );
-        }
-        else
-        {
-            p_input->stream.i_new_status = FORWARD_S;
-            p_input->stream.i_new_rate =
-                                    p_input->stream.control.i_rate * 2;
-
-            if ( p_input->stream.i_new_rate < DEFAULT_RATE )
-            {
-                msg_Dbg( p_input, "playing at %i:1 fast forward",
-                     DEFAULT_RATE / p_input->stream.i_new_rate );
-            }
-            else if ( p_input->stream.i_new_rate > DEFAULT_RATE )
-            {
-                msg_Dbg( p_input, "playing at 1:%i slow motion",
-                      p_input->stream.i_new_rate / DEFAULT_RATE );
-            }
-            else if ( p_input->stream.i_new_rate == DEFAULT_RATE )
-            {
-                p_input->stream.i_new_status = PLAYING_S;
-                msg_Dbg( p_input, "playing at normal rate" );
-            }
-        }
-        break;
-
-    default:
-        break;
-    }
-
-    vlc_cond_signal( &p_input->stream.stream_wait );
-    vlc_mutex_unlock( &p_input->stream.stream_lock );
-
-    vlc_object_release( p_input );
-}
-
-void __input_SetRate( vlc_object_t * p_this, int i_rate )
-{
-    input_thread_t *p_input;
-
-    p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
-
-    if( p_input == NULL )
-    {
-        msg_Err( p_this, "no input found" );
-        return;
-    }
-
-    vlc_mutex_lock( &p_input->stream.stream_lock );
-
-    if( i_rate * 8 < DEFAULT_RATE )
-    {
-        msg_Dbg( p_input, "can not play faster than 8x" );
-        vlc_mutex_unlock( &p_input->stream.stream_lock );
-        return;
-    }
-    if( i_rate > DEFAULT_RATE * 8 )
-    {
-        msg_Dbg( p_input, "can not play slower than 1/8x" );
-        vlc_mutex_unlock( &p_input->stream.stream_lock );
-        return;
-    }
-    p_input->stream.i_new_status = FORWARD_S;
-    p_input->stream.i_new_rate = i_rate;
-
-    if ( p_input->stream.i_new_rate < DEFAULT_RATE )
-    {
-        msg_Dbg( p_input, "playing at %i:1 fast forward",
-             DEFAULT_RATE / p_input->stream.i_new_rate );
-    }
-    else if ( p_input->stream.i_new_rate > DEFAULT_RATE )
-    {
-        msg_Dbg( p_input, "playing at 1:%i slow motion",
-              p_input->stream.i_new_rate / DEFAULT_RATE );
-    }
-    else if ( p_input->stream.i_new_rate == DEFAULT_RATE )
-    {
-        p_input->stream.i_new_status = PLAYING_S;
-        msg_Dbg( p_input, "playing at normal rate" );
-    }
-
-    vlc_cond_signal( &p_input->stream.stream_wait );
-    vlc_mutex_unlock( &p_input->stream.stream_lock );
-
-    vlc_object_release( p_input );
-}
-
-/*****************************************************************************
- * input_Seek: changes the stream postion
- *****************************************************************************/
-void __input_Seek( vlc_object_t * p_this, off_t i_position, int i_whence )
-{
-    input_thread_t *p_input;
-
-    char psz_time1[MSTRTIME_MAX_SIZE];
-    char psz_time2[MSTRTIME_MAX_SIZE];
-
-    p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
-
-    if( p_input == NULL )
-    {
-        msg_Err( p_this, "no input found" );
-        return;
-    }
-
-    vlc_mutex_lock( &p_input->stream.stream_lock );
-
-#define A p_input->stream.p_selected_area
-    switch( i_whence & 0x30 )
-    {
-        case INPUT_SEEK_SECONDS:
-            i_position *= (off_t)50 * p_input->stream.i_mux_rate;
-            break;
-
-        case INPUT_SEEK_PERCENT:
-            i_position = A->i_size * i_position / (off_t)100;
-            break;
-
-        case INPUT_SEEK_BYTES:
-        default:
-            break;
-    }
-
-    switch( i_whence & 0x03 )
-    {
-        case INPUT_SEEK_CUR:
-            A->i_seek = A->i_tell + i_position;
-            break;
-
-        case INPUT_SEEK_END:
-            A->i_seek = A->i_size + i_position;
-            break;
-
-        case INPUT_SEEK_SET:
-        default:
-            A->i_seek = i_position;
-            break;
-    }
-
-    if( A->i_seek < 0 )
-    {
-        A->i_seek = 0;
-    }
-    else if( A->i_seek > A->i_size )
-    {
-        A->i_seek = A->i_size;
-    }
-
-    msg_Dbg( p_input, "seeking position "I64Fd"/"I64Fd" (%s/%s)",
-             A->i_seek, A->i_size,
-             input_OffsetToTime( p_input, psz_time1, i_position ),
-             input_OffsetToTime( p_input, psz_time2, A->i_size ) );
-#undef A
-
-    vlc_cond_signal( &p_input->stream.stream_wait );
-    vlc_mutex_unlock( &p_input->stream.stream_lock );
-
-    vlc_object_release( p_input );
-}
-
-/*****************************************************************************
- * input_Tell: requests the stream postion
- *****************************************************************************/
-void __input_Tell( vlc_object_t * p_this, stream_position_t * p_position )
-{
-    input_thread_t *p_input;
-
-    p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
-
-    if( p_input == NULL )
-    {
-        p_position->i_tell = 0;
-        p_position->i_size = 0;
-        p_position->i_mux_rate = 0;
-        msg_Err( p_this, "no input found" );
-        return;
-    }
-
-    vlc_mutex_lock( &p_input->stream.stream_lock );
-
-#define A p_input->stream.p_selected_area
-    p_position->i_tell = A->i_tell;
-    p_position->i_size = A->i_size;
-    p_position->i_mux_rate = p_input->stream.i_mux_rate;
-#undef A
-
-    vlc_mutex_unlock( &p_input->stream.stream_lock );
-    vlc_object_release( p_input );
-}
-
 /*****************************************************************************
  * input_OffsetToTime : converts an off_t value to a time indicator, using
  *                      mux_rate
@@ -317,51 +58,6 @@ char * input_OffsetToTime( input_thread_t * p_input, char * psz_buffer,
     }
 }
 
-/*****************************************************************************
- * input_DumpStream: dumps the contents of a stream descriptor
- *****************************************************************************
- * BEWARE : this function assumes that you already own the lock on
- * p_input->stream.stream_lock
- *****************************************************************************/
-void input_DumpStream( input_thread_t * p_input )
-{
-    char psz_time1[MSTRTIME_MAX_SIZE];
-    char psz_time2[MSTRTIME_MAX_SIZE];
-    unsigned int i, j;
-
-#define S   p_input->stream
-    msg_Dbg( p_input, "dumping stream ID 0x%x [OK:%ld/D:%ld]", S.i_stream_id,
-             S.c_packets_read, S.c_packets_trashed );
-    if( S.b_seekable )
-        msg_Dbg( p_input, "seekable stream, position: "I64Fd"/"I64Fd" (%s/%s)",
-                 S.p_selected_area->i_tell, S.p_selected_area->i_size,
-                 input_OffsetToTime( p_input, psz_time1,
-                                     S.p_selected_area->i_tell ),
-                 input_OffsetToTime( p_input, psz_time2,
-                                     S.p_selected_area->i_size ) );
-    else
-        msg_Dbg( p_input, "pace %scontrolled", S.b_pace_control ? "" : "un-" );
-#undef S
-    for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
-    {
-#define P   p_input->stream.pp_programs[i]
-        msg_Dbg( p_input, "dumping program 0x%x, version %d (%s)",
-                 P->i_number, P->i_version,
-                 P->b_is_ok ? "complete" : "partial" );
-#undef P
-        for( j = 0; j < p_input->stream.pp_programs[i]->i_es_number; j++ )
-        {
-#define ES  p_input->stream.pp_programs[i]->pp_es[j]
-            msg_Dbg( p_input, "ES 0x%x, "
-                     "stream 0x%x, fourcc `%4.4s', %s [OK:%ld/ERR:%ld]",
-                     ES->i_id, ES->i_stream_id, (char*)&ES->i_fourcc,
-                     ES->p_dec != NULL ? "selected" : "not selected",
-                     ES->c_packets, ES->c_invalid_packets );
-#undef ES
-        }
-    }
-}
-
 /*****************************************************************************
  * input_ToggleES: answers to a user request with calls to (Un)SelectES
  *****************************************************************************
@@ -433,41 +129,3 @@ int input_ChangeProgram( input_thread_t * p_input, uint16_t i_program_number )
 
     return 0;
 }
-
-/****************************************************************************
- * input_ToggleGrayscale: change to grayscale or color output
- ****************************************************************************/
-int input_ToggleGrayscale( input_thread_t * p_input )
-{
-    /* No need to warn the input thread since only the decoders and outputs
-     * worry about it. */
-    vlc_mutex_lock( &p_input->stream.control.control_lock );
-    p_input->stream.control.b_grayscale =
-                    !p_input->stream.control.b_grayscale;
-
-    msg_Dbg( p_input, "changing to %s output",
-             p_input->stream.control.b_grayscale ? "grayscale" : "color" );
-
-    vlc_mutex_unlock( &p_input->stream.control.control_lock );
-
-    return 0;
-}
-
-/****************************************************************************
- * input_ToggleMute: activate/deactivate mute mode
- ****************************************************************************/
-int input_ToggleMute( input_thread_t * p_input )
-{
-    /* We need to feed the decoders with 0, and only input can do that, so
-     * pass the message to the input thread. */
-    vlc_mutex_lock( &p_input->stream.stream_lock );
-    p_input->stream.b_new_mute = !p_input->stream.control.b_mute;
-
-    msg_Dbg( p_input, "%s mute mode",
-             p_input->stream.control.b_mute ? "activating" : "deactivating" );
-
-    vlc_mutex_unlock( &p_input->stream.stream_lock );
-
-    return 0;
-}
-
index 8c0e2a61b591f69ad94c31fb27605c5606b40d4b..c3d9612b379b5a8754c8939ccf429430f67ad467 100644 (file)
@@ -1017,7 +1017,7 @@ static int ProgramCallback( vlc_object_t *p_this, char const *psz_cmd,
     {
         vlc_mutex_unlock( &p_input->stream.stream_lock );
         input_ChangeProgram( p_input, (uint16_t)newval.i_int );
-        input_SetStatus( p_input, INPUT_STATUS_PLAY );
+        var_SetInteger( p_input, "state", PLAYING_S );
         vlc_mutex_lock( &p_input->stream.stream_lock );
     }
     vlc_mutex_unlock( &p_input->stream.stream_lock );
@@ -1066,7 +1066,7 @@ static int TitleCallback( vlc_object_t *p_this, char const *psz_cmd,
     vlc_mutex_unlock( &p_input->stream.stream_lock );
 
     input_ChangeArea( p_input, p_area );
-    input_SetStatus( p_input, INPUT_STATUS_PLAY );
+    var_SetInteger( p_input, "state", PLAYING_S );
 
     val.b_bool = VLC_TRUE;
     var_Set( p_input, "intf-change", val );
@@ -1111,7 +1111,7 @@ static int ChapterCallback( vlc_object_t *p_this, char const *psz_cmd,
     vlc_mutex_unlock( &p_input->stream.stream_lock );
 
     input_ChangeArea( p_input, p_area );
-    input_SetStatus( p_input, INPUT_STATUS_PLAY );
+    var_SetInteger( p_input, "state", PLAYING_S );
 
     val.b_bool = VLC_TRUE;
     var_Set( p_input, "intf-change", val );
@@ -1144,7 +1144,7 @@ static int NavigationCallback( vlc_object_t *p_this, char const *psz_cmd,
         p_area->i_part = newval.i_int;
         vlc_mutex_unlock( &p_input->stream.stream_lock );
         input_ChangeArea( p_input, p_area );
-        input_SetStatus( p_input, INPUT_STATUS_PLAY );
+        var_SetInteger( p_input, "state", PLAYING_S );
         vlc_mutex_lock( &p_input->stream.stream_lock );
     }
     vlc_mutex_unlock( &p_input->stream.stream_lock );
index 825dda199051c0b7efcc00e86dddbd7f39fa9125..72b2f20dedfb6861321a03dee00f756cf8ba0442 100644 (file)
@@ -569,20 +569,14 @@ static int      DStreamControl( stream_t *s, int i_query, va_list args )
 static int      DStreamThread ( stream_t *s )
 {
     d_stream_sys_t *p_sys = (d_stream_sys_t*)s->p_sys;
-    char         *psz_mrl;
     demux_t      *p_demux;
 
     /* Create the demuxer */
 
-    psz_mrl = malloc( strlen( p_sys->psz_name ) + 3 );
-    sprintf( psz_mrl, "/%s:", p_sys->psz_name );
-
-    if( ( p_demux = demux2_New( s, psz_mrl, s, p_sys->out ) ) == NULL )
+    if( ( p_demux = demux2_New( s, "", p_sys->psz_name, "", s, p_sys->out ) ) == NULL )
     {
-        free( psz_mrl );
         return VLC_EGENERIC;
     }
-    free( psz_mrl );
 
     vlc_mutex_lock( &p_sys->lock );
     p_sys->p_demux = p_demux;