#include "input/input_interface.h"
+#define VLC_CODEC_NULL VLC_FOURCC( 'n', 'u', 'l', 'l' )
+
#undef DEBUG_BUFFER
/*****************************************************************************
* Local prototypes
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;
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 );
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 );
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;
/*****************************************************************************
* 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";
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;
+}
+
+
/*****************************************************************************
*
*****************************************************************************/