1 /* dvd_demux.c: DVD demux functions.
2 *****************************************************************************
3 * Copyright (C) 1998-2001 VideoLAN
4 * $Id: dvd_demux.c,v 1.8 2002/07/31 20:56:51 sam Exp $
6 * Author: Stéphane Borel <stef@via.ecp.fr>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 *****************************************************************************/
23 /*****************************************************************************
25 *****************************************************************************/
31 #include <vlc/input.h>
38 #include <sys/types.h>
43 #ifdef STRNCASECMP_IN_STRINGS_H
47 /* how many packets DVDDemux will read in each loop */
48 #define DVD_READ_ONCE 64
50 /*****************************************************************************
52 *****************************************************************************/
53 static int DVDDemux ( input_thread_t * );
55 void DVDLaunchDecoders( input_thread_t * );
58 * Data demux functions
61 /*****************************************************************************
62 * DVDInit: initializes DVD structures
63 *****************************************************************************/
64 int E_(DVDInit) ( vlc_object_t *p_this )
66 input_thread_t *p_input = (input_thread_t *)p_this;
68 if( p_input->stream.i_method != INPUT_METHOD_DVD )
73 p_input->pf_demux = DVDDemux;
74 p_input->pf_rewind = NULL;
76 vlc_mutex_lock( &p_input->stream.stream_lock );
78 DVDLaunchDecoders( p_input );
80 vlc_mutex_unlock( &p_input->stream.stream_lock );
85 /*****************************************************************************
87 *****************************************************************************/
88 static int DVDDemux( input_thread_t * p_input )
90 data_packet_t * p_data;
94 /* Read headers to compute payload length */
95 for( i = 0 ; i < DVD_READ_ONCE ; i++ )
97 i_result = input_ReadPS( p_input, &p_data );
103 else if( i_result == 0 )
108 input_DemuxPS( p_input, p_data );