]> git.sesse.net Git - vlc/blobdiff - src/stream_output/stream_output.c
qt4: build fix
[vlc] / src / stream_output / stream_output.c
index a6672dede5784847466da56805d9bda44a0beec1..8fbfbb0aeec3996b065bd46a22da951bc67a1c68 100644 (file)
@@ -268,7 +268,8 @@ int sout_InputSendBuffer( sout_packetizer_input_t *p_input,
         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 );
@@ -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;
+}
+
+
 /*****************************************************************************
  *
  *****************************************************************************/