/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <stdlib.h>
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <vlc_input.h>
#include <vlc_sout.h>
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
-vlc_module_begin();
- set_description( _("Gathering stream output") );
- set_capability( "sout stream", 50 );
- add_shortcut( "gather" );
- set_callbacks( Open, Close );
-vlc_module_end();
+vlc_module_begin ()
+ set_description( N_("Gathering stream output") )
+ set_capability( "sout stream", 50 )
+ add_shortcut( "gather" )
+ set_callbacks( Open, Close )
+vlc_module_end ()
/*****************************************************************************
* Exported prototypes
struct sout_stream_id_t
{
- vlc_bool_t b_used;
+ bool b_used;
es_format_t fmt;
void *id;
struct sout_stream_sys_t
{
- sout_stream_t *p_out;
-
int i_id;
sout_stream_id_t **id;
};
sout_stream_sys_t *p_sys;
p_stream->p_sys = p_sys = malloc( sizeof( sout_stream_sys_t ) );
- p_sys->p_out = sout_StreamNew( p_stream->p_sout, p_stream->psz_next );
- if( p_sys->p_out == NULL )
+ if( p_sys == NULL )
+ return VLC_EGENERIC;
+
+ if( !p_stream->p_next )
{
free( p_sys );
return VLC_EGENERIC;
{
sout_stream_id_t *id = p_sys->id[i];
- sout_StreamIdDel( p_sys->p_out, id->id );
+ sout_StreamIdDel( p_stream->p_next, id->id );
es_format_Clean( &id->fmt );
free( id );
}
TAB_CLEAN( p_sys->i_id, p_sys->id );
- sout_StreamDelete( p_sys->p_out );
free( p_sys );
}
/* */
msg_Dbg( p_stream, "reusing already opened output" );
- id->b_used = VLC_TRUE;
+ id->b_used = true;
return id;
}
if( !id->b_used && id->fmt.i_cat == p_fmt->i_cat )
{
TAB_REMOVE( p_sys->i_id, p_sys->id, id );
- sout_StreamIdDel( p_sys->p_out, id->id );
+ sout_StreamIdDel( p_stream->p_next, id->id );
es_format_Clean( &id->fmt );
free( id );
msg_Dbg( p_stream, "creating new output" );
id = malloc( sizeof( sout_stream_id_t ) );
+ if( id == NULL )
+ return NULL;
es_format_Copy( &id->fmt, p_fmt );
- id->b_used = VLC_TRUE;
- id->id = sout_StreamIdAdd( p_sys->p_out, &id->fmt );
+ id->b_used = true;
+ id->id = sout_StreamIdAdd( p_stream->p_next, &id->fmt );
if( id->id == NULL )
{
free( id );
*****************************************************************************/
static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
{
- id->b_used = VLC_FALSE;
+ VLC_UNUSED(p_stream);
+ id->b_used = false;
return VLC_SUCCESS;
}
static int Send( sout_stream_t *p_stream,
sout_stream_id_t *id, block_t *p_buffer )
{
- sout_stream_sys_t *p_sys = p_stream->p_sys;
-
- return sout_StreamIdSend( p_sys->p_out, id->id, p_buffer );
+ return sout_StreamIdSend( p_stream->p_next, id->id, p_buffer );
}
-