#include <string.h> /* strerror() */
#include <vlc_sout.h>
+#include <vlc_playlist.h>
#include "stream_output.h"
sout_instance_t *__sout_NewInstance( vlc_object_t *p_parent, char * psz_dest )
{
sout_instance_t *p_sout;
- vlc_value_t keep;
-
- if( var_Get( p_parent, "sout-keep", &keep ) < 0 )
- {
- msg_Warn( p_parent, "cannot get sout-keep value" );
- keep.b_bool = VLC_FALSE;
- }
- if( keep.b_bool )
- {
- if( ( p_sout = vlc_object_find( p_parent, VLC_OBJECT_SOUT,
- FIND_ANYWHERE ) ) != NULL )
- {
- if( !strcmp( p_sout->psz_sout, psz_dest ) )
- {
- msg_Dbg( p_parent, "sout keep: reusing sout" );
- msg_Dbg( p_parent, "sout keep: you probably want to use "
- "gather stream_out" );
- vlc_object_detach( p_sout );
- vlc_object_attach( p_sout, p_parent );
- vlc_object_release( p_sout );
- return p_sout;
- }
- else
- {
- msg_Dbg( p_parent, "sout keep: destroying unusable sout" );
- vlc_object_release( p_sout );
- sout_DeleteInstance( p_sout );
- }
- }
- }
- else if( !keep.b_bool )
- {
- while( ( p_sout = vlc_object_find( p_parent, VLC_OBJECT_SOUT,
- FIND_PARENT ) ) != NULL )
- {
- msg_Dbg( p_parent, "sout keep: destroying old sout" );
- vlc_object_release( p_sout );
- sout_DeleteInstance( p_sout );
- }
- }
/* *** Allocate descriptor *** */
p_sout = vlc_object_create( p_parent, VLC_OBJECT_SOUT );
*****************************************************************************/
void sout_DeleteInstance( sout_instance_t * p_sout )
{
- /* Unlink object */
- vlc_object_detach( p_sout );
-
/* remove the stream out chain */
sout_StreamDelete( p_sout->p_stream );
if( p_input )
{
stats_UpdateInteger( p_input, p_input->p->counters.p_sout_sent_packets,
- 30, NULL );
+ 30, NULL );
stats_UpdateInteger( p_input, p_input->p->counters.p_sout_sent_bytes,
p_access->i_sent_bytes, &i_total );
stats_UpdateFloat( p_input, p_input->p->counters.p_sout_send_bitrate,
- (float)i_total, NULL );
+ (float)i_total, NULL );
p_access->i_sent_bytes = 0;
vlc_object_release( p_input );
}