/*****************************************************************************
* nsv.c: NullSoft Video demuxer.
*****************************************************************************
- * Copyright (C) 2004-2007 the VideoLAN team
+ * Copyright (C) 2004-2007 VLC authors and VideoLAN
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
- * 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.
*****************************************************************************/
/*****************************************************************************
*****************************************************************************/
static int ReSynch( demux_t *p_demux )
{
- const uint8_t *p_peek;
- int i_skip;
- int i_peek;
-
- while( vlc_object_alive (p_demux) )
+ for( ;; )
{
- if( ( i_peek = stream_Peek( p_demux->s, &p_peek, 1024 ) ) < 8 )
- {
- return VLC_EGENERIC;
- }
- i_skip = 0;
+ const uint8_t *p_peek;
+ int i_peek = stream_Peek( p_demux->s, &p_peek, 1024 );
+ if( i_peek < 8 )
+ break;
+
+ int i_skip = 0;
while( i_skip < i_peek - 4 )
{
i_skip++;
}
- stream_Read( p_demux->s, NULL, i_skip );
+ if( stream_Read( p_demux->s, NULL, i_skip ) < i_skip )
+ break;
}
return VLC_EGENERIC;
}