X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fdemux%2Fpva.c;h=d5ceafb6b9e1cb1e787231aace003026993154ef;hb=9645e735e898e86d823e87a7c7a522b353462c07;hp=b22df5ee290f9c24314f2031418c163931808c50;hpb=91f2877dec9e00d081facbb7b12f610a9f329357;p=vlc diff --git a/modules/demux/pva.c b/modules/demux/pva.c index b22df5ee29..d5ceafb6b9 100644 --- a/modules/demux/pva.c +++ b/modules/demux/pva.c @@ -1,7 +1,7 @@ /***************************************************************************** * pva.c: PVA demuxer ***************************************************************************** - * Copyright (C) 2004 VideoLAN + * Copyright (C) 2004 the VideoLAN team * $Id$ * * Authors: Laurent Aimar @@ -18,20 +18,20 @@ * * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif -/* TODO: - * - ... - */ +#include +#include +#include /***************************************************************************** * Module descriptor @@ -39,14 +39,14 @@ static int Open ( vlc_object_t * ); static void Close ( vlc_object_t * ); -vlc_module_begin(); - set_description( _("PVA demuxer" ) ); - set_capability( "demux2", 10 ); - set_category( CAT_INPUT ); - set_subcategory( SUBCAT_INPUT_DEMUX ); - set_callbacks( Open, Close ); - add_shortcut( "pva" ); -vlc_module_end(); +vlc_module_begin () + set_description( N_("PVA demuxer" ) ) + set_capability( "demux", 10 ) + set_category( CAT_INPUT ) + set_subcategory( SUBCAT_INPUT_DEMUX ) + set_callbacks( Open, Close ) + add_shortcut( "pva" ) +vlc_module_end () /***************************************************************************** * Local prototypes @@ -82,16 +82,14 @@ static int Open( vlc_object_t *p_this ) demux_t *p_demux = (demux_t*)p_this; demux_sys_t *p_sys; es_format_t fmt; - uint8_t *p_peek; + const uint8_t *p_peek; if( stream_Peek( p_demux->s, &p_peek, 5 ) < 5 ) return VLC_EGENERIC; if( p_peek[0] != 'A' || p_peek[1] != 'V' || p_peek[4] != 0x55 ) { /* In case we had forced this demuxer we try to resynch */ - if( strcasecmp( p_demux->psz_demux, "pva" ) || ReSynch( p_demux ) ) - { + if( !p_demux->b_force || ReSynch( p_demux ) ) return VLC_EGENERIC; - } } /* Fill p_demux field */ @@ -100,10 +98,10 @@ static int Open( vlc_object_t *p_this ) p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); /* Register one audio and one video stream */ - es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 'm', 'p', 'g', 'a' ) ); + es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_MPGA ); p_sys->p_audio = es_out_Add( p_demux->out, &fmt ); - es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC( 'm', 'p', 'g', 'v' ) ); + es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_MPGV ); p_sys->p_video = es_out_Add( p_demux->out, &fmt ); p_sys->i_vc = -1; @@ -111,7 +109,7 @@ static int Open( vlc_object_t *p_this ) p_sys->p_pes = NULL; p_sys->p_es = NULL; - p_sys->b_pcr_audio = VLC_FALSE; + p_sys->b_pcr_audio = false; return VLC_SUCCESS; } @@ -138,7 +136,7 @@ static int Demux( demux_t *p_demux ) { demux_sys_t *p_sys = p_demux->p_sys; - uint8_t *p_peek; + const uint8_t *p_peek; int i_size; block_t *p_frame; int64_t i_pts; @@ -296,7 +294,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) f = (double) va_arg( args, double ); i64 = stream_Size( p_demux->s ); - es_out_Control( p_demux->out, ES_OUT_RESET_PCR ); if( stream_Seek( p_demux->s, (int64_t)(i64 * f) ) || ReSynch( p_demux ) ) { return VLC_EGENERIC; @@ -342,11 +339,11 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) *****************************************************************************/ static int ReSynch( demux_t *p_demux ) { - uint8_t *p_peek; + const uint8_t *p_peek; int i_skip; int i_peek; - while( !p_demux->b_die ) + while( vlc_object_alive (p_demux) ) { if( ( i_peek = stream_Peek( p_demux->s, &p_peek, 1024 ) ) < 8 ) { @@ -436,7 +433,7 @@ static void ParsePES( demux_t *p_demux ) if( p_pes->i_pts > 0 ) { es_out_Control( p_demux->out, ES_OUT_SET_PCR, (int64_t)p_pes->i_pts); - p_sys->b_pcr_audio = VLC_TRUE; + p_sys->b_pcr_audio = true; } es_out_Send( p_demux->out, p_sys->p_audio, p_pes ); }