]> git.sesse.net Git - vlc/blobdiff - src/stream_output/stream_output.c
qt4: build fix
[vlc] / src / stream_output / stream_output.c
index 2726a3510ce32cc54e2af8e92abaa240c84f9e24..8fbfbb0aeec3996b065bd46a22da951bc67a1c68 100644 (file)
@@ -47,6 +47,8 @@
 
 #include "input/input_interface.h"
 
+#define VLC_CODEC_NULL VLC_FOURCC( 'n', 'u', 'l', 'l' )
+
 #undef DEBUG_BUFFER
 /*****************************************************************************
  * Local prototypes
@@ -211,7 +213,7 @@ sout_packetizer_input_t *sout_InputNew( sout_instance_t *p_sout,
 
     msg_Dbg( p_sout, "adding a new sout input (sout_input:%p)", p_input );
 
-    if( p_fmt->i_codec == VLC_FOURCC( 'n', 'u', 'l', 'l' ) )
+    if( p_fmt->i_codec == VLC_CODEC_NULL )
     {
         vlc_object_release( p_sout );
         return p_input;
@@ -240,7 +242,7 @@ int sout_InputDelete( sout_packetizer_input_t *p_input )
 
     msg_Dbg( p_sout, "removing a sout input (sout_input:%p)", p_input );
 
-    if( p_input->p_fmt->i_codec != VLC_FOURCC( 'n', 'u', 'l', 'l' ) )
+    if( p_input->p_fmt->i_codec != VLC_CODEC_NULL )
     {
         vlc_mutex_lock( &p_sout->lock );
         p_sout->p_stream->pf_del( p_sout->p_stream, p_input->id );
@@ -261,12 +263,13 @@ int sout_InputSendBuffer( sout_packetizer_input_t *p_input,
     sout_instance_t     *p_sout = p_input->p_sout;
     int                 i_ret;
 
-    if( p_input->p_fmt->i_codec == VLC_FOURCC( 'n', 'u', 'l', 'l' ) )
+    if( p_input->p_fmt->i_codec == VLC_CODEC_NULL )
     {
         block_Release( p_buffer );
         return VLC_SUCCESS;
     }
-    if( p_buffer->i_dts <= 0 )
+
+    if( p_buffer->i_dts <= VLC_TS_INVALID )
     {
         msg_Warn( p_sout, "trying to send non-dated packet to stream output!");
         block_Release( p_buffer );
@@ -300,8 +303,6 @@ sout_access_out_t *sout_AccessOutNew( vlc_object_t *p_sout,
     psz_next = config_ChainCreate( &p_access->psz_access, &p_access->p_cfg,
                                    psz_access );
     free( psz_next );
-    if( !p_access->psz_access )
-        p_access->psz_access = strdup( "" );
     p_access->psz_path   = strdup( psz_name ? psz_name : "" );
     p_access->p_sys      = NULL;
     p_access->pf_seek    = NULL;
@@ -404,7 +405,7 @@ int sout_AccessOutControl (sout_access_out_t *access, int query, ...)
 /*****************************************************************************
  * sout_MuxNew: create a new mux
  *****************************************************************************/
-sout_mux_t * sout_MuxNew( sout_instance_t *p_sout, char *psz_mux,
+sout_mux_t * sout_MuxNew( sout_instance_t *p_sout, const char *psz_mux,
                           sout_access_out_t *p_access )
 {
     static const char typename[] = "mux";
@@ -614,6 +615,44 @@ void sout_MuxSendBuffer( sout_mux_t *p_mux, sout_input_t *p_input,
     p_mux->pf_mux( p_mux );
 }
 
+
+/*****************************************************************************
+ * sout_MuxGetStream: find stream to be muxed
+ *****************************************************************************/
+int sout_MuxGetStream( sout_mux_t *p_mux, int i_blocks, mtime_t *pi_dts )
+{
+    mtime_t i_dts = 0;
+    int     i_stream = -1;
+
+    for( int i = 0; i < p_mux->i_nb_inputs; i++ )
+    {
+        sout_input_t *p_input = p_mux->pp_inputs[i];
+        block_t *p_data;
+
+        if( block_FifoCount( p_input->p_fifo ) < i_blocks )
+        {
+            if( p_input->p_fmt->i_cat != SPU_ES )
+            {
+                return -1;
+            }
+            /* FIXME: SPU muxing */
+            continue;
+        }
+
+        p_data = block_FifoShow( p_input->p_fifo );
+        if( i_stream < 0 || p_data->i_dts < i_dts )
+        {
+            i_stream = i;
+            i_dts    = p_data->i_dts;
+        }
+    }
+
+    if( pi_dts ) *pi_dts = i_dts;
+
+    return i_stream;
+}
+
+
 /*****************************************************************************
  *
  *****************************************************************************/