- return VLC_EGENERIC;
-}
-
-/*****************************************************************************
- * Activate: initializes ogg demux structures
- *****************************************************************************/
-static int Activate( vlc_object_t * p_this )
-{
- input_thread_t *p_input = (input_thread_t *)p_this;
- demux_sys_t *p_ogg;
- int b_forced;
-
- p_input->p_demux_data = NULL;
- b_forced = ( ( *p_input->psz_demux )&&
- ( !strncmp( p_input->psz_demux, "ogg", 10 ) ) ) ? 1 : 0;
-
- /* Check if we are dealing with an ogg stream */
- if( !b_forced && ( Ogg_Check( p_input ) != VLC_SUCCESS ) )
- return -1;
-
- /* Allocate p_ogg */
- if( !( p_ogg = malloc( sizeof( demux_sys_t ) ) ) )
- {
- msg_Err( p_input, "out of memory" );
- goto error;
- }
- memset( p_ogg, 0, sizeof( demux_sys_t ) );
- p_input->p_demux_data = p_ogg;
- p_ogg->pp_stream = NULL;
- p_ogg->p_stream_video = NULL;
- p_ogg->p_stream_audio = NULL;
- p_ogg->p_stream_spu = NULL;
-
- /* Initialize the Ogg physical bitstream parser */
- ogg_sync_init( &p_ogg->oy );
-
- /*Set exported functions */
- p_input->pf_demux = Demux;
- p_input->pf_demux_control = Control;
-
- /* Initialize access plug-in structures. */
- if( p_input->i_mtu == 0 )
- {
- /* Improve speed. */
- p_input->i_bufsize = INPUT_DEFAULT_BUFSIZE;
- }
-
- /* Create one program */
- vlc_mutex_lock( &p_input->stream.stream_lock );
- if( input_InitStream( p_input, 0 ) == -1)
- {
- vlc_mutex_unlock( &p_input->stream.stream_lock );
- msg_Err( p_input, "cannot init stream" );
- goto error;
- }
- if( input_AddProgram( p_input, 0, 0) == NULL )
- {
- vlc_mutex_unlock( &p_input->stream.stream_lock );
- msg_Err( p_input, "cannot add program" );
- goto error;
- }
- p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
- vlc_mutex_unlock( &p_input->stream.stream_lock );
-
- /* Begnning of stream, tell the demux to look for elementary streams. */
- p_ogg->i_eos = 0;
-
- p_ogg->i_prev_sync_state = SYNCHRO_REINIT;
-
- return 0;
-
- error:
- Deactivate( (vlc_object_t *)p_input );
- return -1;