]> git.sesse.net Git - vlc/blobdiff - src/input/input_ext-intf.c
Some heavy changes today:
[vlc] / src / input / input_ext-intf.c
index fdb0ad7d393e35fae13c4f494629ca06227e0185..130c742427e4269982ee69732f6dedabe1df26b7 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * input_ext-intf.c: services to the interface
  *****************************************************************************
- * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input_ext-intf.c,v 1.22 2001/04/28 03:36:25 sam Exp $
+ * Copyright (C) 1998-2001 VideoLAN
+ * $Id: input_ext-intf.c,v 1.32 2001/12/30 07:09:56 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include "defs.h"
-
 #include <string.h>                                    /* memcpy(), memset() */
 #include <sys/types.h>                                              /* off_t */
 
-#ifdef WIN32
-#define snprintf _snprintf
-#endif
-
-#include "config.h"
-#include "common.h"
-#include "threads.h"
-#include "mtime.h"
-
-#include "intf_msg.h"
+#include <videolan/vlc.h>
 
 #include "stream_control.h"
 #include "input_ext-dec.h"
 #include "input_ext-intf.h"
-
-#include "input.h"
+#include "input_ext-plugins.h"
 
 /*****************************************************************************
  * input_SetStatus: change the reading status
@@ -133,14 +121,6 @@ void input_SetStatus( input_thread_t * p_input, int i_mode )
     vlc_mutex_unlock( &p_input->stream.stream_lock );
 }
 
-/*****************************************************************************
- * input_SetRate: change the reading rate
- *****************************************************************************/
-void input_SetRate( input_thread_t * p_input, int i_mode )
-{
-    ; /* FIXME: stub */
-}
 /*****************************************************************************
  * input_Seek: changes the stream postion
  *****************************************************************************/
@@ -152,7 +132,7 @@ void input_Seek( input_thread_t * p_input, off_t i_position )
     vlc_mutex_lock( &p_input->stream.stream_lock );
     p_input->stream.p_selected_area->i_seek = i_position;
 
-    intf_WarnMsg( 1, "input: seeking position %lld/%lld (%s/%s)", i_position,
+    intf_WarnMsg( 3, "input: seeking position %lld/%lld (%s/%s)", i_position,
                   p_input->stream.p_selected_area->i_size,
                   input_OffsetToTime( p_input, psz_time1, i_position ),
                   input_OffsetToTime( p_input, psz_time2,
@@ -204,7 +184,8 @@ void input_DumpStream( input_thread_t * p_input )
     char        psz_time2[OFFSETTOTIME_MAX_SIZE];
 
 #define S   p_input->stream
-    intf_Msg( "input info: Dumping stream ID 0x%x", S.i_stream_id );
+    intf_Msg( "input info: Dumping stream ID 0x%x [OK:%d/D:%d]", S.i_stream_id,
+              S.c_packets_read, S.c_packets_trashed );
     if( S.b_seekable )
         intf_Msg( "input info: seekable stream, position: %lld/%lld (%s/%s)",
                   S.p_selected_area->i_tell, S.p_selected_area->i_size,
@@ -226,9 +207,10 @@ void input_DumpStream( input_thread_t * p_input )
         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]
-            intf_Msg( "input info: ES 0x%x, stream 0x%x, type 0x%x, %s",
+            intf_Msg( "input info: ES 0x%x, stream 0x%x, type 0x%x, %s [OK:%d/ERR:%d]",
                       ES->i_id, ES->i_stream_id, ES->i_type,
-                      ES->p_decoder_fifo != NULL ? "selected" : "not selected");
+                      ES->p_decoder_fifo != NULL ? "selected" : "not selected",
+                      ES->c_packets, ES->c_invalid_packets );
 #undef ES
         }
     }
@@ -236,8 +218,9 @@ void input_DumpStream( input_thread_t * p_input )
 
 /*****************************************************************************
  * input_ChangeES: answers to a user request with calls to (Un)SelectES
- * ---
+ *****************************************************************************
  * Useful since the interface plugins know p_es
+ * This functon is deprecated, use input_ToggleEs instead.
  *****************************************************************************/
 int input_ChangeES( input_thread_t * p_input, es_descriptor_t * p_es,
                     u8 i_cat )
@@ -271,14 +254,14 @@ int input_ChangeES( input_thread_t * p_input, es_descriptor_t * p_es,
                 input_UnselectES( p_input,
                                   p_input->stream.pp_selected_es[i_index] );
                 input_SelectES( p_input, p_es );
-                intf_WarnMsg( 1, "input info: es selected -> %s (0x%x)",
+                intf_WarnMsg( 3, "input info: es selected -> %s (0x%x)",
                                                 p_es->psz_desc, p_es->i_id );
             }
         }
         else
         {
             input_SelectES( p_input, p_es );
-            intf_WarnMsg( 1, "input info: es selected -> %s (0x%x)",
+            intf_WarnMsg( 3, "input info: es selected -> %s (0x%x)",
                           p_es->psz_desc, p_es->i_id );
         }
     }
@@ -286,7 +269,7 @@ int input_ChangeES( input_thread_t * p_input, es_descriptor_t * p_es,
     {
         if( i_index != -1 )
         {
-            intf_WarnMsg( 1, "input info: es unselected -> %s (0x%x)",
+            intf_WarnMsg( 3, "input info: es unselected -> %s (0x%x)",
                           p_input->stream.pp_selected_es[i_index]->psz_desc,
                           p_input->stream.pp_selected_es[i_index]->i_id );
 
@@ -317,11 +300,11 @@ int input_ToggleES( input_thread_t * p_input, es_descriptor_t * p_es,
     {
         if( b_select )
         {
-            input_SelectES( p_input, p_es );
+            p_input->stream.p_newly_selected_es = p_es;
         }
         else
         {
-            input_UnselectES( p_input, p_es );
+            p_input->stream.p_removed_es = p_es;
         }
     }
 
@@ -329,3 +312,84 @@ int input_ToggleES( input_thread_t * p_input, es_descriptor_t * p_es,
 
     return 0;
 }
+
+/****************************************************************************
+ * input_ChangeArea: interface request an area change
+ ****************************************************************************/
+int input_ChangeArea( input_thread_t * p_input, input_area_t * p_area )
+{
+    vlc_mutex_lock( &p_input->stream.stream_lock );
+
+    p_input->stream.p_new_area = p_area;
+
+    vlc_mutex_unlock( &p_input->stream.stream_lock );
+
+    return 0;
+}
+
+/****************************************************************************
+ * input_ChangeProgram: interface request an area change
+ ****************************************************************************/
+int input_ChangeProgram( input_thread_t * p_input, 
+            pgrm_descriptor_t * p_program )
+{
+    vlc_mutex_lock( &p_input->stream.stream_lock );
+
+    p_input->stream.p_new_program = p_program;
+
+    vlc_mutex_unlock( &p_input->stream.stream_lock );
+
+    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;
+
+    intf_WarnMsg( 3, "input warning: 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;
+
+    intf_WarnMsg( 3, "input warning: %s mute mode",
+            p_input->stream.control.b_mute ? "activating" : "deactivating" );
+
+    vlc_mutex_unlock( &p_input->stream.stream_lock );
+
+    return 0;
+}
+
+/****************************************************************************
+ * input_SetSMP: change the number of video decoder threads
+ ****************************************************************************/
+int input_SetSMP( input_thread_t * p_input, int i_smp )
+{
+    /* No need to warn the input thread since only the decoders
+     * worry about it. */
+    vlc_mutex_lock( &p_input->stream.control.control_lock );
+    p_input->stream.control.i_smp = i_smp;
+    vlc_mutex_unlock( &p_input->stream.control.control_lock );
+
+    return 0;
+}
+