From ade615bfc0c153a408e0ae88b89458c52dc0a0f1 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Fri, 6 Dec 2002 16:34:08 +0000 Subject: [PATCH] * ./configure.ac.in: removed -W in favour of -Wtraditional. * ALL: a bunch of additional warning fixes. --- configure.ac.in | 23 +- include/input_ext-intf.h | 42 +- modules/access/dvd/access.c | 74 ++-- modules/access/dvd/dvd.h | 30 +- modules/access/dvd/es.c | 24 +- modules/access/dvd/seek.c | 52 +-- modules/access/dvd/seek.h | 6 +- modules/access/dvd/udf.c | 161 +++---- modules/access/dvdplay/access.c | 58 +-- modules/access/rtp.c | 34 +- modules/access/vcd/vcd.c | 6 +- modules/audio_filter/converter/a52tospdif.c | 12 +- modules/audio_filter/resampler/ugly.c | 14 +- modules/audio_output/oss.c | 10 +- modules/codec/a52.c | 34 +- .../ffmpeg/postprocessing/postprocessing_c.c | 138 +++--- .../postprocessing/postprocessing_mmx.c | 4 +- .../postprocessing/postprocessing_mmxext.c | 4 +- modules/codec/ffmpeg/video.c | 124 +++--- modules/codec/mad/libmad.c | 8 +- modules/codec/mpeg_audio/decoder.c | 4 +- modules/codec/mpeg_audio/decoder.h | 8 +- modules/codec/mpeg_audio/generic.c | 4 +- modules/codec/mpeg_audio/generic.h | 14 +- modules/codec/spudec/parse.c | 18 +- modules/codec/spudec/spudec.h | 20 +- modules/codec/spudec/subtitler.c | 73 ++-- modules/codec/spudec/text.c | 10 +- modules/control/rc/rc.c | 6 +- modules/demux/asf/asf.c | 154 +++---- modules/demux/asf/libasf.c | 116 ++--- modules/demux/asf/libasf.h | 50 +-- modules/demux/avi/avi.c | 398 +++++++++--------- modules/demux/avi/avi.h | 36 +- modules/demux/avi/libavi.c | 12 +- modules/demux/avi/libavi.h | 6 +- modules/demux/mp4/libmp4.c | 74 ++-- modules/demux/mp4/mp4.c | 46 +- modules/demux/mp4/mp4.h | 70 ++- modules/demux/mpeg/ps.c | 4 +- modules/demux/mpeg/system.c | 87 ++-- modules/demux/mpeg/ts.c | 153 +++---- modules/demux/wav/wav.c | 5 +- modules/gui/gtk/common.h | 8 +- modules/gui/gtk/gtk.c | 4 +- modules/gui/gtk/gtk_callbacks.c | 16 +- modules/gui/gtk/menu.c | 94 ++--- modules/gui/gtk/preferences.c | 18 +- modules/misc/network/ipv4.c | 24 +- modules/video_filter/crop.c | 13 +- modules/video_output/x11/xcommon.c | 41 +- modules/video_output/x11/xcommon.h | 20 +- src/input/input.c | 18 +- src/input/input_dec.c | 10 +- src/input/input_ext-intf.c | 8 +- src/input/input_programs.c | 35 +- src/misc/cpu.c | 6 +- 57 files changed, 1278 insertions(+), 1263 deletions(-) diff --git a/configure.ac.in b/configure.ac.in index 78702b73b5..789bdad7f2 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -460,16 +460,16 @@ fi # fi #done -AC_CACHE_CHECK([if \$CC accepts -W], - [ac_cv_c_W], - [CFLAGS="-W ${CFLAGS_save}" - AC_TRY_COMPILE([],,ac_cv_c_W=yes, ac_cv_c_W=no)]) - AC_CACHE_CHECK([if \$CC accepts -Wall], [ac_cv_c_Wall], [CFLAGS="-Wall ${CFLAGS_save}" AC_TRY_COMPILE([],,ac_cv_c_Wall=yes, ac_cv_c_Wall=no)]) +AC_CACHE_CHECK([if \$CC accepts -Wtraditional], + [ac_cv_c_Wtraditional], + [CFLAGS="-Wtraditional ${CFLAGS_save}" + AC_TRY_COMPILE([],,ac_cv_c_Wtraditional=yes, ac_cv_c_Wtraditional=no)]) + AC_CACHE_CHECK([if \$CC accepts -Wconversion], [ac_cv_c_Wconversion], [CFLAGS="-Wconversion ${CFLAGS_save}" @@ -495,17 +495,18 @@ AC_CACHE_CHECK([if \$CC accepts -Winline], [CFLAGS="-Winline ${CFLAGS_save}" AC_TRY_COMPILE([],,ac_cv_c_Winline=yes, ac_cv_c_Winline=no)]) -if test "x${ac_cv_c_W}" != "xno"; then - CFLAGS_save="-W ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}" - CXXFLAGS_save="-W ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}" - OBJCFLAGS_save="-W ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}" -fi - if test "x${ac_cv_c_Wall}" != "xno"; then CFLAGS_save="-Wall ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}" CXXFLAGS_save="-Wall ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}" OBJCFLAGS_save="-Wall ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}" fi + +if test "x${ac_cv_c_Wtraditional}" != "xno"; then + CFLAGS_save="-Wtraditional ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}" + CXXFLAGS_save="-Wtraditional ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}" + OBJCFLAGS_save="-Wtraditional ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}" +fi + if test "x${ac_cv_c_Wunreachable_code}" != "xno"; then CFLAGS_save="-Wunreachable-code ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}" CXXFLAGS_save="-Wunreachable-code ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}" diff --git a/include/input_ext-intf.h b/include/input_ext-intf.h index 0288182ea6..42dd55d259 100644 --- a/include/input_ext-intf.h +++ b/include/input_ext-intf.h @@ -1,10 +1,10 @@ /***************************************************************************** * input_ext-intf.h: structures of the input exported to the interface * This header provides structures to read the stream descriptors and - * control the pace of reading. + * control the pace of reading. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: input_ext-intf.h,v 1.79 2002/12/06 10:10:40 sam Exp $ + * $Id: input_ext-intf.h,v 1.80 2002/12/06 16:34:03 sam Exp $ * * Authors: Christophe Massiot * @@ -12,7 +12,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -61,7 +61,7 @@ struct es_descriptor_t /* PES parser information */ pes_packet_t * p_pes; /* Current PES */ - int i_pes_real_size; /* as indicated by the header */ + unsigned int i_pes_real_size; /* as indicated by the header */ /* Decoder information */ decoder_fifo_t * p_decoder_fifo; @@ -75,7 +75,7 @@ struct es_descriptor_t #define PROGRAM_ASSOCIATION_TABLE_PID 0x0000 #define CONDITIONNAL_ACCESS_TABLE_PID 0x0001 /* not used */ #define EMPTY_ID 0xffff /* empty record in a table */ - + /* ES Categories to be used by interface plugins */ #define UNKNOWN_ES 0x00 @@ -114,7 +114,7 @@ struct pgrm_descriptor_t /* Demultiplexer data */ pgrm_sys_t * p_demux_data; - int i_es_number; /* size of the following array */ + unsigned int i_es_number; /* size of the following array */ es_descriptor_t ** pp_es; /* array of pointers to ES */ }; @@ -131,7 +131,7 @@ struct pgrm_descriptor_t struct input_area_t { /* selected area attributes */ - int i_id; /* identificator for area */ + unsigned int i_id; /* identificator for area */ off_t i_start; /* start offset of area */ off_t i_size; /* total size of the area * (in arbitrary units) */ @@ -143,8 +143,8 @@ struct input_area_t * (changed by the interface thread */ /* area subdivision */ - int i_part_nb; /* number of parts (chapter for DVD)*/ - int i_part; /* currently selected part */ + unsigned int i_part_nb; /* number of parts (chapter for DVD)*/ + unsigned int i_part; /* currently selected part */ /* offset to plugin related data */ @@ -168,7 +168,7 @@ struct input_info_t { * Value of this item */ char * psz_value; - + /** * Pointer to next item in list, or NULL it at end of list */ @@ -188,12 +188,12 @@ struct input_info_category_t { * The name of this category */ char * psz_name; - + /** * first element of a linked list containing info items */ input_info_t * p_info; - + /** * Pointer to next element in this list, or NULL if at end of list */ @@ -215,13 +215,13 @@ struct stream_descriptor_t * or modify stream, pgrm or es */ /* Input method data */ - int i_method; /* input method for stream: file, + unsigned int i_method; /* input method for stream: file, disc or network */ vlc_bool_t b_pace_control; /* can we read when we want ? */ vlc_bool_t b_seekable; /* can we do lseek() ? */ /* if (b_seekable) : */ - int i_area_nb; + unsigned int i_area_nb; input_area_t ** pp_areas; /* list of areas in stream == offset * interval with own properties */ input_area_t * p_selected_area; @@ -232,7 +232,7 @@ struct stream_descriptor_t * units of 50 bytes/s) ; 0 if undef */ /* New status and rate requested by the interface */ - int i_new_status, i_new_rate; + unsigned int i_new_status, i_new_rate; int b_new_mute; /* int because it can be -1 */ vlc_cond_t stream_wait; /* interface -> input in case of a * status change request */ @@ -241,20 +241,20 @@ struct stream_descriptor_t stream_sys_t * p_demux_data; /* Programs descriptions */ - int i_pgrm_number; /* size of the following array */ + unsigned int i_pgrm_number; /* size of the following array */ pgrm_descriptor_t ** pp_programs; /* array of pointers to pgrm */ - pgrm_descriptor_t * p_selected_program; /* currently + pgrm_descriptor_t * p_selected_program; /* currently selected program */ pgrm_descriptor_t * p_new_program; /* Newly selected program */ /* ES descriptions */ - int i_es_number; + unsigned int i_es_number; es_descriptor_t ** pp_es; /* carried elementary streams */ - int i_selected_es_number; + unsigned int i_selected_es_number; es_descriptor_t ** pp_selected_es; /* ES with a decoder */ es_descriptor_t * p_newly_selected_es; /* ES selected from * the interface */ es_descriptor_t * p_removed_es; /* ES removed from the interface */ - + /* Stream control */ stream_ctrl_t control; @@ -263,7 +263,7 @@ struct stream_descriptor_t /* Input info */ input_info_category_t * p_info; - + /* Statistics */ count_t c_packets_read; /* packets read */ count_t c_packets_trashed; /* trashed packets */ diff --git a/modules/access/dvd/access.c b/modules/access/dvd/access.c index 79cd9345e8..ab17a63a57 100644 --- a/modules/access/dvd/access.c +++ b/modules/access/dvd/access.c @@ -8,7 +8,7 @@ * -udf.* to find files ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: access.c,v 1.5 2002/11/13 20:23:21 fenrir Exp $ + * $Id: access.c,v 1.6 2002/12/06 16:34:04 sam Exp $ * * Author: Stéphane Borel * @@ -16,7 +16,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -104,7 +104,7 @@ int E_(DVDOpen) ( vlc_object_t *p_this ) return -1; } p_input->p_access_data = (void *)p_dvd; - + p_input->pf_read = DVDRead; p_input->pf_seek = DVDSeek; p_input->pf_set_area = DVDSetArea; @@ -116,10 +116,10 @@ int E_(DVDOpen) ( vlc_object_t *p_this ) free( p_dvd ); return -1; } - - /* + + /* * set up input - */ + */ p_input->i_mtu = 0; /* override environment variable DVDCSS_METHOD with config option @@ -146,9 +146,9 @@ int E_(DVDOpen) ( vlc_object_t *p_this ) /* * get plugin ready - */ + */ p_dvd->dvdhandle = dvdcss_open( psz_device ); - + /* free allocated string */ free( psz_device ); @@ -210,7 +210,7 @@ int E_(DVDOpen) ( vlc_object_t *p_this ) /* Titles are Program Chains */ area[i]->i_id = i; - /* Absolute start offset and size + /* Absolute start offset and size * We can only set that with vts ifo, so we do it during the * first call to DVDSetArea */ area[i]->i_start = 0; @@ -223,23 +223,23 @@ int E_(DVDOpen) ( vlc_object_t *p_this ) /* Offset to vts_i_0.ifo */ area[i]->i_plugin_data = p_dvd->p_ifo->i_start + title_inf.p_attr[i-1].i_start_sector; - } + } #undef area - + p_dvd->i_title = p_dvd->i_title <= title_inf.i_title_nb ? p_dvd->i_title : 1; #undef title_inf p_area = p_input->stream.pp_areas[p_dvd->i_title]; - + p_area->i_part = p_dvd->i_chapter <= p_area->i_part_nb ? p_dvd->i_chapter : 1; p_dvd->i_chapter = 1; - + p_dvd->b_new_chapter = 0; p_dvd->i_audio_nb = 0; p_dvd->i_spu_nb = 0; - + /* set title, chapter, audio and subpic */ if( DVDSetArea( p_input, p_area ) < 0 ) { @@ -277,13 +277,13 @@ void E_(DVDClose) ( vlc_object_t *p_this ) * DVDSetProgram: used to change angle *****************************************************************************/ static int DVDSetProgram( input_thread_t * p_input, - pgrm_descriptor_t * p_program ) + pgrm_descriptor_t * p_program ) { if( p_input->stream.p_selected_program != p_program ) { thread_dvd_data_t * p_dvd; int i_angle; - + p_dvd = (thread_dvd_data_t*)(p_input->p_access_data); i_angle = p_program->i_number; @@ -342,7 +342,7 @@ static void DVDFlushStream( input_thread_t * p_input ) { input_DelES( p_input, p_input->stream.pp_es[0] ); } - + while( p_input->stream.i_pgrm_number ) { input_DelProgram( p_input, p_input->stream.pp_programs[0] ); @@ -367,7 +367,7 @@ static int DVDReadAngle( input_thread_t * p_input ) p_dvd = (thread_dvd_data_t*)(p_input->p_access_data); i_angle_nb = vmg.title_inf.p_attr[p_dvd->i_title-1].i_angle_nb; - + input_AddProgram( p_input, 1, sizeof( stream_ps_data_t ) ); p_input->stream.p_selected_program = p_input->stream.pp_programs[0]; @@ -459,16 +459,16 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) /* Destroy obsolete ES by reinitializing programs */ DVDFlushStream( p_input ); - + /* Angle management: angles are handled through programs */ p_dvd->i_angle_nb = DVDReadAngle( p_input ); if( ( p_dvd->i_angle <= 0 ) || p_dvd->i_angle > p_dvd->i_angle_nb ) { p_dvd->i_angle = 1; } - + DVDSetProgram( p_input, - p_input->stream.pp_programs[p_dvd->i_angle-1] ); + p_input->stream.pp_programs[p_dvd->i_angle-1] ); msg_Dbg( p_input, "title first %i, last %i, size %i", i_first, i_last, i_last + 1 - p_dvd->i_vts_lb ); @@ -481,7 +481,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) DVDReadVideo( p_input ); DVDReadAudio( p_input ); DVDReadSPU ( p_input ); - + if( p_input->p_demux ) { DVDLaunchDecoders( p_input ); @@ -495,7 +495,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) /* Chapter selection */ p_dvd->i_chapter = DVDSetChapter( p_dvd, p_area->i_part ); - + p_input->stream.p_selected_area->i_tell = DVDTell; /* warn interface that something has changed */ @@ -509,7 +509,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) #define title \ p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title - + /***************************************************************************** * DVDRead: reads data packets. ***************************************************************************** @@ -596,7 +596,7 @@ static ssize_t DVDRead( input_thread_t * p_input, static void DVDSeek( input_thread_t * p_input, off_t i_off ) { thread_dvd_data_t * p_dvd; - + p_dvd = ( thread_dvd_data_t * )(p_input->p_access_data); vlc_mutex_lock( &p_input->stream.stream_lock ); @@ -606,7 +606,7 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off ) p_dvd->i_prg_cell = Lb2CellPrg( p_dvd ); p_dvd->i_map_cell = Lb2CellMap( p_dvd ); - + if( CellIsInterleaved( p_dvd ) ) { /* if we're inside a multi-angle zone, we have to choose i_sector @@ -614,7 +614,7 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off ) * can be very wide out of such zones */ p_dvd->i_vts_lb = CellFirstSector( p_dvd ); } - + p_dvd->i_last_lb = CellLastSector( p_dvd ); p_dvd->i_chapter = CellPrg2Chapter( p_dvd ); @@ -694,7 +694,7 @@ static char * DVDParse( input_thread_t * p_input ) { psz_parser++; } - + if( *psz_parser == '@' ) { /* found end of raw device, and beginning of options */ @@ -766,8 +766,8 @@ static char * DVDParse( input_thread_t * p_input ) else { char * psz_env; - -#ifndef WIN32 + +#ifndef WIN32 if( !S_ISCHR(stat_info.st_mode) ) { msg_Warn( p_input, "raw device %s is" @@ -791,11 +791,11 @@ static char * DVDParse( input_thread_t * p_input ) psz_raw = ""; } } - + if( !*psz_device ) { free( psz_device ); - + if( !p_input->psz_access ) { /* no device and no access specified: we probably don't want DVD */ @@ -804,16 +804,16 @@ static char * DVDParse( input_thread_t * p_input ) psz_device = config_GetPsz( p_input, "dvd" ); } -#ifndef WIN32 +#ifndef WIN32 /* check block device */ if( stat( psz_device, &stat_info ) == -1 ) { msg_Err( p_input, "cannot stat() device `%s' (%s)", psz_device, strerror(errno)); free( psz_device ); - return NULL; + return NULL; } - + if( !S_ISBLK(stat_info.st_mode) && !S_ISCHR(stat_info.st_mode) ) { msg_Warn( p_input, @@ -822,10 +822,10 @@ static char * DVDParse( input_thread_t * p_input ) return NULL; } #endif - + msg_Dbg( p_input, "dvd=%s raw=%s title=%d chapter=%d angle=%d", psz_device, psz_raw, p_dvd->i_title, p_dvd->i_chapter, p_dvd->i_angle ); return psz_device; -} +} diff --git a/modules/access/dvd/dvd.h b/modules/access/dvd/dvd.h index edd7efd080..4c7832b677 100644 --- a/modules/access/dvd/dvd.h +++ b/modules/access/dvd/dvd.h @@ -2,7 +2,7 @@ * dvd.h: thread structure of the DVD plugin ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: dvd.h,v 1.1 2002/08/04 17:23:41 sam Exp $ + * $Id: dvd.h,v 1.2 2002/12/06 16:34:04 sam Exp $ * * Author: Stéphane Borel * @@ -36,27 +36,27 @@ typedef struct thread_dvd_data_s { dvdcss_handle dvdhandle; /* libdvdcss handle */ - int i_audio_nb; - int i_spu_nb; + unsigned int i_audio_nb; + unsigned int i_spu_nb; /* Navigation information */ - int i_title; - int i_title_id; + unsigned int i_title; + unsigned int i_title_id; - int i_chapter_nb; - int i_chapter; + unsigned int i_chapter_nb; + unsigned int i_chapter; vlc_bool_t b_new_chapter; - int i_angle_nb; - int i_angle; + unsigned int i_angle_nb; + unsigned int i_angle; - int i_map_cell; /* cell index in adress map */ - int i_prg_cell; /* cell index in program map */ - int i_angle_cell; /* cell index in the current angle */ + unsigned int i_map_cell; /* cell index in adress map */ + unsigned int i_prg_cell; /* cell index in program map */ + unsigned int i_angle_cell; /* cell index in the current angle */ - int i_vts_start; /* offset to beginning of vts */ - int i_vts_lb; /* sector in vts */ - int i_last_lb; /* last sector of current cell */ + unsigned int i_vts_start; /* offset to beginning of vts */ + unsigned int i_vts_lb; /* sector in vts */ + unsigned int i_last_lb; /* last sector of current cell */ /* Structure that contains all information of the DVD */ struct ifo_s * p_ifo; diff --git a/modules/access/dvd/es.c b/modules/access/dvd/es.c index 15b9ca9928..d228806d8e 100644 --- a/modules/access/dvd/es.c +++ b/modules/access/dvd/es.c @@ -1,7 +1,7 @@ /* es.c: functions to find and select ES ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: es.c,v 1.3 2002/11/05 18:25:43 gbazin Exp $ + * $Id: es.c,v 1.4 2002/12/06 16:34:04 sam Exp $ * * Author: Stéphane Borel * @@ -9,7 +9,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -91,7 +91,7 @@ void DVDReadVideo( input_thread_t * p_input ) /* ES 0 -> video MPEG2 */ IfoPrintVideo( p_dvd ); i_ratio = vts.manager_inf.video_attr.i_ratio; - + if( i_ratio ) { ADDES( 0xe0, 0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0, sizeof(int) ); @@ -101,7 +101,7 @@ void DVDReadVideo( input_thread_t * p_input ) { ADDES( 0xe0, 0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0, 0 ); } - + } /***************************************************************************** @@ -109,7 +109,7 @@ void DVDReadVideo( input_thread_t * p_input ) *****************************************************************************/ #define audio_status \ vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_audio_status[i-1] - + void DVDReadAudio( input_thread_t * p_input ) { thread_dvd_data_t * p_dvd; @@ -120,7 +120,7 @@ void DVDReadAudio( input_thread_t * p_input ) p_dvd = (thread_dvd_data_t*)(p_input->p_access_data); p_dvd->i_audio_nb = 0; - + /* Audio ES, in the order they appear in .ifo */ for( i = 1 ; i <= vts.manager_inf.i_audio_nb ; i++ ) { @@ -184,7 +184,7 @@ void DVDReadSPU( input_thread_t * p_input ) es_descriptor_t * p_es; int i_id; int i; - + p_dvd = (thread_dvd_data_t*)(p_input->p_access_data); p_dvd->i_spu_nb = 0; @@ -226,7 +226,7 @@ void DVDReadSPU( input_thread_t * p_input ) sizeof(int) + 16*sizeof(u32) ); *(int*)p_es->p_demux_data = 0xBeeF; memcpy( (char*)p_es->p_demux_data + sizeof(int), - palette, 16*sizeof(u32) ); + palette, 16*sizeof(u32) ); } else { @@ -248,8 +248,8 @@ void DVDReadSPU( input_thread_t * p_input ) void DVDLaunchDecoders( input_thread_t * p_input ) { thread_dvd_data_t * p_dvd; - int i_audio; - int i_spu; + unsigned int i_audio; + unsigned int i_spu; p_dvd = (thread_dvd_data_t*)(p_input->p_access_data); @@ -266,7 +266,7 @@ void DVDLaunchDecoders( input_thread_t * p_input ) config_PutInt( p_input, "audio-channel", 1 ); i_audio = 1; } - + if( ( config_GetInt( p_input, "audio-type" ) == REQUESTED_A52 ) ) { @@ -303,7 +303,7 @@ void DVDLaunchDecoders( input_thread_t * p_input ) } if( i_spu > 0 ) { - int i = 0, j = 0; + unsigned int i = 0, j = 0; for( i = 0; i < p_input->stream.i_es_number; i++ ) { if ( p_input->stream.pp_es[i]->i_fourcc diff --git a/modules/access/dvd/seek.c b/modules/access/dvd/seek.c index 89cc163e31..2f0f4bbbb6 100644 --- a/modules/access/dvd/seek.c +++ b/modules/access/dvd/seek.c @@ -1,7 +1,7 @@ /* seek.c: functions to navigate through DVD. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: seek.c,v 1.2 2002/08/08 00:35:10 sam Exp $ + * $Id: seek.c,v 1.3 2002/12/06 16:34:04 sam Exp $ * * Author: Stéphane Borel * @@ -9,7 +9,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -82,24 +82,24 @@ int CellPrg2Map( thread_dvd_data_t * p_dvd ) { i_cell++; } - + if( i_cell >= cell.i_cell_nb ) { return -1; } - return i_cell; + return i_cell; } int CellAngleOffset( thread_dvd_data_t * p_dvd, int i_prg_cell ) { int i_cell_off; - + if( i_prg_cell >= title.i_cell_nb ) { return 0; } - + /* basic handling of angles */ switch( ( ( title.p_cell_play[i_prg_cell].i_category & 0xf000 ) >> 12 ) ) @@ -126,7 +126,7 @@ int CellFirstSector( thread_dvd_data_t * p_dvd ) return __MAX( cell.p_cell_map[p_dvd->i_map_cell].i_first_sector, title.p_cell_play[p_dvd->i_prg_cell].i_first_sector ); } - + int CellLastSector( thread_dvd_data_t * p_dvd ) { return __MIN( cell.p_cell_map[p_dvd->i_map_cell].i_last_sector, @@ -135,8 +135,8 @@ int CellLastSector( thread_dvd_data_t * p_dvd ) int NextCellPrg( thread_dvd_data_t * p_dvd ) { - int i_cell = p_dvd->i_prg_cell; - + unsigned int i_cell = p_dvd->i_prg_cell; + if( p_dvd->i_vts_lb > title.p_cell_play[i_cell].i_last_sector ) { i_cell ++; @@ -147,14 +147,14 @@ int NextCellPrg( thread_dvd_data_t * p_dvd ) return -1; } } - + return i_cell; } int Lb2CellPrg( thread_dvd_data_t * p_dvd ) { - int i_cell = 0; - + unsigned int i_cell = 0; + while( p_dvd->i_vts_lb > title.p_cell_play[i_cell].i_last_sector ) { i_cell ++; @@ -165,14 +165,14 @@ int Lb2CellPrg( thread_dvd_data_t * p_dvd ) return -1; } } - + return i_cell; } int Lb2CellMap( thread_dvd_data_t * p_dvd ) { int i_cell = 0; - + while( p_dvd->i_vts_lb > cell.p_cell_map[i_cell].i_last_sector ) { i_cell ++; @@ -182,7 +182,7 @@ int Lb2CellMap( thread_dvd_data_t * p_dvd ) return -1; } } - + return i_cell; } @@ -211,7 +211,7 @@ int LbMaxOnce( thread_dvd_data_t * p_dvd ) p_dvd->i_vts_lb = CellFirstSector( p_dvd ); p_dvd->i_last_lb = CellLastSector( p_dvd ); - + p_dvd->i_chapter = NextChapter( p_dvd ); if( p_dvd->i_chapter < 0 ) { @@ -239,14 +239,14 @@ int LbMaxOnce( thread_dvd_data_t * p_dvd ) int CellPrg2Chapter( thread_dvd_data_t * p_dvd ) { - int i_chapter = 1; - int i_cell = p_dvd->i_prg_cell; - + unsigned int i_chapter = 1; + unsigned int i_cell = p_dvd->i_prg_cell; + if( CellIsInterleaved( p_dvd ) ) { i_cell -= (p_dvd->i_angle - 1); } - + while( title.chapter_map.pi_start_cell[i_chapter] <= i_cell+1 ) { i_chapter ++; @@ -262,12 +262,12 @@ int CellPrg2Chapter( thread_dvd_data_t * p_dvd ) int NextChapter( thread_dvd_data_t * p_dvd ) { int i_cell = p_dvd->i_prg_cell; - + if( CellIsInterleaved( p_dvd ) ) { i_cell -= (p_dvd->i_angle - 1); } - + if( title.chapter_map.pi_start_cell[p_dvd->i_chapter] <= i_cell+1 ) { p_dvd->i_chapter++; @@ -285,13 +285,13 @@ int NextChapter( thread_dvd_data_t * p_dvd ) -int DVDSetChapter( thread_dvd_data_t * p_dvd, int i_chapter ) +int DVDSetChapter( thread_dvd_data_t * p_dvd, unsigned int i_chapter ) { if( i_chapter <= 0 || i_chapter > p_dvd->i_chapter_nb ) { i_chapter = 1; } - + if( p_dvd->i_chapter != i_chapter ) { /* Find cell index in Program chain for current chapter */ @@ -315,13 +315,13 @@ int DVDSetChapter( thread_dvd_data_t * p_dvd, int i_chapter ) #endif return -1; } - + #if 0 intf_WarnMsg( 4, "dvd info: chapter %d prg_cell %d map_cell %d", i_chapter, p_dvd->i_prg_cell, p_dvd->i_map_cell ); #endif } - + return i_chapter; } diff --git a/modules/access/dvd/seek.h b/modules/access/dvd/seek.h index 5b334a1b91..4494915977 100644 --- a/modules/access/dvd/seek.h +++ b/modules/access/dvd/seek.h @@ -1,7 +1,7 @@ /* dvd_seek.h: DVD access plugin. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: seek.h,v 1.1 2002/08/04 17:23:41 sam Exp $ + * $Id: seek.h,v 1.2 2002/12/06 16:34:04 sam Exp $ * * Author: Stéphane Borel * @@ -9,7 +9,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -33,5 +33,5 @@ int LbMaxOnce ( thread_dvd_data_t * ); int CellPrg2Chapter ( thread_dvd_data_t * ); int NextChapter ( thread_dvd_data_t * ); -int DVDSetChapter ( thread_dvd_data_t *, int ); +int DVDSetChapter ( thread_dvd_data_t *, unsigned int ); diff --git a/modules/access/dvd/udf.c b/modules/access/dvd/udf.c index 0f1ab2077c..741906c2b1 100644 --- a/modules/access/dvd/udf.c +++ b/modules/access/dvd/udf.c @@ -5,7 +5,7 @@ * contains the basic udf handling functions ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: udf.c,v 1.3 2002/08/08 22:28:22 sam Exp $ + * $Id: udf.c,v 1.4 2002/12/06 16:34:04 sam Exp $ * * Author: Stéphane Borel * @@ -17,7 +17,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -63,28 +63,28 @@ typedef struct partition_s { vlc_bool_t b_valid; - u8 pi_volume_desc[128]; - u16 i_flags; - u16 i_number; - u8 pi_contents[32]; - u32 i_access_type; - u32 i_start; - u32 i_length; + uint8_t pi_volume_desc[128]; + uint16_t i_flags; + uint16_t i_number; + uint8_t pi_contents[32]; + uint32_t i_access_type; + uint32_t i_start; + uint32_t i_length; dvdcss_handle dvdhandle; } partition_t; typedef struct ad_s { - u32 i_location; - u32 i_length; - u8 i_flags; - u16 i_partition; + uint32_t i_location; + uint32_t i_length; + uint8_t i_flags; + uint16_t i_partition; } ad_t; /* for direct data access, LSB first */ -#define GETN1(p) ((u8)pi_data[p]) -#define GETN2(p) ((u16)pi_data[p]|((u16)pi_data[(p)+1]<<8)) -#define GETN4(p) ((u32)pi_data[p]|((u32)pi_data[(p)+1]<<8)|((u32)pi_data[(p)+2]<<16)|((u32)pi_data[(p)+3]<<24)) +#define GETN1(p) ((uint8_t)pi_data[p]) +#define GETN2(p) ((uint16_t)pi_data[p]|((uint16_t)pi_data[(p)+1]<<8)) +#define GETN4(p) ((uint32_t)pi_data[p]|((uint32_t)pi_data[(p)+1]<<8)|((uint32_t)pi_data[(p)+2]<<16)|((uint32_t)pi_data[(p)+3]<<24)) #define GETN(p,n,target) memcpy(target,&pi_data[p],n) @@ -94,7 +94,7 @@ typedef struct ad_s * Returns number of read bytes on success, 0 on error *****************************************************************************/ static int UDFReadLB( dvdcss_handle dvdhandle, off_t i_lba, - size_t i_block_count, u8 *pi_data ) + size_t i_block_count, uint8_t *pi_data ) { if( dvdcss_seek( dvdhandle, i_lba, DVDCSS_NOFLAGS ) < 0 ) { @@ -111,7 +111,7 @@ static int UDFReadLB( dvdcss_handle dvdhandle, off_t i_lba, /***************************************************************************** * UDFDecode: decode unicode encoded udf data *****************************************************************************/ -static int UDFDecode( u8 * pi_data, int i_len, char * psz_target ) +static int UDFDecode( uint8_t * pi_data, int i_len, char * psz_target ) { int p = 1; int i = 0; @@ -139,7 +139,7 @@ static int UDFDecode( u8 * pi_data, int i_len, char * psz_target ) psz_target[i++] = pi_data[p++]; } } - + psz_target[i]='\0'; return 0; @@ -150,7 +150,7 @@ static int UDFDecode( u8 * pi_data, int i_len, char * psz_target ) * **/ -int UDFEntity (u8 *data, u8 *Flags, char *Identifier) +int UDFEntity (uint8_t *data, uint8_t *Flags, char *Identifier) { Flags[0] = data[0]; strncpy (Identifier, &data[1], 5); @@ -163,7 +163,7 @@ int UDFEntity (u8 *data, u8 *Flags, char *Identifier) /***************************************************************************** * UDFDescriptor: gives a tag ID from your data to find out what it refers to *****************************************************************************/ -static int UDFDescriptor( u8 * pi_data, u16 * pi_tag_id ) +static int UDFDescriptor( uint8_t * pi_data, uint16_t * pi_tag_id ) { pi_tag_id[0] = GETN2( 0 ); /* TODO: check CRC 'n stuff */ @@ -175,7 +175,8 @@ static int UDFDescriptor( u8 * pi_data, u16 * pi_tag_id ) /***************************************************************************** * UDFExtendAD: main volume information *****************************************************************************/ -static int UDFExtentAD (u8 * pi_data, u32 * pi_length, u32 * pi_location) +static int UDFExtentAD ( uint8_t * pi_data, uint32_t * pi_length, + uint32_t * pi_location) { pi_length[0] = GETN4( 0 ); pi_location[0] = GETN4( 4 ); @@ -187,7 +188,7 @@ static int UDFExtentAD (u8 * pi_data, u32 * pi_length, u32 * pi_location) /***************************************************************************** * UDFAD: file set information *****************************************************************************/ -static int UDFAD( u8 * pi_data, struct ad_s * p_ad, u8 i_type, +static int UDFAD( uint8_t * pi_data, struct ad_s * p_ad, uint8_t i_type, struct partition_s partition ) { p_ad->i_length = GETN4( 0 ); @@ -220,7 +221,8 @@ static int UDFAD( u8 * pi_data, struct ad_s * p_ad, u8 i_type, /***************************************************************************** * UDFICB: takes Information Control Block from pi_data *****************************************************************************/ -static int UDFICB( u8 * pi_data, u8 * pi_file_type, u16 * pi_flags) +static int UDFICB( uint8_t * pi_data, uint8_t * pi_file_type, + uint16_t * pi_flags) { pi_file_type[0] = GETN1( 11 ); pi_flags[0] = GETN2( 18 ); @@ -232,8 +234,9 @@ static int UDFICB( u8 * pi_data, u8 * pi_file_type, u16 * pi_flags) /***************************************************************************** * UDFPartition: gets partition descriptor *****************************************************************************/ -static int UDFPartition( u8 * pi_data, u16 * pi_flags, u16 * pi_nb, - byte_t * ps_contents, u32 * pi_start, u32 * pi_length ) +static int UDFPartition( uint8_t * pi_data, uint16_t * pi_flags, + uint16_t * pi_nb, byte_t * ps_contents, + uint32_t * pi_start, uint32_t * pi_length ) { pi_flags[0] = GETN2( 20 ); pi_nb[0] = GETN2( 22 ); @@ -250,11 +253,11 @@ static int UDFPartition( u8 * pi_data, u16 * pi_flags, u16 * pi_nb, ***************************************************************************** * Returns 0 on OK, 1 on error *****************************************************************************/ -static int UDFLogVolume(u8 * pi_data, byte_t * p_volume_descriptor ) +static int UDFLogVolume( uint8_t * pi_data, byte_t * p_volume_descriptor ) { - u32 i_lb_size; - u32 i_MT_L; - u32 i_N_PM; + uint32_t i_lb_size; + uint32_t i_MT_L; + uint32_t i_N_PM; UDFDecode( &pi_data[84], 128, (char *)p_volume_descriptor ); @@ -277,14 +280,14 @@ static int UDFLogVolume(u8 * pi_data, byte_t * p_volume_descriptor ) /***************************************************************************** * UDFFileEntry: fills a ad_t struct with information at pi_data *****************************************************************************/ -static int UDFFileEntry( u8 * pi_data, u8 * pi_file_type, struct ad_s * p_ad, - struct partition_s partition ) +static int UDFFileEntry( uint8_t * pi_data, uint8_t * pi_file_type, + struct ad_s * p_ad, struct partition_s partition ) { - u8 i_file_type; - u16 i_flags; - u32 i_L_EA; - u32 i_L_AD; - int p; + uint8_t i_file_type; + uint16_t i_flags; + uint32_t i_L_EA; + uint32_t i_L_AD; + unsigned int p; UDFICB( &pi_data[16], &i_file_type, &i_flags ); @@ -335,14 +338,14 @@ static int UDFFileEntry( u8 * pi_data, u8 * pi_file_type, struct ad_s * p_ad, /***************************************************************************** * UDFFileIdentifier: gives filename and characteristics of pi_data *****************************************************************************/ -static int UDFFileIdentifier( u8 * pi_data, u8 * pi_file_characteristics, +static int UDFFileIdentifier( uint8_t * pi_data, uint8_t * pi_file_info, char * psz_filename, struct ad_s * p_file_icb, struct partition_s partition ) { - u8 i_L_FI; - u16 i_L_IU; - - pi_file_characteristics[0] = GETN1( 18 ); + uint8_t i_L_FI; + uint16_t i_L_IU; + + pi_file_info[0] = GETN1( 18 ); i_L_FI = GETN1( 19 ); UDFAD( &pi_data[20], p_file_icb, UDFADlong, partition ); i_L_IU = GETN2( 36 ); @@ -368,12 +371,12 @@ static int UDFFileIdentifier( u8 * pi_data, u8 * pi_file_characteristics, * File: Location of file the ICB is pointing to * return 1 on success, 0 on error; *****************************************************************************/ -static int UDFMapICB( struct ad_s icb, u8 * pi_file_type, struct ad_s * p_file, - struct partition_s partition ) +static int UDFMapICB( struct ad_s icb, uint8_t * pi_file_type, + struct ad_s * p_file, struct partition_s partition ) { - u8 pi_lb[DVD_LB_SIZE]; - u32 i_lba; - u16 i_tag_id; + uint8_t pi_lb[DVD_LB_SIZE]; + uint32_t i_lba; + uint16_t i_tag_id; i_lba = partition.i_start + icb.i_location; @@ -411,13 +414,13 @@ static int UDFMapICB( struct ad_s icb, u8 * pi_file_type, struct ad_s * p_file, static int UDFScanDir( struct ad_s dir, char * psz_filename, struct ad_s * p_file_icb, struct partition_s partition ) { - u8 pi_lb[2*DVD_LB_SIZE]; - u32 i_lba; - u16 i_tag_id; - u8 i_file_char; - char psz_temp[DVD_LB_SIZE]; - int p; - + uint8_t pi_lb[2*DVD_LB_SIZE]; + uint32_t i_lba; + uint16_t i_tag_id; + uint8_t i_file_char; + char psz_temp[DVD_LB_SIZE]; + unsigned int p; + /* Scan dir for ICB of file */ i_lba = partition.i_start + dir.i_location; #if 0 @@ -503,22 +506,22 @@ static int UDFScanDir( struct ad_s dir, char * psz_filename, *****************************************************************************/ static int UDFFindPartition( int i_part_nb, struct partition_s *p_partition ) { - u8 pi_lb[DVD_LB_SIZE]; - u8 pi_anchor[DVD_LB_SIZE]; - u16 i_tag_id; - u32 i_lba; - u32 i_MVDS_location; - u32 i_MVDS_length; - u32 i_last_sector; + uint8_t pi_lb[DVD_LB_SIZE]; + uint8_t pi_anchor[DVD_LB_SIZE]; + uint16_t i_tag_id; + uint32_t i_lba; + uint32_t i_MVDS_location; + uint32_t i_MVDS_length; + uint32_t i_last_sector; vlc_bool_t b_term; vlc_bool_t b_vol_valid; int i; /* Find Anchor */ i_last_sector = 0; - + /* try #1, prime anchor */ - i_lba = 256; + i_lba = 256; b_term = 0; /* Search anchor loop */ @@ -534,7 +537,7 @@ static int UDFFindPartition( int i_part_nb, struct partition_s *p_partition ) } if( i_tag_id != 2 ) - { + { /* not an anchor? */ if( b_term ) { @@ -546,10 +549,10 @@ static int UDFFindPartition( int i_part_nb, struct partition_s *p_partition ) { /* we already found the last sector * try #3, alternative backup anchor */ - i_lba = i_last_sector; - + i_lba = i_last_sector; + /* but that's just about enough, then! */ - b_term = 1; + b_term = 1; } else { @@ -557,7 +560,7 @@ static int UDFFindPartition( int i_part_nb, struct partition_s *p_partition ) if( i_last_sector ) { /* try #2, backup anchor */ - i_lba = i_last_sector - 256; + i_lba = i_last_sector - 256; } else { @@ -575,7 +578,7 @@ static int UDFFindPartition( int i_part_nb, struct partition_s *p_partition ) /* main volume descriptor */ UDFExtentAD( &pi_anchor[16], &i_MVDS_length, &i_MVDS_location ); - + p_partition->b_valid = 0; b_vol_valid = 0; p_partition->pi_volume_desc[0] = '\0'; @@ -612,7 +615,7 @@ static int UDFFindPartition( int i_part_nb, struct partition_s *p_partition ) { /* Logical Volume Descriptor */ if( UDFLogVolume( pi_lb , p_partition->pi_volume_desc ) ) - { + { /* TODO: sector size wrong! */ } else @@ -625,7 +628,7 @@ static int UDFFindPartition( int i_part_nb, struct partition_s *p_partition ) ( i_MVDS_length - 1 ) / DVD_LB_SIZE ) && ( i_tag_id != 8 ) && ( ( !p_partition->b_valid ) || ( !b_vol_valid ) ) ); - + if( ( !p_partition->b_valid ) || ( !b_vol_valid ) ) { /* backup volume descriptor */ @@ -645,20 +648,20 @@ static int UDFFindPartition( int i_part_nb, struct partition_s *p_partition ) * starting with '/'. * returns absolute LB number, or 0 on error *****************************************************************************/ -u32 DVDUDFFindFile( dvdcss_handle dvdhandle, char * psz_path ) +uint32_t DVDUDFFindFile( dvdcss_handle dvdhandle, char * psz_path ) { struct partition_s partition; struct ad_s root_icb; struct ad_s file; struct ad_s icb; - u32 i_lba; - u16 i_tag_id; - u8 pi_lb[DVD_LB_SIZE]; - u8 i_file_type; + uint32_t i_lba; + uint16_t i_tag_id; + uint8_t pi_lb[DVD_LB_SIZE]; + uint8_t i_file_type; char psz_tokenline[DVD_LB_SIZE] = ""; char * psz_token; int i_partition; - + strcat( psz_tokenline, psz_path ); /* Init file descriptor of UDF filesystem (== DVD) */ @@ -673,7 +676,7 @@ u32 DVDUDFFindFile( dvdcss_handle dvdhandle, char * psz_path ) #endif return 0; } - + /* Find root dir ICB */ i_lba = partition.i_start; @@ -711,7 +714,7 @@ u32 DVDUDFFindFile( dvdcss_handle dvdhandle, char * psz_path ) #endif return 0; } - + /* Find root dir */ if( !UDFMapICB( root_icb, &i_file_type, &file, partition ) ) { diff --git a/modules/access/dvdplay/access.c b/modules/access/dvdplay/access.c index 2d3036a06b..3afedf4655 100644 --- a/modules/access/dvdplay/access.c +++ b/modules/access/dvdplay/access.c @@ -2,7 +2,7 @@ * access.c: access capabilities for dvdplay plugin. ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: access.c,v 1.6 2002/11/13 20:23:21 fenrir Exp $ + * $Id: access.c,v 1.7 2002/12/06 16:34:04 sam Exp $ * * Author: Stéphane Borel * @@ -10,7 +10,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -78,12 +78,12 @@ int E_(OpenDVD) ( vlc_object_t *p_this ) char * psz_source; dvd_data_t * p_dvd; input_area_t * p_area; - int i_title_nr; - int i_title; - int i_chapter; - int i_angle; - int i; - + unsigned int i_title_nr; + unsigned int i_title; + unsigned int i_chapter; + unsigned int i_angle; + unsigned int i; + p_dvd = malloc( sizeof(dvd_data_t) ); if( p_dvd == NULL ) { @@ -99,7 +99,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this ) p_input->pf_set_program = dvdplay_SetProgram; /* command line */ - if( ( psz_source = dvdplay_ParseCL( p_input, + if( ( psz_source = dvdplay_ParseCL( p_input, &i_title, &i_chapter, &i_angle ) ) == NULL ) { free( p_dvd ); @@ -122,7 +122,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this ) p_dvd->p_intf = NULL; p_dvd->i_still_time = 0; - + /* set up input */ p_input->i_mtu = 0; @@ -133,7 +133,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this ) p_input->stream.b_pace_control = 1; /* seek is only allowed when we have size info */ p_input->stream.b_seekable = 0; - + /* Initialize ES structures */ input_InitStream( p_input, sizeof( stream_ps_data_t ) ); @@ -145,11 +145,11 @@ int E_(OpenDVD) ( vlc_object_t *p_this ) /* Area 0 for menu */ area[0]->i_plugin_data = 0; - + for( i = 1 ; i <= i_title_nr ; i++ ) { input_AddArea( p_input ); - + /* Titles id */ area[i]->i_id = i; @@ -173,7 +173,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this ) vlc_mutex_unlock( &p_input->stream.stream_lock ); return -1; } - + if( i_angle <= p_input->stream.i_pgrm_number ) { dvdplay_SetProgram( p_input, @@ -242,7 +242,7 @@ static int dvdplay_SetProgram( input_thread_t * p_input, { dvd_data_t * p_dvd; int i_angle; - + p_dvd = (dvd_data_t*)(p_input->p_access_data); i_angle = p_program->i_number; @@ -279,17 +279,17 @@ static int dvdplay_SetArea( input_thread_t * p_input, input_area_t * p_area ) if( p_area != p_input->stream.p_selected_area ) { int i_chapter; - + /* prevent intf to try to seek */ p_input->stream.b_seekable = 0; - + /* Store selected chapter */ i_chapter = p_area->i_part; dvdNewArea( p_input, p_area ); - + dvdplay_start( p_dvd->vmg, p_area->i_id ); - + p_area->i_part = i_chapter; } /* i_title >= 0 */ else @@ -350,7 +350,7 @@ static int dvdplay_Read( input_thread_t * p_input, static void dvdplay_Seek( input_thread_t * p_input, off_t i_off ) { dvd_data_t * p_dvd; - + p_dvd = (dvd_data_t *)p_input->p_access_data; vlc_mutex_lock( &p_input->stream.stream_lock ); @@ -377,11 +377,11 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event ) input_thread_t * p_input; dvd_data_t * p_dvd; vlc_value_t val; - int i; + unsigned int i; p_input = (input_thread_t*)p_args; p_dvd = (dvd_data_t*)p_input->p_access_data; - + switch( event ) { case NEW_DOMAIN: @@ -395,8 +395,8 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event ) /* prevent intf to try to seek by default */ p_input->stream.b_seekable = 0; - if( ( i = dvdplay_title_cur( p_dvd->vmg ) ) != - p_input->stream.p_selected_area->i_id ) + i = dvdplay_title_cur( p_dvd->vmg ); + if( i != p_input->stream.p_selected_area->i_id ) { /* the title number has changed: update area */ msg_Warn( p_input, "new title %d (%d)", i, @@ -407,7 +407,7 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event ) /* new pgc in same title: reinit ES */ dvdNewPGC( p_input ); - + p_input->stream.b_changed = 1; break; @@ -497,9 +497,9 @@ static int dvdNewArea( input_thread_t * p_input, input_area_t * p_area ) { input_AddProgram( p_input, i+1, 0 ); } - + dvdplay_SetProgram( p_input, - p_input->stream.pp_programs[i_angle-1] ); + p_input->stream.pp_programs[i_angle-1] ); // dvdNewPGC( p_input ); @@ -517,7 +517,7 @@ static int dvdNewPGC( input_thread_t * p_input ) // int i_subp_nr = -1; // int i_subp = -1; // int i_sec; - + p_dvd = (dvd_data_t*)p_input->p_access_data; // dvdplay_audio_info( p_dvd->vmg, &i_audio_nr, &i_audio ); @@ -539,7 +539,7 @@ static int dvdNewPGC( input_thread_t * p_input ) { p_input->stream.b_seekable = 0; } - + #if 0 i_sec = dvdplay_title_time( p_dvd->vmg ); msg_Dbg( p_input, "title time: %d:%02d:%02d (%d)", diff --git a/modules/access/rtp.c b/modules/access/rtp.c index 621fed1897..3462cc7edc 100644 --- a/modules/access/rtp.c +++ b/modules/access/rtp.c @@ -2,7 +2,7 @@ * rtp.c: RTP access plug-in ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: rtp.c,v 1.6 2002/11/13 20:23:21 fenrir Exp $ + * $Id: rtp.c,v 1.7 2002/12/06 16:34:04 sam Exp $ * * Authors: Tristan Leteurtre * @@ -10,7 +10,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -236,7 +236,7 @@ static int Open( vlc_object_t *p_this ) i_server_port = 0; psz_server_addr = ""; } - + msg_Dbg( p_input, "opening server=%s:%d local=%s:%d", psz_server_addr, i_server_port, psz_bind_addr, i_bind_port ); @@ -256,7 +256,7 @@ static int Open( vlc_object_t *p_this ) return( -1 ); } module_Unneed( p_input, p_network ); - + p_access_data = malloc( sizeof(input_socket_t) ); p_input->p_access_data = (access_sys_t *)p_access_data; @@ -272,7 +272,7 @@ static int Open( vlc_object_t *p_this ) { p_input->psz_demux = "ts"; } - + return( 0 ); } @@ -301,12 +301,12 @@ static void Close( vlc_object_t *p_this ) * RTPNetworkRead : Read for the network, and parses the RTP header *****************************************************************************/ static ssize_t RTPNetworkRead( input_thread_t * p_input, byte_t * p_buffer, - size_t i_len ) + size_t i_len ) { int i_rtp_version; int i_CSRC_count; int i_payload_type; - + byte_t * p_tmp_buffer = alloca( p_input->i_mtu ); /* Get the raw data from the socket. @@ -314,35 +314,35 @@ static ssize_t RTPNetworkRead( input_thread_t * p_input, byte_t * p_buffer, ssize_t i_ret = Read( p_input, p_tmp_buffer, p_input->i_mtu ); if (!i_ret) return 0; - + /* Parse the header and make some verifications. * See RFC 1889 & RFC 2250. */ - + i_rtp_version = ( p_tmp_buffer[0] & 0xC0 ) >> 6; i_CSRC_count = ( p_tmp_buffer[0] & 0x0F ); - i_payload_type = ( p_tmp_buffer[1] & 0x7F ); - - if ( i_rtp_version != 2 ) + i_payload_type = ( p_tmp_buffer[1] & 0x7F ); + + if ( i_rtp_version != 2 ) msg_Dbg( p_input, "RTP version is %u, should be 2", i_rtp_version ); - + if ( i_payload_type != 33 ) msg_Dbg( p_input, "RTP payload type is %u, only 33 (Mpeg2-TS) " \ "is supported", i_payload_type ); - + /* Return the packet without the RTP header. */ i_ret -= ( RTP_HEADER_LEN + 4 * i_CSRC_count ); - if ( i_ret > i_len ) + if ( (size_t)i_ret > i_len ) { /* This should NOT happen. */ msg_Warn( p_input, "RTP input trashing %d bytes", i_ret - i_len ); i_ret = i_len; } - p_input->p_vlc->pf_memcpy( p_buffer, + p_input->p_vlc->pf_memcpy( p_buffer, p_tmp_buffer + RTP_HEADER_LEN + 4 * i_CSRC_count, i_ret ); - + return i_ret; } diff --git a/modules/access/vcd/vcd.c b/modules/access/vcd/vcd.c index c4726ed2a6..bf14c687dc 100644 --- a/modules/access/vcd/vcd.c +++ b/modules/access/vcd/vcd.c @@ -2,7 +2,7 @@ * vcd.c : VCD input module for vlc ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: vcd.c,v 1.11 2002/11/13 20:23:21 fenrir Exp $ + * $Id: vcd.c,v 1.12 2002/12/06 16:34:04 sam Exp $ * * Author: Johan Bilien * @@ -436,8 +436,8 @@ static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area ) ****************************************************************************/ static void VCDSeek( input_thread_t * p_input, off_t i_off ) { - thread_vcd_data_t * p_vcd; - int i_index; + thread_vcd_data_t * p_vcd; + unsigned int i_index; p_vcd = (thread_vcd_data_t *) p_input->p_access_data; diff --git a/modules/audio_filter/converter/a52tospdif.c b/modules/audio_filter/converter/a52tospdif.c index 4e80526924..da7e458ecd 100644 --- a/modules/audio_filter/converter/a52tospdif.c +++ b/modules/audio_filter/converter/a52tospdif.c @@ -2,7 +2,7 @@ * a52tospdif.c : encapsulates A/52 frames into S/PDIF packets ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: a52tospdif.c,v 1.15 2002/11/28 23:24:14 massiot Exp $ + * $Id: a52tospdif.c,v 1.16 2002/12/06 16:34:04 sam Exp $ * * Authors: Christophe Massiot * Stéphane Borel @@ -85,15 +85,15 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, * endian. */ - static const u8 p_sync[6] = { 0x72, 0xF8, 0x1F, 0x4E, 0x01, 0x00 }; + static const uint8_t p_sync[6] = { 0x72, 0xF8, 0x1F, 0x4E, 0x01, 0x00 }; #ifndef HAVE_SWAB - u16 i; + byte_t * p_tmp; + uint16_t i; #endif - u16 i_length = p_in_buf->i_nb_bytes; - u8 * pi_length; + uint16_t i_length = p_in_buf->i_nb_bytes; + uint8_t * pi_length; byte_t * p_in = p_in_buf->p_buffer; byte_t * p_out = p_out_buf->p_buffer; - byte_t * p_tmp; /* Copy the S/PDIF headers. */ memcpy( p_out, p_sync, 6 ); diff --git a/modules/audio_filter/resampler/ugly.c b/modules/audio_filter/resampler/ugly.c index 880bb511ae..198d9caa52 100644 --- a/modules/audio_filter/resampler/ugly.c +++ b/modules/audio_filter/resampler/ugly.c @@ -2,7 +2,7 @@ * ugly.c : ugly resampler (changes pitch) ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: ugly.c,v 1.7 2002/11/20 16:43:32 sam Exp $ + * $Id: ugly.c,v 1.8 2002/12/06 16:34:04 sam Exp $ * * Authors: Samuel Hocevar * @@ -82,12 +82,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, int32_t* p_in = (int32_t*)p_in_buf->p_buffer; int32_t* p_out = (int32_t*)p_out_buf->p_buffer; - int i_nb_channels = aout_FormatNbChannels( &p_filter->input ); - int i_in_nb = p_in_buf->i_nb_samples; - int i_out_nb = i_in_nb * p_filter->output.i_rate - / p_filter->input.i_rate; - int i_sample_bytes = i_nb_channels * sizeof(int32_t); - int i_out, i_chan, i_remainder = 0; + unsigned int i_nb_channels = aout_FormatNbChannels( &p_filter->input ); + unsigned int i_in_nb = p_in_buf->i_nb_samples; + unsigned int i_out_nb = i_in_nb * p_filter->output.i_rate + / p_filter->input.i_rate; + unsigned int i_sample_bytes = i_nb_channels * sizeof(int32_t); + unsigned int i_out, i_chan, i_remainder = 0; for( i_out = i_out_nb ; i_out-- ; ) { diff --git a/modules/audio_output/oss.c b/modules/audio_output/oss.c index 1de455c771..e594d69099 100644 --- a/modules/audio_output/oss.c +++ b/modules/audio_output/oss.c @@ -2,7 +2,7 @@ * oss.c : OSS /dev/dsp module for vlc ***************************************************************************** * Copyright (C) 2000-2002 VideoLAN - * $Id: oss.c,v 1.34 2002/11/21 15:51:57 gbazin Exp $ + * $Id: oss.c,v 1.35 2002/12/06 16:34:04 sam Exp $ * * Authors: Michel Kaempf * Samuel Hocevar @@ -325,10 +325,10 @@ static int Open( vlc_object_t *p_this ) if ( !AOUT_FMT_NON_LINEAR( &p_aout->output.output ) ) { - int i_format = AFMT_S16_NE; - int i_frame_size, i_fragments; - int i_rate; - int i_nb_channels; + unsigned int i_format = AFMT_S16_NE; + unsigned int i_frame_size, i_fragments; + unsigned int i_rate; + unsigned int i_nb_channels; audio_buf_info audio_buf; if( ioctl( p_sys->i_fd, SNDCTL_DSP_SETFMT, &i_format ) < 0 ) diff --git a/modules/codec/a52.c b/modules/codec/a52.c index 24fb533975..37af6b5491 100644 --- a/modules/codec/a52.c +++ b/modules/codec/a52.c @@ -2,7 +2,7 @@ * a52.c: A/52 basic parser ***************************************************************************** * Copyright (C) 2001-2002 VideoLAN - * $Id: a52.c,v 1.18 2002/11/14 22:38:47 massiot Exp $ + * $Id: a52.c,v 1.19 2002/12/06 16:34:05 sam Exp $ * * Authors: Stéphane Borel * Christophe Massiot @@ -13,7 +13,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -86,14 +86,14 @@ vlc_module_end(); /***************************************************************************** * OpenDecoder: probe the decoder and return score *****************************************************************************/ -static int OpenDecoder( vlc_object_t *p_this ) -{ +static int OpenDecoder( vlc_object_t *p_this ) +{ decoder_fifo_t *p_fifo = (decoder_fifo_t*) p_this; if( p_fifo->i_fourcc != VLC_FOURCC('a','5','2',' ') && p_fifo->i_fourcc != VLC_FOURCC('a','5','2','b') ) - { - return VLC_EGENERIC; + { + return VLC_EGENERIC; } p_fifo->pf_run = RunDecoder; @@ -109,7 +109,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo ) { dec_thread_t * p_dec; audio_date_t end_date; - + /* Allocate the memory needed to store the thread's structure */ p_dec = malloc( sizeof(dec_thread_t) ); if( p_dec == NULL ) @@ -140,14 +140,15 @@ static int RunDecoder( decoder_fifo_t *p_fifo ) /* decoder thread's main loop */ while ( !p_dec->p_fifo->b_die && !p_dec->p_fifo->b_error ) { - int i_frame_size, i_original_channels, i_rate, i_bit_rate; + int i_bit_rate; + unsigned int i_rate, i_original_channels, i_frame_size; mtime_t pts; byte_t p_header[7]; aout_buffer_t * p_buffer; /* Look for sync word - should be 0x0b77 */ RealignBits( &p_dec->bit_stream ); - while ( (ShowBits( &p_dec->bit_stream, 16 ) ) != 0x0b77 && + while ( (ShowBits( &p_dec->bit_stream, 16 ) ) != 0x0b77 && (!p_dec->p_fifo->b_die) && (!p_dec->p_fifo->b_error)) { RemoveBits( &p_dec->bit_stream, 8 ); @@ -245,7 +246,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo ) /* End of the spdif decoder thread */ EndThread( p_dec ); - + return 0; } @@ -270,14 +271,15 @@ static void EndThread( dec_thread_t * p_dec ) * since we don't want to oblige S/PDIF people to use liba52 just to get * their SyncInfo... *****************************************************************************/ -int SyncInfo( const byte_t * p_buf, int * pi_channels, int * pi_sample_rate, - int * pi_bit_rate) +static int SyncInfo( const byte_t * p_buf, int * pi_channels, + int * pi_sample_rate, int * pi_bit_rate ) { - static const u8 halfrate[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3}; + static const uint8_t halfrate[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3 }; static const int rate[] = { 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, - 512, 576, 640}; - static const u8 lfeon[8] = {0x10, 0x10, 0x04, 0x04, 0x04, 0x01, 0x04, 0x01}; + 512, 576, 640 }; + static const uint8_t lfeon[8] = { 0x10, 0x10, 0x04, 0x04, + 0x04, 0x01, 0x04, 0x01 }; int frmsizecod; int bitrate; int half; @@ -339,7 +341,7 @@ int SyncInfo( const byte_t * p_buf, int * pi_channels, int * pi_sample_rate, default: return 0; } - + if ( p_buf[6] & lfeon[acmod] ) *pi_channels |= AOUT_CHAN_LFE; frmsizecod = p_buf[4] & 63; diff --git a/modules/codec/ffmpeg/postprocessing/postprocessing_c.c b/modules/codec/ffmpeg/postprocessing/postprocessing_c.c index f77624cc3c..e5e62b3b86 100644 --- a/modules/codec/ffmpeg/postprocessing/postprocessing_c.c +++ b/modules/codec/ffmpeg/postprocessing/postprocessing_c.c @@ -2,15 +2,15 @@ * postprocessing_c.c: Post Processing plugin in C ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: postprocessing_c.c,v 1.1 2002/08/04 22:13:06 fenrir Exp $ + * $Id: postprocessing_c.c,v 1.2 2002/12/06 16:34:05 sam Exp $ * * Authors: Laurent Aimar - * + * * 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 * (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 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ -#include /* only use u8, u32 .... */ +#include /* only use uint8_t, uint32_t .... */ #include "postprocessing.h" #include "postprocessing_common.h" @@ -41,9 +41,9 @@ * so need to be fast ... * ****************************************************************************/ -static inline int pp_deblock_isDC_mode( u8 *p_v ) +static inline int pp_deblock_isDC_mode( uint8_t *p_v ) { - int i_eq_cnt; + unsigned int i_eq_cnt; /* algo : if ( | v[i] -v[i+1] | <= PP_THR1 ) { i_eq_cnt++; } */ i_eq_cnt = 0; @@ -61,8 +61,8 @@ static inline int pp_deblock_isDC_mode( u8 *p_v ) int i; for( i =0; i < 9; i++ ) { - if(( ( p_v[i] - p_v[i+1] + PP_THR1 )&0xffff )<= PP_2xTHR1 ) - { + if(( ( p_v[i] - p_v[i+1] + PP_THR1 )&0xffff )<= PP_2xTHR1 ) + { i_eq_cnt++; } } @@ -70,11 +70,11 @@ static inline int pp_deblock_isDC_mode( u8 *p_v ) return( (i_eq_cnt >= PP_THR2 ) ? 1 : 0 ); } -static inline int pp_deblock_isMinMaxOk( u8 *p_v, int i_QP ) +static inline int pp_deblock_isMinMaxOk( uint8_t *p_v, int i_QP ) { int i_max, i_min; - i_min = i_max = p_v[1]; + i_min = i_max = p_v[1]; if( i_max < p_v[1] ) i_max = p_v[1]; if( i_min > p_v[1] ) i_min = p_v[1]; if( i_max < p_v[2] ) i_max = p_v[2]; @@ -106,7 +106,7 @@ static inline int pp_deblock_isMinMaxOk( u8 *p_v, int i_QP ) } -static inline void pp_deblock_DefaultMode( u8 i_v[10], int i_stride, +static inline void pp_deblock_DefaultMode( uint8_t i_v[10], int i_stride, int i_QP ) { int d, i_delta; @@ -122,7 +122,7 @@ static inline void pp_deblock_DefaultMode( u8 i_v[10], int i_stride, { b_neg = 1; a3x0 = -a3x0; - } + } else { b_neg = 0; @@ -138,7 +138,7 @@ static inline void pp_deblock_DefaultMode( u8 i_v[10], int i_stride, if( a3x2 < 0) a3x2 = -a3x2; /* abs( a3x2 ) */ a3x0_ = PP_MIN3( a3x0, a3x1, a3x2 ); - + d = 5 *( a3x0 - a3x0_ ) / 8; /* always > 0 */ i_delta = ( i_v[4] - i_v[5] ) / 2; @@ -167,13 +167,13 @@ static inline void pp_deblock_DefaultMode( u8 i_v[10], int i_stride, -static inline void pp_deblock_DCMode( u8 *p_v, /* = int i_v[10] */ +static inline void pp_deblock_DCMode( uint8_t *p_v, /* = int i_v[10] */ int i_QP ) { int v[10]; int i; - + int i_p0, i_p9; i_p0 = PP_ABS( p_v[1] - p_v[0] ) < i_QP ? p_v[0] : p_v[1]; i_p9 = PP_ABS( p_v[8] - p_v[9] ) < i_QP ? p_v[9] : p_v[8]; @@ -183,28 +183,28 @@ static inline void pp_deblock_DCMode( u8 *p_v, /* = int i_v[10] */ v[i] = p_v[i]; /* save 8 pix that will be modified */ } - p_v[1] = ( 6 * i_p0 + 4 * v[1] + p_v[1] = ( 6 * i_p0 + 4 * v[1] + 2 *( v[2] + v[3]) + v[4] + v[5]) >> 4; - - p_v[2] = ( 4 * i_p0 + 2 * v[1] + 4 * v[2] + + p_v[2] = ( 4 * i_p0 + 2 * v[1] + 4 * v[2] + 2 *( v[3] + v[4]) + v[5] + v[6]) >> 4; - p_v[3] = ( 2 * i_p0 + 2 * (v[1] + v[2]) + 4 * v[3] + p_v[3] = ( 2 * i_p0 + 2 * (v[1] + v[2]) + 4 * v[3] + 2 *( v[4] + v[5]) + v[6] + v[7]) >> 4; - p_v[4] = ( i_p0 + v[1] + 2 * (v[2] + v[3]) + 4 * v[4] + p_v[4] = ( i_p0 + v[1] + 2 * (v[2] + v[3]) + 4 * v[4] + 2 *( v[5] + v[6]) + v[7] + v[8]) >> 4; - p_v[5] = ( v[1] + v[2] + 2 * (v[3] + v[4]) + 4 * v[5] + p_v[5] = ( v[1] + v[2] + 2 * (v[3] + v[4]) + 4 * v[5] + 2 *( v[6] + v[7]) + v[8] + i_p9) >> 4; - p_v[6] = ( v[2] + v[3] + 2 * (v[4] + v[5]) + 4 * v[6] + p_v[6] = ( v[2] + v[3] + 2 * (v[4] + v[5]) + 4 * v[6] + 2 *( v[7] + v[8]) + 2 * i_p9) >> 4; - p_v[7] = ( v[3] + v[4] + 2 * (v[5] + v[6]) + 4 * v[7] + p_v[7] = ( v[3] + v[4] + 2 * (v[5] + v[6]) + 4 * v[7] + 2 * v[8] + 4 * i_p9) >> 4; - p_v[8] = ( v[4] + v[5] + 2 * (v[6] + v[7]) + 4 * v[8] + p_v[8] = ( v[4] + v[5] + 2 * (v[6] + v[7]) + 4 * v[8] + 6 * i_p9) >> 4; } @@ -219,21 +219,21 @@ static inline void pp_deblock_DCMode( u8 *p_v, /* = int i_v[10] */ /*---------------------------------------------------------------------------*/ /*****************************************************************************/ -void E_( pp_deblock_V )( u8 *p_plane, +void E_( pp_deblock_V )( uint8_t *p_plane, int i_width, int i_height, int i_stride, QT_STORE_T *p_QP_store, int i_QP_stride, int b_chroma ) { int x, y, i; - u8 *p_v; + uint8_t *p_v; int i_QP_scale; /* use to do ( ? >> i_QP_scale ) */ int i_QP; - - u8 i_v[10]; - + + uint8_t i_v[10]; + i_QP_scale = b_chroma ? 5 : 4 ; - for( y = 8; y < i_height - 4; y += 8 ) + for( y = 8; y < i_height - 4; y += 8 ) { p_v = p_plane + ( y - 5 )* i_stride; for( x = 0; x < i_width; x++ ) @@ -278,22 +278,22 @@ void E_( pp_deblock_V )( u8 *p_plane, /*---------------------------------------------------------------------------*/ /*****************************************************************************/ -void E_( pp_deblock_H )( u8 *p_plane, +void E_( pp_deblock_H )( uint8_t *p_plane, int i_width, int i_height, int i_stride, QT_STORE_T *p_QP_store, int i_QP_stride, int b_chroma ) { int x, y; - u8 *p_v; + uint8_t *p_v; int i_QP_scale; int i_QP; - + i_QP_scale = b_chroma ? 5 : 4 ; - for( y = 0; y < i_height; y++ ) + for( y = 0; y < i_height; y++ ) { p_v = p_plane + y * i_stride - 5; - for( x = 8; x < i_width - 4; x += 8 ) + for( x = 8; x < i_width - 4; x += 8 ) { /* p_v point 5 pix before a block boundary */ /* XXX QP is for v5 */ @@ -312,7 +312,7 @@ void E_( pp_deblock_H )( u8 *p_plane, } } } - + return; } @@ -323,14 +323,14 @@ void E_( pp_deblock_H )( u8 *p_plane, * *****************************************************************************/ -static inline void pp_dering_MinMax( u8 *p_block, int i_stride, +static inline void pp_dering_MinMax( uint8_t *p_block, int i_stride, int *pi_min, int *pi_max ) { int y; int i_min, i_max; i_min = 255; i_max = 0; - + for( y = 0; y < 8; y++ ) { if( i_min > p_block[0] ) i_min = p_block[0]; @@ -359,17 +359,17 @@ static inline void pp_dering_MinMax( u8 *p_block, int i_stride, #endif p_block += i_stride; } - + *pi_min = i_min; *pi_max = i_max; } -static inline void pp_dering_BinIndex( u8 *p_block, int i_stride, int i_thr, - u32 *p_bin ) +static inline void pp_dering_BinIndex( uint8_t *p_block, int i_stride, + int i_thr, uint32_t *p_bin ) { int x, y; - u32 i_bin; + uint32_t i_bin; for( y = 0; y < 10; y++ ) { @@ -389,27 +389,27 @@ static inline void pp_dering_BinIndex( u8 *p_block, int i_stride, int i_thr, } } -static inline void pp_dering_Filter( u8 *p_block, int i_stride, - u32 *p_bin, +static inline void pp_dering_Filter( uint8_t *p_block, int i_stride, + uint32_t *p_bin, int i_QP ) { int x, y; - u32 i_bin; + uint32_t i_bin; int i_flt[8][8]; int i_f; - u8 *p_sav; + uint8_t *p_sav; int i_QP_2; - + p_sav = p_block; i_QP_2 = i_QP >> 1; - + for( y = 0; y < 8; y++ ) { i_bin = p_bin[y] & p_bin[y+1] & p_bin[y+2]; /* To be optimised */ i_bin |= i_bin >> 16; /* detect 0 or 1 */ for( x = 0; x < 8; x++ ) - { + { if( i_bin&0x02 ) /* 0x02 since 10 index but want 1-9 */ { /* apply dering */ @@ -419,11 +419,11 @@ static inline void pp_dering_Filter( u8 *p_block, int i_stride, i_f = p_block[x - i_stride - 1] + ( p_block[x - i_stride ] << 1)+ p_block[x - i_stride + 1] + - + ( p_block[x - 1] << 1 )+ ( p_block[x ] << 2 )+ ( p_block[x + 1] << 1 )+ - + p_block[x + i_stride - 1] + ( p_block[x + i_stride ] << 1 ) + p_block[x + i_stride + 1]; @@ -443,7 +443,7 @@ static inline void pp_dering_Filter( u8 *p_block, int i_stride, } else { - i_flt[y][x] = i_f ; + i_flt[y][x] = i_f ; } } else @@ -451,7 +451,7 @@ static inline void pp_dering_Filter( u8 *p_block, int i_stride, i_flt[y][x] = p_block[x]; } i_bin >>= 1; - + } p_block += i_stride; } @@ -474,7 +474,7 @@ static inline void pp_dering_Filter( u8 *p_block, int i_stride, /*---------------------------------------------------------------------------*/ /*****************************************************************************/ -void E_( pp_dering_Y )( u8 *p_plane, +void E_( pp_dering_Y )( uint8_t *p_plane, int i_width, int i_height, int i_stride, QT_STORE_T *p_QP_store, int i_QP_stride ) { @@ -482,10 +482,10 @@ void E_( pp_dering_Y )( u8 *p_plane, int i_max[4], i_min[4], i_range[4]; int i_thr[4]; int i_max_range, i_kmax; - u32 i_bin[4][10]; - u8 *p_block[4]; + uint32_t i_bin[4][10]; + uint8_t *p_block[4]; QT_STORE_T *p_QP; - + /* We process 4 blocks/loop*/ for( y = 8; y < i_height-8; y += 16 ) { @@ -555,8 +555,8 @@ void E_( pp_dering_Y )( u8 *p_plane, i_thr[2], i_bin[2] ); pp_dering_BinIndex( p_block[3] - i_stride - 1, i_stride, i_thr[3], i_bin[3] ); - - + + /* 3: adaptive smoothing */ /* since we begin at (8,8) QP can be different for each block */ p_QP = &( p_QP_store[( y >> 4) * i_QP_stride + (x >> 4)] ); @@ -572,27 +572,27 @@ void E_( pp_dering_Y )( u8 *p_plane, pp_dering_Filter( p_block[3], i_stride, i_bin[3], p_QP[i_QP_stride+1] ); - + p_block[0] += 8; p_block[1] += 8; p_block[2] += 8; p_block[3] += 8; } } - + } -void E_( pp_dering_C )( u8 *p_plane, +void E_( pp_dering_C )( uint8_t *p_plane, int i_width, int i_height, int i_stride, QT_STORE_T *p_QP_store, int i_QP_stride ) { int x, y; int i_max, i_min; int i_thr; - u32 i_bin[10]; - - u8 *p_block; - + uint32_t i_bin[10]; + + uint8_t *p_block; + for( y = 8; y < i_height-8; y += 8 ) { @@ -613,13 +613,13 @@ void E_( pp_dering_C )( u8 *p_plane, pp_dering_BinIndex( p_block - i_stride -1, i_stride, i_thr, i_bin ); - + /* 3: adaptive smoothing */ pp_dering_Filter( p_block, i_stride, - i_bin, + i_bin, p_QP_store[(y>>5)*i_QP_stride+ (x>>5)]); p_block += 8; } } - + } diff --git a/modules/codec/ffmpeg/postprocessing/postprocessing_mmx.c b/modules/codec/ffmpeg/postprocessing/postprocessing_mmx.c index ce78e99fd4..e08f9d862d 100644 --- a/modules/codec/ffmpeg/postprocessing/postprocessing_mmx.c +++ b/modules/codec/ffmpeg/postprocessing/postprocessing_mmx.c @@ -2,7 +2,7 @@ * postprocessing_mmx.c: Post Processing library in MMX ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: postprocessing_mmx.c,v 1.1 2002/08/04 22:13:06 fenrir Exp $ + * $Id: postprocessing_mmx.c,v 1.2 2002/12/06 16:34:05 sam Exp $ * * Authors: Laurent Aimar * @@ -114,7 +114,7 @@ UNUSED_LONGLONG( mmx_m2_5_m5_2 ) = 0xfffe0005fffb0002ULL; ****************************************************************************/ static inline int pp_deblock_isDC_mode( u8 *p_v ) { - int i_eq_cnt; + unsigned int i_eq_cnt; /* algo : x = v[i] - v[i+1] without signed saturation diff --git a/modules/codec/ffmpeg/postprocessing/postprocessing_mmxext.c b/modules/codec/ffmpeg/postprocessing/postprocessing_mmxext.c index 99a6a3b8cc..0c180fca6c 100644 --- a/modules/codec/ffmpeg/postprocessing/postprocessing_mmxext.c +++ b/modules/codec/ffmpeg/postprocessing/postprocessing_mmxext.c @@ -2,7 +2,7 @@ * postprocessing_mmxext.c: Post Processing plugin MMXEXT ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: postprocessing_mmxext.c,v 1.3 2002/10/28 06:26:11 fenrir Exp $ + * $Id: postprocessing_mmxext.c,v 1.4 2002/12/06 16:34:05 sam Exp $ * * Authors: Laurent Aimar * @@ -122,7 +122,7 @@ UNUSED_LONGLONG( mmx_m2_5_m5_2 ) = 0xfffe0005fffb0002ULL; ****************************************************************************/ static inline int pp_deblock_isDC_mode( u8 *p_v ) { - int i_eq_cnt; + unsigned int i_eq_cnt; /* algo : diff --git a/modules/codec/ffmpeg/video.c b/modules/codec/ffmpeg/video.c index 4091196501..62ee5bbc10 100644 --- a/modules/codec/ffmpeg/video.c +++ b/modules/codec/ffmpeg/video.c @@ -2,7 +2,7 @@ * video.c: video decoder using ffmpeg library ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: video.c,v 1.10 2002/12/06 14:22:55 fenrir Exp $ + * $Id: video.c,v 1.11 2002/12/06 16:34:05 sam Exp $ * * Authors: Laurent Aimar * Gildas Bazin @@ -11,7 +11,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -76,7 +76,7 @@ static inline uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma ) return( VLC_FOURCC('I','4','2','0') ); case PIX_FMT_RGB24: return( VLC_FOURCC('R','V','2','4') ); - + case PIX_FMT_YUV422P: return( VLC_FOURCC('I','4','2','2') ); case PIX_FMT_YUV444P: @@ -95,10 +95,10 @@ static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec, AVCodecContext *p_context ) { vout_thread_t *p_vout; - int i_width = p_context->width; - int i_height =p_context->height; - uint32_t i_chroma = ffmpeg_PixFmtToChroma( p_context->pix_fmt ); - int i_aspect; + unsigned int i_width = p_context->width; + unsigned int i_height =p_context->height; + uint32_t i_chroma = ffmpeg_PixFmtToChroma( p_context->pix_fmt ); + unsigned int i_aspect; if( !i_width || !i_height ) { @@ -114,8 +114,8 @@ static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec, it's buggy and very slow */ } #if LIBAVCODEC_BUILD >= 4640 - if( ( i_aspect = (int) ( VOUT_ASPECT_FACTOR * - p_context->aspect_ratio ) ) == 0 ) + i_aspect = VOUT_ASPECT_FACTOR * p_context->aspect_ratio; + if( i_aspect == 0 ) { i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height; } @@ -129,10 +129,10 @@ static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec, case( FF_ASPECT_16_9_625 ): case( FF_ASPECT_16_9_525 ): i_aspect = VOUT_ASPECT_FACTOR * 16 / 9 ; - break; + break; case( FF_ASPECT_SQUARE ): default: - i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height; + i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height; break; } #endif @@ -146,7 +146,7 @@ static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec, } /* FIXME FIXME FIXME this is a big shit - does someone want to rewrite this function ? + does someone want to rewrite this function ? or said to me how write a better thing FIXME FIXME FIXME */ @@ -160,8 +160,8 @@ static void ffmpeg_ConvertPictureI410toI420( picture_t *p_pic, vdec_thread_t *p_vdec ) #endif { - u8 *p_src, *p_dst; - u8 *p_plane[3]; + uint8_t *p_src, *p_dst; + uint8_t *p_plane[3]; int i_plane; int i_stride, i_lines; @@ -230,11 +230,11 @@ static void ffmpeg_ConvertPictureI410toI420( picture_t *p_pic, p_vdec->p_fifo->p_vlc->pf_memcpy( p_dst, p_src, 2*i_stride ); } /* copy to p_pic, by block - if I do pixel per pixel it segfault. It's why I use + if I do pixel per pixel it segfault. It's why I use temporaries buffers */ for( i_plane = 1; i_plane < 3; i_plane++ ) { - int i_size; + int i_size; p_src = p_plane[i_plane]; p_dst = p_pic->p[i_plane].p_pixels; @@ -262,8 +262,8 @@ static void ffmpeg_ConvertPictureI410toI420( picture_t *p_pic, /***************************************************************************** * InitThread: initialize vdec output thread ***************************************************************************** - * This function is called from decoder_Run and performs the second step - * of the initialization. It returns 0 on success. Note that the thread's + * This function is called from decoder_Run and performs the second step + * of the initialization. It returns 0 on success. Note that the thread's * flag are not modified inside this function. * * ffmpeg codec will be open, some memory allocated. But Vout is not yet @@ -293,7 +293,7 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec ) p_vdec->p_format = NULL; } - + /* ***** Get configuration of ffmpeg plugin ***** */ #if LIBAVCODEC_BUILD >= 4611 i_tmp = config_GetInt( p_vdec->p_fifo, "ffmpeg-workaround-bugs" ); @@ -337,7 +337,7 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec ) p_vdec->p_context->flags |= CODEC_FLAG_TRUNCATED; } #endif - + /* ***** Open the codec ***** */ if( avcodec_open(p_vdec->p_context, p_vdec->p_codec) < 0 ) { @@ -352,15 +352,15 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec ) } /* ***** init this codec with special data ***** */ - if( p_vdec->p_format && + if( p_vdec->p_format && p_vdec->p_format->biSize > sizeof(BITMAPINFOHEADER) ) { int b_gotpicture; - + switch( p_vdec->i_codec_id ) { case( CODEC_ID_MPEG4 ): - avcodec_decode_video( p_vdec->p_context, p_vdec->p_ff_pic, + avcodec_decode_video( p_vdec->p_context, p_vdec->p_ff_pic, &b_gotpicture, (void *)&p_vdec->p_format[1], p_vdec->p_format->biSize @@ -389,7 +389,7 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec ) break; } } - + /* ***** Load post processing ***** */ /* get overridding settings */ @@ -431,12 +431,12 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec ) p_vdec->p_pp = vlc_object_create( p_vdec->p_fifo, sizeof( postprocessing_t ) ); p_vdec->p_pp->psz_object_name = "postprocessing"; - p_vdec->p_pp->p_module = + p_vdec->p_pp->p_module = module_Need( p_vdec->p_pp, "postprocessing", "$ffmpeg-pp" ); if( !p_vdec->p_pp->p_module ) { - msg_Warn( p_vdec->p_fifo, + msg_Warn( p_vdec->p_fifo, "no suitable postprocessing module" ); vlc_object_destroy( p_vdec->p_pp ); p_vdec->p_pp = NULL; @@ -445,21 +445,21 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec ) else { /* get mode upon quality */ - p_vdec->i_pp_mode |= - p_vdec->p_pp->pf_getmode( + p_vdec->i_pp_mode |= + p_vdec->p_pp->pf_getmode( config_GetInt( p_vdec->p_fifo, "ffmpeg-pp-q" ), config_GetInt( p_vdec->p_fifo, "ffmpeg-pp-auto" ) ); } #else p_vdec->i_pp_mode = 0; - msg_Warn( p_vdec->p_fifo, + msg_Warn( p_vdec->p_fifo, "post-processing not supported, upgrade ffmpeg" ); #endif break; default: p_vdec->i_pp_mode = 0; - msg_Warn( p_vdec->p_fifo, + msg_Warn( p_vdec->p_fifo, "Post processing unsupported for this codec" ); break; } @@ -497,7 +497,7 @@ void E_( DecodeThread_Video )( vdec_thread_t *p_vdec ) } else { - /* too much late picture, won't decode + /* too much late picture, won't decode but break picture until a new I, and for mpeg4 ...*/ p_vdec->i_frame_late--; /* needed else it will never be decrease */ input_ExtractPES( p_vdec->p_fifo, NULL ); @@ -535,7 +535,7 @@ void E_( DecodeThread_Video )( vdec_thread_t *p_vdec ) p_vdec->i_frame_count = 0; } } -#endif +#endif if( p_pes->i_pts ) { p_vdec->pts = p_pes->i_pts; @@ -548,9 +548,9 @@ void E_( DecodeThread_Video )( vdec_thread_t *p_vdec ) { uint8_t *p_last; int i_need; - /* XXX Don't forget that ffmpeg required a little more bytes + /* XXX Don't forget that ffmpeg required a little more bytes * that the real frame size */ - i_need = i_frame_size + 16 + p_vdec->i_buffer; + i_need = i_frame_size + 16 + p_vdec->i_buffer; if( p_vdec->i_buffer_size < i_need) { p_last = p_vdec->p_buffer; @@ -562,14 +562,14 @@ void E_( DecodeThread_Video )( vdec_thread_t *p_vdec ) } FREE( p_last ); } - i_frame_size = - E_( GetPESData )( p_vdec->p_buffer + p_vdec->i_buffer, + i_frame_size = + E_( GetPESData )( p_vdec->p_buffer + p_vdec->i_buffer, i_frame_size , p_pes ); memset( p_vdec->p_buffer + p_vdec->i_buffer + i_frame_size, 0, 16 ); - } + } input_DeletePES( p_vdec->p_fifo->p_packets_mgt, p_pes ); } while( i_frame_size <= 0 ); @@ -583,8 +583,8 @@ usenextdata: i_frame_size ); #if 0 - msg_Dbg( p_vdec->p_fifo, - "used:%d framesize:%d (%s picture)", + msg_Dbg( p_vdec->p_fifo, + "used:%d framesize:%d (%s picture)", i_used, i_frame_size, b_gotpicture ? "got":"no got" ); #endif if( i_used < 0 ) @@ -598,31 +598,31 @@ usenextdata: else if( i_used < i_frame_size ) { #if 0 - msg_Dbg( p_vdec->p_fifo, + msg_Dbg( p_vdec->p_fifo, "didn't use all memory(%d < %d)", i_used, i_frame_size ); #endif memmove( p_vdec->p_buffer, p_vdec->p_buffer + i_used, p_vdec->i_buffer_size - i_used ); - + p_vdec->i_buffer = i_frame_size - i_used; } else { p_vdec->i_buffer = 0; } - + if( b_gotpicture ) { p_vdec->i_frame_count++; } - + /* consumed bytes */ i_frame_size -= i_used; /* Update frame late count*/ /* I don't make statistic on decoding time */ - if( p_vdec->pts <= mdate()) + if( p_vdec->pts <= mdate()) { p_vdec->i_frame_late++; } @@ -669,18 +669,18 @@ usenextdata: } /* Do post-processing if requested */ - /* XXX: with dr it is not a good thing if the picture will be used as + /* XXX: with dr it is not a good thing if the picture will be used as reference... */ - ffmpeg_PostProcPicture( p_vdec, p_pic ); + ffmpeg_PostProcPicture( p_vdec, p_pic ); /* fix date calculation */ if( p_vdec->pts > 0 ) { i_pts = p_vdec->pts; - + if( p_vdec->p_context->frame_rate > 0 ) { - i_pts += (uint64_t)1000000 * + i_pts += (uint64_t)1000000 * ( p_vdec->i_frame_count - 1) / FRAME_RATE_BASE / p_vdec->p_context->frame_rate; @@ -691,13 +691,13 @@ usenextdata: i_pts = mdate() + DEFAULT_PTS_DELAY; // FIXME } - vout_DatePicture( p_vdec->p_vout, - p_pic, + vout_DatePicture( p_vdec->p_vout, + p_pic, i_pts ); /* Send decoded frame to vout */ vout_DisplayPicture( p_vdec->p_vout, p_pic ); - + if( i_frame_size > 0 ) { goto usenextdata; /* try to use all data */ @@ -737,21 +737,21 @@ void E_( EndThread_Video )( vdec_thread_t *p_vdec ) * picture_t structure (when not in direct rendering mode). *****************************************************************************/ #if LIBAVCODEC_BUILD >= 4641 -static void ffmpeg_CopyPicture( picture_t *p_pic, +static void ffmpeg_CopyPicture( picture_t *p_pic, AVVideoFrame *p_ff_pic, vdec_thread_t *p_vdec ) #else -static void ffmpeg_CopyPicture( picture_t *p_pic, +static void ffmpeg_CopyPicture( picture_t *p_pic, AVPicture *p_ff_pic, vdec_thread_t *p_vdec ) #endif { - int i_plane; + int i_plane; int i_size; int i_line; - u8 *p_dst; - u8 *p_src; + uint8_t *p_dst; + uint8_t *p_src; int i_src_stride; int i_dst_stride; @@ -782,7 +782,7 @@ static void ffmpeg_CopyPicture( picture_t *p_pic, case( PIX_FMT_YUV410P ): ffmpeg_ConvertPictureI410toI420( p_pic, p_ff_pic, p_vdec ); break; -#endif +#endif default: p_vdec->p_fifo->b_error = 1; break; @@ -796,9 +796,9 @@ static void ffmpeg_CopyPicture( picture_t *p_pic, static void ffmpeg_PostProcPicture( vdec_thread_t *p_vdec, picture_t *p_pic ) { if( ( p_vdec->i_pp_mode )&& - ( ( p_vdec->p_vout->render.i_chroma == + ( ( p_vdec->p_vout->render.i_chroma == VLC_FOURCC( 'I','4','2','0' ) )|| - ( p_vdec->p_vout->render.i_chroma == + ( p_vdec->p_vout->render.i_chroma == VLC_FOURCC( 'Y','V','1','2' ) ) ) ) { #if LIBAVCODEC_BUILD >= 4641 @@ -822,7 +822,7 @@ static void ffmpeg_PostProcPicture( vdec_thread_t *p_vdec, picture_t *p_pic ) * (used for direct rendering) *****************************************************************************/ -static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context, +static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context, AVVideoFrame *p_ff_pic ) { vdec_thread_t *p_vdec = (vdec_thread_t *)p_context->opaque; @@ -855,7 +855,7 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context, p_ff_pic->data[1] = p_pic->p[1].p_pixels; p_ff_pic->data[2] = p_pic->p[2].p_pixels; p_ff_pic->data[3] = NULL; /* alpha channel but I'm not sure */ - + p_ff_pic->linesize[0] = p_pic->p[0].i_pitch; p_ff_pic->linesize[1] = p_pic->p[1].i_pitch; p_ff_pic->linesize[2] = p_pic->p[2].i_pitch; @@ -871,7 +871,7 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context, return( 0 ); } -static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context, +static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context, AVVideoFrame *p_ff_pic ) { vdec_thread_t *p_vdec = (vdec_thread_t *)p_context->opaque; diff --git a/modules/codec/mad/libmad.c b/modules/codec/mad/libmad.c index f9aa1cefd2..4381c8b79b 100644 --- a/modules/codec/mad/libmad.c +++ b/modules/codec/mad/libmad.c @@ -95,8 +95,8 @@ enum mad_flow libmad_input( void *p_data, struct mad_stream *p_stream ) /* Fill-in the buffer. If an error occurs print a message and leave * the decoding loop. If the end of stream is reached we also leave * the loop but the return status is left untouched. */ - if( i_wanted > p_dec->bit_stream.p_data->p_payload_end - - p_dec->bit_stream.p_data->p_payload_start ) + if( i_wanted > (size_t)(p_dec->bit_stream.p_data->p_payload_end + - p_dec->bit_stream.p_data->p_payload_start) ) { i_wanted = p_dec->bit_stream.p_data->p_payload_end - p_dec->bit_stream.p_data->p_payload_start; @@ -146,9 +146,9 @@ enum mad_flow libmad_output( void *p_data, struct mad_header const *p_header, aout_buffer_t * p_buffer; mad_fixed_t const * p_left = p_pcm->samples[0]; mad_fixed_t const * p_right = p_pcm->samples[1]; - int i_samples = p_pcm->length; + unsigned int i_samples = p_pcm->length; mad_fixed_t * p_samples; - int i_channels = (p_pcm->channels == 2) ? + unsigned int i_channels = (p_pcm->channels == 2) ? AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT : AOUT_CHAN_CENTER; diff --git a/modules/codec/mpeg_audio/decoder.c b/modules/codec/mpeg_audio/decoder.c index e382a43cfa..e53258ebde 100644 --- a/modules/codec/mpeg_audio/decoder.c +++ b/modules/codec/mpeg_audio/decoder.c @@ -2,7 +2,7 @@ * decoder.c: MPEG audio decoder thread ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: decoder.c,v 1.8 2002/11/14 22:38:47 massiot Exp $ + * $Id: decoder.c,v 1.9 2002/12/06 16:34:05 sam Exp $ * * Authors: Michel Kaempf * Michel Lespinasse @@ -173,7 +173,7 @@ static void DecodeThread( adec_thread_t * p_dec ) { /* Create the output fifo if it doesn't exist yet */ if( ( p_dec->p_aout_input == NULL ) || - ( p_dec->output_format.i_physical_channels != + ( p_dec->output_format.i_physical_channels != (unsigned int) ( sync_info.b_stereo ? AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT : AOUT_CHAN_CENTER ) ) || ( p_dec->output_format.i_rate != sync_info.sample_rate ) ) diff --git a/modules/codec/mpeg_audio/decoder.h b/modules/codec/mpeg_audio/decoder.h index a31ada674c..6748bf722d 100644 --- a/modules/codec/mpeg_audio/decoder.h +++ b/modules/codec/mpeg_audio/decoder.h @@ -2,7 +2,7 @@ * mpeg_adec.h : audio decoder thread interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: decoder.h,v 1.3 2002/08/26 23:00:22 massiot Exp $ + * $Id: decoder.h,v 1.4 2002/12/06 16:34:05 sam Exp $ * * Authors: Michel Kaempf * @@ -26,7 +26,7 @@ *****************************************************************************/ typedef struct adec_thread_s { - /* + /* * Sync Information */ int i_sync; @@ -41,8 +41,8 @@ typedef struct adec_thread_s /* * Decoder properties */ - u32 header; - int frame_size; + uint32_t header; + unsigned int frame_size; adec_bank_t bank_0; adec_bank_t bank_1; diff --git a/modules/codec/mpeg_audio/generic.c b/modules/codec/mpeg_audio/generic.c index 3704909dd1..1cf288c806 100644 --- a/modules/codec/mpeg_audio/generic.c +++ b/modules/codec/mpeg_audio/generic.c @@ -2,7 +2,7 @@ * generic.c: MPEG audio decoder ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: generic.c,v 1.4 2002/08/28 22:25:38 massiot Exp $ + * $Id: generic.c,v 1.5 2002/12/06 16:34:05 sam Exp $ * * Authors: Michel Kaempf * Michel Lespinasse @@ -185,7 +185,7 @@ int adec_SyncFrame( adec_thread_t * p_adec, adec_sync_info_t * p_sync_info ) int adec_DecodeFrame( adec_thread_t * p_adec, float * buffer ) { - int i_total_bytes_read; + unsigned int i_total_bytes_read; /* parse audio data */ diff --git a/modules/codec/mpeg_audio/generic.h b/modules/codec/mpeg_audio/generic.h index b6f5dc35c8..3451c3ac90 100644 --- a/modules/codec/mpeg_audio/generic.h +++ b/modules/codec/mpeg_audio/generic.h @@ -2,7 +2,7 @@ * audio_decoder.h : audio decoder interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: generic.h,v 1.1 2002/08/04 17:23:42 sam Exp $ + * $Id: generic.h,v 1.2 2002/12/06 16:34:05 sam Exp $ * * Authors: Michel Kaempf * @@ -10,7 +10,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -26,10 +26,10 @@ typedef struct audiodec_s audiodec_t; typedef struct adec_sync_info_s { - int sample_rate; /* sample rate in Hz */ - int frame_size; /* frame size in bytes */ - int bit_rate; /* nominal bit rate in kbps */ - int b_stereo; /* mono/stereo */ + unsigned int sample_rate; /* sample rate in Hz */ + unsigned int frame_size; /* frame size in bytes */ + unsigned int bit_rate; /* nominal bit rate in kbps */ + vlc_bool_t b_stereo; /* mono/stereo */ } adec_sync_info_t; typedef struct adec_bank_s @@ -38,7 +38,7 @@ typedef struct adec_bank_s float v2[512]; float * actual; int pos; - + } adec_bank_t; diff --git a/modules/codec/spudec/parse.c b/modules/codec/spudec/parse.c index 7b72cb3845..db789d5756 100644 --- a/modules/codec/spudec/parse.c +++ b/modules/codec/spudec/parse.c @@ -2,7 +2,7 @@ * parse.c: SPU parser ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: parse.c,v 1.5 2002/11/06 21:48:24 gbazin Exp $ + * $Id: parse.c,v 1.6 2002/12/06 16:34:05 sam Exp $ * * Authors: Samuel Hocevar * @@ -10,7 +10,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -249,16 +249,16 @@ static int ParseControlSeq( spudec_thread_t *p_spudec, subpicture_t * p_spu ) { /* Our current index in the SPU packet */ - int i_index = p_spudec->i_rle_size + 4; + unsigned int i_index = p_spudec->i_rle_size + 4; /* The next start-of-control-sequence index and the previous one */ - int i_next_seq = 0, i_cur_seq = 0; + unsigned int i_next_seq = 0, i_cur_seq = 0; /* Command and date */ uint8_t i_command = SPU_CMD_END; mtime_t date = 0; - int i, pi_alpha[4]; + unsigned int i, pi_alpha[4]; /* Initialize the structure */ p_spu->i_start = p_spu->i_stop = 0; @@ -272,18 +272,18 @@ static int ParseControlSeq( spudec_thread_t *p_spudec, { /* Get the control sequence date */ date = GetBits( &p_spudec->bit_stream, 16 ); - + /* Next offset */ i_cur_seq = i_index; i_next_seq = GetBits( &p_spudec->bit_stream, 16 ); - + /* Skip what we just read */ i_index += 4; } - + i_command = GetBits( &p_spudec->bit_stream, 8 ); i_index++; - + switch( i_command ) { case SPU_CMD_FORCE_DISPLAY: /* 00 (force displaying) */ diff --git a/modules/codec/spudec/spudec.h b/modules/codec/spudec/spudec.h index 53d434a700..38474a6c46 100644 --- a/modules/codec/spudec/spudec.h +++ b/modules/codec/spudec/spudec.h @@ -2,7 +2,7 @@ * spudec.h : sub picture unit decoder thread interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: spudec.h,v 1.4 2002/11/06 21:48:24 gbazin Exp $ + * $Id: spudec.h,v 1.5 2002/12/06 16:34:05 sam Exp $ * * Authors: Samuel Hocevar * @@ -10,7 +10,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -41,7 +41,7 @@ struct subpicture_sys_t /* Cropping properties */ vlc_mutex_t lock; vlc_bool_t b_crop; - int i_x_start, i_y_start, i_x_end, i_y_end; + unsigned int i_x_start, i_y_start, i_x_end, i_y_end; }; /***************************************************************************** @@ -49,11 +49,11 @@ struct subpicture_sys_t *****************************************************************************/ typedef struct subtitler_font_s { - int i_height; /* character height in pixels */ - int i_width[256]; /* character widths in pixels */ - int i_memory[256]; /* amount of memory used by character */ - int * p_length[256]; /* line byte widths */ - u16 ** p_offset[256]; /* pointer to RLE data */ + unsigned int i_height; /* character height in pixels */ + unsigned int i_width[256]; /* character widths in pixels */ + unsigned int i_memory[256]; /* amount of memory used by character */ + unsigned int * p_length[256]; /* line byte widths */ + uint16_t ** p_offset[256]; /* pointer to RLE data */ } subtitler_font_t; /***************************************************************************** @@ -81,8 +81,8 @@ struct spudec_thread_t /* * Private properties */ - int i_spu_size; /* size of current SPU packet */ - int i_rle_size; /* size of the RLE part */ + unsigned int i_spu_size; /* size of current SPU packet */ + unsigned int i_rle_size; /* size of the RLE part */ }; /***************************************************************************** diff --git a/modules/codec/spudec/subtitler.c b/modules/codec/spudec/subtitler.c index 088f44103d..aaa5e0c61a 100644 --- a/modules/codec/spudec/subtitler.c +++ b/modules/codec/spudec/subtitler.c @@ -9,7 +9,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -54,7 +54,7 @@ typedef struct subtitler_line_s /***************************************************************************** * Local prototypes *****************************************************************************/ -static uint16_t *PlotSubtitleLine( char *, subtitler_font_t *, int, +static uint16_t *PlotSubtitleLine( char *, subtitler_font_t *, unsigned int, uint16_t * ); static void DestroySPU ( subpicture_t * ); @@ -67,12 +67,12 @@ static void DestroySPU ( subpicture_t * ); * 1 byte : font height in rows * * then, per character: - * 1 byte : character + * 1 byte : character * 1 byte : character width in pixels * * then, per row: * 1 byte : length of row, in entries - * + * * then, per entry * 1 byte : colour * 1 byte : number of pixels of that colour @@ -85,14 +85,14 @@ subtitler_font_t* E_(subtitler_LoadFont)( vout_thread_t * p_vout, { subtitler_font_t * p_font; - int i; - int i_file; - int i_char; - int i_length; - int i_line; - int i_total_length; + unsigned int i; + unsigned int i_char; + unsigned int i_length; + unsigned int i_line; + unsigned int i_total_length; - byte_t pi_buffer[512]; /* file buffer */ + int i_file; + byte_t pi_buffer[512]; /* file buffer */ msg_Dbg( p_vout, "loading font '%s'", psz_name ); @@ -132,7 +132,7 @@ subtitler_font_t* E_(subtitler_LoadFont)( vout_thread_t * p_vout, if( read( i_file, pi_buffer, 1 ) != 1 ) { msg_Err( p_vout, "unexpected end of font file '%s'", psz_name ); - free( p_font ); + free( p_font ); close( i_file ); return( NULL ); } @@ -210,7 +210,7 @@ subtitler_font_t* E_(subtitler_LoadFont)( vout_thread_t * p_vout, i_total_length += i_length; /* Read line RLE data */ - if( read( i_file, pi_buffer, i_length*2 ) != i_length*2) + if( read( i_file, pi_buffer, i_length*2 ) != (int)i_length*2) { msg_Err( p_vout, "unexpected end of font file '%s'", psz_name); E_(subtitler_UnloadFont)( p_vout, p_font ); @@ -237,7 +237,7 @@ subtitler_font_t* E_(subtitler_LoadFont)( vout_thread_t * p_vout, /* Set total memory size of character */ p_font->i_memory[ i_char ] = i_total_length; - + } close(i_file); @@ -248,11 +248,11 @@ subtitler_font_t* E_(subtitler_LoadFont)( vout_thread_t * p_vout, /***************************************************************************** * subtitler_UnloadFont: unload a run-length encoded font file from memory *****************************************************************************/ -void E_(subtitler_UnloadFont)( vout_thread_t * p_vout, +void E_(subtitler_UnloadFont)( vout_thread_t * p_vout, subtitler_font_t * p_font ) { - int i_char; - int i_line; + unsigned int i_char; + unsigned int i_line; msg_Dbg( p_vout, "unloading font" ); @@ -292,12 +292,12 @@ void subtitler_PlotSubtitle ( vout_thread_t *p_vout , char *psz_subtitle, { subpicture_t * p_spu; - int i_x; - int i_width; - int i_lines; - int i_longest_width; - int i_total_length; - int i_char; + unsigned int i_x; + unsigned int i_width; + unsigned int i_lines; + unsigned int i_longest_width; + unsigned int i_total_length; + unsigned int i_char; uint16_t * p_data; @@ -328,7 +328,7 @@ void subtitler_PlotSubtitle ( vout_thread_t *p_vout , char *psz_subtitle, while( *p_char != '\n' && *p_char != 0 ) { - i_width += p_font->i_width[ toascii( *p_char ) ]; + i_width += p_font->i_width[ toascii( *p_char ) ]; if( i_width > p_vout->output.i_width ) { @@ -388,7 +388,7 @@ void subtitler_PlotSubtitle ( vout_thread_t *p_vout , char *psz_subtitle, no characters are lost */ if( *p_char != '\n' && *p_char != 0 ) { - p_char--; + p_char--; } p_line_start = p_char; @@ -411,7 +411,7 @@ void subtitler_PlotSubtitle ( vout_thread_t *p_vout , char *psz_subtitle, i_lines++; i_width = 0; for( i_x = 0; i_x < strlen( p_line->p_text ); i_x++ ) - { + { i_char = toascii(*(( p_line->p_text )+ i_x )); i_width += p_font->i_width[ i_char ]; i_total_length += p_font->i_memory[ i_char ]; @@ -452,7 +452,7 @@ void subtitler_PlotSubtitle ( vout_thread_t *p_vout , char *psz_subtitle, p_spu->i_start = i_start; p_spu->i_stop = i_stop; - + p_spu->b_ephemer = i_stop ? VLC_FALSE : VLC_TRUE; /* FIXME: Do we need these two? */ @@ -492,7 +492,7 @@ void subtitler_PlotSubtitle ( vout_thread_t *p_vout , char *psz_subtitle, p_spu->p_sys->b_crop = VLC_FALSE; p_spu->i_x = (p_vout->output.i_width - i_longest_width) / 2; - p_spu->i_y = p_vout->output.i_height - (p_font->i_height * i_lines); + p_spu->i_y = p_vout->output.i_height - (p_font->i_height * i_lines); p_spu->i_width = i_longest_width; p_spu->i_height = p_font->i_height*i_lines; @@ -518,13 +518,14 @@ void subtitler_PlotSubtitle ( vout_thread_t *p_vout , char *psz_subtitle, * PlotSubtitleLine: plot a single line of a subtitle *****************************************************************************/ static uint16_t * PlotSubtitleLine ( char *psz_line, subtitler_font_t *p_font, - int i_total_width, uint16_t *p_data ) + unsigned int i_total_width, + uint16_t *p_data ) { - int i_x; - int i_y; - int i_length; - int i_line_width; - int i_char; + unsigned int i_x; + unsigned int i_y; + unsigned int i_length; + unsigned int i_line_width; + unsigned int i_char; uint16_t * p_rle; @@ -552,12 +553,12 @@ static uint16_t * PlotSubtitleLine ( char *psz_line, subtitler_font_t *p_font, if(p_rle != NULL ) { - memcpy(p_data, p_rle, i_length * sizeof(uint16_t) ); + memcpy(p_data, p_rle, i_length * sizeof(uint16_t) ); p_data+=i_length; } } } - + /* Pad line to fit box */ if( i_line_width < i_total_width ) { diff --git a/modules/codec/spudec/text.c b/modules/codec/spudec/text.c index 7b0933b262..07f49a9958 100644 --- a/modules/codec/spudec/text.c +++ b/modules/codec/spudec/text.c @@ -2,7 +2,7 @@ * text.c: text subtitles parser ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: text.c,v 1.2 2002/11/15 18:10:26 fenrir Exp $ + * $Id: text.c,v 1.3 2002/12/06 16:34:05 sam Exp $ * * Authors: Gildas Bazin * @@ -59,10 +59,10 @@ void E_(ParseText)( spudec_thread_t *p_spudec, subtitler_font_t *p_font ) /* Check validity of packet data */ if( (p_spudec->bit_stream.p_data->p_payload_end - - p_spudec->bit_stream.p_data->p_payload_start) <= 0 - || (strlen(p_spudec->bit_stream.p_data->p_payload_start) - > p_spudec->bit_stream.p_data->p_payload_end - - p_spudec->bit_stream.p_data->p_payload_start) ) + - p_spudec->bit_stream.p_data->p_payload_start) <= 0 + || (strlen(p_spudec->bit_stream.p_data->p_payload_start) + > (size_t)(p_spudec->bit_stream.p_data->p_payload_end + - p_spudec->bit_stream.p_data->p_payload_start)) ) { /* Dump the packet */ NextDataPacket( p_spudec->p_fifo, &p_spudec->bit_stream ); diff --git a/modules/control/rc/rc.c b/modules/control/rc/rc.c index a87a6f9b04..fba364e0f4 100644 --- a/modules/control/rc/rc.c +++ b/modules/control/rc/rc.c @@ -2,7 +2,7 @@ * rc.c : remote control stdin/stdout plugin for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: rc.c,v 1.13 2002/12/02 21:13:25 jlj Exp $ + * $Id: rc.c,v 1.14 2002/12/06 16:34:06 sam Exp $ * * Authors: Peter Surda * @@ -459,7 +459,7 @@ static int Playlist( vlc_object_t *p_this, char *psz_cmd, char *psz_arg ) !strcmp( psz_cmd, "chapter_n" ) || !strcmp( psz_cmd, "chapter_p" ) ) { - int i_chapter = 0; + unsigned int i_chapter = 0; if( !strcmp( psz_cmd, "chapter" ) ) { @@ -513,7 +513,7 @@ static int Playlist( vlc_object_t *p_this, char *psz_cmd, char *psz_arg ) !strcmp( psz_cmd, "title_n" ) || !strcmp( psz_cmd, "title_p" ) ) { - int i_title = 0; + unsigned int i_title = 0; if( !strcmp( psz_cmd, "title" ) ) { diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c index 1e3eb475ca..2de1d00256 100644 --- a/modules/demux/asf/asf.c +++ b/modules/demux/asf/asf.c @@ -2,14 +2,14 @@ * asf.c : ASFv01 file input module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: asf.c,v 1.11 2002/12/03 17:00:16 fenrir Exp $ + * $Id: asf.c,v 1.12 2002/12/06 16:34:06 sam Exp $ * Authors: Laurent Aimar - * + * * 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 * (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 @@ -56,7 +56,7 @@ static uint16_t GetWLE( uint8_t *p_buff ) return( (p_buff[0]) + ( p_buff[1] <<8 ) ); } static uint32_t GetDWLE( uint8_t *p_buff ) -{ +{ return( p_buff[0] + ( p_buff[1] <<8 ) + ( p_buff[2] <<16 ) + ( p_buff[3] <<24 ) ); } @@ -65,14 +65,14 @@ static uint32_t GetDWLE( uint8_t *p_buff ) * Activate: check file and initializes ASF structures *****************************************************************************/ static int Activate( vlc_object_t * p_this ) -{ +{ input_thread_t *p_input = (input_thread_t *)p_this; uint8_t *p_peek; guid_t guid; - + demux_sys_t *p_demux; int i_stream; - + /* Initialize access plug-in structures. */ if( p_input->i_mtu == 0 ) { @@ -96,7 +96,7 @@ static int Activate( vlc_object_t * p_this ) } /* create our structure that will contains all data */ - if( !( p_input->p_demux_data = + if( !( p_input->p_demux_data = p_demux = malloc( sizeof( demux_sys_t ) ) ) ) { msg_Err( p_input, "out of memory" ); @@ -120,7 +120,7 @@ static int Activate( vlc_object_t * p_this ) msg_Warn( p_input, "ASF v1.0 plugin discarded (not a valid file)" ); return( -1 ); } - + if( !( p_demux->p_fp = ASF_FindObject( p_demux->root.p_hdr, &asf_object_file_properties_guid, 0 ) ) ) { @@ -129,7 +129,7 @@ static int Activate( vlc_object_t * p_this ) msg_Warn( p_input, "ASF v1.0 plugin discarded (missing file_properties object)" ); return( -1 ); } - + if( p_demux->p_fp->i_min_data_packet_size != p_demux->p_fp->i_max_data_packet_size ) { ASF_FreeObjectRoot( p_input, &p_demux->root ); @@ -137,8 +137,8 @@ static int Activate( vlc_object_t * p_this ) msg_Warn( p_input, "ASF v1.0 plugin discarded (invalid file_properties object)" ); return( -1 ); } - - p_demux->i_streams = ASF_CountObject( p_demux->root.p_hdr, + + p_demux->i_streams = ASF_CountObject( p_demux->root.p_hdr, &asf_object_stream_properties_guid ); if( !p_demux->i_streams ) { @@ -174,19 +174,19 @@ static int Activate( vlc_object_t * p_this ) { asf_stream_t *p_stream; asf_object_stream_properties_t *p_sp; - + p_sp = ASF_FindObject( p_demux->root.p_hdr, &asf_object_stream_properties_guid, i_stream ); - p_stream = - p_demux->stream[p_sp->i_stream_number] = + p_stream = + p_demux->stream[p_sp->i_stream_number] = malloc( sizeof( asf_stream_t ) ); memset( p_stream, 0, sizeof( asf_stream_t ) ); p_stream->p_sp = p_sp; vlc_mutex_lock( &p_input->stream.stream_lock ); - p_stream->p_es = + p_stream->p_es = input_AddES( p_input, p_input->stream.p_selected_program, p_sp->i_stream_number, @@ -207,42 +207,42 @@ static int Activate( vlc_object_t * p_this ) p_stream->i_cat = AUDIO_ES; msg_Dbg( p_input, - "adding new audio stream(codec:0x%x,ID:%d)", + "adding new audio stream(codec:0x%x,ID:%d)", i_codec, p_sp->i_stream_number ); switch( i_codec ) { case( 0x01 ): - p_stream->p_es->i_fourcc = + p_stream->p_es->i_fourcc = VLC_FOURCC( 'a', 'r', 'a', 'w' ); break; case( 0x50 ): case( 0x55 ): - p_stream->p_es->i_fourcc = + p_stream->p_es->i_fourcc = VLC_FOURCC( 'm','p','g','a' ); break; case( 0x2000 ): - p_stream->p_es->i_fourcc = + p_stream->p_es->i_fourcc = VLC_FOURCC( 'a','5','2',' ' ); break; case( 0x160 ): - p_stream->p_es->i_fourcc = + p_stream->p_es->i_fourcc = VLC_FOURCC( 'w','m','a','1' ); break; case( 0x161 ): - p_stream->p_es->i_fourcc = + p_stream->p_es->i_fourcc = VLC_FOURCC( 'w','m','a','2' ); break; default: - p_stream->p_es->i_fourcc = + p_stream->p_es->i_fourcc = VLC_FOURCC( 'm','s',(i_codec >> 8)&0xff,i_codec&0xff ); } if( p_sp->i_type_specific_data_length > 0 ) { WAVEFORMATEX *p_wf; - int i_size; + size_t i_size; uint8_t *p_data; - + i_size = p_sp->i_type_specific_data_length; p_wf = malloc( i_size ); @@ -264,14 +264,14 @@ static int Activate( vlc_object_t * p_this ) i_size - sizeof( WAVEFORMATEX ) ); } } - + } else if( CmpGUID( &p_sp->i_stream_type, &asf_object_stream_type_video ) ) { p_stream->i_cat = VIDEO_ES; msg_Dbg( p_input, - "adding new video stream(ID:%d)", + "adding new video stream(ID:%d)", p_sp->i_stream_number ); if( p_sp->p_type_specific_data ) { @@ -283,21 +283,21 @@ static int Activate( vlc_object_t * p_this ) } else { - p_stream->p_es->i_fourcc = + p_stream->p_es->i_fourcc = VLC_FOURCC( 'u','n','d','f' ); } if( p_sp->i_type_specific_data_length > 11 ) { BITMAPINFOHEADER *p_bih; - int i_size; + size_t i_size; uint8_t *p_data; i_size = p_sp->i_type_specific_data_length - 11; - + p_bih = malloc( i_size ); p_stream->p_es->p_demux_data = (void*)p_bih; p_data = p_sp->p_type_specific_data + 11; - + p_bih->biSize = GetDWLE( p_data ); p_bih->biWidth = GetDWLE( p_data + 4 ); p_bih->biHeight = GetDWLE( p_data + 8 ); @@ -322,8 +322,8 @@ static int Activate( vlc_object_t * p_this ) else { p_stream->i_cat = UNKNOWN_ES; - msg_Dbg( p_input, - "ignoring unknown stream(ID:%d)", + msg_Dbg( p_input, + "ignoring unknown stream(ID:%d)", p_sp->i_stream_number ); p_stream->p_es->i_fourcc = VLC_FOURCC( 'u','n','d','f' ); } @@ -336,7 +336,7 @@ static int Activate( vlc_object_t * p_this ) } vlc_mutex_unlock( &p_input->stream.stream_lock ); } - + p_demux->i_data_begin = p_demux->root.p_data->i_object_pos + 50; if( p_demux->root.p_data->i_object_size != 0 ) @@ -361,12 +361,12 @@ static int Activate( vlc_object_t * p_this ) mtime_t i_length; /* real number of packets */ - i_count = ( p_input->stream.p_selected_area->i_size - - p_demux->i_data_begin ) / + i_count = ( p_input->stream.p_selected_area->i_size - + p_demux->i_data_begin ) / p_demux->p_fp->i_min_data_packet_size; /* calculate the time duration in s */ - i_length = (mtime_t)p_demux->p_fp->i_play_duration / 10 * - (mtime_t)i_count / + i_length = (mtime_t)p_demux->p_fp->i_play_duration / 10 * + (mtime_t)i_count / (mtime_t)p_demux->p_fp->i_data_packets_count / (mtime_t)1000000; if( i_length > 0 ) @@ -391,12 +391,12 @@ static int Activate( vlc_object_t * p_this ) p_input->stream.p_selected_program->b_is_ok = 1; vlc_mutex_unlock( &p_input->stream.stream_lock ); - + return( 0 ); } /***************************************************************************** - * Demux: read packet and send them to decoders + * Demux: read packet and send them to decoders *****************************************************************************/ #define GETVALUE2b( bits, var, def ) \ switch( (bits)&0x03 ) \ @@ -419,13 +419,13 @@ static int Demux( input_thread_t *p_input ) off_t i_offset; msleep( DEFAULT_PTS_DELAY ); i_offset = ASF_TellAbsolute( p_input ) - p_demux->i_data_begin; - + if( i_offset < 0 ) { i_offset = 0; } /* XXX work only when i_min_data_packet_size == i_max_data_packet_size */ - i_offset += p_demux->p_fp->i_min_data_packet_size - + i_offset += p_demux->p_fp->i_min_data_packet_size - i_offset % p_demux->p_fp->i_min_data_packet_size; ASF_SeekAbsolute( p_input, p_demux->i_data_begin + i_offset ); @@ -448,7 +448,7 @@ static int Demux( input_thread_t *p_input ) int i_data_packet_min = p_demux->p_fp->i_min_data_packet_size; uint8_t *p_peek; int i_skip; - + int i_packet_size_left; int i_packet_flags; int i_packet_property; @@ -457,14 +457,14 @@ static int Demux( input_thread_t *p_input ) int i_packet_length; int i_packet_sequence; int i_packet_padding_length; - + uint32_t i_packet_send_time; uint16_t i_packet_duration; int i_payload; int i_payload_count; int i_payload_length_type; - + if( input_Peek( p_input, &p_peek, i_data_packet_min ) < i_data_packet_min ) { // EOF ? @@ -472,7 +472,7 @@ static int Demux( input_thread_t *p_input ) return( 0 ); } i_skip = 0; - + /* *** parse error correction if present *** */ if( p_peek[0]&0x80 ) { @@ -484,7 +484,7 @@ static int Demux( input_thread_t *p_input ) i_opaque_data_present = ( p_peek[0] >> 4 )& 0x01; // 1bit i_error_correction_length_type = ( p_peek[0] >> 5 ) & 0x03; // 2bits i_skip += 1; // skip error correction flags - + if( i_error_correction_length_type != 0x00 || i_opaque_data_present != 0 || i_error_correction_data_length != 0x02 ) @@ -501,7 +501,7 @@ static int Demux( input_thread_t *p_input ) i_packet_flags = p_peek[i_skip]; i_skip++; i_packet_property = p_peek[i_skip]; i_skip++; - + b_packet_multiple_payload = i_packet_flags&0x01; /* read some value */ @@ -511,11 +511,11 @@ static int Demux( input_thread_t *p_input ) i_packet_send_time = GetDWLE( p_peek + i_skip ); i_skip += 4; i_packet_duration = GetWLE( p_peek + i_skip ); i_skip += 2; - + // i_packet_size_left = i_packet_length; // XXX données reellement lu /* FIXME I have to do that for some file, I don't known why */ i_packet_size_left = i_data_packet_min; - + if( b_packet_multiple_payload ) { i_payload_count = p_peek[i_skip] & 0x3f; @@ -544,13 +544,13 @@ static int Demux( input_thread_t *p_input ) mtime_t i_pts; mtime_t i_pts_delta; - i_stream_number = p_peek[i_skip] & 0x7f; + i_stream_number = p_peek[i_skip] & 0x7f; i_skip++; - + GETVALUE2b( i_packet_property >> 4, i_media_object_number, 0 ); GETVALUE2b( i_packet_property >> 2, i_tmp, 0 ); GETVALUE2b( i_packet_property, i_replicated_data_length, 0 ); - + if( i_replicated_data_length > 1 ) // should be at least 8 bytes { i_pts = (mtime_t)GetDWLE( p_peek + i_skip + 4 ) * 1000; @@ -584,25 +584,25 @@ static int Demux( input_thread_t *p_input ) } else { - i_payload_data_length = i_packet_length - + i_payload_data_length = i_packet_length - i_packet_padding_length - i_skip; } - + #if 0 - msg_Dbg( p_input, + msg_Dbg( p_input, "payload(%d/%d) stream_number:%d media_object_number:%d media_object_offset:%d replicated_data_length:%d payload_data_length %d", - i_payload + 1, + i_payload + 1, i_payload_count, i_stream_number, - i_media_object_number, - i_media_object_offset, - i_replicated_data_length, + i_media_object_number, + i_media_object_offset, + i_replicated_data_length, i_payload_data_length ); #endif if( !( p_stream = p_demux->stream[i_stream_number] ) ) { - msg_Warn( p_input, + msg_Warn( p_input, "undeclared stream[Id 0x%x]", i_stream_number ); i_skip += i_payload_data_length; continue; // over payload @@ -615,9 +615,9 @@ static int Demux( input_thread_t *p_input ) } - for( i_payload_data_pos = 0; - i_payload_data_pos < i_payload_data_length && - i_packet_size_left > 0; + for( i_payload_data_pos = 0; + i_payload_data_pos < i_payload_data_length && + i_packet_size_left > 0; i_payload_data_pos += i_sub_payload_data_length ) { data_packet_t *p_data; @@ -645,7 +645,7 @@ static int Demux( input_thread_t *p_input ) if( !p_stream->p_pes ) // add a new PES { - p_stream->i_time = + p_stream->i_time = ( (mtime_t)i_pts + i_payload * (mtime_t)i_pts_delta ); if( p_demux->i_first_pts == -1 ) @@ -655,9 +655,9 @@ static int Demux( input_thread_t *p_input ) p_stream->i_time -= p_demux->i_first_pts; p_stream->p_pes = input_NewPES( p_input->p_method_data ); - p_stream->p_pes->i_dts = - p_stream->p_pes->i_pts = - input_ClockGetTS( p_input, + p_stream->p_pes->i_dts = + p_stream->p_pes->i_pts = + input_ClockGetTS( p_input, p_input->stream.p_selected_program, ( p_stream->i_time+DEFAULT_PTS_DELAY) * 9 /100 ); @@ -675,7 +675,7 @@ static int Demux( input_thread_t *p_input ) p_data->p_payload_start += i_skip; i_packet_size_left -= i_read; - + if( !p_stream->p_pes->p_first ) { p_stream->p_pes->p_first = p_stream->p_pes->p_last = p_data; @@ -700,7 +700,7 @@ static int Demux( input_thread_t *p_input ) } } } - + if( i_packet_size_left > 0 ) { if( !ASF_SkipBytes( p_input, i_packet_size_left ) ) @@ -744,14 +744,14 @@ loop_error_recovery: { /* update pcr XXX in mpeg scale so in 90000 unit/s */ p_demux->i_pcr =( __MAX( p_demux->i_time /*- DEFAULT_PTS_DELAY*/, 0 ) ) * 9 / 100; - + /* first wait for the good time to read next packets */ input_ClockManageRef( p_input, p_input->stream.p_selected_program, p_demux->i_pcr ); } - + return( 1 ); } @@ -759,14 +759,14 @@ loop_error_recovery: * MP4End: frees unused data *****************************************************************************/ static void Deactivate( vlc_object_t * p_this ) -{ +{ #define FREE( p ) \ - if( p ) { free( p ); } - + if( p ) { free( p ); } + input_thread_t * p_input = (input_thread_t *)p_this; demux_sys_t *p_demux = p_input->p_demux_data; int i_stream; - + msg_Dbg( p_input, "Freeing all memory" ); ASF_FreeObjectRoot( p_input, &p_demux->root ); for( i_stream = 0; i_stream < 128; i_stream++ ) @@ -782,7 +782,7 @@ static void Deactivate( vlc_object_t * p_this ) } #undef p_stream } - + #undef FREE } diff --git a/modules/demux/asf/libasf.c b/modules/demux/asf/libasf.c index 05d2893fe9..f6d55bbf03 100644 --- a/modules/demux/asf/libasf.c +++ b/modules/demux/asf/libasf.c @@ -1,15 +1,15 @@ /***************************************************************************** - * libasf.c : + * libasf.c : ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: libasf.c,v 1.7 2002/11/25 15:08:34 fenrir Exp $ + * $Id: libasf.c,v 1.8 2002/12/06 16:34:06 sam Exp $ * Authors: Laurent Aimar - * + * * 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 * (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 @@ -34,7 +34,7 @@ #define FREE( p ) \ if( p ) {free( p ); p = NULL; } - + #define GUID_FMT "0x%x-0x%x-0x%x-0x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x" #define GUID_PRINT( guid ) \ (guid).v1, \ @@ -86,7 +86,7 @@ int CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 ) * Some basic functions to manipulate stream more easily in vlc * * ASF_TellAbsolute get file position - * + * * ASF_SeekAbsolute seek in the file * * ASF_ReadData read data from the file in a buffer @@ -95,9 +95,9 @@ int CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 ) off_t ASF_TellAbsolute( input_thread_t *p_input ) { off_t i_pos; - + vlc_mutex_lock( &p_input->stream.stream_lock ); - + i_pos= p_input->stream.p_selected_area->i_tell; // - ( p_input->p_last_data - p_input->p_current_data ); @@ -105,7 +105,7 @@ off_t ASF_TellAbsolute( input_thread_t *p_input ) return( i_pos ); } - + int ASF_SeekAbsolute( input_thread_t *p_input, off_t i_pos) { @@ -124,8 +124,8 @@ int ASF_SeekAbsolute( input_thread_t *p_input, } if( p_input->stream.b_seekable && - ( p_input->stream.i_method == INPUT_METHOD_FILE || - i_pos < i_filepos || + ( p_input->stream.i_method == INPUT_METHOD_FILE || + i_pos < i_filepos || i_pos - i_filepos > 10000 ) ) { p_input->pf_seek( p_input, i_pos ); @@ -140,7 +140,7 @@ int ASF_SeekAbsolute( input_thread_t *p_input, data_packet_t *p_data; int i_read; - i_read = + i_read = input_SplitBuffer(p_input, &p_data, __MIN( i_size, 1024 ) ); if( i_read <= 0 ) { @@ -148,7 +148,7 @@ int ASF_SeekAbsolute( input_thread_t *p_input, } input_DeletePacket( p_input->p_method_data, p_data ); i_size -= i_read; - + } while( i_size > 0 ); } return( 1 ); @@ -161,7 +161,7 @@ int ASF_ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size ) int i_read; - + if( !i_size ) { return( 1 ); @@ -176,23 +176,23 @@ int ASF_ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size ) } memcpy( p_buff, p_data->p_payload_start, i_read ); input_DeletePacket( p_input->p_method_data, p_data ); - + p_buff += i_read; i_size -= i_read; - + } while( i_size ); - + return( 1 ); } int ASF_SkipBytes( input_thread_t *p_input, int i_count ) { - return( ASF_SeekAbsolute( p_input, + return( ASF_SeekAbsolute( p_input, ASF_TellAbsolute( p_input ) + i_count ) ); } /****************************************************************************/ -int ASF_ReadObjectCommon( input_thread_t *p_input, +int ASF_ReadObjectCommon( input_thread_t *p_input, asf_object_t *p_obj ) { asf_object_common_t *p_common = (asf_object_common_t*)p_obj; @@ -202,7 +202,7 @@ int ASF_ReadObjectCommon( input_thread_t *p_input, { return( 0 ); } - GetGUID( &p_common->i_object_id, p_peek ); + GetGUID( &p_common->i_object_id, p_peek ); p_common->i_object_size = GetQWLE( p_peek + 16 ); p_common->i_object_pos = ASF_TellAbsolute( p_input ); p_common->p_next = NULL; @@ -212,8 +212,8 @@ int ASF_ReadObjectCommon( input_thread_t *p_input, GUID_PRINT( p_common->i_object_id ), p_common->i_object_size ); #endif - - return( 1 ); + + return( 1 ); } int ASF_NextObject( input_thread_t *p_input, @@ -236,14 +236,14 @@ int ASF_NextObject( input_thread_t *p_input, if( p_obj->common.p_father && p_obj->common.p_father->common.i_object_size != 0 ) { if( p_obj->common.p_father->common.i_object_pos + p_obj->common.p_father->common.i_object_size < - p_obj->common.i_object_pos + p_obj->common.i_object_size + 24 ) + p_obj->common.i_object_pos + p_obj->common.i_object_size + 24 ) /* 24 is min size of an object */ { return( 0 ); } } - return( ASF_SeekAbsolute( p_input, + return( ASF_SeekAbsolute( p_input, p_obj->common.i_object_pos + p_obj->common.i_object_size ) ); } @@ -272,7 +272,7 @@ int ASF_ReadObject_Header( input_thread_t *p_input, asf_object_t *p_subobj; int i_peek; uint8_t *p_peek; - + if( ( i_peek = input_Peek( p_input, &p_peek, 30 ) ) < 30 ) { return( 0 ); @@ -297,7 +297,7 @@ int ASF_ReadObject_Header( input_thread_t *p_input, if( !( ASF_ReadObject( p_input, p_subobj, (asf_object_t*)p_hdr ) ) ) { - break; + break; } if( !ASF_NextObject( p_input, p_subobj ) ) /* Go to the next object */ { @@ -313,7 +313,7 @@ int ASF_ReadObject_Data( input_thread_t *p_input, asf_object_data_t *p_data = (asf_object_data_t*)p_obj; int i_peek; uint8_t *p_peek; - + if( ( i_peek = input_Peek( p_input, &p_peek, 50 ) ) < 50 ) { return( 0 ); @@ -338,7 +338,7 @@ int ASF_ReadObject_Index( input_thread_t *p_input, asf_object_index_t *p_index = (asf_object_index_t*)p_obj; int i_peek; uint8_t *p_peek; - + if( ( i_peek = input_Peek( p_input, &p_peek, 56 ) ) < 56 ) { return( 0 ); @@ -374,7 +374,7 @@ int ASF_ReadObject_file_properties( input_thread_t *p_input, asf_object_file_properties_t *p_fp = (asf_object_file_properties_t*)p_obj; int i_peek; uint8_t *p_peek; - + if( ( i_peek = input_Peek( p_input, &p_peek, 92) ) < 92 ) { return( 0 ); @@ -390,7 +390,7 @@ int ASF_ReadObject_file_properties( input_thread_t *p_input, p_fp->i_min_data_packet_size = GetDWLE( p_peek + 92 ); p_fp->i_max_data_packet_size = GetDWLE( p_peek + 96 ); p_fp->i_max_bitrate = GetDWLE( p_peek + 100 ); - + #ifdef ASF_DEBUG msg_Dbg( p_input, "Read \"File Properties Object\" file_id:" GUID_FMT @@ -419,7 +419,7 @@ int ASF_ReadObject_header_extention( input_thread_t *p_input, asf_object_header_extention_t *p_he = (asf_object_header_extention_t*)p_obj; int i_peek; uint8_t *p_peek; - + if( ( i_peek = input_Peek( p_input, &p_peek, p_he->i_object_size ) ) < 46) { return( 0 ); @@ -444,7 +444,7 @@ int ASF_ReadObject_header_extention( input_thread_t *p_input, GUID_PRINT( p_he->i_reserved1 ), p_he->i_reserved2, p_he->i_header_extention_size ); -#endif +#endif return( 1 ); } void ASF_FreeObject_header_extention( input_thread_t *p_input, @@ -458,11 +458,11 @@ void ASF_FreeObject_header_extention( input_thread_t *p_input, int ASF_ReadObject_stream_properties( input_thread_t *p_input, asf_object_t *p_obj ) { - asf_object_stream_properties_t *p_sp = + asf_object_stream_properties_t *p_sp = (asf_object_stream_properties_t*)p_obj; int i_peek; uint8_t *p_peek; - + if( ( i_peek = input_Peek( p_input, &p_peek, p_sp->i_object_size ) ) < 74 ) { return( 0 ); @@ -519,7 +519,7 @@ int ASF_ReadObject_stream_properties( input_thread_t *p_input, void ASF_FreeObject_stream_properties( input_thread_t *p_input, asf_object_t *p_obj ) { - asf_object_stream_properties_t *p_sp = + asf_object_stream_properties_t *p_sp = (asf_object_stream_properties_t*)p_obj; FREE( p_sp->p_type_specific_data ); @@ -534,8 +534,8 @@ int ASF_ReadObject_codec_list( input_thread_t *p_input, int i_peek; uint8_t *p_peek, *p_data; - int i_codec; - + unsigned int i_codec; + if( ( i_peek = input_Peek( p_input, &p_peek, p_cl->i_object_size ) ) < 44 ) { return( 0 ); @@ -575,7 +575,7 @@ int ASF_ReadObject_codec_list( input_thread_t *p_input, } codec.psz_description[i_len] = '\0'; p_data += 2 * i_len; - + /* opaque information */ codec.i_information_length = GetWLE( p_data ); p_data += 2; if( codec.i_information_length > 0 ) @@ -609,10 +609,10 @@ int ASF_ReadObject_codec_list( input_thread_t *p_input, "Read \"Codec List Object\" codec[%d] %s name:\"%s\" description:\"%s\" information_length:%d", i_codec, ( codec.i_type == ASF_CODEC_TYPE_VIDEO ) ? "video" : ( ( codec.i_type == ASF_CODEC_TYPE_AUDIO ) ? "audio" : "unknown" ), - codec.psz_name, - codec.psz_description, + codec.psz_name, + codec.psz_description, codec.i_information_length ); - + #undef codec } #endif @@ -622,7 +622,7 @@ void ASF_FreeObject_codec_list( input_thread_t *p_input, asf_object_t *p_obj ) { asf_object_codec_list_t *p_cl = (asf_object_codec_list_t*)p_obj; - int i_codec; + unsigned int i_codec; for( i_codec = 0; i_codec < p_cl->i_codec_entries_count; i_codec++ ) { @@ -641,7 +641,7 @@ void ASF_FreeObject_codec_list( input_thread_t *p_input, int ASF_ReadObject_content_description( input_thread_t *p_input, asf_object_t *p_obj ) { - asf_object_content_description_t *p_cd = + asf_object_content_description_t *p_cd = (asf_object_content_description_t*)p_obj; int i_peek; uint8_t *p_peek, *p_data; @@ -652,7 +652,7 @@ int ASF_ReadObject_content_description( input_thread_t *p_input, int i_copyright; int i_description; int i_rating; - + #define GETSTRINGW( psz_str, i_size ) \ psz_str = calloc( i_size/2 + 1, sizeof( char ) ); \ for( i_len = 0; i_len < i_size/2; i_len++ ) \ @@ -661,7 +661,7 @@ int ASF_ReadObject_content_description( input_thread_t *p_input, } \ psz_str[i_size/2] = '\0'; \ p_data += i_size; - + if( ( i_peek = input_Peek( p_input, &p_peek, p_cd->i_object_size ) ) < 34 ) { return( 0 ); @@ -690,7 +690,7 @@ int ASF_ReadObject_content_description( input_thread_t *p_input, p_cd->psz_copyright, p_cd->psz_description, p_cd->psz_rating ); -#endif +#endif return( 1 ); } @@ -698,7 +698,7 @@ void ASF_FreeObject_content_description( input_thread_t *p_input, asf_object_t *p_obj ) { asf_object_content_description_t *p_cd = (asf_object_content_description_t*)p_obj; - + FREE( p_cd->psz_title ); FREE( p_cd->psz_author ); FREE( p_cd->psz_copyright ); @@ -710,7 +710,7 @@ static struct { const guid_t *p_id; int i_type; - int (*ASF_ReadObject_function)( input_thread_t *p_input, + int (*ASF_ReadObject_function)( input_thread_t *p_input, asf_object_t *p_obj ); void (*ASF_FreeObject_function)( input_thread_t *p_input, asf_object_t *p_obj ); @@ -749,7 +749,7 @@ int ASF_ReadObject( input_thread_t *p_input, p_obj->common.p_first = NULL; p_obj->common.p_next = NULL; p_obj->common.p_last = NULL; - + if( p_obj->common.i_object_size < 24 ) { @@ -778,11 +778,11 @@ int ASF_ReadObject( input_thread_t *p_input, else { /* XXX ASF_ReadObject_function realloc *pp_obj XXX */ - i_result = + i_result = (ASF_Object_Function[i_index].ASF_ReadObject_function)( p_input, p_obj ); } - + /* link this object with father */ if( p_father ) { @@ -805,12 +805,12 @@ void ASF_FreeObject( input_thread_t *p_input, { int i_index; asf_object_t *p_child; - + if( !p_obj ) { return; } - + /* Free all child object */ p_child = p_obj->common.p_first; while( p_child ) @@ -836,14 +836,14 @@ void ASF_FreeObject( input_thread_t *p_input, /* Now free this object */ if( ASF_Object_Function[i_index].ASF_FreeObject_function == NULL ) { - msg_Warn( p_input, + msg_Warn( p_input, "Unknown asf object " GUID_FMT, GUID_PRINT( p_obj->common.i_object_id ) ); } else { #ifdef ASF_DEBUG - msg_Dbg( p_input, + msg_Dbg( p_input, "Free asf object " GUID_FMT, GUID_PRINT( p_obj->common.i_object_id ) ); #endif @@ -873,7 +873,7 @@ int ASF_ReadObjectRoot( input_thread_t *p_input, p_root->p_hdr = NULL; p_root->p_data = NULL; p_root->p_index = NULL; - + for( ; ; ) { p_obj = malloc( sizeof( asf_object_t ) ); @@ -914,7 +914,7 @@ void ASF_FreeObjectRoot( input_thread_t *p_input, asf_object_root_t *p_root ) { asf_object_t *p_obj; - + p_obj = p_root->p_first; while( p_obj ) { @@ -930,7 +930,7 @@ void ASF_FreeObjectRoot( input_thread_t *p_input, p_root->p_hdr = NULL; p_root->p_data = NULL; p_root->p_index = NULL; - + } int __ASF_CountObject( asf_object_t *p_obj, const guid_t *p_guid ) diff --git a/modules/demux/asf/libasf.h b/modules/demux/asf/libasf.h index 505844c1b8..bd9279e5a9 100644 --- a/modules/demux/asf/libasf.h +++ b/modules/demux/asf/libasf.h @@ -1,15 +1,15 @@ /***************************************************************************** - * libasf.h : + * libasf.h : ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: libasf.h,v 1.4 2002/11/14 16:17:47 fenrir Exp $ + * $Id: libasf.h,v 1.5 2002/12/06 16:34:06 sam Exp $ * Authors: Laurent Aimar - * + * * 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 * (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 @@ -53,7 +53,7 @@ static const guid_t asf_object_null_guid = { 0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00 } }; -static const guid_t asf_object_header_guid = +static const guid_t asf_object_header_guid = { 0x75B22630, 0x668E, @@ -61,7 +61,7 @@ static const guid_t asf_object_header_guid = { 0xA6,0xD9, 0x00,0xAA,0x00,0x62,0xCE,0x6C } }; -static const guid_t asf_object_data_guid = +static const guid_t asf_object_data_guid = { 0x75B22636, 0x668E, @@ -104,12 +104,12 @@ static const guid_t asf_object_content_description_guid = { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c } }; -static const guid_t asf_object_header_extention_guid = +static const guid_t asf_object_header_extention_guid = { 0x5FBF03B5, 0xA92E, 0x11CF, - { 0x8E,0xE3, 0x00,0xC0,0x0C,0x20,0x53,0x65 } + { 0x8E,0xE3, 0x00,0xC0,0x0C,0x20,0x53,0x65 } }; static const guid_t asf_object_codec_list_guid = @@ -167,15 +167,15 @@ typedef struct asf_packet_s int i_payload_size; u8 *p_payload_data; - + } asf_packet_t; #endif #define ASF_OBJECT_COMMON \ int i_type; \ guid_t i_object_id; \ - u64 i_object_size; \ - u64 i_object_pos; \ + uint64_t i_object_size; \ + uint64_t i_object_pos; \ union asf_object_u *p_father; \ union asf_object_u *p_first; \ union asf_object_u *p_last; \ @@ -195,7 +195,7 @@ typedef struct asf_index_entry_s } asf_index_entry_t; /**************************************************************************** - * High level asf object + * High level asf object ****************************************************************************/ /* This is the first header find in a asf file * It's the only object that have subobject */ @@ -205,7 +205,7 @@ typedef struct asf_object_header_s uint32_t i_sub_object_count; uint8_t i_reserved1; /* 0x01, but could be safely ignored */ uint8_t i_reserved2; /* 0x02, if not must failed to source the contain */ - + } asf_object_header_t; typedef struct asf_object_data_s @@ -214,7 +214,7 @@ typedef struct asf_object_data_s guid_t i_file_id; uint64_t i_total_data_packets; uint16_t i_reserved; - + } asf_object_data_t; @@ -225,7 +225,7 @@ typedef struct asf_object_index_s uint64_t i_index_entry_time_interval; uint32_t i_max_packet_count; uint32_t i_index_entry_count; - + asf_index_entry_t *index_entry; } asf_object_index_t; @@ -233,7 +233,7 @@ typedef struct asf_object_index_s typedef struct asf_object_root_s { ASF_OBJECT_COMMON - + asf_object_header_t *p_hdr; asf_object_data_t *p_data; asf_object_index_t *p_index; @@ -249,7 +249,7 @@ typedef struct asf_object_root_s typedef struct asf_object_file_properties_s { ASF_OBJECT_COMMON - + guid_t i_file_id; uint64_t i_file_size; uint64_t i_creation_date; @@ -261,7 +261,7 @@ typedef struct asf_object_file_properties_s uint32_t i_min_data_packet_size; uint32_t i_max_data_packet_size; uint32_t i_max_bitrate; - + } asf_object_file_properties_t; #define ASF_STREAM_PROPERTIES_ENCRYPTED 0x8000 @@ -320,7 +320,7 @@ typedef struct asf_codec_entry_s uint16_t i_type; char *psz_name; char *psz_description; - + uint16_t i_information_length; uint8_t *p_information; } asf_codec_entry_t; @@ -330,7 +330,7 @@ typedef struct asf_object_codec_list_s ASF_OBJECT_COMMON guid_t i_reserved; uint32_t i_codec_entries_count; - asf_codec_entry_t *codec; + asf_codec_entry_t *codec; } asf_object_codec_list_t; @@ -339,7 +339,7 @@ typedef struct asf_object_script_command_s { ASF_OBJECT_COMMON - + } asf_object_script_command_t; #endif typedef struct asf_marker_s @@ -352,7 +352,7 @@ typedef struct asf_marker_s uint32_t i_marker_description_length; uint8_t *i_marker_description; /* u8 padding */ - + } asf_marker_t; typedef struct asf_object_marker_s @@ -383,10 +383,10 @@ typedef union asf_object_u asf_object_root_t root; asf_object_file_properties_t file_properties; asf_object_stream_properties_t stream_properties; - asf_object_header_extention_t header_extention; + asf_object_header_extention_t header_extention; asf_object_codec_list_t codec_list; asf_object_marker_t marker; - + } asf_object_t; @@ -397,7 +397,7 @@ int ASF_SkipBytes( input_thread_t *p_input, int i_count ); void GetGUID( guid_t *p_guid, uint8_t *p_data ); int CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 ); - + int ASF_ReadObjectCommon( input_thread_t *p_input, asf_object_t *p_obj ); int ASF_NextObject( input_thread_t *p_input, diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c index 7cd9efebae..940328414e 100644 --- a/modules/demux/avi/avi.c +++ b/modules/demux/avi/avi.c @@ -2,14 +2,14 @@ * avi.c : AVI file Stream input module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: avi.c,v 1.16 2002/12/04 15:47:31 fenrir Exp $ + * $Id: avi.c,v 1.17 2002/12/06 16:34:06 sam Exp $ * Authors: Laurent Aimar - * + * * 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 * (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 @@ -59,10 +59,10 @@ static int AVIDemux_UnSeekable( input_thread_t *p_input ); vlc_module_begin(); add_category_hint( "demuxer", NULL ); add_bool( "avi-interleaved", 0, NULL, - "force interleaved method", + "force interleaved method", "force interleaved method" ); add_bool( "avi-index", 0, NULL, - "force index creation", + "force index creation", "force index creation" ); set_description( "avi demuxer" ); @@ -71,7 +71,7 @@ vlc_module_begin(); vlc_module_end(); /***************************************************************************** - * Some useful functions to manipulate memory + * Some useful functions to manipulate memory *****************************************************************************/ static uint16_t GetWLE( uint8_t *p_buff ) @@ -103,14 +103,14 @@ static inline off_t __EVEN( off_t i ) #define __ABS( x ) ( (x) < 0 ? (-(x)) : (x) ) /* read data in a pes */ -static int input_ReadInPES( input_thread_t *p_input, - pes_packet_t **pp_pes, - int i_size ) +static int input_ReadInPES( input_thread_t *p_input, + pes_packet_t **pp_pes, + size_t i_size ) { pes_packet_t *p_pes; data_packet_t *p_data; - + if( !(p_pes = input_NewPES( p_input->p_method_data ) ) ) { pp_pes = NULL; @@ -121,14 +121,14 @@ static int input_ReadInPES( input_thread_t *p_input, if( !i_size ) { - p_pes->p_first = - p_pes->p_last = + p_pes->p_first = + p_pes->p_last = input_NewPacket( p_input->p_method_data, 0 ); p_pes->i_nb_data = 1; p_pes->i_pes_size = 0; return 0; } - + p_pes->i_nb_data = 0; p_pes->i_pes_size = 0; @@ -136,15 +136,15 @@ static int input_ReadInPES( input_thread_t *p_input, { int i_read; - i_read = input_SplitBuffer(p_input, - &p_data, - __MIN( i_size - + i_read = input_SplitBuffer(p_input, + &p_data, + __MIN( i_size - p_pes->i_pes_size, 1024 ) ); if( i_read <= 0 ) { return p_pes->i_pes_size; } - + if( !p_pes->p_first ) { p_pes->p_first = p_data; @@ -156,7 +156,7 @@ static int input_ReadInPES( input_thread_t *p_input, p_pes->p_last = p_data; p_pes->i_nb_data++; p_pes->i_pes_size += i_read; - } + } return p_pes->i_pes_size; @@ -173,7 +173,7 @@ static int AVI_GetKeyFlag( vlc_fourcc_t i_fourcc, uint8_t *p_byte ) * framenumber ? 5bits * piture type 0(I),1(P) 2bits */ - if( GetDWBE( p_byte ) != 0x00000100 ) + if( GetDWBE( p_byte ) != 0x00000100 ) { /* it's not an msmpegv1 stream, strange...*/ return AVIIF_KEYFRAME; @@ -208,7 +208,7 @@ static int AVI_GetKeyFlag( vlc_fourcc_t i_fourcc, uint8_t *p_byte ) } } -vlc_fourcc_t AVI_FourccGetCodec( int i_cat, vlc_fourcc_t i_codec ) +vlc_fourcc_t AVI_FourccGetCodec( unsigned int i_cat, vlc_fourcc_t i_codec ) { switch( i_cat ) { @@ -227,11 +227,11 @@ vlc_fourcc_t AVI_FourccGetCodec( int i_cat, vlc_fourcc_t i_codec ) case WAVE_FORMAT_WMA2: return VLC_FOURCC( 'w', 'm', 'a', '2' ); default: - return VLC_FOURCC( 'm', 's', + return VLC_FOURCC( 'm', 's', ( i_codec >> 8 )&0xff, i_codec&0xff ); } case VIDEO_ES: - // XXX DIV1 <- msmpeg4v1, DIV2 <- msmpeg4v2, DIV3 <- msmpeg4v3, mp4v for mpeg4 + // XXX DIV1 <- msmpeg4v1, DIV2 <- msmpeg4v2, DIV3 <- msmpeg4v3, mp4v for mpeg4 switch( i_codec ) { case FOURCC_DIV1: @@ -315,7 +315,7 @@ static void AVI_ParseStreamHeader( vlc_fourcc_t i_id, static int AVI_PacketGetHeader( input_thread_t *p_input, avi_packet_t *p_pk ) { uint8_t *p_peek; - + if( input_Peek( p_input, &p_peek, 16 ) < 16 ) { return VLC_EGENERIC; @@ -331,7 +331,7 @@ static int AVI_PacketGetHeader( input_thread_t *p_input, avi_packet_t *p_pk ) { p_pk->i_type = 0; } - + memcpy( p_pk->i_peek, p_peek + 8, 8 ); AVI_ParseStreamHeader( p_pk->i_fourcc, &p_pk->i_stream, &p_pk->i_cat ); @@ -359,13 +359,13 @@ static int AVI_PacketRead( input_thread_t *p_input, avi_packet_t *p_pk, pes_packet_t **pp_pes ) { - int i_size; + size_t i_size; vlc_bool_t b_pad; i_size = __EVEN( p_pk->i_size + 8 ); b_pad = ( i_size != p_pk->i_size + 8 ); - - if( input_ReadInPES( p_input, pp_pes, i_size ) != i_size ) + + if( input_ReadInPES( p_input, pp_pes, i_size ) != (ssize_t)i_size ) { return VLC_EGENERIC; } @@ -416,7 +416,7 @@ static void __AVI_AddEntryIndex( avi_stream_t *p_info, { p_info->i_idxmax = 16384; p_info->i_idxnb = 0; - if( !( p_info->p_index = calloc( p_info->i_idxmax, + if( !( p_info->p_index = calloc( p_info->i_idxmax, sizeof( AVIIndexEntry_t ) ) ) ) { return; @@ -426,7 +426,7 @@ static void __AVI_AddEntryIndex( avi_stream_t *p_info, { p_info->i_idxmax += 16384; if( !( p_info->p_index = realloc( (void*)p_info->p_index, - p_info->i_idxmax * + p_info->i_idxmax * sizeof( AVIIndexEntry_t ) ) ) ) { return; @@ -435,7 +435,7 @@ static void __AVI_AddEntryIndex( avi_stream_t *p_info, /* calculate cumulate length */ if( p_info->i_idxnb > 0 ) { - p_index->i_lengthtotal = + p_index->i_lengthtotal = p_info->p_index[p_info->i_idxnb - 1].i_length + p_info->p_index[p_info->i_idxnb - 1].i_lengthtotal; } @@ -449,8 +449,8 @@ static void __AVI_AddEntryIndex( avi_stream_t *p_info, } -static void AVI_IndexAddEntry( demux_sys_t *p_avi, - int i_stream, +static void AVI_IndexAddEntry( demux_sys_t *p_avi, + int i_stream, AVIIndexEntry_t *p_index) { __AVI_AddEntryIndex( p_avi->pp_info[i_stream], @@ -464,18 +464,18 @@ static void AVI_IndexAddEntry( demux_sys_t *p_avi, static void AVI_IndexLoad( input_thread_t *p_input ) { demux_sys_t *p_avi = p_input->p_demux_data; - + avi_chunk_list_t *p_riff; avi_chunk_list_t *p_movi; avi_chunk_idx1_t *p_idx1; - int i_stream; - int i_index; + unsigned int i_stream; + unsigned int i_index; off_t i_offset; - - p_riff = (avi_chunk_list_t*)AVI_ChunkFind( &p_avi->ck_root, + + p_riff = (avi_chunk_list_t*)AVI_ChunkFind( &p_avi->ck_root, AVIFOURCC_RIFF, 0); - + p_idx1 = (avi_chunk_idx1_t*)AVI_ChunkFind( p_riff, AVIFOURCC_idx1, 0); p_movi = (avi_chunk_list_t*)AVI_ChunkFind( p_riff, AVIFOURCC_movi, 0); @@ -491,7 +491,7 @@ static void AVI_IndexLoad( input_thread_t *p_input ) p_avi->pp_info[i_stream]->p_index = NULL; } /* *** calculate offset *** */ - if( p_idx1->i_entry_count > 0 && + if( p_idx1->i_entry_count > 0 && p_idx1->entry[0].i_pos < p_movi->i_chunk_pos ) { i_offset = p_movi->i_chunk_pos + 8; @@ -503,8 +503,8 @@ static void AVI_IndexLoad( input_thread_t *p_input ) for( i_index = 0; i_index < p_idx1->i_entry_count; i_index++ ) { - int i_cat; - + unsigned int i_cat; + AVI_ParseStreamHeader( p_idx1->entry[i_index].i_fourcc, &i_stream, &i_cat ); @@ -513,7 +513,7 @@ static void AVI_IndexLoad( input_thread_t *p_input ) { AVIIndexEntry_t index; index.i_id = p_idx1->entry[i_index].i_fourcc; - index.i_flags = + index.i_flags = p_idx1->entry[i_index].i_flags&(~AVIIF_FIXKEYFRAME); index.i_pos = p_idx1->entry[i_index].i_pos + i_offset; index.i_length = p_idx1->entry[i_index].i_length; @@ -522,28 +522,28 @@ static void AVI_IndexLoad( input_thread_t *p_input ) } for( i_stream = 0; i_stream < p_avi->i_streams; i_stream++ ) { - msg_Dbg( p_input, - "stream[%d] creating %d index entries", + msg_Dbg( p_input, + "stream[%d] creating %d index entries", i_stream, p_avi->pp_info[i_stream]->i_idxnb ); } - + } static void AVI_IndexCreate( input_thread_t *p_input ) { demux_sys_t *p_avi = p_input->p_demux_data; - + avi_chunk_list_t *p_riff; avi_chunk_list_t *p_movi; - int i_stream; - off_t i_movi_end; - - p_riff = (avi_chunk_list_t*)AVI_ChunkFind( &p_avi->ck_root, + unsigned int i_stream; + off_t i_movi_end; + + p_riff = (avi_chunk_list_t*)AVI_ChunkFind( &p_avi->ck_root, AVIFOURCC_RIFF, 0); p_movi = (avi_chunk_list_t*)AVI_ChunkFind( p_riff, AVIFOURCC_movi, 0); - + if( !p_movi ) { msg_Err( p_input, "cannot find p_movi" ); @@ -556,7 +556,7 @@ static void AVI_IndexCreate( input_thread_t *p_input ) p_avi->pp_info[i_stream]->i_idxmax = 0; p_avi->pp_info[i_stream]->p_index = NULL; } - i_movi_end = __MIN( p_movi->i_chunk_pos + p_movi->i_chunk_size, + i_movi_end = __MIN( (off_t)(p_movi->i_chunk_pos + p_movi->i_chunk_size), p_input->stream.p_selected_area->i_size ); AVI_SeekAbsolute( p_input, p_movi->i_chunk_pos + 12); @@ -564,7 +564,7 @@ static void AVI_IndexCreate( input_thread_t *p_input ) for( ;; ) { avi_packet_t pk; - + if( AVI_PacketGetHeader( p_input, &pk ) ) { break; @@ -574,7 +574,7 @@ static void AVI_IndexCreate( input_thread_t *p_input ) { AVIIndexEntry_t index; index.i_id = pk.i_fourcc; - index.i_flags = + index.i_flags = AVI_GetKeyFlag(p_avi->pp_info[pk.i_stream]->i_codec, pk.i_peek); index.i_pos = pk.i_pos; index.i_length = pk.i_size; @@ -608,8 +608,8 @@ static void AVI_IndexCreate( input_thread_t *p_input ) print_stat: for( i_stream = 0; i_stream < p_avi->i_streams; i_stream++ ) { - msg_Dbg( p_input, - "stream[%d] creating %d index entries", + msg_Dbg( p_input, + "stream[%d] creating %d index entries", i_stream, p_avi->pp_info[i_stream]->i_idxnb ); } @@ -623,7 +623,7 @@ static vlc_bool_t AVI_StreamStart ( input_thread_t *, demux_sys_t *, int ); static int AVI_StreamSeek ( input_thread_t *, demux_sys_t *, int, mtime_t ); static void AVI_StreamStop ( input_thread_t *, demux_sys_t *, int ); -static vlc_bool_t AVI_StreamStart( input_thread_t *p_input, +static vlc_bool_t AVI_StreamStart( input_thread_t *p_input, demux_sys_t *p_avi, int i_stream ) { #define p_stream p_avi->pp_info[i_stream] @@ -637,7 +637,7 @@ static vlc_bool_t AVI_StreamStart( input_thread_t *p_input, msg_Warn( p_input, "stream[%d] already selected", i_stream ); return VLC_TRUE; } - + if( !p_stream->p_es->p_decoder_fifo ) { vlc_mutex_lock( &p_input->stream.stream_lock ); @@ -665,7 +665,7 @@ static void AVI_StreamStop( input_thread_t *p_input, msg_Warn( p_input, "stream[%d] already unselected", i_stream ); return; } - + if( p_stream->p_es->p_decoder_fifo ) { vlc_mutex_lock( &p_input->stream.stream_lock ); @@ -673,7 +673,7 @@ static void AVI_StreamStop( input_thread_t *p_input, vlc_mutex_unlock( &p_input->stream.stream_lock ); } - + p_stream->b_activated = VLC_FALSE; #undef p_stream @@ -684,9 +684,9 @@ static void AVI_StreamStop( input_thread_t *p_input, ****************************************************************************/ static mtime_t AVI_MovieGetLength( input_thread_t *p_input, demux_sys_t *p_avi ) { - int i_stream; + unsigned int i_stream; mtime_t i_maxlength; - + i_maxlength = 0; for( i_stream = 0; i_stream < p_avi->i_streams; i_stream++ ) { @@ -700,8 +700,8 @@ static mtime_t AVI_MovieGetLength( input_thread_t *p_input, demux_sys_t *p_avi if( p_stream->i_samplesize ) { - i_length = - (mtime_t)( p_stream->p_index[p_stream->i_idxnb-1].i_lengthtotal + + i_length = + (mtime_t)( p_stream->p_index[p_stream->i_idxnb-1].i_lengthtotal + p_stream->p_index[p_stream->i_idxnb-1].i_length ) / (mtime_t)p_stream->i_scale / (mtime_t)p_stream->i_rate / @@ -714,12 +714,12 @@ static mtime_t AVI_MovieGetLength( input_thread_t *p_input, demux_sys_t *p_avi (mtime_t)p_stream->i_rate; } - msg_Dbg( p_input, + msg_Dbg( p_input, "stream[%d] length:"I64Fd" (based on index)", i_stream, i_length ); i_maxlength = __MAX( i_maxlength, i_length ); -#undef p_stream +#undef p_stream } return i_maxlength; @@ -729,22 +729,22 @@ static mtime_t AVI_MovieGetLength( input_thread_t *p_input, demux_sys_t *p_avi * AVIEnd: frees unused data *****************************************************************************/ static void __AVIEnd ( vlc_object_t * p_this ) -{ +{ input_thread_t * p_input = (input_thread_t *)p_this; - int i; - demux_sys_t *p_avi = p_input->p_demux_data ; - + unsigned int i; + demux_sys_t *p_avi = p_input->p_demux_data ; + if( p_avi->pp_info ) { for( i = 0; i < p_avi->i_streams; i++ ) { - if( p_avi->pp_info[i] ) + if( p_avi->pp_info[i] ) { if( p_avi->pp_info[i]->p_index ) { free( p_avi->pp_info[i]->p_index ); } - free( p_avi->pp_info[i] ); + free( p_avi->pp_info[i] ); } } free( p_avi->pp_info ); @@ -763,7 +763,7 @@ static void __AVIEnd ( vlc_object_t * p_this ) * AVIInit: check file and initializes AVI structures *****************************************************************************/ static int AVIInit( vlc_object_t * p_this ) -{ +{ input_thread_t * p_input = (input_thread_t *)p_this; avi_chunk_t ck_riff; avi_chunk_list_t *p_riff = (avi_chunk_list_t*)&ck_riff; @@ -775,12 +775,12 @@ static int AVIInit( vlc_object_t * p_this ) avi_chunk_avih_t *p_avih; demux_sys_t *p_avi; es_descriptor_t *p_es = NULL; /* avoid warning */ - int i; + unsigned int i; #ifdef __AVI_SUBTITLE__ mtime_t i_microsecperframe = 0; // for some subtitle format #endif - - vlc_bool_t b_stream_audio, b_stream_video; + + vlc_bool_t b_stream_audio, b_stream_video; p_input->pf_demux = AVIDemux_Seekable; if( AVI_TestFile( p_input ) ) @@ -796,7 +796,7 @@ static int AVIInit( vlc_object_t * p_this ) p_input->i_bufsize = INPUT_DEFAULT_BUFSIZE; } - if( !( p_input->p_demux_data = + if( !( p_input->p_demux_data = p_avi = malloc( sizeof(demux_sys_t) ) ) ) { msg_Err( p_input, "out of memory" ); @@ -814,7 +814,7 @@ static int AVIInit( vlc_object_t * p_this ) { p_input->pf_demux = AVIDemux_UnSeekable; } - + if( AVI_ChunkReadRoot( p_input, &p_avi->ck_root, p_avi->b_seekable ) ) { msg_Err( p_input, "avi module discarded (invalid file)" ); @@ -823,11 +823,11 @@ static int AVIInit( vlc_object_t * p_this ) AVI_ChunkDumpDebug( p_input, &p_avi->ck_root ); - p_riff = (avi_chunk_list_t*)AVI_ChunkFind( &p_avi->ck_root, + p_riff = (avi_chunk_list_t*)AVI_ChunkFind( &p_avi->ck_root, AVIFOURCC_RIFF, 0 ); p_hdrl = (avi_chunk_list_t*)AVI_ChunkFind( p_riff, AVIFOURCC_hdrl, 0 ); - p_movi = (avi_chunk_list_t*)AVI_ChunkFind( p_riff, + p_movi = (avi_chunk_list_t*)AVI_ChunkFind( p_riff, AVIFOURCC_movi, 0 ); #if 0 p_INFO = (avi_chunk_list_t*)AVI_ChunkFind( p_riff, @@ -836,7 +836,7 @@ static int AVIInit( vlc_object_t * p_this ) AVIFOURCC_INAM, 0 ); if( p_name ) { - + } #endif @@ -845,8 +845,8 @@ static int AVIInit( vlc_object_t * p_this ) msg_Err( p_input, "avi module discarded (invalid file)" ); return VLC_EGENERIC; } - - if( !( p_avih = (avi_chunk_avih_t*)AVI_ChunkFind( p_hdrl, + + if( !( p_avih = (avi_chunk_avih_t*)AVI_ChunkFind( p_hdrl, AVIFOURCC_avih, 0 ) ) ) { msg_Err( p_input, "cannot find avih chunk" ); @@ -855,7 +855,7 @@ static int AVIInit( vlc_object_t * p_this ) p_avi->i_streams = AVI_ChunkCount( p_hdrl, AVIFOURCC_strl ); if( p_avih->i_streams != p_avi->i_streams ) { - msg_Warn( p_input, + msg_Warn( p_input, "found %d stream but %d are declared", p_avi->i_streams, p_avih->i_streams ); @@ -884,10 +884,10 @@ static int AVIInit( vlc_object_t * p_this ) return VLC_EGENERIC; } p_input->stream.p_selected_program = p_input->stream.pp_programs[0]; - vlc_mutex_unlock( &p_input->stream.stream_lock ); - + vlc_mutex_unlock( &p_input->stream.stream_lock ); + /* print informations on streams */ - msg_Dbg( p_input, "AVIH: %d stream, flags %s%s%s%s ", + msg_Dbg( p_input, "AVIH: %d stream, flags %s%s%s%s ", p_avi->i_streams, p_avih->i_flags&AVIF_HASINDEX?" HAS_INDEX":"", p_avih->i_flags&AVIF_MUSTUSEINDEX?" MUST_USE_INDEX":"", @@ -895,10 +895,10 @@ static int AVIInit( vlc_object_t * p_this ) p_avih->i_flags&AVIF_TRUSTCKTYPE?" TRUST_CKTYPE":"" ); /* now read info on each stream and create ES */ - p_avi->pp_info = calloc( p_avi->i_streams, + p_avi->pp_info = calloc( p_avi->i_streams, sizeof( avi_stream_t* ) ); - memset( p_avi->pp_info, - 0, + memset( p_avi->pp_info, + 0, sizeof( avi_stream_t* ) * p_avi->i_streams ); for( i = 0 ; i < p_avi->i_streams; i++ ) @@ -911,23 +911,23 @@ static int AVIInit( vlc_object_t * p_this ) void *p_init_data; #define p_info p_avi->pp_info[i] p_info = malloc( sizeof(avi_stream_t ) ); - memset( p_info, 0, sizeof( avi_stream_t ) ); - - p_avi_strl = (avi_chunk_list_t*)AVI_ChunkFind( p_hdrl, + memset( p_info, 0, sizeof( avi_stream_t ) ); + + p_avi_strl = (avi_chunk_list_t*)AVI_ChunkFind( p_hdrl, AVIFOURCC_strl, i ); - p_avi_strh = (avi_chunk_strh_t*)AVI_ChunkFind( p_avi_strl, + p_avi_strh = (avi_chunk_strh_t*)AVI_ChunkFind( p_avi_strl, AVIFOURCC_strh, 0 ); p_avi_strf_auds = (avi_chunk_strf_auds_t*) p_avi_strf_vids = (avi_chunk_strf_vids_t*) AVI_ChunkFind( p_avi_strl, AVIFOURCC_strf, 0 ); - if( !p_avi_strl || !p_avi_strh || + if( !p_avi_strl || !p_avi_strh || ( !p_avi_strf_auds && !p_avi_strf_vids ) ) { msg_Warn( p_input, "stream[%d] incomlete", i ); continue; } - + /* *** Init p_info *** */ p_info->i_rate = p_avi_strh->i_rate; p_info->i_scale = p_avi_strh->i_scale; @@ -937,8 +937,8 @@ static int AVIInit( vlc_object_t * p_this ) { case( AVIFOURCC_auds ): p_info->i_cat = AUDIO_ES; - p_info->i_fourcc = - AVI_FourccGetCodec( AUDIO_ES, + p_info->i_fourcc = + AVI_FourccGetCodec( AUDIO_ES, p_avi_strf_auds->p_wf->wFormatTag ); p_info->i_codec = p_info->i_fourcc; i_init_size = p_avi_strf_auds->i_chunk_size; @@ -950,14 +950,14 @@ static int AVIInit( vlc_object_t * p_this ) p_avi_strf_auds->p_wf->nSamplesPerSec, p_avi_strf_auds->p_wf->wBitsPerSample ); break; - + case( AVIFOURCC_vids ): p_info->i_cat = VIDEO_ES; - /* XXX quick hack for playing ffmpeg video, I don't know + /* XXX quick hack for playing ffmpeg video, I don't know who is doing something wrong */ p_info->i_samplesize = 0; p_info->i_fourcc = p_avi_strf_vids->p_bih->biCompression; - p_info->i_codec = + p_info->i_codec = AVI_FourccGetCodec( VIDEO_ES, p_info->i_fourcc ); i_init_size = p_avi_strf_vids->i_chunk_size; p_init_data = p_avi_strf_vids->p_bih; @@ -993,18 +993,18 @@ static int AVIInit( vlc_object_t * p_this ) p_input->stream.p_selected_program, 1+i, i_init_size ); vlc_mutex_unlock( &p_input->stream.stream_lock ); - p_es->i_stream_id =i; /* XXX: i don't use it */ + p_es->i_stream_id =i; /* XXX: i don't use it */ p_es->i_fourcc = p_info->i_fourcc; p_es->i_cat = p_info->i_cat; /* We copy strf for decoder in p_es->p_demux_data */ if( p_init_data ) { - memcpy( p_es->p_demux_data, + memcpy( p_es->p_demux_data, p_init_data, i_init_size ); } -#undef p_info +#undef p_info } #ifdef __AVI_SUBTITLE__ @@ -1030,11 +1030,11 @@ static int AVIInit( vlc_object_t * p_this ) { AVI_IndexLoad( p_input ); } - + /* *** movie length in sec *** */ #if 0 - p_avi->i_length = (mtime_t)p_avih->i_totalframes * - (mtime_t)p_avih->i_microsecperframe / + p_avi->i_length = (mtime_t)p_avih->i_totalframes * + (mtime_t)p_avih->i_microsecperframe / (mtime_t)1000000; #endif @@ -1046,21 +1046,21 @@ static int AVIInit( vlc_object_t * p_this ) msg_Warn( p_input, "broken or missing index, 'seek' will be axproximative or will have strange behavour" ); } - vlc_mutex_lock( &p_input->stream.stream_lock ); + vlc_mutex_lock( &p_input->stream.stream_lock ); if( p_avi->i_length ) { - p_input->stream.i_mux_rate = + p_input->stream.i_mux_rate = p_input->stream.p_selected_area->i_size / 50 / p_avi->i_length; } else { p_input->stream.i_mux_rate = 0; } - vlc_mutex_unlock( &p_input->stream.stream_lock ); + vlc_mutex_unlock( &p_input->stream.stream_lock ); b_stream_audio = VLC_FALSE; b_stream_video = VLC_FALSE; - + for( i = 0; i < p_avi->i_streams; i++ ) { #define p_info p_avi->pp_info[i] @@ -1068,14 +1068,14 @@ static int AVIInit( vlc_object_t * p_this ) { case( VIDEO_ES ): - if( !b_stream_video ) + if( !b_stream_video ) { b_stream_video = AVI_StreamStart( p_input, p_avi, i ); } break; case( AUDIO_ES ): - if( !b_stream_audio ) + if( !b_stream_audio ) { b_stream_audio = AVI_StreamStart( p_input, p_avi, i ); } @@ -1083,10 +1083,10 @@ static int AVIInit( vlc_object_t * p_this ) default: break; } -#undef p_info +#undef p_info } - if( !b_stream_video ) + if( !b_stream_video ) { msg_Warn( p_input, "no video stream found" ); } @@ -1098,7 +1098,7 @@ static int AVIInit( vlc_object_t * p_this ) vlc_mutex_lock( &p_input->stream.stream_lock ); p_input->stream.p_selected_program->b_is_ok = 1; vlc_mutex_unlock( &p_input->stream.stream_lock ); - + if( p_avi->b_seekable ) { AVI_ChunkGoto( p_input, p_movi ); @@ -1120,7 +1120,7 @@ static int AVIInit( vlc_object_t * p_this ) * Function to convert pts to chunk or byte *****************************************************************************/ -static inline mtime_t AVI_PTSToChunk( avi_stream_t *p_info, +static inline mtime_t AVI_PTSToChunk( avi_stream_t *p_info, mtime_t i_pts ) { return (mtime_t)((int64_t)i_pts * @@ -1131,7 +1131,7 @@ static inline mtime_t AVI_PTSToChunk( avi_stream_t *p_info, static inline mtime_t AVI_PTSToByte( avi_stream_t *p_info, mtime_t i_pts ) { - return (mtime_t)((int64_t)i_pts * + return (mtime_t)((int64_t)i_pts * (int64_t)p_info->i_samplesize * (int64_t)p_info->i_rate / (int64_t)p_info->i_scale / @@ -1161,7 +1161,7 @@ static mtime_t AVI_GetDPTS( avi_stream_t *p_stream, int i_count ) static mtime_t AVI_GetPTS( avi_stream_t *p_info ) { - + if( p_info->i_samplesize ) { /* we need a valid entry we will emulate one */ @@ -1177,7 +1177,7 @@ static mtime_t AVI_GetPTS( avi_stream_t *p_info ) } else { - i_len = p_info->i_idxposb; + i_len = p_info->i_idxposb; /* no valid entry use only offset*/ } } @@ -1203,7 +1203,7 @@ static mtime_t AVI_GetPTS( avi_stream_t *p_info ) } static int AVI_StreamChunkFind( input_thread_t *p_input, - int i_stream ) + unsigned int i_stream ) { demux_sys_t *p_avi = p_input->p_demux_data; avi_packet_t avi_pk; @@ -1251,9 +1251,9 @@ static int AVI_StreamChunkFind( input_thread_t *p_input, { /* add this chunk to the index */ AVIIndexEntry_t index; - + index.i_id = avi_pk.i_fourcc; - index.i_flags = + index.i_flags = AVI_GetKeyFlag(p_avi->pp_info[avi_pk.i_stream]->i_codec, avi_pk.i_peek); index.i_pos = avi_pk.i_pos; @@ -1264,7 +1264,7 @@ static int AVI_StreamChunkFind( input_thread_t *p_input, { return VLC_SUCCESS; } - + if( AVI_PacketNext( p_input ) ) { return VLC_EGENERIC; @@ -1276,12 +1276,12 @@ static int AVI_StreamChunkFind( input_thread_t *p_input, /* be sure that i_ck will be a valid index entry */ static int AVI_SetStreamChunk( input_thread_t *p_input, - int i_stream, - int i_ck ) + unsigned int i_stream, + unsigned int i_ck ) { demux_sys_t *p_avi = p_input->p_demux_data; avi_stream_t *p_stream = p_avi->pp_info[i_stream]; - + p_stream->i_idxposc = i_ck; p_stream->i_idxposb = 0; @@ -1304,15 +1304,15 @@ static int AVI_SetStreamChunk( input_thread_t *p_input, /* XXX FIXME up to now, we assume that all chunk are one after one */ -static int AVI_SetStreamBytes( input_thread_t *p_input, - int i_stream, +static int AVI_SetStreamBytes( input_thread_t *p_input, + unsigned int i_stream, off_t i_byte ) { demux_sys_t *p_avi = p_input->p_demux_data; avi_stream_t *p_stream = p_avi->pp_info[i_stream]; if( ( p_stream->i_idxnb > 0 ) - &&( i_byte < p_stream->p_index[p_stream->i_idxnb - 1].i_lengthtotal + + &&( i_byte < p_stream->p_index[p_stream->i_idxnb - 1].i_lengthtotal + p_stream->p_index[p_stream->i_idxnb - 1].i_length ) ) { /* index is valid to find the ck */ @@ -1329,7 +1329,7 @@ static int AVI_SetStreamBytes( input_thread_t *p_input, } else { - if( p_stream->p_index[i_idxposc].i_lengthtotal + + if( p_stream->p_index[i_idxposc].i_lengthtotal + p_stream->p_index[i_idxposc].i_length <= i_byte) { i_idxmin = i_idxposc ; @@ -1338,13 +1338,13 @@ static int AVI_SetStreamBytes( input_thread_t *p_input, else { p_stream->i_idxposc = i_idxposc; - p_stream->i_idxposb = i_byte - + p_stream->i_idxposb = i_byte - p_stream->p_index[i_idxposc].i_lengthtotal; return VLC_SUCCESS; } } } - + } else { @@ -1369,34 +1369,34 @@ static int AVI_SetStreamBytes( input_thread_t *p_input, static int AVI_StreamSeek( input_thread_t *p_input, demux_sys_t *p_avi, - int i_stream, + int i_stream, mtime_t i_date ) { #define p_stream p_avi->pp_info[i_stream] mtime_t i_oldpts; - + i_oldpts = AVI_GetPTS( p_stream ); if( !p_stream->i_samplesize ) { if( AVI_SetStreamChunk( p_input, - i_stream, + i_stream, AVI_PTSToChunk( p_stream, i_date ) ) ) { return VLC_EGENERIC; } - + /* search key frame */ - msg_Dbg( p_input, + msg_Dbg( p_input, "old:"I64Fd" %s new "I64Fd, - i_oldpts, + i_oldpts, i_oldpts > i_date ? ">" : "<", i_date ); if( i_date < i_oldpts ) { - while( p_stream->i_idxposc > 0 && - !( p_stream->p_index[p_stream->i_idxposc].i_flags & + while( p_stream->i_idxposc > 0 && + !( p_stream->p_index[p_stream->i_idxposc].i_flags & AVIIF_KEYFRAME ) ) { if( AVI_SetStreamChunk( p_input, @@ -1413,8 +1413,8 @@ static int AVI_StreamSeek( input_thread_t *p_input, !( p_stream->p_index[p_stream->i_idxposc].i_flags & AVIIF_KEYFRAME ) ) { - if( AVI_SetStreamChunk( p_input, - i_stream, + if( AVI_SetStreamChunk( p_input, + i_stream, p_stream->i_idxposc + 1 ) ) { return VLC_EGENERIC; @@ -1440,14 +1440,14 @@ static int AVI_StreamSeek( input_thread_t *p_input, ***************************************************************************** * Returns -1 in case of error, 0 in case of EOF, 1 otherwise *****************************************************************************/ -static int AVISeek ( input_thread_t *p_input, +static int AVISeek ( input_thread_t *p_input, mtime_t i_date, int i_percent ) { demux_sys_t *p_avi = p_input->p_demux_data; - int i_stream; - msg_Dbg( p_input, - "seek requested: "I64Fd" secondes %d%%", + unsigned int i_stream; + msg_Dbg( p_input, + "seek requested: "I64Fd" secondes %d%%", i_date / 1000000, i_percent ); @@ -1459,7 +1459,7 @@ static int AVISeek ( input_thread_t *p_input, uint64_t i_pos; /* use i_percent to create a true i_date */ - msg_Warn( p_input, + msg_Warn( p_input, "mmh, seeking without index at %d%%" " work only for interleaved file", i_percent ); @@ -1469,13 +1469,13 @@ static int AVISeek ( input_thread_t *p_input, return( -1 ); } i_percent = __MAX( i_percent, 0 ); - + /* try to find chunk that is at i_percent or the file */ - i_pos = __MAX( i_percent * + i_pos = __MAX( i_percent * p_input->stream.p_selected_area->i_size / 100, p_avi->i_movi_begin ); /* search first selected stream */ - for( i_stream = 0, p_stream = NULL; + for( i_stream = 0, p_stream = NULL; i_stream < p_avi->i_streams; i_stream++ ) { p_stream = p_avi->pp_info[i_stream]; @@ -1489,21 +1489,21 @@ static int AVISeek ( input_thread_t *p_input, msg_Err( p_input, "cannot find any selected stream" ); return( -1 ); } - + /* be sure that the index exit */ - if( AVI_SetStreamChunk( p_input, + if( AVI_SetStreamChunk( p_input, i_stream, 0 ) ) { msg_Err( p_input, "cannot seek" ); return( -1 ); } - + while( i_pos >= p_stream->p_index[p_stream->i_idxposc].i_pos + p_stream->p_index[p_stream->i_idxposc].i_length + 8 ) { /* search after i_idxposc */ - if( AVI_SetStreamChunk( p_input, + if( AVI_SetStreamChunk( p_input, i_stream, p_stream->i_idxposc + 1 ) ) { msg_Err( p_input, "cannot seek" ); @@ -1524,7 +1524,7 @@ static int AVISeek ( input_thread_t *p_input, // if( p_stream->b_activated ) { AVI_StreamSeek( p_input, p_avi, i_stream, i_date ); - p_avi->i_time = __MAX( AVI_GetPTS( p_stream ), + p_avi->i_time = __MAX( AVI_GetPTS( p_stream ), p_avi->i_time ); } } @@ -1567,23 +1567,23 @@ static int AVISeek ( input_thread_t *p_input, * Returns -1 in case of error, 0 in case of EOF, 1 otherwise *****************************************************************************/ typedef struct avi_stream_toread_s -{ +{ vlc_bool_t b_ok; int i_toread; - - off_t i_posf; // where we will read : + + off_t i_posf; // where we will read : // if i_idxposb == 0 : begining of chunk (+8 to acces data) // else : point on data directly } avi_stream_toread_t; static int AVIDemux_Seekable( input_thread_t *p_input ) { - int i_stream; + unsigned int i_stream; vlc_bool_t b_stream; // cannot be more than 100 stream (dcXX or wbXX) - avi_stream_toread_t toread[100]; + avi_stream_toread_t toread[100]; demux_sys_t *p_avi = p_input->p_demux_data; @@ -1604,7 +1604,7 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) { AVI_StreamStop( p_input, p_avi, i_stream ); } - } + } #undef p_stream } @@ -1619,7 +1619,7 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) (mtime_t)p_avi->i_length * (mtime_t)AVI_TellAbsolute( p_input ) / (mtime_t)p_input->stream.p_selected_area->i_size; - i_percent = 100 * AVI_TellAbsolute( p_input ) / + i_percent = 100 * AVI_TellAbsolute( p_input ) / p_input->stream.p_selected_area->i_size; // input_ClockInit( p_input->stream.p_selected_program ); @@ -1633,14 +1633,14 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) #endif } - + /* wait for the good time */ p_avi->i_pcr = p_avi->i_time * 9 / 100; input_ClockManageRef( p_input, p_input->stream.p_selected_program, - p_avi->i_pcr ); + p_avi->i_pcr ); p_avi->i_time += 100*1000; /* read 100ms */ @@ -1661,7 +1661,7 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) if( p_stream->i_idxposc < p_stream->i_idxnb ) { - toread[i_stream].i_posf = + toread[i_stream].i_posf = p_stream->p_index[p_stream->i_idxposc].i_pos; if( p_stream->i_idxposb > 0 ) { @@ -1669,7 +1669,7 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) } } else - { + { toread[i_stream].i_posf = -1; } @@ -1677,7 +1677,7 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) if( p_stream->i_samplesize ) { - toread[i_stream].i_toread = AVI_PTSToByte( p_stream, + toread[i_stream].i_toread = AVI_PTSToByte( p_stream, __ABS( i_dpts ) ); } else @@ -1685,25 +1685,25 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) toread[i_stream].i_toread = AVI_PTSToChunk( p_stream, __ABS( i_dpts ) ); } - + if( i_dpts < 0 ) { toread[i_stream].i_toread *= -1; } #undef p_stream } - + b_stream = VLC_FALSE; - + for( ;; ) { #define p_stream p_avi->pp_info[i_stream] vlc_bool_t b_done; pes_packet_t *p_pes; off_t i_pos; - int i; - int i_size; - + unsigned int i; + size_t i_size; + /* search for first chunk to be read */ for( i = 0, b_done = VLC_TRUE, i_pos = -1; i < p_avi->i_streams; i++ ) { @@ -1734,7 +1734,7 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) // return( b_stream ? 1 : 0 ); return( 1 ); } - + if( i_pos == -1 ) { /* no valid index, we will parse directly the stream */ @@ -1782,9 +1782,9 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) { /* add this chunk to the index */ AVIIndexEntry_t index; - + index.i_id = avi_pk.i_fourcc; - index.i_flags = + index.i_flags = AVI_GetKeyFlag(p_avi->pp_info[avi_pk.i_stream]->i_codec, avi_pk.i_peek); index.i_pos = avi_pk.i_pos; @@ -1808,7 +1808,7 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) } } } - + } else { @@ -1818,7 +1818,7 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) /* read thoses data */ if( p_stream->i_samplesize ) { - i_size = __MIN( p_stream->p_index[p_stream->i_idxposc].i_length - + i_size = __MIN( p_stream->p_index[p_stream->i_idxposc].i_length - p_stream->i_idxposb, 100 * 1024 ); // 10Ko max // toread[i_stream].i_toread ); @@ -1853,7 +1853,7 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) } p_pes->i_pts = AVI_GetPTS( p_stream ); - + /* read data */ if( p_stream->i_samplesize ) { @@ -1863,7 +1863,7 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) } toread[i_stream].i_toread -= i_size; p_stream->i_idxposb += i_size; - if( p_stream->i_idxposb >= + if( p_stream->i_idxposb >= p_stream->p_index[p_stream->i_idxposc].i_length ) { p_stream->i_idxposb = 0; @@ -1876,15 +1876,15 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) p_stream->i_idxposc++; } - if( p_stream->i_idxposc < p_stream->i_idxnb) + if( p_stream->i_idxposc < p_stream->i_idxnb) { - toread[i_stream].i_posf = + toread[i_stream].i_posf = p_stream->p_index[p_stream->i_idxposc].i_pos; if( p_stream->i_idxposb > 0 ) { toread[i_stream].i_posf += 8 + p_stream->i_idxposb; } - + } else { @@ -1892,15 +1892,15 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) } b_stream = VLC_TRUE; // at least one read succeed - + if( p_stream->p_es && p_stream->p_es->p_decoder_fifo ) { p_pes->i_dts = - p_pes->i_pts = + p_pes->i_pts = input_ClockGetTS( p_input, p_input->stream.p_selected_program, p_pes->i_pts * 9/100); - + input_DecodePES( p_stream->p_es->p_decoder_fifo, p_pes ); } else @@ -1921,20 +1921,20 @@ static int AVIDemux_UnSeekable( input_thread_t *p_input ) demux_sys_t *p_avi = p_input->p_demux_data; avi_stream_t *p_stream_master; vlc_bool_t b_audio; - int i_stream; - int i_packet; + unsigned int i_stream; + unsigned int i_packet; /* *** send audio data to decoder only if rate == DEFAULT_RATE *** */ vlc_mutex_lock( &p_input->stream.stream_lock ); b_audio = p_input->stream.control.i_rate == DEFAULT_RATE; - vlc_mutex_unlock( &p_input->stream.stream_lock ); + vlc_mutex_unlock( &p_input->stream.stream_lock ); input_ClockManageRef( p_input, p_input->stream.p_selected_program, p_avi->i_pcr ); /* *** find master stream for data packet skipping algo *** */ /* *** -> first video, if any, or first audio ES *** */ - for( i_stream = 0, p_stream_master = NULL; + for( i_stream = 0, p_stream_master = NULL; i_stream < p_avi->i_streams; i_stream++ ) { #define p_stream p_avi->pp_info[i_stream] @@ -1960,7 +1960,7 @@ static int AVIDemux_UnSeekable( input_thread_t *p_input ) } p_avi->i_pcr = AVI_GetPTS( p_stream_master ) * 9 / 100; - + for( i_packet = 0; i_packet < 10; i_packet++) { #define p_stream p_avi->pp_info[avi_pk.i_stream] @@ -1988,7 +1988,7 @@ static int AVIDemux_UnSeekable( input_thread_t *p_input ) case AVIFOURCC_idx1: return( 0 ); // eof default: - msg_Warn( p_input, + msg_Warn( p_input, "seems to have lost position, resync" ); if( AVI_PacketSearch( p_input ) ) { @@ -1998,7 +1998,7 @@ static int AVIDemux_UnSeekable( input_thread_t *p_input ) } } else - { + { /* do will send this packet to decoder ? */ if( ( !b_audio && avi_pk.i_cat == AUDIO_ES )|| !p_stream->p_es || @@ -2012,7 +2012,7 @@ static int AVIDemux_UnSeekable( input_thread_t *p_input ) else { /* it's a selected stream, check for time */ - if( __ABS( AVI_GetPTS( p_stream ) - + if( __ABS( AVI_GetPTS( p_stream ) - AVI_GetPTS( p_stream_master ) )< 600*1000 ) { /* load it and send to decoder */ @@ -2021,9 +2021,9 @@ static int AVIDemux_UnSeekable( input_thread_t *p_input ) { return( -1 ); } - p_pes->i_pts = - input_ClockGetTS( p_input, - p_input->stream.p_selected_program, + p_pes->i_pts = + input_ClockGetTS( p_input, + p_input->stream.p_selected_program, AVI_GetPTS( p_stream ) * 9/100); input_DecodePES( p_stream->p_es->p_decoder_fifo, p_pes ); } @@ -2048,7 +2048,7 @@ static int AVIDemux_UnSeekable( input_thread_t *p_input ) } -#undef p_stream +#undef p_stream } return( 1 ); diff --git a/modules/demux/avi/avi.h b/modules/demux/avi/avi.h index 8886a8c9f7..e60aaf9bec 100644 --- a/modules/demux/avi/avi.h +++ b/modules/demux/avi/avi.h @@ -2,14 +2,14 @@ * avi.h : AVI file Stream input module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: avi.h,v 1.7 2002/11/15 18:10:26 fenrir Exp $ + * $Id: avi.h,v 1.8 2002/12/06 16:34:06 sam Exp $ * Authors: Laurent Aimar - * + * * 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 * (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 @@ -26,11 +26,11 @@ typedef struct avi_packet_s off_t i_pos; uint32_t i_size; vlc_fourcc_t i_type; // only for AVIFOURCC_LIST - + uint8_t i_peek[8]; //first 8 bytes - int i_stream; - int i_cat; + unsigned int i_stream; + unsigned int i_cat; } avi_packet_t; @@ -48,22 +48,22 @@ typedef struct avi_stream_s { vlc_bool_t b_activated; - int i_cat; /* AUDIO_ES, VIDEO_ES */ + unsigned int i_cat; /* AUDIO_ES, VIDEO_ES */ vlc_fourcc_t i_fourcc; vlc_fourcc_t i_codec; int i_rate; int i_scale; int i_samplesize; - + es_descriptor_t *p_es; AVIIndexEntry_t *p_index; - int i_idxnb; - int i_idxmax; + unsigned int i_idxnb; + unsigned int i_idxmax; - int i_idxposc; /* numero of chunk */ - int i_idxposb; /* byte in the current chunk */ + unsigned int i_idxposc; /* numero of chunk */ + unsigned int i_idxposb; /* byte in the current chunk */ } avi_stream_t; @@ -71,21 +71,21 @@ struct demux_sys_t { mtime_t i_time; mtime_t i_length; - mtime_t i_pcr; + mtime_t i_pcr; vlc_bool_t b_seekable; avi_chunk_t ck_root; - + off_t i_movi_begin; off_t i_movi_lastchunk_pos; /* XXX position of last valid chunk */ - + /* number of streams and information */ - int i_streams; - avi_stream_t **pp_info; + unsigned int i_streams; + avi_stream_t **pp_info; #ifdef __AVI_SUBTITLE__ subtitle_demux_t *p_sub; #endif - + }; diff --git a/modules/demux/avi/libavi.c b/modules/demux/avi/libavi.c index a4cd2ba3db..e60d71dc60 100644 --- a/modules/demux/avi/libavi.c +++ b/modules/demux/avi/libavi.c @@ -2,7 +2,7 @@ * libavi.c : ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: libavi.c,v 1.8 2002/12/04 15:47:31 fenrir Exp $ + * $Id: libavi.c,v 1.9 2002/12/06 16:34:06 sam Exp $ * Authors: Laurent Aimar * * This program is free software; you can redistribute it and/or modify @@ -378,7 +378,7 @@ static int AVI_ChunkRead_list( input_thread_t *p_input, if( AVI_ChunkRead( p_input, p_chk, p_container, b_seekable ) || ( AVI_TellAbsolute( p_input ) >= - p_chk->common.p_father->common.i_chunk_pos + + (off_t)p_chk->common.p_father->common.i_chunk_pos + __EVEN( p_chk->common.p_father->common.i_chunk_size ) ) ) { break; @@ -599,7 +599,7 @@ static int AVI_ChunkRead_idx1( input_thread_t *p_input, avi_chunk_t *p_chk, vlc_bool_t b_seekable ) { - int i_count, i_index; + unsigned int i_count, i_index; AVI_READCHUNK_ENTER; @@ -769,9 +769,9 @@ static struct { 0, NULL, NULL } }; -static int AVI_ChunkFunctionFind( int i_fourcc ) +static int AVI_ChunkFunctionFind( vlc_fourcc_t i_fourcc ) { - int i_index; + unsigned int i_index; for( i_index = 0; ; i_index++ ) { if( ( AVI_Chunk_Function[i_index].i_fourcc == i_fourcc )|| @@ -885,7 +885,7 @@ int AVI_ChunkReadRoot( input_thread_t *p_input, if( AVI_ChunkRead( p_input, p_chk, p_root, b_seekable ) || ( AVI_TellAbsolute( p_input ) >= - p_chk->common.p_father->common.i_chunk_pos + + (off_t)p_chk->common.p_father->common.i_chunk_pos + __EVEN( p_chk->common.p_father->common.i_chunk_size ) ) ) { break; diff --git a/modules/demux/avi/libavi.h b/modules/demux/avi/libavi.h index e44693beaf..c59ebf01cf 100644 --- a/modules/demux/avi/libavi.h +++ b/modules/demux/avi/libavi.h @@ -2,7 +2,7 @@ * libavi.h : LibAVI library ****************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: libavi.h,v 1.5 2002/12/04 15:47:31 fenrir Exp $ + * $Id: libavi.h,v 1.6 2002/12/06 16:34:06 sam Exp $ * Authors: Laurent Aimar * * This program is free software; you can redistribute it and/or modify @@ -191,8 +191,8 @@ typedef struct avi_chunk_list_s typedef struct avi_chunk_idx1_s { AVI_CHUNK_COMMON - int i_entry_count; - int i_entry_max; + unsigned int i_entry_count; + unsigned int i_entry_max; idx1_entry_t *entry; } avi_chunk_idx1_t; diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c index 296d365358..67984ceac2 100644 --- a/modules/demux/mp4/libmp4.c +++ b/modules/demux/mp4/libmp4.c @@ -2,7 +2,7 @@ * libmp4.c : LibMP4 library for mp4 module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: libmp4.c,v 1.9 2002/11/17 06:46:56 fenrir Exp $ + * $Id: libmp4.c,v 1.10 2002/12/06 16:34:06 sam Exp $ * Authors: Laurent Aimar * * This program is free software; you can redistribute it and/or modify @@ -534,7 +534,7 @@ int MP4_ReadBoxContainerRaw( MP4_Stream_t *p_stream, MP4_Box_t *p_container ) MP4_Box_t *p_box; if( MP4_TellStream( p_stream ) + 8 > - p_container->i_pos + p_container->i_size ) + (off_t)(p_container->i_pos + p_container->i_size) ) { /* there is no box to load */ return( 0 ); @@ -573,7 +573,7 @@ int MP4_ReadBoxContainerRaw( MP4_Stream_t *p_stream, MP4_Box_t *p_container ) int MP4_ReadBoxContainer( MP4_Stream_t *p_stream, MP4_Box_t *p_container ) { - if( p_container->i_size <= MP4_BOX_HEADERSIZE(p_container ) + 8 ) + if( p_container->i_size <= (size_t)MP4_BOX_HEADERSIZE(p_container ) + 8 ) { /* container is empty, 8 stand for the first header in this box */ return( 1 ); @@ -612,7 +612,7 @@ int MP4_ReadBox_ftyp( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) if( ( p_box->data.p_ftyp->i_compatible_brands_count = i_read / 4 ) ) { - int i; + unsigned int i; p_box->data.p_ftyp->i_compatible_brands = calloc( p_box->data.p_ftyp->i_compatible_brands_count, sizeof(uint32_t)); @@ -637,7 +637,7 @@ void MP4_FreeBox_ftyp( input_thread_t *p_input, MP4_Box_t *p_box ) int MP4_ReadBox_mvhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; #ifdef MP4_VERBOSE char s_creation_time[128]; char s_modification_time[128]; @@ -709,7 +709,7 @@ int MP4_ReadBox_mvhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) int MP4_ReadBox_tkhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; #ifdef MP4_VERBOSE char s_creation_time[128]; char s_modification_time[128]; @@ -773,7 +773,7 @@ int MP4_ReadBox_tkhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) int MP4_ReadBox_tref( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - if( p_box->i_size < MP4_BOX_HEADERSIZE(p_box ) + 8 ) + if( p_box->i_size < (size_t)MP4_BOX_HEADERSIZE(p_box ) + 8 ) { /* container is empty, 8 stand for the first header in this box */ return( 1 ); @@ -797,7 +797,7 @@ int MP4_ReadBox_tref( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) int MP4_ReadBox_mdhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; uint16_t i_language; #ifdef MP4_VERBOSE char s_creation_time[128]; @@ -879,7 +879,7 @@ void MP4_FreeBox_hdlr( input_thread_t *p_input, MP4_Box_t *p_box ) int MP4_ReadBox_vmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_vmhd_t ); @@ -1014,7 +1014,7 @@ int MP4_ReadBox_dref( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) int MP4_ReadBox_stts( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_stts_t ); MP4_GETVERSIONFLAGS( p_box->data.p_stts ); @@ -1049,7 +1049,7 @@ void MP4_FreeBox_stts( input_thread_t *p_input, MP4_Box_t *p_box ) int MP4_ReadBox_ctts( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_ctts_t ); MP4_GETVERSIONFLAGS( p_box->data.p_ctts ); @@ -1084,8 +1084,8 @@ void MP4_FreeBox_ctts( input_thread_t *p_input, MP4_Box_t *p_box ) static int MP4_ReadLengthDescriptor( uint8_t **pp_peek, int64_t *i_read ) { - int i_b; - int i_len = 0; + unsigned int i_b; + unsigned int i_len = 0; do { i_b = **pp_peek; @@ -1100,9 +1100,9 @@ static int MP4_ReadLengthDescriptor( uint8_t **pp_peek, int64_t *i_read ) int MP4_ReadBox_esds( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { #define es_descriptor p_box->data.p_esds->es_descriptor - int i_len; - int i_flags; - int i_type; + unsigned int i_len; + unsigned int i_flags; + unsigned int i_type; MP4_READBOX_ENTER( MP4_Box_data_esds_t ); @@ -1127,7 +1127,7 @@ int MP4_ReadBox_esds( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) } if( es_descriptor.b_url ) { - int i_len; + unsigned int i_len; MP4_GET1BYTE( i_len ); es_descriptor.psz_URL = calloc( sizeof(char), i_len + 1 ); @@ -1188,7 +1188,7 @@ void MP4_FreeBox_esds( input_thread_t *p_input, MP4_Box_t *p_box ) int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_sample_soun_t ); @@ -1228,7 +1228,7 @@ int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) #if 0 int MP4_ReadBox_sample_mp4a( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_sample_mp4a_t ); @@ -1268,7 +1268,7 @@ int MP4_ReadBox_sample_mp4a( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) int MP4_ReadBox_sample_vide( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_sample_vide_t ); @@ -1340,7 +1340,7 @@ int MP4_ReadBox_stsd( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) int MP4_ReadBox_stsz( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_stsz_t ); @@ -1378,7 +1378,7 @@ void MP4_FreeBox_stsz( input_thread_t *p_input, MP4_Box_t *p_box ) int MP4_ReadBox_stsc( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_stsc_t ); @@ -1418,7 +1418,7 @@ void MP4_FreeBox_stsc( input_thread_t *p_input, MP4_Box_t *p_box ) int MP4_ReadBox_stco_co64( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_co64_t ); @@ -1465,7 +1465,7 @@ void MP4_FreeBox_stco_co64( input_thread_t *p_input, MP4_Box_t *p_box ) int MP4_ReadBox_stss( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_stss_t ); @@ -1500,7 +1500,7 @@ void MP4_FreeBox_stss( input_thread_t *p_input, MP4_Box_t *p_box ) int MP4_ReadBox_stsh( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_stsh_t ); @@ -1540,7 +1540,7 @@ void MP4_FreeBox_stsh( input_thread_t *p_input, MP4_Box_t *p_box ) int MP4_ReadBox_stdp( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_stdp_t ); @@ -1571,7 +1571,7 @@ void MP4_FreeBox_stdp( input_thread_t *p_input, MP4_Box_t *p_box ) int MP4_ReadBox_padb( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_padb_t ); @@ -1619,7 +1619,7 @@ void MP4_FreeBox_padb( input_thread_t *p_input, MP4_Box_t *p_box ) int MP4_ReadBox_elst( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_padb_t ); @@ -1678,8 +1678,8 @@ void MP4_FreeBox_elst( input_thread_t *p_input, MP4_Box_t *p_box ) int MP4_ReadBox_cprt( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) { - int i_language; - int i; + unsigned int i_language; + unsigned int i; MP4_READBOX_ENTER( MP4_Box_data_cprt_t ); @@ -2009,7 +2009,7 @@ static struct int MP4_ReadBox( MP4_Stream_t *p_stream, MP4_Box_t *p_box, MP4_Box_t *p_father ) { int i_result; - int i_index; + unsigned int i_index; if( !MP4_ReadBoxCommon( p_stream, p_box ) ) { @@ -2061,7 +2061,7 @@ int MP4_ReadBox( MP4_Stream_t *p_stream, MP4_Box_t *p_box, MP4_Box_t *p_father ) *****************************************************************************/ int MP4_CountBox( MP4_Box_t *p_box, uint32_t i_type ) { - int i_count; + unsigned int i_count; MP4_Box_t *p_child; if( !p_box ) @@ -2167,7 +2167,7 @@ MP4_Box_t *MP4_FindNbBox( MP4_Box_t *p_box, uint32_t i_number ) *****************************************************************************/ void MP4_BoxFree( input_thread_t *p_input, MP4_Box_t *p_box ) { - int i_index; + unsigned int i_index; MP4_Box_t *p_child; MP4_Box_t *p_next; @@ -2283,7 +2283,7 @@ int MP4_BoxGetRoot( input_thread_t *p_input, MP4_Box_t *p_root ) static void __MP4_BoxDumpStructure( input_thread_t *p_input, - MP4_Box_t *p_box, int i_level ) + MP4_Box_t *p_box, unsigned int i_level ) { MP4_Box_t *p_child; @@ -2298,7 +2298,7 @@ static void __MP4_BoxDumpStructure( input_thread_t *p_input, else { char str[512]; - int i; + unsigned int i; memset( str, (uint8_t)' ', 512 ); for( i = 0; i < i_level; i++ ) { @@ -2338,7 +2338,7 @@ void MP4_BoxDumpStructure( input_thread_t *p_input, MP4_Box_t *p_box ) *****************************************************************************/ static void __get_token( char **ppsz_path, char **ppsz_token, int *pi_number ) { - int i_len ; + size_t i_len ; if( !*ppsz_path[0] ) { *ppsz_token = NULL; @@ -2391,7 +2391,7 @@ static void __MP4_BoxGet( MP4_Box_t **pp_result, { char *psz_path; #if !defined(HAVE_VASPRINTF) || defined(SYS_DARWIN) - int i_size; + size_t i_size; #endif diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c index cb7bc8e039..0f0bf79515 100644 --- a/modules/demux/mp4/mp4.c +++ b/modules/demux/mp4/mp4.c @@ -2,7 +2,7 @@ * mp4.c : MP4 file input module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: mp4.c,v 1.8 2002/11/28 16:32:29 fenrir Exp $ + * $Id: mp4.c,v 1.9 2002/12/06 16:34:06 sam Exp $ * Authors: Laurent Aimar * * This program is free software; you can redistribute it and/or modify @@ -99,7 +99,7 @@ static int MP4Init( vlc_object_t * p_this ) MP4_Box_t *p_mvhd; MP4_Box_t *p_trak; - int i; + unsigned int i; /* I need to seek */ if( !p_input->stream.b_seekable ) { @@ -313,7 +313,7 @@ static int MP4Init( vlc_object_t * p_this ) static int MP4Demux( input_thread_t *p_input ) { demux_sys_t *p_demux = p_input->p_demux_data; - int i_track; + unsigned int i_track; /* XXX beurk, beuRK and BEURK, but only way I've found to detect seek from interface */ @@ -401,7 +401,7 @@ static int MP4Demux( input_thread_t *p_input ) static int MP4Seek ( input_thread_t *p_input, mtime_t i_date ) { demux_sys_t *p_demux = p_input->p_demux_data; - int i_track; + unsigned int i_track; /* First update update global time */ p_demux->i_time = i_date * p_demux->i_timescale / 1000000; @@ -420,19 +420,19 @@ static int MP4Seek ( input_thread_t *p_input, mtime_t i_date ) * MP4End: frees unused data *****************************************************************************/ static void __MP4End ( vlc_object_t * p_this ) -{ +{ #define FREE( p ) \ - if( p ) { free( p ); } - int i_track; + if( p ) { free( p ); } + unsigned int i_track; input_thread_t * p_input = (input_thread_t *)p_this; demux_sys_t *p_demux = p_input->p_demux_data; - + msg_Dbg( p_input, "Freeing all memory" ); MP4_BoxFree( p_input, &p_demux->box_root ); for( i_track = 0; i_track < p_demux->i_tracks; i_track++ ) { - int i_chunk; - for( i_chunk = 0; + unsigned int i_chunk; + for( i_chunk = 0; i_chunk < p_demux->track[i_track].i_chunk_count; i_chunk++ ) { if( p_demux->track[i_track].chunk ) @@ -465,7 +465,7 @@ static void __MP4End ( vlc_object_t * p_this ) static int MP4_TrackSynchro( input_thread_t *p_input, track_data_mp4_t *p_track ) { demux_sys_t *p_demux = p_input->p_demux_data; - int i_chunk_last; + unsigned int i_chunk_last; MP4_Box_t *p_stss; if( !p_track->b_ok || @@ -508,9 +508,9 @@ static int MP4_TrackSynchro( input_thread_t *p_input, track_data_mp4_t *p_track /* *** Try to find nearest sync points *** */ if( ( p_stss = MP4_BoxGet( p_track->p_stbl, "stss" ) ) ) { - int i_index; - msg_Dbg( p_input, - "track[Id 0x%x] using Sync Sample Box (stss)", + unsigned int i_index; + msg_Dbg( p_input, + "track[Id 0x%x] using Sync Sample Box (stss)", p_track->i_track_ID ); for( i_index = 0; i_index < p_stss->data.p_stss->i_entry_count; i_index++ ) { @@ -574,7 +574,7 @@ static void MP4_ParseTrack( input_thread_t *p_input, track_data_mp4_t *p_demux_track, MP4_Box_t * p_trak ) { - int i; + unsigned int i; MP4_Box_t *p_tkhd = MP4_BoxGet( p_trak, "tkhd" ); MP4_Box_t *p_tref = MP4_BoxGet( p_trak, "tref" ); @@ -692,8 +692,8 @@ static int MP4_CreateChunksIndex( input_thread_t *p_input, MP4_Box_t *p_co64; /* give offset for each chunk, same for stco and co64 */ MP4_Box_t *p_stsc; - int i_chunk; - int i_index, i_last; + unsigned int i_chunk; + unsigned int i_index, i_last; if( ( !(p_co64 = MP4_BoxGet( p_demux_track->p_stbl, "stco" ) )&& @@ -900,12 +900,12 @@ static int MP4_CreateSamplesIndex( input_thread_t *p_input, static void MP4_StartDecoder( input_thread_t *p_input, track_data_mp4_t *p_demux_track ) { - MP4_Box_t *p_sample; - int i; - int i_chunk; + MP4_Box_t * p_sample; + unsigned int i; + unsigned int i_chunk; - int i_decoder_specific_info_len; - uint8_t *p_decoder_specific_info; + unsigned int i_decoder_specific_info_len; + uint8_t * p_decoder_specific_info; uint8_t *p_init; BITMAPINFOHEADER *p_bih; @@ -1141,7 +1141,7 @@ static int MP4_ReadSample( input_thread_t *p_input, track_data_mp4_t *p_demux_track, pes_packet_t **pp_pes ) { - int i_size; + size_t i_size; off_t i_pos; data_packet_t *p_data; diff --git a/modules/demux/mp4/mp4.h b/modules/demux/mp4/mp4.h index 1ab16bc973..6f8d621e4b 100644 --- a/modules/demux/mp4/mp4.h +++ b/modules/demux/mp4/mp4.h @@ -2,14 +2,14 @@ * mp4.h : MP4 file input module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: mp4.h,v 1.4 2002/11/17 06:46:56 fenrir Exp $ + * $Id: mp4.h,v 1.5 2002/12/06 16:34:06 sam Exp $ * Authors: Laurent Aimar - * + * * 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 * (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 @@ -48,7 +48,7 @@ typedef struct waveformatex_s uint32_t i_avgbytespersec; uint16_t i_blockalign; uint16_t i_bitspersample; - uint16_t i_size; /* This give size of data + uint16_t i_size; /* This give size of data imediatly following this header. */ } waveformatex_t; @@ -62,7 +62,7 @@ typedef struct chunk_data_mp4_s uint32_t i_sample_count; /* how many samples in this chunk */ uint32_t i_sample_first; /* index of the first sample in this chunk */ - /* now provide way to calculate pts, dts, and offset without to + /* now provide way to calculate pts, dts, and offset without to much memory and with fast acces */ /* with this we can calculate dts/pts without waste memory */ @@ -70,9 +70,9 @@ typedef struct chunk_data_mp4_s uint32_t *p_sample_count_dts; uint32_t *p_sample_delta_dts; /* dts delta */ - /* TODO if needed add pts + /* TODO if needed add pts but quickly *add* support for edts and seeking */ - + } chunk_data_mp4_t; @@ -91,31 +91,31 @@ typedef struct track_data_mp4_s /* display size only ! */ int i_width; int i_height; - - /* more internal data */ + + /* more internal data */ uint64_t i_timescale; /* time scale for this track only */ - /* give the next sample to read, i_chunk is to find quickly where + /* give the next sample to read, i_chunk is to find quickly where the sample is located */ uint32_t i_sample; /* next sample to read */ uint32_t i_chunk; /* chunk where next sample is stored */ /* total count of chunk and sample */ - uint32_t i_chunk_count; + uint32_t i_chunk_count; uint32_t i_sample_count; - + chunk_data_mp4_t *chunk; /* always defined for each chunk */ - - /* sample size, p_sample_size defined only if i_sample_size == 0 + + /* sample size, p_sample_size defined only if i_sample_size == 0 else i_sample_size is size for all sample */ uint32_t i_sample_size; - uint32_t *p_sample_size; /* XXX perhaps add file offset if take + uint32_t *p_sample_size; /* XXX perhaps add file offset if take too much time to do sumations each time*/ - + es_descriptor_t *p_es; /* vlc es for this track */ MP4_Box_t *p_stbl; /* will contain all timing information */ MP4_Box_t *p_stsd; /* will contain all data to initialize decoder */ - + MP4_Box_t *p_sample; /* actual SampleEntry to make life simpler */ } track_data_mp4_t; @@ -125,23 +125,21 @@ typedef struct track_data_mp4_s *****************************************************************************/ struct demux_sys_t { + MP4_Box_t box_root; /* container for the whole file */ - MP4_Box_t box_root; /* container for the hole file */ + mtime_t i_pcr; - mtime_t i_pcr; - - uint64_t i_time; /* time position of the presentation in movie timescale */ - uint64_t i_timescale; /* movie time scale */ - uint64_t i_duration; /* movie duration */ - int i_tracks; /* number of track */ + uint64_t i_time; /* time position of the presentation + * in movie timescale */ + uint64_t i_timescale; /* movie time scale */ + uint64_t i_duration; /* movie duration */ + unsigned int i_tracks; /* number of tracks */ track_data_mp4_t *track; /* array of track */ - - }; static inline uint64_t MP4_GetTrackPos( track_data_mp4_t *p_track ) { - int i_sample; + unsigned int i_sample; uint64_t i_pos; @@ -149,13 +147,13 @@ static inline uint64_t MP4_GetTrackPos( track_data_mp4_t *p_track ) if( p_track->i_sample_size ) { - i_pos += ( p_track->i_sample - + i_pos += ( p_track->i_sample - p_track->chunk[p_track->i_chunk].i_sample_first ) * p_track->i_sample_size; } else { - for( i_sample = p_track->chunk[p_track->i_chunk].i_sample_first; + for( i_sample = p_track->chunk[p_track->i_chunk].i_sample_first; i_sample < p_track->i_sample; i_sample++ ) { i_pos += p_track->p_sample_size[i_sample]; @@ -168,10 +166,10 @@ static inline uint64_t MP4_GetTrackPos( track_data_mp4_t *p_track ) /* Return time in µs of a track */ static inline mtime_t MP4_GetTrackPTS( track_data_mp4_t *p_track ) { - int i_sample; - int i_index; + unsigned int i_sample; + unsigned int i_index; uint64_t i_dts; - + i_sample = p_track->i_sample - p_track->chunk[p_track->i_chunk].i_sample_first; i_dts = p_track->chunk[p_track->i_chunk].i_first_dts; i_index = 0; @@ -179,22 +177,22 @@ static inline mtime_t MP4_GetTrackPTS( track_data_mp4_t *p_track ) { if( i_sample > p_track->chunk[p_track->i_chunk].p_sample_count_dts[i_index] ) { - i_dts += p_track->chunk[p_track->i_chunk].p_sample_count_dts[i_index] * + i_dts += p_track->chunk[p_track->i_chunk].p_sample_count_dts[i_index] * p_track->chunk[p_track->i_chunk].p_sample_delta_dts[i_index]; i_sample -= p_track->chunk[p_track->i_chunk].p_sample_count_dts[i_index]; i_index++; } else { - i_dts += i_sample * + i_dts += i_sample * p_track->chunk[p_track->i_chunk].p_sample_delta_dts[i_index]; i_sample = 0; break; } } - return( (mtime_t)( + return( (mtime_t)( (mtime_t)1000000 * - (mtime_t)i_dts / + (mtime_t)i_dts / (mtime_t)p_track->i_timescale ) ); } diff --git a/modules/demux/mpeg/ps.c b/modules/demux/mpeg/ps.c index 195e4640c8..785200862b 100644 --- a/modules/demux/mpeg/ps.c +++ b/modules/demux/mpeg/ps.c @@ -2,7 +2,7 @@ * ps.c : Program Stream input module for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: ps.c,v 1.6 2002/11/20 13:37:36 sam Exp $ + * $Id: ps.c,v 1.7 2002/12/06 16:34:07 sam Exp $ * * Authors: Christophe Massiot * @@ -195,7 +195,7 @@ static int Activate( vlc_object_t * p_this ) else { /* (We have to do it ourselves) */ - int i_es; + unsigned int i_es; /* FIXME: we should do multiple passes in case an audio type * is not present */ diff --git a/modules/demux/mpeg/system.c b/modules/demux/mpeg/system.c index 2a7a287e45..c43f218bf5 100644 --- a/modules/demux/mpeg/system.c +++ b/modules/demux/mpeg/system.c @@ -2,7 +2,7 @@ * system.c: helper module for TS, PS and PES management ***************************************************************************** * Copyright (C) 1998-2002 VideoLAN - * $Id: system.c,v 1.7 2002/11/20 13:37:36 sam Exp $ + * $Id: system.c,v 1.8 2002/12/06 16:34:07 sam Exp $ * * Authors: Christophe Massiot * Michel Lespinasse @@ -14,7 +14,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -86,10 +86,10 @@ static int Activate ( vlc_object_t *p_this ) static inline size_t MoveChunk( byte_t * p_dest, data_packet_t ** pp_data_src, byte_t ** pp_src, size_t i_buf_len ) { - ptrdiff_t i_available; + size_t i_available; - if( (i_available = (*pp_data_src)->p_payload_end - *pp_src) - >= i_buf_len ) + i_available = (ptrdiff_t)((*pp_data_src)->p_payload_end - *pp_src); + if( i_available >= i_buf_len ) { if( p_dest != NULL ) memcpy( p_dest, *pp_src, i_buf_len ); @@ -98,7 +98,7 @@ static inline size_t MoveChunk( byte_t * p_dest, data_packet_t ** pp_data_src, } else { - size_t i_init_len = i_buf_len; + size_t i_init_len = i_buf_len; do { @@ -113,9 +113,10 @@ static inline size_t MoveChunk( byte_t * p_dest, data_packet_t ** pp_data_src, return( i_init_len - i_buf_len ); } *pp_src = (*pp_data_src)->p_payload_start; + + i_available = (ptrdiff_t)((*pp_data_src)->p_payload_end - *pp_src); } - while( (i_available = (*pp_data_src)->p_payload_end - *pp_src) - <= i_buf_len ); + while( i_available <= i_buf_len ); if( i_buf_len ) { @@ -176,7 +177,7 @@ static void ParsePES( input_thread_t * p_input, es_descriptor_t * p_es ) } else { - int i_pes_header_size, i_payload_size; + unsigned int i_pes_header_size, i_payload_size; if ( p_es->i_pes_real_size && (p_es->i_pes_real_size != p_pes->i_pes_size) ) @@ -214,7 +215,7 @@ static void ParsePES( input_thread_t * p_input, es_descriptor_t * p_es ) i_max_len = MoveChunk( p_full_header, &p_data, &p_byte, 12 ); if( i_max_len < 2 ) { - msg_Warn( p_input, + msg_Warn( p_input, "PES packet too short to have a MPEG-2 header" ); input_DeletePES( p_input->p_method_data, p_pes ); @@ -479,7 +480,7 @@ static void GatherPES( input_thread_t * p_input, data_packet_t * p_data, } p_pes->i_rate = p_input->stream.control.i_rate; p_pes->p_first = p_data; - + /* If the PES header fits in the first data packet, we can * already set p_gather->i_pes_real_size. */ if( p_data->p_payload_end - p_data->p_payload_start @@ -489,9 +490,9 @@ static void GatherPES( input_thread_t * p_input, data_packet_t * p_data, + p_data->p_payload_start[5] + 6; } else - { + { p_es->i_pes_real_size = 0; - } + } } else { @@ -505,7 +506,7 @@ static void GatherPES( input_thread_t * p_input, data_packet_t * p_data, /* Size of the payload carried in the data packet */ p_pes->i_pes_size += (p_data->p_payload_end - p_data->p_payload_start); - + /* We can check if the packet is finished */ if( p_pes->i_pes_size == p_es->i_pes_real_size ) { @@ -550,8 +551,8 @@ static void DecodePSM( input_thread_t * p_input, data_packet_t * p_data ) (stream_ps_data_t *)p_input->stream.p_demux_data; byte_t * p_byte; byte_t * p_end; - int i; - int i_new_es_number = 0; + unsigned int i; + unsigned int i_new_es_number = 0; if( p_data->p_demux_start + 10 > p_data->p_payload_end ) { @@ -595,7 +596,7 @@ static void DecodePSM( input_thread_t * p_input, data_packet_t * p_data ) while( p_byte + 4 <= p_end ) { es_descriptor_t * p_es = NULL; - u8 i_stream_id = p_byte[1]; + uint8_t i_stream_id = p_byte[1]; /* FIXME: there will be a problem with private streams... (same * stream_id) */ @@ -700,7 +701,7 @@ static void DecodePSM( input_thread_t * p_input, data_packet_t * p_data ) { \ return( -1 ); \ } \ - else if( i_error < SIZE ) \ + else if( (size_t)i_error < SIZE ) \ { \ /* EOF */ \ return( 0 ); \ @@ -802,15 +803,15 @@ static ssize_t ReadPS( input_thread_t * p_input, data_packet_t ** pp_data ) static es_descriptor_t * ParsePS( input_thread_t * p_input, data_packet_t * p_data ) { - u32 i_code; + uint32_t i_code; es_descriptor_t * p_es = NULL; i_code = p_data->p_demux_start[3]; if( i_code > 0xBC ) /* ES start code */ { - u16 i_id; - int i_dummy; + uint16_t i_id; + unsigned int i_dummy; /* This is a PES packet. Find out if we want it or not. */ i_id = GetID( p_data ); @@ -1034,11 +1035,11 @@ static void DemuxPS( input_thread_t * p_input, data_packet_t * p_data ) DecodePSM( p_input, p_data ); b_trash = 1; break; - + case 0x1B9: /* PROGRAM_END_CODE */ b_trash = 1; break; - + default: /* This should not happen */ b_trash = 1; @@ -1073,7 +1074,7 @@ static void DemuxPS( input_thread_t * p_input, data_packet_t * p_data ) } } - + /* * TS Demultiplexing */ @@ -1141,8 +1142,8 @@ static ssize_t ReadTS( input_thread_t * p_input, data_packet_t ** pp_data ) static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data, psi_callback_t pf_psi_callback ) { - u16 i_pid; - int i_dummy; + uint16_t i_pid; + unsigned int i_dummy; vlc_bool_t b_adaptation; /* Adaptation field is present */ vlc_bool_t b_payload; /* Packet carries payload */ vlc_bool_t b_unit_start; /* A PSI or a PES start in the packet */ @@ -1163,7 +1164,7 @@ static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data, /* Find out the elementary stream. */ vlc_mutex_lock( &p_input->stream.stream_lock ); - + for( i_dummy = 0; i_dummy < p_input->stream.i_pgrm_number; i_dummy ++ ) { if( (( pgrm_ts_data_t * ) p_input->stream.pp_programs[i_dummy]-> @@ -1173,20 +1174,20 @@ static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data, break; } } - + p_es= input_FindES( p_input, i_pid ); - + if( (p_es != NULL) && (p_es->p_demux_data != NULL) ) { p_es_demux = (es_ts_data_t *)p_es->p_demux_data; - + if( p_es_demux->b_psi ) { b_psi = 1; } else { - p_pgrm_demux = (pgrm_ts_data_t *)p_es->p_pgrm->p_demux_data; + p_pgrm_demux = (pgrm_ts_data_t *)p_es->p_pgrm->p_demux_data; } } @@ -1199,17 +1200,17 @@ static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data, } else if( p_es->p_decoder_fifo == NULL && !b_psi ) { - b_trash = 1; + b_trash = 1; } vlc_mutex_unlock( &p_input->stream.control.control_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock ); - /* Don't change the order of the tests : if b_psi then p_pgrm_demux + /* Don't change the order of the tests : if b_psi then p_pgrm_demux * may still be null. Who said it was ugly ? * I have written worse. --Meuuh */ - if( ( p_es ) && + if( ( p_es ) && ((p_es->p_decoder_fifo != NULL) || b_psi || b_pcr ) ) { p_es->c_packets++; @@ -1226,7 +1227,7 @@ static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data, { /* p[4] is adaptation_field_length minus one */ p_data->p_payload_start += 5 + p[4]; - + /* The adaptation field can be limited to the * adaptation_field_length byte, so that there is nothing to do: * skip this possibility */ @@ -1243,7 +1244,7 @@ static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data, p_data->b_discard_payload = 1; p_es->c_invalid_packets++; } - + /* Now we are sure that the byte containing flags is present: * read it */ else @@ -1255,18 +1256,18 @@ static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data, "discontinuity_indicator encountered by TS demux " "(position read: %d, saved: %d)", p[5] & 0x80, p_es_demux->i_continuity_counter ); - + /* If the PID carries the PCR, there will be a system * time-based discontinuity. We let the PCR decoder * handle that. */ p_es->p_pgrm->i_synchro_state = SYNCHRO_REINIT; - + /* There also may be a continuity_counter * discontinuity: resynchronize our counter with * the one of the stream. */ p_es_demux->i_continuity_counter = (p[3] & 0x0f) - 1; } - + } /* valid TS adaptation field ? */ } /* length > 0 */ } /* has adaptation field */ @@ -1320,7 +1321,7 @@ static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data, } /* not continuous */ } /* continuity */ } /* if selected or PCR */ - + /* Handle PCR */ if( b_pcr && b_adaptation && (p[5] & 0x10) && p[4]>=7 ) { @@ -1332,7 +1333,7 @@ static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data, ( (mtime_t)p[9] << 1 ) | ( (mtime_t)p[10] >> 7 ); /* Call the pace control. */ - for( i_dummy = 0; i_dummy < p_input->stream.i_pgrm_number; + for( i_dummy = 0; i_dummy < p_input->stream.i_pgrm_number; i_dummy ++ ) { if( ( ( pgrm_ts_data_t * ) p_input->stream.pp_programs[i_dummy]-> @@ -1344,7 +1345,7 @@ static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data, } } - + /* Trash the packet if it has no payload or if it isn't selected */ if( b_trash ) { @@ -1361,7 +1362,7 @@ static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data, else { /* The payload carries a PES stream */ - GatherPES( p_input, p_data, p_es, b_unit_start, b_lost ); + GatherPES( p_input, p_data, p_es, b_unit_start, b_lost ); } } diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c index c0c418d602..05eea787da 100644 --- a/modules/demux/mpeg/ts.c +++ b/modules/demux/mpeg/ts.c @@ -2,7 +2,7 @@ * mpeg_ts.c : Transport Stream input module for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: ts.c,v 1.9 2002/11/20 13:37:36 sam Exp $ + * $Id: ts.c,v 1.10 2002/12/06 16:34:07 sam Exp $ * * Authors: Henri Fallon * Johan Bilien @@ -11,7 +11,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -192,7 +192,7 @@ static int Activate( vlc_object_t * p_this ) #ifdef MODULE_NAME_IS_ts_dvbpsi p_stream_data->p_pat_handle = (dvbpsi_handle *) - dvbpsi_AttachPAT( (dvbpsi_pat_callback) &TS_DVBPSI_HandlePAT, p_input ); + dvbpsi_AttachPAT( (dvbpsi_pat_callback) &TS_DVBPSI_HandlePAT, p_input ); if( p_stream_data->p_pat_handle == NULL ) { @@ -202,7 +202,7 @@ static int Activate( vlc_object_t * p_this ) return -1; } #endif - + /* We'll have to catch the PAT in order to continue * Then the input will catch the PMT and then the others ES * The PAT es is indepedent of any program. */ @@ -215,7 +215,7 @@ static int Activate( vlc_object_t * p_this ) p_demux_data->p_psi_section->b_is_complete = 1; vlc_mutex_unlock( &p_input->stream.stream_lock ); - + return 0; } @@ -272,11 +272,11 @@ static int Demux( input_thread_t * p_input ) /***************************************************************************** * DemuxPSI : makes up complete PSI data *****************************************************************************/ -static void TSDemuxPSI( input_thread_t * p_input, data_packet_t * p_data, +static void TSDemuxPSI( input_thread_t * p_input, data_packet_t * p_data, es_descriptor_t * p_es, vlc_bool_t b_unit_start ) { es_ts_data_t * p_demux_data; - + p_demux_data = (es_ts_data_t *)p_es->p_demux_data; #define p_psi (p_demux_data->p_psi_section) @@ -299,12 +299,12 @@ static void TSDemuxPSI( input_thread_t * p_input, data_packet_t * p_data, /* This is the begining of a new section */ - if( ((u8)(p[1]) & 0xc0) != 0x80 ) + if( ((u8)(p[1]) & 0xc0) != 0x80 ) { msg_Warn( p_input, "invalid PSI packet" ); p_psi->b_trash = 1; } - else + else { p_psi->i_section_length = ((p[1] & 0xF) << 8) | p[2]; p_psi->b_section_complete = 0; @@ -328,7 +328,7 @@ static void TSDemuxPSI( input_thread_t * p_input, data_packet_t * p_data, { /* New Section of an already started PSI */ p_psi->b_section_complete = 0; - + if( p_psi->i_version_number != (( p[5] >> 1 ) & 0x1f) ) { msg_Warn( p_input, @@ -352,7 +352,7 @@ static void TSDemuxPSI( input_thread_t * p_input, data_packet_t * p_data, } } } /* b_unit_start */ - + if( !p_psi->b_trash ) { /* read */ @@ -360,13 +360,13 @@ static void TSDemuxPSI( input_thread_t * p_input, data_packet_t * p_data, ( p_psi->i_section_length - p_psi->i_read_in_section ) ) { /* The end of the section is in this TS packet */ - memcpy( p_psi->p_current, p, + memcpy( p_psi->p_current, p, (p_psi->i_section_length - p_psi->i_read_in_section) ); - + p_psi->b_section_complete = 1; - p_psi->p_current += + p_psi->p_current += (p_psi->i_section_length - p_psi->i_read_in_section); - + if( p_psi->i_section_number == p_psi->i_last_section_number ) { /* This was the last section of PSI */ @@ -394,11 +394,11 @@ static void TSDemuxPSI( input_thread_t * p_input, data_packet_t * p_data, } } -#undef p_psi +#undef p_psi #undef p - + input_DeletePacket( p_input->p_method_data, p_data ); - + return ; } @@ -412,7 +412,7 @@ static void TSDecodePAT( input_thread_t * p_input, es_descriptor_t * p_es ) pgrm_descriptor_t * p_pgrm; es_descriptor_t * p_current_es; - byte_t * p_current_data; + byte_t * p_current_data; int i_section_length, i_program_id, i_pmt_pid; int i_loop, i_current_section; @@ -421,7 +421,7 @@ static void TSDecodePAT( input_thread_t * p_input, es_descriptor_t * p_es ) p_demux_data = (es_ts_data_t *)p_es->p_demux_data; p_stream_data = (stream_ts_data_t *)p_input->stream.p_demux_data; - + #define p_psi (p_demux_data->p_psi_section) /* Not so fast, Mike ! If the PAT version has changed, we first check @@ -437,7 +437,7 @@ static void TSDecodePAT( input_thread_t * p_input, es_descriptor_t * p_es ) i_section_length = ((u32)(p_current_data[1] & 0xF) << 8) | p_current_data[2]; i_current_section = (u8)p_current_data[6]; - + for( i_loop = 0; ( i_loop < (i_section_length - 9) / 4 ) && !b_changed; i_loop++ ) @@ -466,7 +466,7 @@ static void TSDecodePAT( input_thread_t * p_input, es_descriptor_t * p_es ) } } } - + p_current_data += 3 + i_section_length; } while( ( i_current_section < p_psi->i_last_section_number ) @@ -479,13 +479,13 @@ static void TSDecodePAT( input_thread_t * p_input, es_descriptor_t * p_es ) if( b_changed ) { - /* PAT has changed. We are going to delete all programs and + /* PAT has changed. We are going to delete all programs and * create new ones. We chose not to only change what was needed * as a PAT change may mean the stream is radically changing and * this is a secure method to avoid crashes */ es_ts_data_t * p_es_demux; pgrm_ts_data_t * p_pgrm_demux; - + p_current_data = p_psi->buffer; /* Delete all programs */ @@ -493,13 +493,13 @@ static void TSDecodePAT( input_thread_t * p_input, es_descriptor_t * p_es ) { input_DelProgram( p_input, p_input->stream.pp_programs[0] ); } - + do { i_section_length = ((u32)(p_current_data[1] & 0xF) << 8) | p_current_data[2]; i_current_section = (u8)p_current_data[6]; - + for( i_loop = 0; i_loop < (i_section_length - 9) / 4 ; i_loop++ ) { i_program_id = ( (u32)*(p_current_data + i_loop * 4 + 8) << 8 ) @@ -507,31 +507,31 @@ static void TSDecodePAT( input_thread_t * p_input, es_descriptor_t * p_es ) i_pmt_pid = ( ((u32)*(p_current_data + i_loop * 4 + 10) & 0x1F) << 8 ) | *(p_current_data + i_loop * 4 + 11); - + /* If program = 0, we're having info about NIT not PMT */ if( i_program_id ) { /* Add this program */ - p_pgrm = input_AddProgram( p_input, i_program_id, + p_pgrm = input_AddProgram( p_input, i_program_id, sizeof( pgrm_ts_data_t ) ); - + /* whatis the PID of the PMT of this program */ p_pgrm_demux = (pgrm_ts_data_t *)p_pgrm->p_demux_data; p_pgrm_demux->i_pmt_version = PMT_UNINITIALIZED; - + /* Add the PMT ES to this program */ p_current_es = input_AddES( p_input, p_pgrm,(u16)i_pmt_pid, sizeof( es_ts_data_t) ); p_es_demux = (es_ts_data_t *)p_current_es->p_demux_data; p_es_demux->b_psi = 1; p_es_demux->i_psi_type = PSI_IS_PMT; - - p_es_demux->p_psi_section = + + p_es_demux->p_psi_section = malloc( sizeof( psi_section_t ) ); p_es_demux->p_psi_section->b_is_complete = 0; } } - + p_current_data += 3 + i_section_length; } while( i_current_section < p_psi->i_last_section_number ); @@ -560,18 +560,18 @@ static void TSDecodePMT( input_thread_t * p_input, es_descriptor_t * p_es ) p_demux_data = (es_ts_data_t *)p_es->p_demux_data; p_pgrm_data = (pgrm_ts_data_t *)p_es->p_pgrm->p_demux_data; - + #define p_psi (p_demux_data->p_psi_section) - if( p_psi->i_version_number != p_pgrm_data->i_pmt_version ) + if( p_psi->i_version_number != p_pgrm_data->i_pmt_version ) { - es_descriptor_t * p_new_es; + es_descriptor_t * p_new_es; es_ts_data_t * p_es_demux; byte_t * p_current_data, * p_current_section; int i_section_length,i_current_section; int i_prog_info_length, i_loop; int i_es_info_length, i_pid, i_stream_type; - + p_current_section = p_psi->buffer; p_current_data = p_psi->buffer; @@ -606,8 +606,8 @@ static void TSDecodePMT( input_thread_t * p_input, es_descriptor_t * p_es ) /* For the moment we ignore program descriptors */ p_current_data += 12 + i_prog_info_length; - - /* The end of the section, before the CRC is at + + /* The end of the section, before the CRC is at * p_current_section + i_section_length -1 */ while( p_current_data < p_current_section + i_section_length -1 ) { @@ -616,12 +616,12 @@ static void TSDecodePMT( input_thread_t * p_input, es_descriptor_t * p_es ) *(p_current_data + 2); i_es_info_length = ( ((u32)*(p_current_data + 3) & 0xF) << 8 ) | *(p_current_data + 4); - + /* Add this ES to the program */ - p_new_es = input_AddES( p_input, p_es->p_pgrm, + p_new_es = input_AddES( p_input, p_es->p_pgrm, (u16)i_pid, sizeof( es_ts_data_t ) ); - /* Tell the interface what kind of stream it is and select + /* Tell the interface what kind of stream it is and select * the required ones */ { switch( i_stream_type ) @@ -690,15 +690,15 @@ static void TSDecodePMT( input_thread_t * p_input, es_descriptor_t * p_es ) break; } } - + p_current_data += 5 + i_es_info_length; } /* Go to the beginning of the next section*/ p_current_data += 3 + i_section_length; - + p_current_section++; - + } while( i_current_section < p_psi->i_last_section_number ); p_pgrm_data->i_pmt_version = p_psi->i_version_number; @@ -719,27 +719,27 @@ static void TSDecodePMT( input_thread_t * p_input, es_descriptor_t * p_es ) else p_input->pf_set_program( p_input, p_es->p_pgrm ); } - + /* inform interface that stream has changed */ p_input->stream.b_changed = 1; /* Remove lock */ vlc_mutex_unlock( &p_input->stream.stream_lock ); } - + #undef p_psi } #elif defined MODULE_NAME_IS_ts_dvbpsi /* - * PSI Decoding using libdvbcss + * PSI Decoding using libdvbcss */ /***************************************************************************** * DemuxPSI : send the PSI to the right libdvbpsi decoder *****************************************************************************/ -static void TS_DVBPSI_DemuxPSI( input_thread_t * p_input, - data_packet_t * p_data, - es_descriptor_t * p_es, +static void TS_DVBPSI_DemuxPSI( input_thread_t * p_input, + data_packet_t * p_data, + es_descriptor_t * p_es, vlc_bool_t b_unit_start ) { es_ts_data_t * p_es_demux_data; @@ -752,28 +752,28 @@ static void TS_DVBPSI_DemuxPSI( input_thread_t * p_input, switch( p_es_demux_data->i_psi_type) { case PSI_IS_PAT: - dvbpsi_PushPacket( + dvbpsi_PushPacket( ( dvbpsi_handle ) p_stream_demux_data->p_pat_handle, p_data->p_demux_start ); break; case PSI_IS_PMT: p_pgrm_demux_data = ( pgrm_ts_data_t * )p_es->p_pgrm->p_demux_data; - dvbpsi_PushPacket( + dvbpsi_PushPacket( ( dvbpsi_handle ) p_pgrm_demux_data->p_pmt_handle, p_data->p_demux_start ); break; default: msg_Warn( p_input, "received unknown PSI in DemuxPSI" ); } - + input_DeletePacket( p_input->p_method_data, p_data ); } /***************************************************************************** * HandlePAT: will treat a PAT returned by dvbpsi *****************************************************************************/ - -void TS_DVBPSI_HandlePAT( input_thread_t * p_input, dvbpsi_pat_t * p_new_pat ) +static void TS_DVBPSI_HandlePAT( input_thread_t * p_input, + dvbpsi_pat_t * p_new_pat ) { dvbpsi_pat_program_t * p_pgrm; pgrm_descriptor_t * p_new_pgrm; @@ -783,10 +783,10 @@ void TS_DVBPSI_HandlePAT( input_thread_t * p_input, dvbpsi_pat_t * p_new_pat ) stream_ts_data_t * p_stream_data; vlc_mutex_lock( &p_input->stream.stream_lock ); - + p_stream_data = (stream_ts_data_t *)p_input->stream.p_demux_data; - - if ( !p_new_pat->b_current_next || + + if ( !p_new_pat->b_current_next || p_stream_data->i_pat_version == PAT_UNINITIALIZED ) { /* Delete all programs */ @@ -794,22 +794,22 @@ void TS_DVBPSI_HandlePAT( input_thread_t * p_input, dvbpsi_pat_t * p_new_pat ) { input_DelProgram( p_input, p_input->stream.pp_programs[0] ); } - + /* treat the new programs list */ p_pgrm = p_new_pat->p_first_program; - + while( p_pgrm ) { /* If program = 0, we're having info about NIT not PMT */ if( p_pgrm->i_number ) { /* Add this program */ - p_new_pgrm = input_AddProgram( p_input, p_pgrm->i_number, + p_new_pgrm = input_AddProgram( p_input, p_pgrm->i_number, sizeof( pgrm_ts_data_t ) ); p_pgrm_demux = (pgrm_ts_data_t *)p_new_pgrm->p_demux_data; p_pgrm_demux->i_pmt_version = PMT_UNINITIALIZED; - + /* Add the PMT ES to this program */ p_current_es = input_AddES( p_input, p_new_pgrm, (u16) p_pgrm->i_pid, @@ -817,7 +817,7 @@ void TS_DVBPSI_HandlePAT( input_thread_t * p_input, dvbpsi_pat_t * p_new_pat ) p_es_demux = (es_ts_data_t *)p_current_es->p_demux_data; p_es_demux->b_psi = 1; p_es_demux->i_psi_type = PSI_IS_PMT; - + p_es_demux->p_psi_section = malloc( sizeof( psi_section_t ) ); if ( p_es_demux->p_psi_section == NULL ) { @@ -825,13 +825,13 @@ void TS_DVBPSI_HandlePAT( input_thread_t * p_input, dvbpsi_pat_t * p_new_pat ) p_input->b_error = 1; return; } - + p_es_demux->p_psi_section->b_is_complete = 0; - + /* Create a PMT decoder */ p_pgrm_demux->p_pmt_handle = (dvbpsi_handle *) dvbpsi_AttachPMT( p_pgrm->i_number, - (dvbpsi_pmt_callback) &TS_DVBPSI_HandlePMT, + (dvbpsi_pmt_callback) &TS_DVBPSI_HandlePMT, p_input ); if( p_pgrm_demux->p_pmt_handle == NULL ) @@ -842,9 +842,9 @@ void TS_DVBPSI_HandlePAT( input_thread_t * p_input, dvbpsi_pat_t * p_new_pat ) } } - p_pgrm = p_pgrm->p_next; + p_pgrm = p_pgrm->p_next; } - + p_stream_data->i_pat_version = p_new_pat->i_version; } vlc_mutex_unlock( &p_input->stream.stream_lock ); @@ -853,16 +853,17 @@ void TS_DVBPSI_HandlePAT( input_thread_t * p_input, dvbpsi_pat_t * p_new_pat ) /***************************************************************************** * HandlePMT: will treat a PMT returned by dvbpsi *****************************************************************************/ -void TS_DVBPSI_HandlePMT( input_thread_t * p_input, dvbpsi_pmt_t * p_new_pmt ) +static void TS_DVBPSI_HandlePMT( input_thread_t * p_input, + dvbpsi_pmt_t * p_new_pmt ) { dvbpsi_pmt_es_t * p_es; pgrm_descriptor_t * p_pgrm; es_descriptor_t * p_new_es; pgrm_ts_data_t * p_pgrm_demux; vlc_bool_t b_vls_compat = config_GetInt( p_input, "vls-backwards-compat" ); - + vlc_mutex_lock( &p_input->stream.stream_lock ); - + p_pgrm = input_FindProgram( p_input, p_new_pmt->i_program_number ); if( p_pgrm == NULL ) @@ -874,14 +875,14 @@ void TS_DVBPSI_HandlePMT( input_thread_t * p_input, dvbpsi_pmt_t * p_new_pmt ) p_pgrm_demux = (pgrm_ts_data_t *)p_pgrm->p_demux_data; p_pgrm_demux->i_pcr_pid = p_new_pmt->i_pcr_pid; - if( !p_new_pmt->b_current_next || + if( !p_new_pmt->b_current_next || p_pgrm_demux->i_pmt_version == PMT_UNINITIALIZED ) { p_es = p_new_pmt->p_first_es; while( p_es ) { /* Add this ES */ - p_new_es = input_AddES( p_input, p_pgrm, + p_new_es = input_AddES( p_input, p_pgrm, (u16)p_es->i_pid, sizeof( es_ts_data_t ) ); if( p_new_es == NULL ) { @@ -1004,7 +1005,7 @@ void TS_DVBPSI_HandlePMT( input_thread_t * p_input, dvbpsi_pmt_t * p_new_pmt ) p_es = p_es->p_next; } - + /* if no program is selected :*/ if( !p_input->stream.p_selected_program ) { @@ -1027,7 +1028,7 @@ void TS_DVBPSI_HandlePMT( input_thread_t * p_input, dvbpsi_pmt_t * p_new_pmt ) { p_input->pf_set_program( p_input, p_pgrm ); } - + p_pgrm_demux->i_pmt_version = p_new_pmt->i_version; p_input->stream.b_changed = 1; } diff --git a/modules/demux/wav/wav.c b/modules/demux/wav/wav.c index 65607dbaa4..c95ac4fe8f 100644 --- a/modules/demux/wav/wav.c +++ b/modules/demux/wav/wav.c @@ -2,7 +2,7 @@ * wav.c : wav file input module for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: wav.c,v 1.5 2002/12/03 17:00:16 fenrir Exp $ + * $Id: wav.c,v 1.6 2002/12/06 16:34:07 sam Exp $ * Authors: Laurent Aimar * * This program is free software; you can redistribute it and/or modify @@ -604,7 +604,8 @@ static int WAVDemux( input_thread_t *p_input ) p_input->stream.p_selected_program, p_demux->i_pcr ); - if( TellAbsolute( p_input ) >= p_demux->i_data_pos + p_demux->i_data_size ) + if( TellAbsolute( p_input ) + >= (off_t)(p_demux->i_data_pos + p_demux->i_data_size) ) { return( 0 ); // EOF } diff --git a/modules/gui/gtk/common.h b/modules/gui/gtk/common.h index 04befaa876..b5fe25d142 100644 --- a/modules/gui/gtk/common.h +++ b/modules/gui/gtk/common.h @@ -2,7 +2,7 @@ * gtk_common.h: private Gtk+ interface description ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: common.h,v 1.3 2002/09/30 11:05:38 sam Exp $ + * $Id: common.h,v 1.4 2002/12/06 16:34:07 sam Exp $ * * Authors: Samuel Hocevar * @@ -10,7 +10,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -46,7 +46,7 @@ struct intf_sys_t vlc_bool_t b_slider_free; /* slider status */ /* menus handlers */ - vlc_bool_t b_program_update; /* do we need to update programs + vlc_bool_t b_program_update; /* do we need to update programs menu */ vlc_bool_t b_title_update; /* do we need to update title menus */ vlc_bool_t b_chapter_update; /* do we need to update @@ -84,7 +84,7 @@ struct intf_sys_t /* The window labels for DVD mode */ GtkLabel * p_label_title; GtkLabel * p_label_chapter; - gint i_part; /* current chapter */ + guint i_part; /* current chapter */ }; /***************************************************************************** diff --git a/modules/gui/gtk/gtk.c b/modules/gui/gtk/gtk.c index 33e700cd96..541d0feb12 100644 --- a/modules/gui/gtk/gtk.c +++ b/modules/gui/gtk/gtk.c @@ -2,7 +2,7 @@ * gtk.c : Gtk+ plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: gtk.c,v 1.8 2002/11/12 16:02:51 gbazin Exp $ + * $Id: gtk.c,v 1.9 2002/12/06 16:34:07 sam Exp $ * * Authors: Samuel Hocevar * @@ -10,7 +10,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 diff --git a/modules/gui/gtk/gtk_callbacks.c b/modules/gui/gtk/gtk_callbacks.c index fe2793001e..9f9fdd21ab 100644 --- a/modules/gui/gtk/gtk_callbacks.c +++ b/modules/gui/gtk/gtk_callbacks.c @@ -2,17 +2,17 @@ * gtk_callbacks.c : Callbacks for the Gtk+ plugin. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: gtk_callbacks.c,v 1.5 2002/11/12 16:02:51 gbazin Exp $ + * $Id: gtk_callbacks.c,v 1.6 2002/12/06 16:34:07 sam Exp $ * * Authors: Samuel Hocevar * Stéphane Borel * Julien BLACHE - * + * * 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 * (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 @@ -128,12 +128,12 @@ gboolean GtkWindowToggle( GtkWidget *widget, gpointer user_data ) { intf_thread_t *p_intf = GtkGetIntf( widget ); - + if( GTK_WIDGET_VISIBLE(p_intf->p_sys->p_window) ) { gtk_widget_hide( p_intf->p_sys->p_window); - } - else + } + else { gtk_widget_show( p_intf->p_sys->p_window ); } @@ -240,7 +240,7 @@ void GtkTitleNext( GtkButton * button, gpointer user_data ) { intf_thread_t * p_intf; input_area_t * p_area; - int i_id; + unsigned int i_id; p_intf = GtkGetIntf( button ); vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); @@ -248,7 +248,7 @@ void GtkTitleNext( GtkButton * button, gpointer user_data ) if( i_id < p_intf->p_sys->p_input->stream.i_area_nb ) { - p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id]; + p_area = p_intf->p_sys->p_input->stream.pp_areas[i_id]; vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area ); diff --git a/modules/gui/gtk/menu.c b/modules/gui/gtk/menu.c index 9b8ec74e4f..510a72492d 100644 --- a/modules/gui/gtk/menu.c +++ b/modules/gui/gtk/menu.c @@ -2,17 +2,17 @@ * menu.c : functions to handle menu items. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: menu.c,v 1.1 2002/08/04 17:23:43 sam Exp $ + * $Id: menu.c,v 1.2 2002/12/06 16:34:07 sam Exp $ * * Authors: Samuel Hocevar * Stéphane Borel * Johan Bilien - * + * * 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 * (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 @@ -57,7 +57,7 @@ void GtkMenubarAudioToggle ( GtkCheckMenuItem *, gpointer ); void GtkPopupAudioToggle ( GtkCheckMenuItem *, gpointer ); void GtkMenubarSubtitleToggle( GtkCheckMenuItem *, gpointer ); void GtkPopupSubtitleToggle ( GtkCheckMenuItem *, gpointer ); -static gint GtkTitleMenu( gpointer, GtkWidget *, +static gint GtkTitleMenu( gpointer, GtkWidget *, void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) ); static gint GtkRadioMenu( intf_thread_t *, GtkWidget *, GSList *, char *, int, int, int, @@ -100,7 +100,7 @@ gint GtkSetupMenus( intf_thread_t * p_intf ); /* * Audio - */ + */ void GtkMenubarAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) { @@ -114,9 +114,9 @@ void GtkPopupAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) GtkMenubarAudioToggle, b_audio_update ); } -/* +/* * Subtitles - */ + */ void GtkMenubarSubtitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) { @@ -250,7 +250,7 @@ void GtkMenubarChapterToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) input_ChangeArea( p_intf->p_sys->p_input, (input_area_t*)p_area ); p_intf->p_sys->b_chapter_update = 1; - p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_popup ), "popup_navigation" ) ); vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); @@ -339,7 +339,7 @@ static gint GtkRadioMenu( intf_thread_t * p_intf, { p_item_selected = p_item; } - + gtk_widget_show( p_item ); /* setup signal hanling */ @@ -385,9 +385,9 @@ static gint GtkRadioMenu( intf_thread_t * p_intf, } /***************************************************************************** - * GtkProgramMenu: update the programs menu of the interface + * GtkProgramMenu: update the programs menu of the interface ***************************************************************************** - * Builds the program menu according to what have been found in the PAT + * Builds the program menu according to what have been found in the PAT * by the input. Usefull for multi-programs streams such as DVB ones. *****************************************************************************/ static gint GtkProgramMenu( gpointer p_data, @@ -401,7 +401,7 @@ static gint GtkProgramMenu( gpointer p_data, GtkWidget * p_item_active; GSList * p_group; char psz_name[ GTK_MENU_LABEL_SIZE ]; - gint i; + guint i; /* cast */ p_intf = (intf_thread_t *)p_data; @@ -429,7 +429,7 @@ static gint GtkProgramMenu( gpointer p_data, snprintf( psz_name, GTK_MENU_LABEL_SIZE, "id %d", p_intf->p_sys->p_input->stream.pp_programs[i]->i_number ); psz_name[GTK_MENU_LABEL_SIZE-1] = '\0'; - + p_item = gtk_radio_menu_item_new_with_label( p_group, psz_name ); p_group = gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) ); @@ -455,7 +455,7 @@ static gint GtkProgramMenu( gpointer p_data, gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu ); /* activation will call signals so we can only do it - * when submenu is attached to menu - to get intf_window + * when submenu is attached to menu - to get intf_window * We have to release the lock since input_ToggleES needs it */ if( p_item_active != NULL ) { @@ -494,8 +494,8 @@ static gint GtkLanguageMenus( gpointer p_data, GtkWidget * p_item_active; GSList * p_group; char psz_name[ GTK_MENU_LABEL_SIZE ]; - gint i_item; - gint i; + guint i_item; + guint i; p_intf = (intf_thread_t *)p_data; @@ -585,7 +585,7 @@ static gint GtkLanguageMenus( gpointer p_data, gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu ); /* acitvation will call signals so we can only do it - * when submenu is attached to menu - to get intf_window + * when submenu is attached to menu - to get intf_window * We have to release the lock since input_ToggleES needs it */ if( p_item_active != NULL ) { @@ -610,8 +610,8 @@ static gint GtkLanguageMenus( gpointer p_data, * -cascaded lists of chapters for each title *****************************************************************************/ static gint GtkTitleMenu( gpointer p_data, - GtkWidget * p_navigation, - void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) ) + GtkWidget * p_navigation, + void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) ) { intf_thread_t * p_intf; char psz_name[ GTK_MENU_LABEL_SIZE ]; @@ -626,10 +626,10 @@ static gint GtkTitleMenu( gpointer p_data, GtkWidget * p_item; GSList * p_title_group; GSList * p_chapter_group; - gint i_title; - gint i_chapter; - gint i_title_nb; - gint i_chapter_nb; + guint i_title; + guint i_chapter; + guint i_title_nb; + guint i_chapter_nb; /* cast */ p_intf = (intf_thread_t*)p_data; @@ -712,13 +712,13 @@ static gint GtkTitleMenu( gpointer p_data, { p_title_item = gtk_menu_item_new_with_label( psz_name ); -#if 1 +#if 1 p_chapter_menu = gtk_menu_new(); gtk_object_set_data( GTK_OBJECT( p_chapter_menu ), "p_intf", p_intf ); i_chapter_nb = p_intf->p_sys->p_input->stream.pp_areas[i_title]->i_part_nb; - + for( i_chapter = 0 ; i_chapter < i_chapter_nb ; i_chapter++ ) { /* we group chapters in packets of ten for small screens */ @@ -747,7 +747,7 @@ static gint GtkTitleMenu( gpointer p_data, snprintf( psz_name, GTK_MENU_LABEL_SIZE, _("Chapter %d"), i_chapter + 1 ); psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0'; - + p_item = gtk_radio_menu_item_new_with_label( p_chapter_group, psz_name ); p_chapter_group = gtk_radio_menu_item_group( @@ -861,7 +861,7 @@ gint GtkSetupMenus( intf_thread_t * p_intf ) es_descriptor_t * p_spu_es; GtkWidget * p_menubar_menu; GtkWidget * p_popup_menu; - gint i; + guint i; p_intf->p_sys->b_chapter_update |= p_intf->p_sys->b_title_update; p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_title_update | @@ -870,9 +870,9 @@ gint GtkSetupMenus( intf_thread_t * p_intf ) p_intf->p_sys->b_program_update; if( p_intf->p_sys->b_program_update ) - { + { pgrm_descriptor_t * p_pgrm; - + if( p_intf->p_sys->p_input->stream.p_new_program ) { p_pgrm = p_intf->p_sys->p_input->stream.p_new_program; @@ -882,25 +882,25 @@ gint GtkSetupMenus( intf_thread_t * p_intf ) p_pgrm = p_intf->p_sys->p_input->stream.p_selected_program; } - p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_window ), "menubar_program" ) ); GtkProgramMenu( p_intf, p_menubar_menu, p_pgrm, GtkMenubarProgramToggle ); - + p_intf->p_sys->b_program_update = 1; - p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_popup ), "popup_program" ) ); GtkProgramMenu( p_intf, p_popup_menu, p_pgrm, GtkPopupProgramToggle ); p_intf->p_sys->b_program_update = 0; } - + if( p_intf->p_sys->b_title_update ) - { + { char psz_title[5]; - p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_window ), "menubar_title" ) ); GtkRadioMenu( p_intf, p_menubar_menu, NULL, _("Title"), 0, p_intf->p_sys->p_input->stream.i_area_nb - 1, @@ -919,7 +919,7 @@ gint GtkSetupMenus( intf_thread_t * p_intf ) { char psz_chapter[5]; - p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_popup ), "popup_navigation" ) ); GtkTitleMenu( p_intf, p_popup_menu, GtkPopupNavigationToggle ); #if 0 @@ -929,7 +929,7 @@ gint GtkSetupMenus( intf_thread_t * p_intf ) on_menubar_chapter_toggle ); #endif - p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_window ), "menubar_chapter" ) ); GtkRadioMenu( p_intf, p_menubar_menu, NULL, _("Chapter"), 1, @@ -938,7 +938,7 @@ gint GtkSetupMenus( intf_thread_t * p_intf ) GtkMenubarChapterToggle ); - snprintf( psz_chapter, 4, "%d", + snprintf( psz_chapter, 4, "%d", p_intf->p_sys->p_input->stream.p_selected_area->i_part ); psz_chapter[ 4 ] = '\0'; gtk_label_set_text( p_intf->p_sys->p_label_chapter, psz_chapter ); @@ -974,37 +974,37 @@ gint GtkSetupMenus( intf_thread_t * p_intf ) /* find audio root menu */ p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_window ), "menubar_audio" ) ); - - p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + + p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_popup ), "popup_audio" ) ); - + p_intf->p_sys->b_audio_update = 1; GtkLanguageMenus( p_intf, p_menubar_menu, p_audio_es, AUDIO_ES, GtkMenubarAudioToggle ); p_intf->p_sys->b_audio_update = 1; GtkLanguageMenus( p_intf, p_popup_menu, p_audio_es, AUDIO_ES, GtkPopupAudioToggle ); - + p_intf->p_sys->b_audio_update = 0; } - + /* sub picture menus */ if( p_intf->p_sys->b_spu_update ) { /* find spu root menu */ p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_window ), "menubar_subpictures" ) ); - - p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + + p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_popup ), "popup_subpictures" ) ); - + p_intf->p_sys->b_spu_update = 1; GtkLanguageMenus( p_intf, p_menubar_menu, p_spu_es, SPU_ES, GtkMenubarSubtitleToggle ); p_intf->p_sys->b_spu_update = 1; GtkLanguageMenus( p_intf, p_popup_menu, p_spu_es, SPU_ES, GtkPopupSubtitleToggle ); - + p_intf->p_sys->b_spu_update = 0; } diff --git a/modules/gui/gtk/preferences.c b/modules/gui/gtk/preferences.c index 32d732c7d9..1934cd62c6 100644 --- a/modules/gui/gtk/preferences.c +++ b/modules/gui/gtk/preferences.c @@ -2,7 +2,7 @@ * gtk_preferences.c: functions to handle the preferences dialog box. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: preferences.c,v 1.4 2002/08/15 12:11:15 sam Exp $ + * $Id: preferences.c,v 1.5 2002/12/06 16:34:07 sam Exp $ * * Authors: Gildas Bazin * Loïc Minier @@ -609,7 +609,7 @@ static void GtkCreateConfigDialog( char *psz_module_name, * GtkConfigApply: store the changes to the config inside the modules * configuration structure and clear the hash table. ****************************************************************************/ -void GtkConfigApply( GtkButton * button, gpointer user_data ) +static void GtkConfigApply( GtkButton * button, gpointer user_data ) { intf_thread_t *p_intf; GHashTable *hash_table; @@ -627,19 +627,19 @@ void GtkConfigApply( GtkButton * button, gpointer user_data ) gtk_widget_set_sensitive( apply_button, FALSE ); } -void GtkConfigOk( GtkButton * button, gpointer user_data ) +static void GtkConfigOk( GtkButton * button, gpointer user_data ) { GtkConfigApply( button, user_data ); gtk_widget_destroy( gtk_widget_get_toplevel( GTK_WIDGET (button) ) ); } -void GtkConfigCancel( GtkButton * button, gpointer user_data ) +static void GtkConfigCancel( GtkButton * button, gpointer user_data ) { gtk_widget_destroy( gtk_widget_get_toplevel( GTK_WIDGET (button) ) ); } -void GtkConfigSave( GtkButton * button, gpointer user_data ) +static void GtkConfigSave( GtkButton * button, gpointer user_data ) { intf_thread_t *p_intf; @@ -653,8 +653,8 @@ void GtkConfigSave( GtkButton * button, gpointer user_data ) * GtkModuleHighlighted: display module description when an entry is selected * in the clist, and activate the configure button if necessary. ****************************************************************************/ -void GtkModuleHighlighted( GtkCList *module_clist, int row, int column, - GdkEventButton *event, gpointer user_data ) +static void GtkModuleHighlighted( GtkCList *module_clist, int row, int column, + GdkEventButton *event, gpointer user_data ) { intf_thread_t *p_intf; GtkWidget *config_button; @@ -698,7 +698,7 @@ void GtkModuleHighlighted( GtkCList *module_clist, int row, int column, /**************************************************************************** * GtkModuleConfigure: display module configuration dialog box. ****************************************************************************/ -void GtkModuleConfigure( GtkButton *button, gpointer user_data ) +static void GtkModuleConfigure( GtkButton *button, gpointer user_data ) { module_t *p_module; intf_thread_t *p_intf; @@ -716,7 +716,7 @@ void GtkModuleConfigure( GtkButton *button, gpointer user_data ) /**************************************************************************** * GtkModuleSelected: select module. ****************************************************************************/ -void GtkModuleSelected( GtkButton *button, gpointer user_data ) +static void GtkModuleSelected( GtkButton *button, gpointer user_data ) { module_t *p_module; GtkWidget *widget; diff --git a/modules/misc/network/ipv4.c b/modules/misc/network/ipv4.c index d1e290f89f..92cf64ae37 100644 --- a/modules/misc/network/ipv4.c +++ b/modules/misc/network/ipv4.c @@ -2,7 +2,7 @@ * ipv4.c: IPv4 network abstraction layer ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: ipv4.c,v 1.8 2002/12/04 06:23:08 titer Exp $ + * $Id: ipv4.c,v 1.9 2002/12/06 16:34:07 sam Exp $ * * Authors: Christophe Massiot * Mathias Kretschmer @@ -11,7 +11,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -98,7 +98,7 @@ static int BuildAddr( struct sockaddr_in * p_socket, else { struct hostent * p_hostent; - + /* Try to convert address directly from in_addr - this will work if * psz_address is dotted decimal. */ #ifdef HAVE_ARPA_INET_H @@ -201,7 +201,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket ) msg_Warn( p_this, "cannot configure socket (SO_RCVBUF)" ); #endif } - + /* Check if we really got what we have asked for, because Linux, etc. * will silently limit the max buffer size to net.core.rmem_max which * is typically only 65535 bytes */ @@ -226,15 +226,15 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket ) msg_Warn( p_this, "socket buffer size is 0x%x instead of 0x%x", i_opt, 0x80000 ); } - - + + /* Build the local socket */ #if defined( WIN32 ) && !defined( UNDER_CE ) /* Under Win32 and for the multicast, we bind on INADDR_ANY, * so let's call BuildAddr with "" instead of psz_bind_addr */ psz_bind_win32 = psz_bind_addr ; - + /* Check if this is a multicast socket */ if (IN_MULTICAST( ntohl( inet_addr(psz_bind_addr) ) ) ) { @@ -242,8 +242,8 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket ) } if ( BuildAddr( &sock, psz_bind_win32, i_bind_port ) == -1 ) #else - if ( BuildAddr( &sock, psz_bind_addr, i_bind_port ) == -1 ) -#endif + if ( BuildAddr( &sock, psz_bind_addr, i_bind_port ) == -1 ) +#endif { msg_Dbg( p_this, "could not build local address" ); #if defined( WIN32 ) || defined( UNDER_CE ) @@ -253,7 +253,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket ) #endif return( -1 ); } - + /* Bind it */ if( bind( i_handle, (struct sockaddr *)&sock, sizeof( sock ) ) < 0 ) { @@ -289,7 +289,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket ) #endif } } - + #if !defined( UNDER_CE ) && !defined( SYS_BEOS ) /* Join the multicast group if the socket is a multicast address */ #ifndef IN_MULTICAST @@ -352,7 +352,7 @@ static int OpenUDP( vlc_object_t * p_this, network_socket_t * p_socket ) #endif return( -1 ); } - + /* Connect the socket */ if( connect( i_handle, (struct sockaddr *) &sock, sizeof( sock ) ) == (-1) ) diff --git a/modules/video_filter/crop.c b/modules/video_filter/crop.c index e67914746d..73184183ab 100644 --- a/modules/video_filter/crop.c +++ b/modules/video_filter/crop.c @@ -2,7 +2,7 @@ * crop.c : Crop video plugin for vlc ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: crop.c,v 1.4 2002/11/28 17:35:00 sam Exp $ + * $Id: crop.c,v 1.5 2002/12/06 16:34:07 sam Exp $ * * Authors: Samuel Hocevar * @@ -375,7 +375,7 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic ) static void UpdateStats( vout_thread_t *p_vout, picture_t *p_pic ) { - u8 *p_in = p_pic->p[0].p_pixels; + uint8_t *p_in = p_pic->p[0].p_pixels; int i_pitch = p_pic->p[0].i_pitch; int i_lines = p_pic->p[0].i_lines; int i_firstwhite = -1, i_lastwhite = -1, i; @@ -415,14 +415,17 @@ static void UpdateStats( vout_thread_t *p_vout, picture_t *p_pic ) return; } - if( i_lastwhite - i_firstwhite < p_vout->p_sys->i_height / 2 ) + if( (unsigned int)(i_lastwhite - i_firstwhite) + < p_vout->p_sys->i_height / 2 ) { p_vout->p_sys->i_lastchange = 0; return; } - if( i_lastwhite - i_firstwhite < p_vout->p_sys->i_height + 16 - && i_lastwhite - i_firstwhite + 16 > p_vout->p_sys->i_height ) + if( (unsigned int)(i_lastwhite - i_firstwhite) + < p_vout->p_sys->i_height + 16 + && (unsigned int)(i_lastwhite - i_firstwhite + 16) + > p_vout->p_sys->i_height ) { p_vout->p_sys->i_lastchange = 0; return; diff --git a/modules/video_output/x11/xcommon.c b/modules/video_output/x11/xcommon.c index 1004cd027a..10efea00cb 100644 --- a/modules/video_output/x11/xcommon.c +++ b/modules/video_output/x11/xcommon.c @@ -2,7 +2,7 @@ * xcommon.c: Functions common to the X11 and XVideo plugins ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: xcommon.c,v 1.7 2002/11/14 22:38:48 massiot Exp $ + * $Id: xcommon.c,v 1.8 2002/12/06 16:34:08 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -89,7 +89,7 @@ static void DestroyWindow ( vout_thread_t *, x11_window_t * ); static int NewPicture ( vout_thread_t *, picture_t * ); static void FreePicture ( vout_thread_t *, picture_t * ); -static IMAGE_TYPE *CreateImage ( vout_thread_t *, +static IMAGE_TYPE *CreateImage ( vout_thread_t *, Display *, EXTRA_ARGS, int, int ); #ifdef HAVE_SYS_SHM_H static IMAGE_TYPE *CreateShmImage ( vout_thread_t *, @@ -183,7 +183,7 @@ int E_(Activate) ( vlc_object_t *p_this ) if( b_chroma ) { - msg_Dbg( p_vout, "forcing chroma 0x%.8x (%4.4s)", + msg_Dbg( p_vout, "forcing chroma 0x%.8x (%4.4s)", i_chroma, (char*)&i_chroma ); } else @@ -490,15 +490,17 @@ static int ManageVideo( vout_thread_t *p_vout ) while( XCheckWindowEvent( p_vout->p_sys->p_display, p_vout->p_sys->p_win->base_window, StructureNotifyMask | KeyPressMask | - ButtonPressMask | ButtonReleaseMask | + ButtonPressMask | ButtonReleaseMask | PointerMotionMask | Button1MotionMask , &xevent ) == True ) { /* ConfigureNotify event: prepare */ if( xevent.type == ConfigureNotify ) { - if( (xevent.xconfigure.width != p_vout->p_sys->p_win->i_width) - || (xevent.xconfigure.height != p_vout->p_sys->p_win->i_height) ) + if( (unsigned int)xevent.xconfigure.width + != p_vout->p_sys->p_win->i_width + || (unsigned int)xevent.xconfigure.height + != p_vout->p_sys->p_win->i_height ) { /* Update dimensions */ p_vout->i_changes |= VOUT_SIZE_CHANGE; @@ -512,7 +514,7 @@ static int ManageVideo( vout_thread_t *p_vout ) /* We may have keys like F1 trough F12, ESC ... */ x_key_symbol = XKeycodeToKeysym( p_vout->p_sys->p_display, xevent.xkey.keycode, 0 ); - switch( x_key_symbol ) + switch( (int)x_key_symbol ) { case XK_Escape: if( p_vout->b_fullscreen ) @@ -579,7 +581,7 @@ static int ManageVideo( vout_thread_t *p_vout ) default: /* "Normal Keys" - * The reason why I use this instead of XK_0 is that + * The reason why I use this instead of XK_0 is that * with XLookupString, we don't have to care about * keymaps. */ @@ -681,7 +683,7 @@ static int ManageVideo( vout_thread_t *p_vout ) p_vout->p_sys->i_time_mouse_last_moved = mdate(); if( ! p_vout->p_sys->b_mouse_pointer_visible ) { - ToggleCursor( p_vout ); + ToggleCursor( p_vout ); } } /* Reparent move -- XXX: why are we getting this ? */ @@ -759,7 +761,7 @@ static int ManageVideo( vout_thread_t *p_vout ) msg_Dbg( p_vout, "video display resized (%dx%d)", p_vout->p_sys->p_win->i_width, p_vout->p_sys->p_win->i_height ); - + #ifdef MODULE_NAME_IS_x11 /* We need to signal the vout thread about the size change because it * is doing the rescaling */ @@ -772,7 +774,7 @@ static int ManageVideo( vout_thread_t *p_vout ) XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->p_win->video_window, i_width, i_height ); - + XMoveWindow( p_vout->p_sys->p_display, p_vout->p_sys->p_win->video_window, i_x, i_y ); } @@ -899,7 +901,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win ) { /* WM_DELETE_WINDOW is not supported by window manager */ msg_Warn( p_vout, "missing or bad window manager" ); - } + } /* Creation of a graphic context that doesn't generate a GraphicsExpose * event when using functions like XCopyArea */ @@ -955,7 +957,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win ) XSelectInput( p_vout->p_sys->p_display, p_win->base_window, StructureNotifyMask | KeyPressMask | - ButtonPressMask | ButtonReleaseMask | + ButtonPressMask | ButtonReleaseMask | PointerMotionMask ); #ifdef MODULE_NAME_IS_x11 @@ -1076,7 +1078,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic ) p_vout->p_sys->i_xvport, p_vout->output.i_chroma, #else p_vout->p_sys->p_visual, - p_vout->p_sys->i_screen_depth, + p_vout->p_sys->i_screen_depth, p_vout->p_sys->i_bytes_per_pixel, #endif p_vout->output.i_width, p_vout->output.i_height ); @@ -1637,8 +1639,8 @@ static int XVideoGetPort( vout_thread_t *p_vout, /* Look for the first available port supporting this format */ for( i_port = p_adaptor[i_adaptor].base_id; - ( i_port < p_adaptor[i_adaptor].base_id - + p_adaptor[i_adaptor].num_ports ) + ( i_port < (int)(p_adaptor[i_adaptor].base_id + + p_adaptor[i_adaptor].num_ports) ) && ( i_selected_port == -1 ); i_port++ ) { @@ -1858,12 +1860,13 @@ static int InitDisplay( vout_thread_t *p_vout ) /* Under XFree4.0, the list contains pixmap formats available * through all video depths ; so we have to check against current * depth. */ - if( p_formats->depth == p_vout->p_sys->i_screen_depth ) + if( p_formats->depth == (int)p_vout->p_sys->i_screen_depth ) { if( p_formats->bits_per_pixel / 8 - > p_vout->p_sys->i_bytes_per_pixel ) + > (int)p_vout->p_sys->i_bytes_per_pixel ) { - p_vout->p_sys->i_bytes_per_pixel = p_formats->bits_per_pixel / 8; + p_vout->p_sys->i_bytes_per_pixel = + p_formats->bits_per_pixel / 8; } } } diff --git a/modules/video_output/x11/xcommon.h b/modules/video_output/x11/xcommon.h index cd460df65b..7b1728b158 100644 --- a/modules/video_output/x11/xcommon.h +++ b/modules/video_output/x11/xcommon.h @@ -2,7 +2,7 @@ * xcommon.h: Defines common to the X11 and XVideo plugins ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: xcommon.h,v 1.3 2002/09/10 12:15:07 sam Exp $ + * $Id: xcommon.h,v 1.4 2002/12/06 16:34:08 sam Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -51,8 +51,8 @@ typedef struct x11_window_t Window base_window; /* base window */ Window video_window; /* sub-window for displaying video */ GC gc; /* graphic context instance handler */ - int i_width; /* window width */ - int i_height; /* window height */ + unsigned int i_width; /* window width */ + unsigned int i_height; /* window height */ Atom wm_protocols; Atom wm_delete_window; @@ -92,16 +92,16 @@ struct vout_sys_t #else Colormap colormap; /* colormap used (8bpp only) */ - int i_screen_depth; - int i_bytes_per_pixel; - int i_bytes_per_line; + unsigned int i_screen_depth; + unsigned int i_bytes_per_pixel; + unsigned int i_bytes_per_line; #endif /* Screen saver properties */ - int i_ss_timeout; /* timeout */ - int i_ss_interval; /* interval between changes */ - int i_ss_blanking; /* blanking mode */ - int i_ss_exposure; /* exposure mode */ + unsigned int i_ss_timeout; /* timeout */ + unsigned int i_ss_interval; /* interval between changes */ + unsigned int i_ss_blanking; /* blanking mode */ + unsigned int i_ss_exposure; /* exposure mode */ #ifdef DPMSINFO_IN_DPMS_H BOOL b_ss_dpms; /* DPMS mode */ #endif diff --git a/src/input/input.c b/src/input/input.c index 57b7acfb0e..5bdfbddc24 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -4,7 +4,7 @@ * decoders. ***************************************************************************** * Copyright (C) 1998-2002 VideoLAN - * $Id: input.c,v 1.217 2002/12/06 10:10:39 sam Exp $ + * $Id: input.c,v 1.218 2002/12/06 16:34:08 sam Exp $ * * Authors: Christophe Massiot * @@ -12,7 +12,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -87,7 +87,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent, /* Access */ p_input->p_access = NULL; - + p_input->i_bufsize = 0; p_input->i_mtu = 0; @@ -221,7 +221,7 @@ static int RunThread( input_thread_t *p_input ) while( !p_input->b_die && !p_input->b_error && !p_input->b_eof ) { - int i, i_count; + unsigned int i, i_count; p_input->c_loops++; @@ -234,8 +234,8 @@ static int RunThread( input_thread_t *p_input ) /* Reinitialize buffer manager. */ input_AccessReinit( p_input ); - - p_input->pf_set_program( p_input, + + p_input->pf_set_program( p_input, p_input->stream.p_new_program ); /* Escape all decoders for the stream discontinuity they @@ -253,7 +253,7 @@ static int RunThread( input_thread_t *p_input ) } p_input->stream.p_new_program = NULL; } - + if( p_input->stream.p_new_area ) { if( p_input->stream.b_seekable && p_input->pf_set_area != NULL ) @@ -398,7 +398,7 @@ static int InitThread( input_thread_t * p_input ) if( psz_parser[0] == '/' && psz_parser[1] == '/' ) { psz_parser += 2 ; - } + } p_input->psz_name = psz_parser ; @@ -549,7 +549,7 @@ static void EndThread( input_thread_t * p_input ) /* Free info structures */ msg_Dbg( p_input, "freeing info structures..."); input_DelInfo( p_input ); - + input_DumpStream( p_input ); /* Free all ES and destroy all decoder threads */ diff --git a/src/input/input_dec.c b/src/input/input_dec.c index e9c4c1fb6f..783ac551d2 100644 --- a/src/input/input_dec.c +++ b/src/input/input_dec.c @@ -2,7 +2,7 @@ * input_dec.c: Functions for the management of decoders ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: input_dec.c,v 1.51 2002/11/11 14:39:12 sam Exp $ + * $Id: input_dec.c,v 1.52 2002/12/06 16:34:08 sam Exp $ * * Authors: Christophe Massiot * @@ -10,7 +10,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -229,7 +229,7 @@ void input_FlushPESFifo( decoder_fifo_t *p_fifo ) *****************************************************************************/ void input_EscapeDiscontinuity( input_thread_t * p_input ) { - int i_es, i; + unsigned int i_es, i; for( i_es = 0; i_es < p_input->stream.i_selected_es_number; i_es++ ) { @@ -250,7 +250,7 @@ void input_EscapeDiscontinuity( input_thread_t * p_input ) *****************************************************************************/ void input_EscapeAudioDiscontinuity( input_thread_t * p_input ) { - int i_es, i; + unsigned int i_es, i; for( i_es = 0; i_es < p_input->stream.i_selected_es_number; i_es++ ) { @@ -296,7 +296,7 @@ static decoder_fifo_t * CreateDecoderFifo( input_thread_t * p_input, p_fifo->i_id = p_es->i_id; p_fifo->i_fourcc = p_es->i_fourcc; p_fifo->p_demux_data = p_es->p_demux_data; - + p_fifo->p_stream_ctrl = &p_input->stream.control; p_fifo->p_sout = p_input->stream.p_sout; diff --git a/src/input/input_ext-intf.c b/src/input/input_ext-intf.c index bf410feef2..d37f16ba73 100644 --- a/src/input/input_ext-intf.c +++ b/src/input/input_ext-intf.c @@ -2,7 +2,7 @@ * input_ext-intf.c: services to the interface ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: input_ext-intf.c,v 1.43 2002/11/11 14:39:12 sam Exp $ + * $Id: input_ext-intf.c,v 1.44 2002/12/06 16:34:08 sam Exp $ * * Authors: Christophe Massiot * @@ -272,9 +272,9 @@ char * input_OffsetToTime( input_thread_t * p_input, char * psz_buffer, *****************************************************************************/ void input_DumpStream( input_thread_t * p_input ) { - int i, j; - char psz_time1[OFFSETTOTIME_MAX_SIZE]; - char psz_time2[OFFSETTOTIME_MAX_SIZE]; + char psz_time1[OFFSETTOTIME_MAX_SIZE]; + char psz_time2[OFFSETTOTIME_MAX_SIZE]; + unsigned int i, j; #define S p_input->stream msg_Dbg( p_input, "dumping stream ID 0x%x [OK:%d/D:%d]", S.i_stream_id, diff --git a/src/input/input_programs.c b/src/input/input_programs.c index 90f855a27d..3793d7baee 100644 --- a/src/input/input_programs.c +++ b/src/input/input_programs.c @@ -2,7 +2,7 @@ * input_programs.c: es_descriptor_t, pgrm_descriptor_t management ***************************************************************************** * Copyright (C) 1999-2002 VideoLAN - * $Id: input_programs.c,v 1.98 2002/11/11 14:39:12 sam Exp $ + * $Id: input_programs.c,v 1.99 2002/12/06 16:34:08 sam Exp $ * * Authors: Christophe Massiot * @@ -10,7 +10,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 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 @@ -57,7 +57,7 @@ int input_InitStream( input_thread_t * p_input, size_t i_data_len ) p_input->stream.pp_programs = NULL; p_input->stream.p_selected_program = NULL; p_input->stream.p_new_program = NULL; - + if( i_data_len ) { if ( (p_input->stream.p_demux_data = malloc( i_data_len )) == NULL ) @@ -103,7 +103,7 @@ void input_EndStream( input_thread_t * p_input ) { free( p_input->stream.pp_selected_es ); } - + if( p_input->stream.p_demux_data != NULL ) { free( p_input->stream.p_demux_data ); @@ -113,9 +113,10 @@ void input_EndStream( input_thread_t * p_input ) /***************************************************************************** * input_FindProgram: returns a pointer to a program described by its ID *****************************************************************************/ -pgrm_descriptor_t * input_FindProgram( input_thread_t * p_input, u16 i_pgrm_id ) +pgrm_descriptor_t * input_FindProgram( input_thread_t * p_input, + uint16_t i_pgrm_id ) { - int i; + unsigned int i; for( i = 0; i < p_input->stream.i_pgrm_number; i++ ) { @@ -188,7 +189,7 @@ pgrm_descriptor_t * input_AddProgram( input_thread_t * p_input, *****************************************************************************/ void input_DelProgram( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm ) { - int i_pgrm_index; + unsigned int i_pgrm_index; /* Find the program in the programs table */ for( i_pgrm_index = 0; i_pgrm_index < p_input->stream.i_pgrm_number; @@ -265,11 +266,11 @@ input_area_t * input_AddArea( input_thread_t * p_input ) *****************************************************************************/ int input_SetProgram( input_thread_t * p_input, pgrm_descriptor_t * p_new_prg ) { - int i_es_index; - int i_required_audio_es; - int i_required_spu_es; - int i_audio_es = 0; - int i_spu_es = 0; + unsigned int i_es_index; + unsigned int i_required_audio_es; + unsigned int i_required_spu_es; + unsigned int i_audio_es = 0; + unsigned int i_spu_es = 0; if ( p_input->stream.p_selected_program ) { @@ -366,7 +367,7 @@ int input_SetProgram( input_thread_t * p_input, pgrm_descriptor_t * p_new_prg ) *****************************************************************************/ void input_DelArea( input_thread_t * p_input, input_area_t * p_area ) { - int i_area_index; + unsigned int i_area_index; /* Find the area in the areas table */ for( i_area_index = 0; i_area_index < p_input->stream.i_area_nb; @@ -396,9 +397,9 @@ void input_DelArea( input_thread_t * p_input, input_area_t * p_area ) /***************************************************************************** * input_FindES: returns a pointer to an ES described by its ID *****************************************************************************/ -es_descriptor_t * input_FindES( input_thread_t * p_input, u16 i_es_id ) +es_descriptor_t * input_FindES( input_thread_t * p_input, uint16_t i_es_id ) { - int i; + unsigned int i; for( i = 0; i < p_input->stream.i_es_number; i++ ) { @@ -483,7 +484,7 @@ es_descriptor_t * input_AddES( input_thread_t * p_input, *****************************************************************************/ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es ) { - int i_index, i_es_index; + unsigned int i_index, i_es_index; pgrm_descriptor_t * p_pgrm; /* Find the ES in the ES table */ @@ -605,7 +606,7 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es ) int input_UnselectES( input_thread_t * p_input, es_descriptor_t * p_es ) { - int i_index = 0; + unsigned int i_index = 0; if( p_es == NULL ) { diff --git a/src/misc/cpu.c b/src/misc/cpu.c index c73ba7f42c..a5a0c8dce8 100644 --- a/src/misc/cpu.c +++ b/src/misc/cpu.c @@ -2,7 +2,7 @@ * cpu.c: CPU detection code ***************************************************************************** * Copyright (C) 1998-2002 VideoLAN - * $Id: cpu.c,v 1.9 2002/11/11 14:39:12 sam Exp $ + * $Id: cpu.c,v 1.10 2002/12/06 16:34:08 sam Exp $ * * Authors: Samuel Hocevar * Christophe Massiot @@ -106,7 +106,7 @@ uint32_t CPUCapabilities( void ) volatile vlc_bool_t b_amd; /* Needed for x86 CPU capabilities detection */ -# define cpuid( a ) \ +# define cpuid( reg ) \ asm volatile ( "pushl %%ebx\n\t" \ "cpuid\n\t" \ "movl %%ebx,%1\n\t" \ @@ -115,7 +115,7 @@ uint32_t CPUCapabilities( void ) "=r" ( i_ebx ), \ "=c" ( i_ecx ), \ "=d" ( i_edx ) \ - : "a" ( a ) \ + : "a" ( reg ) \ : "cc" ); # if defined( CAN_COMPILE_SSE ) || defined ( CAN_COMPILE_3DNOW ) \ -- 2.39.2