/*****************************************************************************
* vlm.c: VLM interface plugin
*****************************************************************************
- * Copyright (C) 2000-2005 the VideoLAN team
+ * Copyright (C) 2000-2005 VLC authors and VideoLAN
* $Id$
*
* Authors: Simon Latapie <garf@videolan.org>
* Laurent Aimar <fenrir@videolan.org>
* Gildas Bazin <gbazin@videolan.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
{
vlm_t *p_vlm = NULL, **pp_vlm = &(libvlc_priv (p_this->p_libvlc)->p_vlm);
char *psz_vlmconf;
- static const char vlm_object_name[] = "vlm daemon";
/* Avoid multiple creation */
vlc_mutex_lock( &vlm_mutex );
msg_Dbg( p_this, "creating VLM" );
p_vlm = vlc_custom_create( p_this->p_libvlc, sizeof( *p_vlm ),
- VLC_OBJECT_GENERIC, vlm_object_name );
+ "vlm daemon" );
if( !p_vlm )
{
vlc_mutex_unlock( &vlm_mutex );
vlc_mutex_lock( &vlm_mutex );
assert( p_vlm->users > 0 );
if( --p_vlm->users == 0 )
- {
- assert( libvlc_priv(p_vlm->p_libvlc)->p_vlm = p_vlm );
- libvlc_priv(p_vlm->p_libvlc)->p_vlm = NULL;
- }
+ assert( libvlc_priv(p_vlm->p_libvlc)->p_vlm == p_vlm );
else
p_vlm = NULL;
- vlc_mutex_unlock( &vlm_mutex );
if( p_vlm == NULL )
+ {
+ vlc_mutex_unlock( &vlm_mutex );
return;
+ }
/* Destroy and release VLM */
vlc_mutex_lock( &p_vlm->lock );
vlc_object_release( p_vlm->p_vod );
}
+ libvlc_priv(p_vlm->p_libvlc)->p_vlm = NULL;
+ vlc_mutex_unlock( &vlm_mutex );
+
vlc_mutex_lock( &p_vlm->lock_manage );
p_vlm->input_state_changed = true;
vlc_cond_signal( &p_vlm->wait_manage );
int canc = vlc_savecancel ();
i_lastcheck = vlm_Date();
- while( !vlm->b_die )
+ while( vlc_object_alive( vlm ) )
{
char **ppsz_scheduled_commands = NULL;
int i_scheduled_commands = 0;
vlc_gc_decref( p_media->vod.p_item );
char *psz_uri = make_URI( p_cfg->ppsz_input[0], NULL );
- p_media->vod.p_item = input_item_New( p_vlm, psz_uri,
- p_cfg->psz_name );
+ p_media->vod.p_item = input_item_New( psz_uri, p_cfg->psz_name );
free( psz_uri );
if( p_cfg->psz_output )
psz_mux = p_cfg->vod.psz_mux;
es_format_t es, *p_es = &es;
- union { char text[5]; uint32_t value; } fourcc;
+ union {
+ char text[5];
+ unsigned char utext[5];
+ uint32_t value;
+ } fourcc;
sprintf( fourcc.text, "%4.4s", psz_mux );
- fourcc.text[0] = tolower(fourcc.text[0]);
- fourcc.text[1] = tolower(fourcc.text[1]);
- fourcc.text[2] = tolower(fourcc.text[2]);
- fourcc.text[3] = tolower(fourcc.text[3]);
+ for( int i = 0; i < 4; i++ )
+ fourcc.utext[i] = tolower(fourcc.utext[i]);
item.i_es = 1;
item.es = &p_es;
if( p_cfg->b_vod && !p_vlm->p_vod )
{
p_vlm->p_vod = vlc_custom_create( VLC_OBJECT(p_vlm), sizeof( vod_t ),
- VLC_OBJECT_GENERIC, "vod server" );
+ "vod server" );
p_vlm->p_vod->p_module = module_need( p_vlm->p_vod, "vod server", "$vod-server", false );
if( !p_vlm->p_vod->p_module )
{
p_media->cfg.id = p_vlm->i_id++;
/* FIXME do we do something here if enabled is true ? */
- p_media->vod.p_item = input_item_New( p_vlm, NULL, NULL );
+ p_media->vod.p_item = input_item_New( NULL, NULL );
p_media->vod.p_media = NULL;
TAB_INIT( p_media->i_instance, p_media->instance );
if( psz_name )
p_instance->psz_name = strdup( psz_name );
- p_instance->p_item = input_item_New( p_vlm, NULL, NULL );
+ p_instance->p_item = input_item_New( NULL, NULL );
p_instance->i_index = 0;
p_instance->b_sout_keep = false;