* ALL: a bunch of additional warning fixes.
57 files changed:
-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 -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}"
AC_CACHE_CHECK([if \$CC accepts -Wconversion],
[ac_cv_c_Wconversion],
[CFLAGS="-Wconversion ${CFLAGS_save}"
[CFLAGS="-Winline ${CFLAGS_save}"
AC_TRY_COMPILE([],,ac_cv_c_Winline=yes, ac_cv_c_Winline=no)])
[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_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}"
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}"
/*****************************************************************************
* input_ext-intf.h: structures of the input exported to the interface
* This header provides structures to read the stream descriptors and
/*****************************************************************************
* 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
*****************************************************************************
* 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 <massiot@via.ecp.fr>
*
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* 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.
* 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
* 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
/* PES parser information */
pes_packet_t * p_pes; /* Current PES */
/* 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;
/* Decoder information */
decoder_fifo_t * p_decoder_fifo;
#define PROGRAM_ASSOCIATION_TABLE_PID 0x0000
#define CONDITIONNAL_ACCESS_TABLE_PID 0x0001 /* not used */
#define EMPTY_ID 0xffff /* empty record in a table */
#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
/* ES Categories to be used by interface plugins */
#define UNKNOWN_ES 0x00
/* Demultiplexer data */
pgrm_sys_t * p_demux_data;
/* 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 */
};
es_descriptor_t ** pp_es; /* array of pointers to ES */
};
struct input_area_t
{
/* selected area attributes */
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) */
off_t i_start; /* start offset of area */
off_t i_size; /* total size of the area
* (in arbitrary units) */
* (changed by the interface thread */
/* area subdivision */
* (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 */
/* offset to plugin related data */
* Value of this item
*/
char * psz_value;
* Value of this item
*/
char * psz_value;
/**
* Pointer to next item in list, or NULL it at end of list
*/
/**
* Pointer to next item in list, or NULL it at end of list
*/
* The name of this category
*/
char * psz_name;
* The name of this category
*/
char * psz_name;
/**
* first element of a linked list containing info items
*/
input_info_t * p_info;
/**
* 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
*/
/**
* Pointer to next element in this list, or NULL if at end of list
*/
* or modify stream, pgrm or es */
/* Input method data */
* 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) : */
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) : */
+ 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;
input_area_t ** pp_areas; /* list of areas in stream == offset
* interval with own properties */
input_area_t * p_selected_area;
* units of 50 bytes/s) ; 0 if undef */
/* New status and rate requested by the interface */
* 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 */
int b_new_mute; /* int because it can be -1 */
vlc_cond_t stream_wait; /* interface -> input in case of a
* status change request */
stream_sys_t * p_demux_data;
/* Programs descriptions */
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 ** 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 */
selected program */
pgrm_descriptor_t * p_new_program; /* Newly selected program */
/* ES descriptions */
+ unsigned int i_es_number;
es_descriptor_t ** pp_es; /* carried elementary streams */
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 */
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;
/* Stream control */
stream_ctrl_t control;
/* Input info */
input_info_category_t * p_info;
/* Input info */
input_info_category_t * p_info;
/* Statistics */
count_t c_packets_read; /* packets read */
count_t c_packets_trashed; /* trashed packets */
/* Statistics */
count_t c_packets_read; /* packets read */
count_t c_packets_trashed; /* trashed packets */
* -udf.* to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* -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 <stef@via.ecp.fr>
*
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
* 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.
* 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
* 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
return -1;
}
p_input->p_access_data = (void *)p_dvd;
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;
p_input->pf_read = DVDRead;
p_input->pf_seek = DVDSeek;
p_input->pf_set_area = DVDSetArea;
free( p_dvd );
return -1;
}
free( p_dvd );
return -1;
}
p_input->i_mtu = 0;
/* override environment variable DVDCSS_METHOD with config option
p_input->i_mtu = 0;
/* override environment variable DVDCSS_METHOD with config option
p_dvd->dvdhandle = dvdcss_open( psz_device );
p_dvd->dvdhandle = dvdcss_open( psz_device );
/* free allocated string */
free( psz_device );
/* free allocated string */
free( psz_device );
/* Titles are Program Chains */
area[i]->i_id = i;
/* 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;
* We can only set that with vts ifo, so we do it during the
* first call to DVDSetArea */
area[i]->i_start = 0;
/* 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;
/* 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;
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_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_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;
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 )
{
/* set title, chapter, audio and subpic */
if( DVDSetArea( p_input, p_area ) < 0 )
{
* DVDSetProgram: used to change angle
*****************************************************************************/
static int DVDSetProgram( input_thread_t * p_input,
* 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;
{
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;
p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
i_angle = p_program->i_number;
{
input_DelES( p_input, p_input->stream.pp_es[0] );
}
{
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] );
while( p_input->stream.i_pgrm_number )
{
input_DelProgram( p_input, p_input->stream.pp_programs[0] );
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;
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];
input_AddProgram( p_input, 1, sizeof( stream_ps_data_t ) );
p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
/* Destroy obsolete ES by reinitializing programs */
DVDFlushStream( p_input );
/* 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;
}
/* 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;
}
- 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 );
msg_Dbg( p_input, "title first %i, last %i, size %i",
i_first, i_last, i_last + 1 - p_dvd->i_vts_lb );
DVDReadVideo( p_input );
DVDReadAudio( p_input );
DVDReadSPU ( p_input );
DVDReadVideo( p_input );
DVDReadAudio( p_input );
DVDReadSPU ( p_input );
if( p_input->p_demux )
{
DVDLaunchDecoders( p_input );
if( p_input->p_demux )
{
DVDLaunchDecoders( p_input );
/* Chapter selection */
p_dvd->i_chapter = DVDSetChapter( p_dvd, p_area->i_part );
/* 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 */
p_input->stream.p_selected_area->i_tell = DVDTell;
/* warn interface that something has changed */
#define title \
p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title
#define title \
p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title
/*****************************************************************************
* DVDRead: reads data packets.
*****************************************************************************
/*****************************************************************************
* DVDRead: reads data packets.
*****************************************************************************
static void DVDSeek( input_thread_t * p_input, off_t i_off )
{
thread_dvd_data_t * p_dvd;
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 );
p_dvd = ( thread_dvd_data_t * )(p_input->p_access_data);
vlc_mutex_lock( &p_input->stream.stream_lock );
p_dvd->i_prg_cell = Lb2CellPrg( p_dvd );
p_dvd->i_map_cell = Lb2CellMap( p_dvd );
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
if( CellIsInterleaved( p_dvd ) )
{
/* if we're inside a multi-angle zone, we have to choose i_sector
* can be very wide out of such zones */
p_dvd->i_vts_lb = CellFirstSector( p_dvd );
}
* 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 );
p_dvd->i_last_lb = CellLastSector( p_dvd );
p_dvd->i_chapter = CellPrg2Chapter( p_dvd );
if( *psz_parser == '@' )
{
/* found end of raw device, and beginning of options */
if( *psz_parser == '@' )
{
/* found end of raw device, and beginning of options */
if( !S_ISCHR(stat_info.st_mode) )
{
msg_Warn( p_input, "raw device %s is"
if( !S_ISCHR(stat_info.st_mode) )
{
msg_Warn( p_input, "raw device %s is"
if( !*psz_device )
{
free( psz_device );
if( !*psz_device )
{
free( psz_device );
if( !p_input->psz_access )
{
/* no device and no access specified: we probably don't want DVD */
if( !p_input->psz_access )
{
/* no device and no access specified: we probably don't want DVD */
psz_device = config_GetPsz( p_input, "dvd" );
}
psz_device = config_GetPsz( p_input, "dvd" );
}
/* 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 );
/* 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 );
if( !S_ISBLK(stat_info.st_mode) && !S_ISCHR(stat_info.st_mode) )
{
msg_Warn( p_input,
if( !S_ISBLK(stat_info.st_mode) && !S_ISCHR(stat_info.st_mode) )
{
msg_Warn( p_input,
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;
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;
* dvd.h: thread structure of the DVD plugin
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* 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 <stef@via.ecp.fr>
*
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
{
dvdcss_handle dvdhandle; /* libdvdcss handle */
{
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 */
/* 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;
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;
/* Structure that contains all information of the DVD */
struct ifo_s * p_ifo;
/* es.c: functions to find and select ES
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
/* 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 <stef@via.ecp.fr>
*
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
* 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.
* 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
* 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
/* ES 0 -> video MPEG2 */
IfoPrintVideo( p_dvd );
i_ratio = vts.manager_inf.video_attr.i_ratio;
/* 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) );
if( i_ratio )
{
ADDES( 0xe0, 0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0, sizeof(int) );
{
ADDES( 0xe0, 0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0, 0 );
}
{
ADDES( 0xe0, 0, VLC_FOURCC('m','p','g','v'), VIDEO_ES, 0, 0 );
}
}
/*****************************************************************************
}
/*****************************************************************************
*****************************************************************************/
#define audio_status \
vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_audio_status[i-1]
*****************************************************************************/
#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;
void DVDReadAudio( input_thread_t * p_input )
{
thread_dvd_data_t * p_dvd;
p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
p_dvd->i_audio_nb = 0;
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++ )
{
/* Audio ES, in the order they appear in .ifo */
for( i = 1 ; i <= vts.manager_inf.i_audio_nb ; i++ )
{
es_descriptor_t * p_es;
int i_id;
int i;
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;
p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
p_dvd->i_spu_nb = 0;
sizeof(int) + 16*sizeof(u32) );
*(int*)p_es->p_demux_data = 0xBeeF;
memcpy( (char*)p_es->p_demux_data + sizeof(int),
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) );
void DVDLaunchDecoders( input_thread_t * p_input )
{
thread_dvd_data_t * p_dvd;
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);
p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
config_PutInt( p_input, "audio-channel", 1 );
i_audio = 1;
}
config_PutInt( p_input, "audio-channel", 1 );
i_audio = 1;
}
if( ( config_GetInt( p_input, "audio-type" )
== REQUESTED_A52 ) )
{
if( ( config_GetInt( p_input, "audio-type" )
== REQUESTED_A52 ) )
{
+ 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
for( i = 0; i < p_input->stream.i_es_number; i++ )
{
if ( p_input->stream.pp_es[i]->i_fourcc
/* seek.c: functions to navigate through DVD.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
/* 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 <stef@via.ecp.fr>
*
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
* 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.
* 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
* 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
if( i_cell >= cell.i_cell_nb )
{
return -1;
}
if( i_cell >= cell.i_cell_nb )
{
return -1;
}
}
int CellAngleOffset( thread_dvd_data_t * p_dvd, int i_prg_cell )
{
int i_cell_off;
}
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;
}
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 ) )
/* basic handling of angles */
switch( ( ( title.p_cell_play[i_prg_cell].i_category & 0xf000 )
>> 12 ) )
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 );
}
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,
int CellLastSector( thread_dvd_data_t * p_dvd )
{
return __MIN( cell.p_cell_map[p_dvd->i_map_cell].i_last_sector,
int NextCellPrg( 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 ++;
if( p_dvd->i_vts_lb > title.p_cell_play[i_cell].i_last_sector )
{
i_cell ++;
return i_cell;
}
int Lb2CellPrg( thread_dvd_data_t * p_dvd )
{
return i_cell;
}
int Lb2CellPrg( thread_dvd_data_t * p_dvd )
{
+ unsigned int i_cell = 0;
+
while( p_dvd->i_vts_lb > title.p_cell_play[i_cell].i_last_sector )
{
i_cell ++;
while( p_dvd->i_vts_lb > title.p_cell_play[i_cell].i_last_sector )
{
i_cell ++;
return i_cell;
}
int Lb2CellMap( thread_dvd_data_t * p_dvd )
{
int i_cell = 0;
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 ++;
while( p_dvd->i_vts_lb > cell.p_cell_map[i_cell].i_last_sector )
{
i_cell ++;
p_dvd->i_vts_lb = CellFirstSector( p_dvd );
p_dvd->i_last_lb = CellLastSector( 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 )
{
p_dvd->i_chapter = NextChapter( p_dvd );
if( p_dvd->i_chapter < 0 )
{
int CellPrg2Chapter( 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);
}
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 ++;
while( title.chapter_map.pi_start_cell[i_chapter] <= i_cell+1 )
{
i_chapter ++;
int NextChapter( thread_dvd_data_t * p_dvd )
{
int i_cell = p_dvd->i_prg_cell;
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( 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++;
if( title.chapter_map.pi_start_cell[p_dvd->i_chapter] <= i_cell+1 )
{
p_dvd->i_chapter++;
-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( 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 */
if( p_dvd->i_chapter != i_chapter )
{
/* Find cell index in Program chain for current chapter */
#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
}
#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
}
/* dvd_seek.h: DVD access plugin.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
/* 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 <stef@via.ecp.fr>
*
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
* 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.
* 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
* 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
int CellPrg2Chapter ( thread_dvd_data_t * );
int NextChapter ( 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 );
* contains the basic udf handling functions
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* 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 <stef@via.ecp.fr>
*
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
* 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.
* 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
* 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
typedef struct partition_s
{
vlc_bool_t b_valid;
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
{
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 */
} 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)
#define GETN(p,n,target) memcpy(target,&pi_data[p],n)
* Returns number of read bytes on success, 0 on error
*****************************************************************************/
static int UDFReadLB( dvdcss_handle dvdhandle, off_t i_lba,
* 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 )
{
{
if( dvdcss_seek( dvdhandle, i_lba, DVDCSS_NOFLAGS ) < 0 )
{
/*****************************************************************************
* UDFDecode: decode unicode encoded udf data
*****************************************************************************/
/*****************************************************************************
* 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 )
psz_target[i++] = pi_data[p++];
}
}
psz_target[i++] = pi_data[p++];
}
}
psz_target[i]='\0';
return 0;
psz_target[i]='\0';
return 0;
-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);
{
Flags[0] = data[0];
strncpy (Identifier, &data[1], 5);
/*****************************************************************************
* UDFDescriptor: gives a tag ID from your data to find out what it refers to
*****************************************************************************/
/*****************************************************************************
* 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 */
{
pi_tag_id[0] = GETN2( 0 );
/* TODO: check CRC 'n stuff */
/*****************************************************************************
* UDFExtendAD: main volume information
*****************************************************************************/
/*****************************************************************************
* 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 );
{
pi_length[0] = GETN4( 0 );
pi_location[0] = GETN4( 4 );
/*****************************************************************************
* UDFAD: file set information
*****************************************************************************/
/*****************************************************************************
* 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 );
struct partition_s partition )
{
p_ad->i_length = GETN4( 0 );
/*****************************************************************************
* UDFICB: takes Information Control Block from pi_data
*****************************************************************************/
/*****************************************************************************
* 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 );
{
pi_file_type[0] = GETN1( 11 );
pi_flags[0] = GETN2( 18 );
/*****************************************************************************
* UDFPartition: gets partition descriptor
*****************************************************************************/
/*****************************************************************************
* 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 );
{
pi_flags[0] = GETN2( 20 );
pi_nb[0] = GETN2( 22 );
*****************************************************************************
* Returns 0 on OK, 1 on error
*****************************************************************************/
*****************************************************************************
* 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 );
UDFDecode( &pi_data[84], 128, (char *)p_volume_descriptor );
/*****************************************************************************
* UDFFileEntry: fills a ad_t struct with information at pi_data
*****************************************************************************/
/*****************************************************************************
* 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 );
UDFICB( &pi_data[16], &i_file_type, &i_flags );
/*****************************************************************************
* UDFFileIdentifier: gives filename and characteristics of pi_data
*****************************************************************************/
/*****************************************************************************
* 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 )
{
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 );
i_L_FI = GETN1( 19 );
UDFAD( &pi_data[20], p_file_icb, UDFADlong, partition );
i_L_IU = GETN2( 36 );
* File: Location of file the ICB is pointing to
* return 1 on success, 0 on error;
*****************************************************************************/
* 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;
i_lba = partition.i_start + icb.i_location;
static int UDFScanDir( struct ad_s dir, char * psz_filename,
struct ad_s * p_file_icb, struct partition_s partition )
{
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
/* Scan dir for ICB of file */
i_lba = partition.i_start + dir.i_location;
#if 0
*****************************************************************************/
static int UDFFindPartition( int i_part_nb, struct partition_s *p_partition )
{
*****************************************************************************/
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;
vlc_bool_t b_term;
vlc_bool_t b_vol_valid;
int i;
/* Find Anchor */
i_last_sector = 0;
/* try #1, prime anchor */
/* try #1, prime anchor */
b_term = 0;
/* Search anchor loop */
b_term = 0;
/* Search anchor loop */
/* not an anchor? */
if( b_term )
{
/* not an anchor? */
if( b_term )
{
{
/* we already found the last sector
* try #3, alternative backup anchor */
{
/* 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! */
/* but that's just about enough, then! */
if( i_last_sector )
{
/* try #2, backup anchor */
if( i_last_sector )
{
/* try #2, backup anchor */
- i_lba = i_last_sector - 256;
+ i_lba = i_last_sector - 256;
/* main volume descriptor */
UDFExtentAD( &pi_anchor[16], &i_MVDS_length, &i_MVDS_location );
/* 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';
p_partition->b_valid = 0;
b_vol_valid = 0;
p_partition->pi_volume_desc[0] = '\0';
{
/* Logical Volume Descriptor */
if( UDFLogVolume( pi_lb , p_partition->pi_volume_desc ) )
{
/* Logical Volume Descriptor */
if( UDFLogVolume( pi_lb , p_partition->pi_volume_desc ) )
/* TODO: sector size wrong! */
}
else
/* TODO: sector size wrong! */
}
else
( i_MVDS_length - 1 ) / DVD_LB_SIZE )
&& ( i_tag_id != 8 )
&& ( ( !p_partition->b_valid ) || ( !b_vol_valid ) ) );
( 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 */
if( ( !p_partition->b_valid ) || ( !b_vol_valid ) )
{
/* backup volume descriptor */
* starting with '/'.
* returns absolute LB number, or 0 on error
*****************************************************************************/
* 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;
{
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;
char psz_tokenline[DVD_LB_SIZE] = "";
char * psz_token;
int i_partition;
strcat( psz_tokenline, psz_path );
/* Init file descriptor of UDF filesystem (== DVD) */
strcat( psz_tokenline, psz_path );
/* Init file descriptor of UDF filesystem (== DVD) */
/* Find root dir ICB */
i_lba = partition.i_start;
/* Find root dir ICB */
i_lba = partition.i_start;
/* Find root dir */
if( !UDFMapICB( root_icb, &i_file_type, &file, partition ) )
{
/* Find root dir */
if( !UDFMapICB( root_icb, &i_file_type, &file, partition ) )
{
* access.c: access capabilities for dvdplay plugin.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* 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 <stef@via.ecp.fr>
*
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
* 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.
* 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
* 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
char * psz_source;
dvd_data_t * p_dvd;
input_area_t * p_area;
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 )
{
p_dvd = malloc( sizeof(dvd_data_t) );
if( p_dvd == NULL )
{
p_input->pf_set_program = dvdplay_SetProgram;
/* command line */
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 );
&i_title, &i_chapter, &i_angle ) ) == NULL )
{
free( p_dvd );
p_dvd->p_intf = NULL;
p_dvd->i_still_time = 0;
p_dvd->p_intf = NULL;
p_dvd->i_still_time = 0;
/* set up input */
p_input->i_mtu = 0;
/* set up input */
p_input->i_mtu = 0;
p_input->stream.b_pace_control = 1;
/* seek is only allowed when we have size info */
p_input->stream.b_seekable = 0;
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 ) );
/* Initialize ES structures */
input_InitStream( p_input, sizeof( stream_ps_data_t ) );
/* Area 0 for menu */
area[0]->i_plugin_data = 0;
/* Area 0 for menu */
area[0]->i_plugin_data = 0;
for( i = 1 ; i <= i_title_nr ; i++ )
{
input_AddArea( p_input );
for( i = 1 ; i <= i_title_nr ; i++ )
{
input_AddArea( p_input );
/* Titles id */
area[i]->i_id = i;
/* Titles id */
area[i]->i_id = i;
vlc_mutex_unlock( &p_input->stream.stream_lock );
return -1;
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
return -1;
}
if( i_angle <= p_input->stream.i_pgrm_number )
{
dvdplay_SetProgram( p_input,
if( i_angle <= p_input->stream.i_pgrm_number )
{
dvdplay_SetProgram( p_input,
{
dvd_data_t * p_dvd;
int i_angle;
{
dvd_data_t * p_dvd;
int i_angle;
p_dvd = (dvd_data_t*)(p_input->p_access_data);
i_angle = p_program->i_number;
p_dvd = (dvd_data_t*)(p_input->p_access_data);
i_angle = p_program->i_number;
if( p_area != p_input->stream.p_selected_area )
{
int i_chapter;
if( p_area != p_input->stream.p_selected_area )
{
int i_chapter;
/* prevent intf to try to seek */
p_input->stream.b_seekable = 0;
/* 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 );
/* Store selected chapter */
i_chapter = p_area->i_part;
dvdNewArea( p_input, p_area );
dvdplay_start( p_dvd->vmg, p_area->i_id );
dvdplay_start( p_dvd->vmg, p_area->i_id );
p_area->i_part = i_chapter;
} /* i_title >= 0 */
else
p_area->i_part = i_chapter;
} /* i_title >= 0 */
else
static void dvdplay_Seek( input_thread_t * p_input, off_t i_off )
{
dvd_data_t * p_dvd;
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 );
p_dvd = (dvd_data_t *)p_input->p_access_data;
vlc_mutex_lock( &p_input->stream.stream_lock );
input_thread_t * p_input;
dvd_data_t * p_dvd;
vlc_value_t val;
input_thread_t * p_input;
dvd_data_t * p_dvd;
vlc_value_t val;
p_input = (input_thread_t*)p_args;
p_dvd = (dvd_data_t*)p_input->p_access_data;
p_input = (input_thread_t*)p_args;
p_dvd = (dvd_data_t*)p_input->p_access_data;
switch( event )
{
case NEW_DOMAIN:
switch( event )
{
case NEW_DOMAIN:
/* prevent intf to try to seek by default */
p_input->stream.b_seekable = 0;
/* 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,
{
/* the title number has changed: update area */
msg_Warn( p_input, "new title %d (%d)", i,
/* new pgc in same title: reinit ES */
dvdNewPGC( p_input );
/* new pgc in same title: reinit ES */
dvdNewPGC( p_input );
p_input->stream.b_changed = 1;
break;
p_input->stream.b_changed = 1;
break;
{
input_AddProgram( p_input, i+1, 0 );
}
{
input_AddProgram( p_input, i+1, 0 );
}
dvdplay_SetProgram( p_input,
dvdplay_SetProgram( p_input,
- p_input->stream.pp_programs[i_angle-1] );
+ p_input->stream.pp_programs[i_angle-1] );
// int i_subp_nr = -1;
// int i_subp = -1;
// int i_sec;
// 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 );
p_dvd = (dvd_data_t*)p_input->p_access_data;
// dvdplay_audio_info( p_dvd->vmg, &i_audio_nr, &i_audio );
{
p_input->stream.b_seekable = 0;
}
{
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)",
#if 0
i_sec = dvdplay_title_time( p_dvd->vmg );
msg_Dbg( p_input, "title time: %d:%02d:%02d (%d)",
* rtp.c: RTP access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* 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 <tooney@via.ecp.fr>
*
*
* Authors: Tristan Leteurtre <tooney@via.ecp.fr>
*
* 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.
* 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
* 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
i_server_port = 0;
psz_server_addr = "";
}
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 );
msg_Dbg( p_input, "opening server=%s:%d local=%s:%d",
psz_server_addr, i_server_port, psz_bind_addr, i_bind_port );
return( -1 );
}
module_Unneed( p_input, p_network );
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;
p_access_data = malloc( sizeof(input_socket_t) );
p_input->p_access_data = (access_sys_t *)p_access_data;
{
p_input->psz_demux = "ts";
}
{
p_input->psz_demux = "ts";
}
* RTPNetworkRead : Read for the network, and parses the RTP header
*****************************************************************************/
static ssize_t RTPNetworkRead( input_thread_t * p_input, byte_t * p_buffer,
* RTPNetworkRead : Read for the network, and parses the RTP header
*****************************************************************************/
static ssize_t RTPNetworkRead( input_thread_t * p_input, byte_t * p_buffer,
{
int i_rtp_version;
int i_CSRC_count;
int i_payload_type;
{
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.
byte_t * p_tmp_buffer = alloca( p_input->i_mtu );
/* Get the raw data from the socket.
ssize_t i_ret = Read( p_input, p_tmp_buffer, p_input->i_mtu );
if (!i_ret) return 0;
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. */
/* 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_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 );
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 );
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 );
/* Return the packet without the RTP header. */
i_ret -= ( RTP_HEADER_LEN + 4 * i_CSRC_count );
+ 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;
}
{
/* 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 );
p_tmp_buffer + RTP_HEADER_LEN + 4 * i_CSRC_count,
i_ret );
* vcd.c : VCD input module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* 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 <jobi@via.ecp.fr>
*
*
* Author: Johan Bilien <jobi@via.ecp.fr>
*
****************************************************************************/
static void VCDSeek( input_thread_t * p_input, off_t i_off )
{
****************************************************************************/
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;
p_vcd = (thread_vcd_data_t *) p_input->p_access_data;
* a52tospdif.c : encapsulates A/52 frames into S/PDIF packets
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* 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 <massiot@via.ecp.fr>
* Stéphane Borel <stef@via.ecp.fr>
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stéphane Borel <stef@via.ecp.fr>
- 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 };
+ byte_t * p_tmp;
+ uint16_t i;
- 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_in = p_in_buf->p_buffer;
byte_t * p_out = p_out_buf->p_buffer;
/* Copy the S/PDIF headers. */
memcpy( p_out, p_sync, 6 );
/* Copy the S/PDIF headers. */
memcpy( p_out, p_sync, 6 );
* ugly.c : ugly resampler (changes pitch)
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* 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 <sam@zoy.org>
*
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
int32_t* p_in = (int32_t*)p_in_buf->p_buffer;
int32_t* p_out = (int32_t*)p_out_buf->p_buffer;
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-- ; )
{
for( i_out = i_out_nb ; i_out-- ; )
{
* oss.c : OSS /dev/dsp module for vlc
*****************************************************************************
* Copyright (C) 2000-2002 VideoLAN
* 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 <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
if ( !AOUT_FMT_NON_LINEAR( &p_aout->output.output ) )
{
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 )
audio_buf_info audio_buf;
if( ioctl( p_sys->i_fd, SNDCTL_DSP_SETFMT, &i_format ) < 0 )
* a52.c: A/52 basic parser
*****************************************************************************
* Copyright (C) 2001-2002 VideoLAN
* 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 <stef@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
* 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.
* 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
* 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
/*****************************************************************************
* OpenDecoder: probe the decoder and return score
*****************************************************************************/
/*****************************************************************************
* 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') )
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;
}
p_fifo->pf_run = RunDecoder;
{
dec_thread_t * p_dec;
audio_date_t end_date;
{
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 )
/* Allocate the memory needed to store the thread's structure */
p_dec = malloc( sizeof(dec_thread_t) );
if( p_dec == NULL )
/* decoder thread's main loop */
while ( !p_dec->p_fifo->b_die && !p_dec->p_fifo->b_error )
{
/* 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 );
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 );
(!p_dec->p_fifo->b_die) && (!p_dec->p_fifo->b_error))
{
RemoveBits( &p_dec->bit_stream, 8 );
/* End of the spdif decoder thread */
EndThread( p_dec );
/* End of the spdif decoder thread */
EndThread( p_dec );
* since we don't want to oblige S/PDIF people to use liba52 just to get
* their SyncInfo...
*****************************************************************************/
* 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,
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;
int frmsizecod;
int bitrate;
int half;
if ( p_buf[6] & lfeon[acmod] ) *pi_channels |= AOUT_CHAN_LFE;
frmsizecod = p_buf[4] & 63;
if ( p_buf[6] & lfeon[acmod] ) *pi_channels |= AOUT_CHAN_LFE;
frmsizecod = p_buf[4] & 63;
* postprocessing_c.c: Post Processing plugin in C
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* 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 <fenrir@via.ecp.fr>
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 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
* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
-#include <vlc/vlc.h> /* only use u8, u32 .... */
+#include <vlc/vlc.h> /* only use uint8_t, uint32_t .... */
#include "postprocessing.h"
#include "postprocessing_common.h"
#include "postprocessing.h"
#include "postprocessing_common.h"
* so need to be fast ...
*
****************************************************************************/
* 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 )
/* algo : if ( | v[i] -v[i+1] | <= PP_THR1 ) { i_eq_cnt++; } */
i_eq_cnt = 0;
/* algo : if ( | v[i] -v[i+1] | <= PP_THR1 ) { i_eq_cnt++; } */
i_eq_cnt = 0;
int i;
for( i =0; i < 9; i++ )
{
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 )
+ {
return( (i_eq_cnt >= PP_THR2 ) ? 1 : 0 );
}
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 )
- 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];
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];
-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;
int i_QP )
{
int d, i_delta;
{
b_neg = 1;
a3x0 = -a3x0;
{
b_neg = 1;
a3x0 = -a3x0;
if( a3x2 < 0) a3x2 = -a3x2; /* abs( a3x2 ) */
a3x0_ = PP_MIN3( a3x0, a3x1, a3x2 );
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;
d = 5 *( a3x0 - a3x0_ ) / 8; /* always > 0 */
i_delta = ( i_v[4] - i_v[5] ) / 2;
-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_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];
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];
v[i] = p_v[i]; /* save 8 pix that will be modified */
}
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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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]
/*---------------------------------------------------------------------------*/
/*****************************************************************************/
/*---------------------------------------------------------------------------*/
/*****************************************************************************/
-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;
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;
int i_QP_scale; /* use to do ( ? >> i_QP_scale ) */
int i_QP;
int i_QP_scale; /* use to do ( ? >> i_QP_scale ) */
int i_QP;
i_QP_scale = b_chroma ? 5 : 4 ;
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++ )
{
p_v = p_plane + ( y - 5 )* i_stride;
for( x = 0; x < i_width; x++ )
/*---------------------------------------------------------------------------*/
/*****************************************************************************/
/*---------------------------------------------------------------------------*/
/*****************************************************************************/
-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;
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;
int i_QP_scale;
int i_QP;
int i_QP_scale;
int i_QP;
i_QP_scale = b_chroma ? 5 : 4 ;
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;
{
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 */
{
/* p_v point 5 pix before a block boundary */
/* XXX QP is for v5 */
*
*****************************************************************************/
*
*****************************************************************************/
-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;
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];
for( y = 0; y < 8; y++ )
{
if( i_min > p_block[0] ) i_min = p_block[0];
#endif
p_block += i_stride;
}
#endif
p_block += i_stride;
}
*pi_min = i_min;
*pi_max = i_max;
}
*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 )
for( y = 0; y < 10; y++ )
{
for( y = 0; y < 10; y++ )
{
-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_flt[8][8];
int i_f;
int i_flt[8][8];
int i_f;
p_sav = p_block;
i_QP_2 = i_QP >> 1;
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++ )
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 */
if( i_bin&0x02 ) /* 0x02 since 10 index but want 1-9 */
{
/* apply dering */
i_f = p_block[x - i_stride - 1] +
( p_block[x - i_stride ] << 1)+
p_block[x - i_stride + 1] +
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 - 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];
p_block[x + i_stride - 1] +
( p_block[x + i_stride ] << 1 ) +
p_block[x + i_stride + 1];
i_flt[y][x] = p_block[x];
}
i_bin >>= 1;
i_flt[y][x] = p_block[x];
}
i_bin >>= 1;
/*---------------------------------------------------------------------------*/
/*****************************************************************************/
/*---------------------------------------------------------------------------*/
/*****************************************************************************/
-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 )
{
int i_width, int i_height, int i_stride,
QT_STORE_T *p_QP_store, int i_QP_stride )
{
int i_max[4], i_min[4], i_range[4];
int i_thr[4];
int i_max_range, i_kmax;
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];
/* We process 4 blocks/loop*/
for( y = 8; y < i_height-8; y += 16 )
{
/* We process 4 blocks/loop*/
for( y = 8; y < i_height-8; y += 16 )
{
i_thr[2], i_bin[2] );
pp_dering_BinIndex( p_block[3] - i_stride - 1, i_stride,
i_thr[3], i_bin[3] );
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)] );
/* 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)] );
pp_dering_Filter( p_block[3], i_stride,
i_bin[3], p_QP[i_QP_stride+1] );
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;
}
}
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;
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 )
{
for( y = 8; y < i_height-8; y += 8 )
{
pp_dering_BinIndex( p_block - i_stride -1, i_stride,
i_thr,
i_bin );
pp_dering_BinIndex( p_block - i_stride -1, i_stride,
i_thr,
i_bin );
/* 3: adaptive smoothing */
pp_dering_Filter( p_block, i_stride,
/* 3: adaptive smoothing */
pp_dering_Filter( p_block, i_stride,
p_QP_store[(y>>5)*i_QP_stride+ (x>>5)]);
p_block += 8;
}
}
p_QP_store[(y>>5)*i_QP_stride+ (x>>5)]);
p_block += 8;
}
}
* postprocessing_mmx.c: Post Processing library in MMX
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* 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 <fenrir@via.ecp.fr>
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
****************************************************************************/
static inline int pp_deblock_isDC_mode( u8 *p_v )
{
****************************************************************************/
static inline int pp_deblock_isDC_mode( u8 *p_v )
{
/* algo :
x = v[i] - v[i+1] without signed saturation
/* algo :
x = v[i] - v[i+1] without signed saturation
* postprocessing_mmxext.c: Post Processing plugin MMXEXT
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* 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 <fenrir@via.ecp.fr>
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
****************************************************************************/
static inline int pp_deblock_isDC_mode( u8 *p_v )
{
****************************************************************************/
static inline int pp_deblock_isDC_mode( u8 *p_v )
{
* video.c: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* 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 <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
* 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.
* 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
* 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
return( VLC_FOURCC('I','4','2','0') );
case PIX_FMT_RGB24:
return( VLC_FOURCC('R','V','2','4') );
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:
case PIX_FMT_YUV422P:
return( VLC_FOURCC('I','4','2','2') );
case PIX_FMT_YUV444P:
AVCodecContext *p_context )
{
vout_thread_t *p_vout;
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 )
{
if( !i_width || !i_height )
{
it's buggy and very slow */
}
#if LIBAVCODEC_BUILD >= 4640
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;
}
{
i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height;
}
case( FF_ASPECT_16_9_625 ):
case( FF_ASPECT_16_9_525 ):
i_aspect = VOUT_ASPECT_FACTOR * 16 / 9 ;
case( FF_ASPECT_16_9_625 ):
case( FF_ASPECT_16_9_525 ):
i_aspect = VOUT_ASPECT_FACTOR * 16 / 9 ;
case( FF_ASPECT_SQUARE ):
default:
case( FF_ASPECT_SQUARE ):
default:
- i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height;
+ i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height;
}
/* FIXME FIXME FIXME this is a big shit
}
/* 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
*/
or said to me how write a better thing
FIXME FIXME FIXME
*/
vdec_thread_t *p_vdec )
#endif
{
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;
int i_plane;
int i_stride, i_lines;
p_vdec->p_fifo->p_vlc->pf_memcpy( p_dst, p_src, 2*i_stride );
}
/* copy to p_pic, by block
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++ )
{
temporaries buffers */
for( i_plane = 1; i_plane < 3; i_plane++ )
{
p_src = p_plane[i_plane];
p_dst = p_pic->p[i_plane].p_pixels;
p_src = p_plane[i_plane];
p_dst = p_pic->p[i_plane].p_pixels;
/*****************************************************************************
* InitThread: initialize vdec output thread
*****************************************************************************
/*****************************************************************************
* 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
* flag are not modified inside this function.
*
* ffmpeg codec will be open, some memory allocated. But Vout is not yet
p_vdec->p_format = NULL;
}
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" );
/* ***** Get configuration of ffmpeg plugin ***** */
#if LIBAVCODEC_BUILD >= 4611
i_tmp = config_GetInt( p_vdec->p_fifo, "ffmpeg-workaround-bugs" );
p_vdec->p_context->flags |= CODEC_FLAG_TRUNCATED;
}
#endif
p_vdec->p_context->flags |= CODEC_FLAG_TRUNCATED;
}
#endif
/* ***** Open the codec ***** */
if( avcodec_open(p_vdec->p_context, p_vdec->p_codec) < 0 )
{
/* ***** Open the codec ***** */
if( avcodec_open(p_vdec->p_context, p_vdec->p_codec) < 0 )
{
}
/* ***** init this codec with special data ***** */
}
/* ***** 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;
p_vdec->p_format->biSize > sizeof(BITMAPINFOHEADER) )
{
int b_gotpicture;
switch( p_vdec->i_codec_id )
{
case( CODEC_ID_MPEG4 ):
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
&b_gotpicture,
(void *)&p_vdec->p_format[1],
p_vdec->p_format->biSize
/* ***** Load post processing ***** */
/* get overridding settings */
/* ***** Load post processing ***** */
/* get overridding settings */
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 = 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 )
{
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;
"no suitable postprocessing module" );
vlc_object_destroy( p_vdec->p_pp );
p_vdec->p_pp = NULL;
else
{
/* get mode upon quality */
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;
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;
"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;
}
"Post processing unsupported for this codec" );
break;
}
- /* 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 );
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 );
p_vdec->i_frame_count = 0;
}
}
p_vdec->i_frame_count = 0;
}
}
if( p_pes->i_pts )
{
p_vdec->pts = p_pes->i_pts;
if( p_pes->i_pts )
{
p_vdec->pts = p_pes->i_pts;
{
uint8_t *p_last;
int i_need;
{
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 */
* 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;
if( p_vdec->i_buffer_size < i_need)
{
p_last = p_vdec->p_buffer;
- 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 );
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 );
input_DeletePES( p_vdec->p_fifo->p_packets_mgt, p_pes );
} while( i_frame_size <= 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 )
i_used, i_frame_size, b_gotpicture ? "got":"no got" );
#endif
if( i_used < 0 )
else if( i_used < i_frame_size )
{
#if 0
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 );
"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;
}
p_vdec->i_buffer = i_frame_size - i_used;
}
else
{
p_vdec->i_buffer = 0;
}
if( b_gotpicture )
{
p_vdec->i_frame_count++;
}
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 */
/* 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++;
}
{
p_vdec->i_frame_late++;
}
}
/* Do post-processing if requested */
}
/* 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
- 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;
/* fix date calculation */
if( p_vdec->pts > 0 )
{
i_pts = p_vdec->pts;
if( p_vdec->p_context->frame_rate > 0 )
{
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;
( p_vdec->i_frame_count - 1) /
FRAME_RATE_BASE /
p_vdec->p_context->frame_rate;
i_pts = mdate() + DEFAULT_PTS_DELAY; // FIXME
}
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 );
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 */
if( i_frame_size > 0 )
{
goto usenextdata; /* try to use all data */
* picture_t structure (when not in direct rendering mode).
*****************************************************************************/
#if LIBAVCODEC_BUILD >= 4641
* 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
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
{
AVPicture *p_ff_pic,
vdec_thread_t *p_vdec )
#endif
{
- u8 *p_dst;
- u8 *p_src;
+ uint8_t *p_dst;
+ uint8_t *p_src;
int i_src_stride;
int i_dst_stride;
int i_src_stride;
int i_dst_stride;
case( PIX_FMT_YUV410P ):
ffmpeg_ConvertPictureI410toI420( p_pic, p_ff_pic, p_vdec );
break;
case( PIX_FMT_YUV410P ):
ffmpeg_ConvertPictureI410toI420( p_pic, p_ff_pic, p_vdec );
break;
default:
p_vdec->p_fifo->b_error = 1;
break;
default:
p_vdec->p_fifo->b_error = 1;
break;
static void ffmpeg_PostProcPicture( vdec_thread_t *p_vdec, picture_t *p_pic )
{
if( ( p_vdec->i_pp_mode )&&
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' ) )||
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
VLC_FOURCC( 'Y','V','1','2' ) ) ) )
{
#if LIBAVCODEC_BUILD >= 4641
* (used for direct rendering)
*****************************************************************************/
* (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;
AVVideoFrame *p_ff_pic )
{
vdec_thread_t *p_vdec = (vdec_thread_t *)p_context->opaque;
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->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;
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;
-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;
AVVideoFrame *p_ff_pic )
{
vdec_thread_t *p_vdec = (vdec_thread_t *)p_context->opaque;
/* 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. */
/* 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;
{
i_wanted = p_dec->bit_stream.p_data->p_payload_end
- p_dec->bit_stream.p_data->p_payload_start;
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];
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;
- int i_channels = (p_pcm->channels == 2) ?
+ unsigned int i_channels = (p_pcm->channels == 2) ?
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT :
AOUT_CHAN_CENTER;
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT :
AOUT_CHAN_CENTER;
* decoder.c: MPEG audio decoder thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* 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 <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
{
/* Create the output fifo if it doesn't exist yet */
if( ( p_dec->p_aout_input == NULL ) ||
{
/* 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 ) )
( sync_info.b_stereo ? AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT :
AOUT_CHAN_CENTER ) ) ||
( p_dec->output_format.i_rate != sync_info.sample_rate ) )
* mpeg_adec.h : audio decoder thread interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* 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 <maxx@via.ecp.fr>
*
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
*****************************************************************************/
typedef struct adec_thread_s
{
*****************************************************************************/
typedef struct adec_thread_s
{
* Sync Information
*/
int i_sync;
* Sync Information
*/
int i_sync;
/*
* Decoder properties
*/
/*
* Decoder properties
*/
- u32 header;
- int frame_size;
+ uint32_t header;
+ unsigned int frame_size;
adec_bank_t bank_0;
adec_bank_t bank_1;
adec_bank_t bank_0;
adec_bank_t bank_1;
* generic.c: MPEG audio decoder
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* 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 <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
int adec_DecodeFrame( adec_thread_t * p_adec, float * buffer )
{
int adec_DecodeFrame( adec_thread_t * p_adec, float * buffer )
{
- int i_total_bytes_read;
+ unsigned int i_total_bytes_read;
* audio_decoder.h : audio decoder interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* 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 <maxx@via.ecp.fr>
*
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
* 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.
* 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
* 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
typedef struct audiodec_s audiodec_t;
typedef struct adec_sync_info_s {
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
} adec_sync_info_t;
typedef struct adec_bank_s
float v2[512];
float * actual;
int pos;
float v2[512];
float * actual;
int pos;
* parse.c: SPU parser
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* 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 <sam@zoy.org>
*
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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.
* 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
* 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
subpicture_t * p_spu )
{
/* Our current index in the SPU packet */
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 */
/* 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;
/* Command and date */
uint8_t i_command = SPU_CMD_END;
mtime_t date = 0;
+ unsigned int i, pi_alpha[4];
/* Initialize the structure */
p_spu->i_start = p_spu->i_stop = 0;
/* Initialize the structure */
p_spu->i_start = p_spu->i_stop = 0;
{
/* Get the control sequence date */
date = GetBits( &p_spudec->bit_stream, 16 );
{
/* 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 );
/* Next offset */
i_cur_seq = i_index;
i_next_seq = GetBits( &p_spudec->bit_stream, 16 );
/* Skip what we just read */
i_index += 4;
}
/* Skip what we just read */
i_index += 4;
}
i_command = GetBits( &p_spudec->bit_stream, 8 );
i_index++;
i_command = GetBits( &p_spudec->bit_stream, 8 );
i_index++;
switch( i_command )
{
case SPU_CMD_FORCE_DISPLAY: /* 00 (force displaying) */
switch( i_command )
{
case SPU_CMD_FORCE_DISPLAY: /* 00 (force displaying) */
* spudec.h : sub picture unit decoder thread interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* 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 <sam@zoy.org>
*
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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.
* 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
* 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
/* Cropping properties */
vlc_mutex_t lock;
vlc_bool_t b_crop;
/* 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;
};
/*****************************************************************************
};
/*****************************************************************************
*****************************************************************************/
typedef struct subtitler_font_s
{
*****************************************************************************/
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;
/*****************************************************************************
} subtitler_font_t;
/*****************************************************************************
/*
* Private properties
*/
/*
* 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 */
};
/*****************************************************************************
};
/*****************************************************************************
* 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.
* 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
* 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
/*****************************************************************************
* Local prototypes
*****************************************************************************/
/*****************************************************************************
* 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 * );
uint16_t * );
static void DestroySPU ( subpicture_t * );
* 1 byte : font height in rows
*
* then, per character:
* 1 byte : font height in rows
*
* then, per character:
* 1 byte : character width in pixels
*
* then, per row:
* 1 byte : length of row, in entries
* 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
* then, per entry
* 1 byte : colour
* 1 byte : number of pixels of that colour
{
subtitler_font_t * p_font;
{
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 );
msg_Dbg( p_vout, "loading font '%s'", psz_name );
if( read( i_file, pi_buffer, 1 ) != 1 )
{
msg_Err( p_vout, "unexpected end of font file '%s'", psz_name );
if( read( i_file, pi_buffer, 1 ) != 1 )
{
msg_Err( p_vout, "unexpected end of font file '%s'", psz_name );
close( i_file );
return( NULL );
}
close( i_file );
return( NULL );
}
i_total_length += i_length;
/* Read line RLE data */
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 );
{
msg_Err( p_vout, "unexpected end of font file '%s'", psz_name);
E_(subtitler_UnloadFont)( p_vout, p_font );
/* Set total memory size of character */
p_font->i_memory[ i_char ] = i_total_length;
/* Set total memory size of character */
p_font->i_memory[ i_char ] = i_total_length;
/*****************************************************************************
* subtitler_UnloadFont: unload a run-length encoded font file from memory
*****************************************************************************/
/*****************************************************************************
* 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 )
{
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" );
msg_Dbg( p_vout, "unloading font" );
- 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;
while( *p_char != '\n' && *p_char != 0 )
{
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 )
{
if( i_width > p_vout->output.i_width )
{
no characters are lost */
if( *p_char != '\n' && *p_char != 0 )
{
no characters are lost */
if( *p_char != '\n' && *p_char != 0 )
{
i_lines++;
i_width = 0;
for( i_x = 0; i_x < strlen( p_line->p_text ); i_x++ )
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 ];
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 ];
p_spu->i_start = i_start;
p_spu->i_stop = i_stop;
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? */
p_spu->b_ephemer = i_stop ? VLC_FALSE : VLC_TRUE;
/* FIXME: Do we need these two? */
p_spu->p_sys->b_crop = VLC_FALSE;
p_spu->i_x = (p_vout->output.i_width - i_longest_width) / 2;
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;
p_spu->i_width = i_longest_width;
p_spu->i_height = p_font->i_height*i_lines;
* PlotSubtitleLine: plot a single line of a subtitle
*****************************************************************************/
static uint16_t * PlotSubtitleLine ( char *psz_line, subtitler_font_t *p_font,
* 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;
- memcpy(p_data, p_rle, i_length * sizeof(uint16_t) );
+ memcpy(p_data, p_rle, i_length * sizeof(uint16_t) );
/* Pad line to fit box */
if( i_line_width < i_total_width )
{
/* Pad line to fit box */
if( i_line_width < i_total_width )
{
* text.c: text subtitles parser
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* 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 <gbazin@netcourrier.com>
*
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
/* Check validity of packet data */
if( (p_spudec->bit_stream.p_data->p_payload_end
/* 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 );
{
/* Dump the packet */
NextDataPacket( p_spudec->p_fifo, &p_spudec->bit_stream );
* rc.c : remote control stdin/stdout plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* 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 <shurdeek@panorama.sth.ac.at>
*
*
* Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
*
!strcmp( psz_cmd, "chapter_n" ) ||
!strcmp( psz_cmd, "chapter_p" ) )
{
!strcmp( psz_cmd, "chapter_n" ) ||
!strcmp( psz_cmd, "chapter_p" ) )
{
+ unsigned int i_chapter = 0;
if( !strcmp( psz_cmd, "chapter" ) )
{
if( !strcmp( psz_cmd, "chapter" ) )
{
!strcmp( psz_cmd, "title_n" ) ||
!strcmp( psz_cmd, "title_p" ) )
{
!strcmp( psz_cmd, "title_n" ) ||
!strcmp( psz_cmd, "title_p" ) )
{
+ unsigned int i_title = 0;
if( !strcmp( psz_cmd, "title" ) )
{
if( !strcmp( psz_cmd, "title" ) )
{
* asf.c : ASFv01 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* 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 <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 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
* 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
return( (p_buff[0]) + ( p_buff[1] <<8 ) );
}
static uint32_t GetDWLE( 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 ) );
}
return( p_buff[0] + ( p_buff[1] <<8 ) +
( p_buff[2] <<16 ) + ( p_buff[3] <<24 ) );
}
* Activate: check file and initializes ASF structures
*****************************************************************************/
static int Activate( vlc_object_t * p_this )
* 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;
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;
demux_sys_t *p_demux;
int i_stream;
/* Initialize access plug-in structures. */
if( p_input->i_mtu == 0 )
{
/* Initialize access plug-in structures. */
if( p_input->i_mtu == 0 )
{
}
/* create our structure that will contains all data */
}
/* 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" );
p_demux = malloc( sizeof( demux_sys_t ) ) ) )
{
msg_Err( p_input, "out of memory" );
msg_Warn( p_input, "ASF v1.0 plugin discarded (not a valid file)" );
return( -1 );
}
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 ) ) )
{
if( !( p_demux->p_fp = ASF_FindObject( p_demux->root.p_hdr,
&asf_object_file_properties_guid, 0 ) ) )
{
msg_Warn( p_input, "ASF v1.0 plugin discarded (missing file_properties object)" );
return( -1 );
}
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 );
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 );
msg_Warn( p_input, "ASF v1.0 plugin discarded (invalid file_properties object)" );
return( -1 );
}
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 )
{
&asf_object_stream_properties_guid );
if( !p_demux->i_streams )
{
{
asf_stream_t *p_stream;
asf_object_stream_properties_t *p_sp;
{
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_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 );
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 );
input_AddES( p_input,
p_input->stream.p_selected_program,
p_sp->i_stream_number,
input_AddES( p_input,
p_input->stream.p_selected_program,
p_sp->i_stream_number,
p_stream->i_cat = AUDIO_ES;
msg_Dbg( p_input,
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 ):
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 ):
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 ):
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 ):
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 ):
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:
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;
VLC_FOURCC( 'm','s',(i_codec >> 8)&0xff,i_codec&0xff );
}
if( p_sp->i_type_specific_data_length > 0 )
{
WAVEFORMATEX *p_wf;
i_size = p_sp->i_type_specific_data_length;
p_wf = malloc( i_size );
i_size = p_sp->i_type_specific_data_length;
p_wf = malloc( i_size );
i_size - sizeof( WAVEFORMATEX ) );
}
}
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,
}
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 )
{
p_sp->i_stream_number );
if( p_sp->p_type_specific_data )
{
- 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;
VLC_FOURCC( 'u','n','d','f' );
}
if( p_sp->i_type_specific_data_length > 11 )
{
BITMAPINFOHEADER *p_bih;
uint8_t *p_data;
i_size = p_sp->i_type_specific_data_length - 11;
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 = 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 );
p_bih->biSize = GetDWLE( p_data );
p_bih->biWidth = GetDWLE( p_data + 4 );
p_bih->biHeight = GetDWLE( p_data + 8 );
else
{
p_stream->i_cat = UNKNOWN_ES;
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' );
}
p_sp->i_stream_number );
p_stream->p_es->i_fourcc = VLC_FOURCC( 'u','n','d','f' );
}
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
}
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 )
p_demux->i_data_begin = p_demux->root.p_data->i_object_pos + 50;
if( p_demux->root.p_data->i_object_size != 0 )
mtime_t i_length;
/* real number of packets */
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 */
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 )
(mtime_t)p_demux->p_fp->i_data_packets_count /
(mtime_t)1000000;
if( i_length > 0 )
p_input->stream.p_selected_program->b_is_ok = 1;
vlc_mutex_unlock( &p_input->stream.stream_lock );
p_input->stream.p_selected_program->b_is_ok = 1;
vlc_mutex_unlock( &p_input->stream.stream_lock );
return( 0 );
}
/*****************************************************************************
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 ) \
*****************************************************************************/
#define GETVALUE2b( bits, var, def ) \
switch( (bits)&0x03 ) \
off_t i_offset;
msleep( DEFAULT_PTS_DELAY );
i_offset = ASF_TellAbsolute( p_input ) - p_demux->i_data_begin;
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 */
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 );
i_offset % p_demux->p_fp->i_min_data_packet_size;
ASF_SeekAbsolute( p_input, p_demux->i_data_begin + i_offset );
int i_data_packet_min = p_demux->p_fp->i_min_data_packet_size;
uint8_t *p_peek;
int i_skip;
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;
int i_packet_size_left;
int i_packet_flags;
int i_packet_property;
int i_packet_length;
int i_packet_sequence;
int i_packet_padding_length;
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;
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 ?
if( input_Peek( p_input, &p_peek, i_data_packet_min ) < i_data_packet_min )
{
// EOF ?
return( 0 );
}
i_skip = 0;
return( 0 );
}
i_skip = 0;
/* *** parse error correction if present *** */
if( p_peek[0]&0x80 )
{
/* *** parse error correction if present *** */
if( p_peek[0]&0x80 )
{
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
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 )
if( i_error_correction_length_type != 0x00 ||
i_opaque_data_present != 0 ||
i_error_correction_data_length != 0x02 )
i_packet_flags = p_peek[i_skip]; i_skip++;
i_packet_property = p_peek[i_skip]; i_skip++;
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 */
b_packet_multiple_payload = i_packet_flags&0x01;
/* read some value */
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_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;
// 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;
if( b_packet_multiple_payload )
{
i_payload_count = p_peek[i_skip] & 0x3f;
mtime_t i_pts;
mtime_t i_pts_delta;
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;
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 );
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;
if( i_replicated_data_length > 1 ) // should be at least 8 bytes
{
i_pts = (mtime_t)GetDWLE( p_peek + i_skip + 4 ) * 1000;
- i_payload_data_length = i_packet_length -
+ i_payload_data_length = i_packet_length -
i_packet_padding_length - i_skip;
}
i_packet_padding_length - i_skip;
}
"payload(%d/%d) stream_number:%d media_object_number:%d media_object_offset:%d replicated_data_length:%d payload_data_length %d",
"payload(%d/%d) stream_number:%d media_object_number:%d media_object_offset:%d replicated_data_length:%d payload_data_length %d",
i_payload_count,
i_stream_number,
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] ) )
{
i_payload_data_length );
#endif
if( !( p_stream = p_demux->stream[i_stream_number] ) )
{
"undeclared stream[Id 0x%x]", i_stream_number );
i_skip += i_payload_data_length;
continue; // over payload
"undeclared stream[Id 0x%x]", i_stream_number );
i_skip += i_payload_data_length;
continue; // over payload
- 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;
i_payload_data_pos += i_sub_payload_data_length )
{
data_packet_t *p_data;
if( !p_stream->p_pes ) // add a new PES
{
if( !p_stream->p_pes ) // add a new PES
{
( (mtime_t)i_pts + i_payload * (mtime_t)i_pts_delta );
if( p_demux->i_first_pts == -1 )
( (mtime_t)i_pts + i_payload * (mtime_t)i_pts_delta );
if( p_demux->i_first_pts == -1 )
p_stream->i_time -= p_demux->i_first_pts;
p_stream->p_pes = input_NewPES( p_input->p_method_data );
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 );
p_input->stream.p_selected_program,
( p_stream->i_time+DEFAULT_PTS_DELAY) * 9 /100 );
p_data->p_payload_start += i_skip;
i_packet_size_left -= i_read;
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;
if( !p_stream->p_pes->p_first )
{
p_stream->p_pes->p_first = p_stream->p_pes->p_last = p_data;
if( i_packet_size_left > 0 )
{
if( !ASF_SkipBytes( p_input, i_packet_size_left ) )
if( i_packet_size_left > 0 )
{
if( !ASF_SkipBytes( p_input, i_packet_size_left ) )
{
/* 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;
{
/* 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 );
}
/* first wait for the good time to read next packets */
input_ClockManageRef( p_input,
p_input->stream.p_selected_program,
p_demux->i_pcr );
}
* MP4End: frees unused data
*****************************************************************************/
static void Deactivate( vlc_object_t * p_this )
* MP4End: frees unused data
*****************************************************************************/
static void Deactivate( vlc_object_t * p_this )
- 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;
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++ )
msg_Dbg( p_input, "Freeing all memory" );
ASF_FreeObjectRoot( p_input, &p_demux->root );
for( i_stream = 0; i_stream < 128; i_stream++ )
/*****************************************************************************
/*****************************************************************************
*****************************************************************************
* Copyright (C) 2001 VideoLAN
*****************************************************************************
* 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 <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 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
* 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
#define FREE( p ) \
if( p ) {free( p ); p = NULL; }
#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, \
#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, \
* Some basic functions to manipulate stream more easily in vlc
*
* ASF_TellAbsolute get file position
* 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
* ASF_SeekAbsolute seek in the file
*
* ASF_ReadData read data from the file in a buffer
off_t ASF_TellAbsolute( input_thread_t *p_input )
{
off_t i_pos;
off_t ASF_TellAbsolute( input_thread_t *p_input )
{
off_t i_pos;
vlc_mutex_lock( &p_input->stream.stream_lock );
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 );
i_pos= p_input->stream.p_selected_area->i_tell;
// - ( p_input->p_last_data - p_input->p_current_data );
int ASF_SeekAbsolute( input_thread_t *p_input,
off_t i_pos)
{
int ASF_SeekAbsolute( input_thread_t *p_input,
off_t i_pos)
{
}
if( p_input->stream.b_seekable &&
}
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 );
i_pos - i_filepos > 10000 ) )
{
p_input->pf_seek( p_input, i_pos );
data_packet_t *p_data;
int i_read;
data_packet_t *p_data;
int i_read;
input_SplitBuffer(p_input, &p_data, __MIN( i_size, 1024 ) );
if( i_read <= 0 )
{
input_SplitBuffer(p_input, &p_data, __MIN( i_size, 1024 ) );
if( i_read <= 0 )
{
}
input_DeletePacket( p_input->p_method_data, p_data );
i_size -= i_read;
}
input_DeletePacket( p_input->p_method_data, p_data );
i_size -= i_read;
} while( i_size > 0 );
}
return( 1 );
} while( i_size > 0 );
}
return( 1 );
if( !i_size )
{
return( 1 );
if( !i_size )
{
return( 1 );
}
memcpy( p_buff, p_data->p_payload_start, i_read );
input_DeletePacket( p_input->p_method_data, p_data );
}
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;
p_buff += i_read;
i_size -= i_read;
return( 1 );
}
int ASF_SkipBytes( input_thread_t *p_input, int i_count )
{
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 ) );
}
/****************************************************************************/
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;
asf_object_t *p_obj )
{
asf_object_common_t *p_common = (asf_object_common_t*)p_obj;
- 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;
p_common->i_object_size = GetQWLE( p_peek + 16 );
p_common->i_object_pos = ASF_TellAbsolute( p_input );
p_common->p_next = NULL;
GUID_PRINT( p_common->i_object_id ),
p_common->i_object_size );
#endif
GUID_PRINT( p_common->i_object_id ),
p_common->i_object_size );
#endif
}
int ASF_NextObject( input_thread_t *p_input,
}
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 <
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 );
}
}
/* 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 ) );
}
p_obj->common.i_object_pos + p_obj->common.i_object_size ) );
}
asf_object_t *p_subobj;
int i_peek;
uint8_t *p_peek;
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 );
if( ( i_peek = input_Peek( p_input, &p_peek, 30 ) ) < 30 )
{
return( 0 );
if( !( ASF_ReadObject( p_input, p_subobj, (asf_object_t*)p_hdr ) ) )
{
if( !( ASF_ReadObject( p_input, p_subobj, (asf_object_t*)p_hdr ) ) )
{
}
if( !ASF_NextObject( p_input, p_subobj ) ) /* Go to the next object */
{
}
if( !ASF_NextObject( p_input, p_subobj ) ) /* Go to the next object */
{
asf_object_data_t *p_data = (asf_object_data_t*)p_obj;
int i_peek;
uint8_t *p_peek;
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 );
if( ( i_peek = input_Peek( p_input, &p_peek, 50 ) ) < 50 )
{
return( 0 );
asf_object_index_t *p_index = (asf_object_index_t*)p_obj;
int i_peek;
uint8_t *p_peek;
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 );
if( ( i_peek = input_Peek( p_input, &p_peek, 56 ) ) < 56 )
{
return( 0 );
asf_object_file_properties_t *p_fp = (asf_object_file_properties_t*)p_obj;
int i_peek;
uint8_t *p_peek;
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 );
if( ( i_peek = input_Peek( p_input, &p_peek, 92) ) < 92 )
{
return( 0 );
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 );
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
#ifdef ASF_DEBUG
msg_Dbg( p_input,
"Read \"File Properties Object\" file_id:" GUID_FMT
asf_object_header_extention_t *p_he = (asf_object_header_extention_t*)p_obj;
int i_peek;
uint8_t *p_peek;
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 );
if( ( i_peek = input_Peek( p_input, &p_peek, p_he->i_object_size ) ) < 46)
{
return( 0 );
GUID_PRINT( p_he->i_reserved1 ),
p_he->i_reserved2,
p_he->i_header_extention_size );
GUID_PRINT( p_he->i_reserved1 ),
p_he->i_reserved2,
p_he->i_header_extention_size );
return( 1 );
}
void ASF_FreeObject_header_extention( input_thread_t *p_input,
return( 1 );
}
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 )
{
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;
(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 );
if( ( i_peek = input_Peek( p_input, &p_peek, p_sp->i_object_size ) ) < 74 )
{
return( 0 );
void ASF_FreeObject_stream_properties( input_thread_t *p_input,
asf_object_t *p_obj )
{
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 );
(asf_object_stream_properties_t*)p_obj;
FREE( p_sp->p_type_specific_data );
int i_peek;
uint8_t *p_peek, *p_data;
int i_peek;
uint8_t *p_peek, *p_data;
+ unsigned int i_codec;
+
if( ( i_peek = input_Peek( p_input, &p_peek, p_cl->i_object_size ) ) < 44 )
{
return( 0 );
if( ( i_peek = input_Peek( p_input, &p_peek, p_cl->i_object_size ) ) < 44 )
{
return( 0 );
}
codec.psz_description[i_len] = '\0';
p_data += 2 * i_len;
}
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 )
/* opaque information */
codec.i_information_length = GetWLE( p_data ); p_data += 2;
if( codec.i_information_length > 0 )
"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" ),
"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 );
codec.i_information_length );
asf_object_t *p_obj )
{
asf_object_codec_list_t *p_cl = (asf_object_codec_list_t*)p_obj;
asf_object_t *p_obj )
{
asf_object_codec_list_t *p_cl = (asf_object_codec_list_t*)p_obj;
for( i_codec = 0; i_codec < p_cl->i_codec_entries_count; i_codec++ )
{
for( i_codec = 0; i_codec < p_cl->i_codec_entries_count; i_codec++ )
{
int ASF_ReadObject_content_description( input_thread_t *p_input,
asf_object_t *p_obj )
{
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;
(asf_object_content_description_t*)p_obj;
int i_peek;
uint8_t *p_peek, *p_data;
int i_copyright;
int i_description;
int i_rating;
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++ ) \
#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++ ) \
} \
psz_str[i_size/2] = '\0'; \
p_data += i_size;
} \
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 );
if( ( i_peek = input_Peek( p_input, &p_peek, p_cd->i_object_size ) ) < 34 )
{
return( 0 );
p_cd->psz_copyright,
p_cd->psz_description,
p_cd->psz_rating );
p_cd->psz_copyright,
p_cd->psz_description,
p_cd->psz_rating );
asf_object_t *p_obj )
{
asf_object_content_description_t *p_cd = (asf_object_content_description_t*)p_obj;
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 );
FREE( p_cd->psz_title );
FREE( p_cd->psz_author );
FREE( p_cd->psz_copyright );
{
const guid_t *p_id;
int i_type;
{
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 );
asf_object_t *p_obj );
void (*ASF_FreeObject_function)( input_thread_t *p_input,
asf_object_t *p_obj );
p_obj->common.p_first = NULL;
p_obj->common.p_next = NULL;
p_obj->common.p_last = NULL;
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 )
{
if( p_obj->common.i_object_size < 24 )
{
else
{
/* XXX ASF_ReadObject_function realloc *pp_obj XXX */
else
{
/* XXX ASF_ReadObject_function realloc *pp_obj XXX */
(ASF_Object_Function[i_index].ASF_ReadObject_function)( p_input,
p_obj );
}
(ASF_Object_Function[i_index].ASF_ReadObject_function)( p_input,
p_obj );
}
/* link this object with father */
if( p_father )
{
/* link this object with father */
if( p_father )
{
{
int i_index;
asf_object_t *p_child;
{
int i_index;
asf_object_t *p_child;
/* Free all child object */
p_child = p_obj->common.p_first;
while( p_child )
/* Free all child object */
p_child = p_obj->common.p_first;
while( p_child )
/* Now free this object */
if( ASF_Object_Function[i_index].ASF_FreeObject_function == NULL )
{
/* Now free this object */
if( ASF_Object_Function[i_index].ASF_FreeObject_function == NULL )
{
"Unknown asf object " GUID_FMT,
GUID_PRINT( p_obj->common.i_object_id ) );
}
else
{
#ifdef ASF_DEBUG
"Unknown asf object " GUID_FMT,
GUID_PRINT( p_obj->common.i_object_id ) );
}
else
{
#ifdef ASF_DEBUG
"Free asf object " GUID_FMT,
GUID_PRINT( p_obj->common.i_object_id ) );
#endif
"Free asf object " GUID_FMT,
GUID_PRINT( p_obj->common.i_object_id ) );
#endif
p_root->p_hdr = NULL;
p_root->p_data = NULL;
p_root->p_index = NULL;
p_root->p_hdr = NULL;
p_root->p_data = NULL;
p_root->p_index = NULL;
for( ; ; )
{
p_obj = malloc( sizeof( asf_object_t ) );
for( ; ; )
{
p_obj = malloc( sizeof( asf_object_t ) );
asf_object_root_t *p_root )
{
asf_object_t *p_obj;
asf_object_root_t *p_root )
{
asf_object_t *p_obj;
p_obj = p_root->p_first;
while( p_obj )
{
p_obj = p_root->p_first;
while( p_obj )
{
p_root->p_hdr = NULL;
p_root->p_data = NULL;
p_root->p_index = NULL;
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 )
}
int __ASF_CountObject( asf_object_t *p_obj, const guid_t *p_guid )
/*****************************************************************************
/*****************************************************************************
*****************************************************************************
* Copyright (C) 2001 VideoLAN
*****************************************************************************
* 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 <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 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
* 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
{ 0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00 }
};
{ 0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00 }
};
-static const guid_t asf_object_header_guid =
+static const guid_t asf_object_header_guid =
{ 0xA6,0xD9, 0x00,0xAA,0x00,0x62,0xCE,0x6C }
};
{ 0xA6,0xD9, 0x00,0xAA,0x00,0x62,0xCE,0x6C }
};
-static const guid_t asf_object_data_guid =
+static const guid_t asf_object_data_guid =
{ 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }
};
{ 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,
{
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 =
};
static const guid_t asf_object_codec_list_guid =
int i_payload_size;
u8 *p_payload_data;
int i_payload_size;
u8 *p_payload_data;
} asf_packet_t;
#endif
#define ASF_OBJECT_COMMON \
int i_type; \
guid_t i_object_id; \
} 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; \
union asf_object_u *p_father; \
union asf_object_u *p_first; \
union asf_object_u *p_last; \
} asf_index_entry_t;
/****************************************************************************
} 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 */
****************************************************************************/
/* This is the first header find in a asf file
* It's the only object that have subobject */
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 */
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
} asf_object_header_t;
typedef struct asf_object_data_s
guid_t i_file_id;
uint64_t i_total_data_packets;
uint16_t i_reserved;
guid_t i_file_id;
uint64_t i_total_data_packets;
uint16_t i_reserved;
uint64_t i_index_entry_time_interval;
uint32_t i_max_packet_count;
uint32_t i_index_entry_count;
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;
asf_index_entry_t *index_entry;
} asf_object_index_t;
typedef struct asf_object_root_s
{
ASF_OBJECT_COMMON
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;
asf_object_header_t *p_hdr;
asf_object_data_t *p_data;
asf_object_index_t *p_index;
typedef struct asf_object_file_properties_s
{
ASF_OBJECT_COMMON
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;
guid_t i_file_id;
uint64_t i_file_size;
uint64_t i_creation_date;
uint32_t i_min_data_packet_size;
uint32_t i_max_data_packet_size;
uint32_t i_max_bitrate;
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
} asf_object_file_properties_t;
#define ASF_STREAM_PROPERTIES_ENCRYPTED 0x8000
uint16_t i_type;
char *psz_name;
char *psz_description;
uint16_t i_type;
char *psz_name;
char *psz_description;
uint16_t i_information_length;
uint8_t *p_information;
} asf_codec_entry_t;
uint16_t i_information_length;
uint8_t *p_information;
} asf_codec_entry_t;
ASF_OBJECT_COMMON
guid_t i_reserved;
uint32_t i_codec_entries_count;
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;
} asf_object_codec_list_t;
} asf_object_script_command_t;
#endif
typedef struct asf_marker_s
} asf_object_script_command_t;
#endif
typedef struct asf_marker_s
uint32_t i_marker_description_length;
uint8_t *i_marker_description;
/* u8 padding */
uint32_t i_marker_description_length;
uint8_t *i_marker_description;
/* u8 padding */
} asf_marker_t;
typedef struct asf_object_marker_s
} asf_marker_t;
typedef struct asf_object_marker_s
asf_object_root_t root;
asf_object_file_properties_t file_properties;
asf_object_stream_properties_t stream_properties;
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_codec_list_t codec_list;
asf_object_marker_t marker;
void GetGUID( guid_t *p_guid, uint8_t *p_data );
int CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 );
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,
int ASF_ReadObjectCommon( input_thread_t *p_input,
asf_object_t *p_obj );
int ASF_NextObject( input_thread_t *p_input,
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* 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 <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 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
* 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
vlc_module_begin();
add_category_hint( "demuxer", NULL );
add_bool( "avi-interleaved", 0, NULL,
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 interleaved method" );
add_bool( "avi-index", 0, NULL,
- "force index creation",
+ "force index creation",
"force index creation" );
set_description( "avi demuxer" );
"force index creation" );
set_description( "avi demuxer" );
vlc_module_end();
/*****************************************************************************
vlc_module_end();
/*****************************************************************************
- * Some useful functions to manipulate memory
+ * Some useful functions to manipulate memory
*****************************************************************************/
static uint16_t GetWLE( uint8_t *p_buff )
*****************************************************************************/
static uint16_t GetWLE( uint8_t *p_buff )
#define __ABS( x ) ( (x) < 0 ? (-(x)) : (x) )
/* read data in a pes */
#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;
{
pes_packet_t *p_pes;
data_packet_t *p_data;
if( !(p_pes = input_NewPES( p_input->p_method_data ) ) )
{
pp_pes = NULL;
if( !(p_pes = input_NewPES( p_input->p_method_data ) ) )
{
pp_pes = NULL;
- 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;
}
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;
p_pes->i_nb_data = 0;
p_pes->i_pes_size = 0;
- 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;
}
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;
if( !p_pes->p_first )
{
p_pes->p_first = p_data;
p_pes->p_last = p_data;
p_pes->i_nb_data++;
p_pes->i_pes_size += i_read;
p_pes->p_last = p_data;
p_pes->i_nb_data++;
p_pes->i_pes_size += i_read;
return p_pes->i_pes_size;
return p_pes->i_pes_size;
* framenumber ? 5bits
* piture type 0(I),1(P) 2bits
*/
* 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;
{
/* it's not an msmpegv1 stream, strange...*/
return AVIIF_KEYFRAME;
-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 )
case WAVE_FORMAT_WMA2:
return VLC_FOURCC( 'w', 'm', 'a', '2' );
default:
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:
( 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:
switch( i_codec )
{
case FOURCC_DIV1:
static int AVI_PacketGetHeader( input_thread_t *p_input, avi_packet_t *p_pk )
{
uint8_t *p_peek;
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;
if( input_Peek( p_input, &p_peek, 16 ) < 16 )
{
return VLC_EGENERIC;
memcpy( p_pk->i_peek, p_peek + 8, 8 );
AVI_ParseStreamHeader( p_pk->i_fourcc, &p_pk->i_stream, &p_pk->i_cat );
memcpy( p_pk->i_peek, p_peek + 8, 8 );
AVI_ParseStreamHeader( p_pk->i_fourcc, &p_pk->i_stream, &p_pk->i_cat );
avi_packet_t *p_pk,
pes_packet_t **pp_pes )
{
avi_packet_t *p_pk,
pes_packet_t **pp_pes )
{
vlc_bool_t b_pad;
i_size = __EVEN( p_pk->i_size + 8 );
b_pad = ( i_size != p_pk->i_size + 8 );
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 )
{
p_info->i_idxmax = 16384;
p_info->i_idxnb = 0;
{
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;
sizeof( AVIIndexEntry_t ) ) ) )
{
return;
{
p_info->i_idxmax += 16384;
if( !( p_info->p_index = realloc( (void*)p_info->p_index,
{
p_info->i_idxmax += 16384;
if( !( p_info->p_index = realloc( (void*)p_info->p_index,
sizeof( AVIIndexEntry_t ) ) ) )
{
return;
sizeof( AVIIndexEntry_t ) ) ) )
{
return;
/* calculate cumulate length */
if( p_info->i_idxnb > 0 )
{
/* 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;
}
p_info->p_index[p_info->i_idxnb - 1].i_length +
p_info->p_index[p_info->i_idxnb - 1].i_lengthtotal;
}
-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],
AVIIndexEntry_t *p_index)
{
__AVI_AddEntryIndex( p_avi->pp_info[i_stream],
static void AVI_IndexLoad( input_thread_t *p_input )
{
demux_sys_t *p_avi = p_input->p_demux_data;
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;
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;
-
- p_riff = (avi_chunk_list_t*)AVI_ChunkFind( &p_avi->ck_root,
+
+ p_riff = (avi_chunk_list_t*)AVI_ChunkFind( &p_avi->ck_root,
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);
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);
p_avi->pp_info[i_stream]->p_index = NULL;
}
/* *** calculate offset *** */
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;
p_idx1->entry[0].i_pos < p_movi->i_chunk_pos )
{
i_offset = p_movi->i_chunk_pos + 8;
for( i_index = 0; i_index < p_idx1->i_entry_count; i_index++ )
{
for( i_index = 0; i_index < p_idx1->i_entry_count; i_index++ )
{
AVI_ParseStreamHeader( p_idx1->entry[i_index].i_fourcc,
&i_stream,
&i_cat );
AVI_ParseStreamHeader( p_idx1->entry[i_index].i_fourcc,
&i_stream,
&i_cat );
{
AVIIndexEntry_t index;
index.i_id = p_idx1->entry[i_index].i_fourcc;
{
AVIIndexEntry_t index;
index.i_id = p_idx1->entry[i_index].i_fourcc;
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;
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;
}
for( i_stream = 0; i_stream < p_avi->i_streams; i_stream++ )
{
}
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 );
}
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;
}
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;
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);
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" );
if( !p_movi )
{
msg_Err( p_input, "cannot find p_movi" );
p_avi->pp_info[i_stream]->i_idxmax = 0;
p_avi->pp_info[i_stream]->p_index = NULL;
}
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);
p_input->stream.p_selected_area->i_size );
AVI_SeekAbsolute( p_input, p_movi->i_chunk_pos + 12);
for( ;; )
{
avi_packet_t pk;
for( ;; )
{
avi_packet_t pk;
if( AVI_PacketGetHeader( p_input, &pk ) )
{
break;
if( AVI_PacketGetHeader( p_input, &pk ) )
{
break;
{
AVIIndexEntry_t index;
index.i_id = pk.i_fourcc;
{
AVIIndexEntry_t index;
index.i_id = pk.i_fourcc;
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;
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;
print_stat:
for( i_stream = 0; i_stream < p_avi->i_streams; i_stream++ )
{
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 );
}
i_stream,
p_avi->pp_info[i_stream]->i_idxnb );
}
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 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]
demux_sys_t *p_avi, int i_stream )
{
#define p_stream p_avi->pp_info[i_stream]
msg_Warn( p_input, "stream[%d] already selected", i_stream );
return VLC_TRUE;
}
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 );
if( !p_stream->p_es->p_decoder_fifo )
{
vlc_mutex_lock( &p_input->stream.stream_lock );
msg_Warn( p_input, "stream[%d] already unselected", i_stream );
return;
}
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 );
if( p_stream->p_es->p_decoder_fifo )
{
vlc_mutex_lock( &p_input->stream.stream_lock );
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
p_stream->b_activated = VLC_FALSE;
#undef p_stream
p_stream->b_activated = VLC_FALSE;
#undef p_stream
****************************************************************************/
static mtime_t AVI_MovieGetLength( input_thread_t *p_input, demux_sys_t *p_avi )
{
****************************************************************************/
static mtime_t AVI_MovieGetLength( input_thread_t *p_input, demux_sys_t *p_avi )
{
i_maxlength = 0;
for( i_stream = 0; i_stream < p_avi->i_streams; i_stream++ )
{
i_maxlength = 0;
for( i_stream = 0; i_stream < p_avi->i_streams; i_stream++ )
{
if( p_stream->i_samplesize )
{
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 /
p_stream->p_index[p_stream->i_idxnb-1].i_length ) /
(mtime_t)p_stream->i_scale /
(mtime_t)p_stream->i_rate /
(mtime_t)p_stream->i_rate;
}
(mtime_t)p_stream->i_rate;
}
"stream[%d] length:"I64Fd" (based on index)",
i_stream,
i_length );
i_maxlength = __MAX( i_maxlength, i_length );
"stream[%d] length:"I64Fd" (based on index)",
i_stream,
i_length );
i_maxlength = __MAX( i_maxlength, i_length );
* AVIEnd: frees unused data
*****************************************************************************/
static void __AVIEnd ( vlc_object_t * p_this )
* AVIEnd: frees unused data
*****************************************************************************/
static void __AVIEnd ( vlc_object_t * p_this )
input_thread_t * p_input = (input_thread_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 )
{
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 );
}
{
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 );
}
}
free( p_avi->pp_info );
* AVIInit: check file and initializes AVI structures
*****************************************************************************/
static int AVIInit( 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;
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;
avi_chunk_avih_t *p_avih;
demux_sys_t *p_avi;
es_descriptor_t *p_es = NULL; /* avoid warning */
avi_chunk_avih_t *p_avih;
demux_sys_t *p_avi;
es_descriptor_t *p_es = NULL; /* avoid warning */
#ifdef __AVI_SUBTITLE__
mtime_t i_microsecperframe = 0; // for some subtitle format
#endif
#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 ) )
p_input->pf_demux = AVIDemux_Seekable;
if( AVI_TestFile( p_input ) )
p_input->i_bufsize = INPUT_DEFAULT_BUFSIZE;
}
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" );
p_avi = malloc( sizeof(demux_sys_t) ) ) )
{
msg_Err( p_input, "out of memory" );
{
p_input->pf_demux = AVIDemux_UnSeekable;
}
{
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)" );
if( AVI_ChunkReadRoot( p_input, &p_avi->ck_root, p_avi->b_seekable ) )
{
msg_Err( p_input, "avi module discarded (invalid file)" );
AVI_ChunkDumpDebug( p_input, &p_avi->ck_root );
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 );
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,
AVIFOURCC_movi, 0 );
#if 0
p_INFO = (avi_chunk_list_t*)AVI_ChunkFind( p_riff,
AVIFOURCC_INAM, 0 );
if( p_name )
{
AVIFOURCC_INAM, 0 );
if( p_name )
{
msg_Err( p_input, "avi module discarded (invalid file)" );
return VLC_EGENERIC;
}
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" );
AVIFOURCC_avih, 0 ) ) )
{
msg_Err( p_input, "cannot find avih chunk" );
p_avi->i_streams = AVI_ChunkCount( p_hdrl, AVIFOURCC_strl );
if( p_avih->i_streams != p_avi->i_streams )
{
p_avi->i_streams = AVI_ChunkCount( p_hdrl, AVIFOURCC_strl );
if( p_avih->i_streams != p_avi->i_streams )
{
"found %d stream but %d are declared",
p_avi->i_streams,
p_avih->i_streams );
"found %d stream but %d are declared",
p_avi->i_streams,
p_avih->i_streams );
return VLC_EGENERIC;
}
p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
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 */
/* 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":"",
p_avi->i_streams,
p_avih->i_flags&AVIF_HASINDEX?" HAS_INDEX":"",
p_avih->i_flags&AVIF_MUSTUSEINDEX?" MUST_USE_INDEX":"",
p_avih->i_flags&AVIF_TRUSTCKTYPE?" TRUST_CKTYPE":"" );
/* now read info on each stream and create ES */
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* ) );
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++ )
sizeof( avi_stream_t* ) * p_avi->i_streams );
for( i = 0 ; i < p_avi->i_streams; i++ )
void *p_init_data;
#define p_info p_avi->pp_info[i]
p_info = malloc( sizeof(avi_stream_t ) );
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,
- 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 );
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;
}
( !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;
/* *** Init p_info *** */
p_info->i_rate = p_avi_strh->i_rate;
p_info->i_scale = p_avi_strh->i_scale;
{
case( AVIFOURCC_auds ):
p_info->i_cat = AUDIO_ES;
{
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;
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;
p_avi_strf_auds->p_wf->nSamplesPerSec,
p_avi_strf_auds->p_wf->wBitsPerSample );
break;
p_avi_strf_auds->p_wf->nSamplesPerSec,
p_avi_strf_auds->p_wf->wBitsPerSample );
break;
case( AVIFOURCC_vids ):
p_info->i_cat = VIDEO_ES;
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;
who is doing something wrong */
p_info->i_samplesize = 0;
p_info->i_fourcc = p_avi_strf_vids->p_bih->biCompression;
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;
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;
p_input->stream.p_selected_program, 1+i,
i_init_size );
vlc_mutex_unlock( &p_input->stream.stream_lock );
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 )
{
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 );
}
p_init_data,
i_init_size );
}
}
#ifdef __AVI_SUBTITLE__
}
#ifdef __AVI_SUBTITLE__
{
AVI_IndexLoad( p_input );
}
{
AVI_IndexLoad( p_input );
}
/* *** movie length in sec *** */
#if 0
/* *** 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 /
msg_Warn( p_input, "broken or missing index, 'seek' will be axproximative or will have strange behavour" );
}
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 );
- 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;
}
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;
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]
for( i = 0; i < p_avi->i_streams; i++ )
{
#define p_info p_avi->pp_info[i]
{
b_stream_video = AVI_StreamStart( p_input, p_avi, i );
}
break;
case( AUDIO_ES ):
{
b_stream_video = AVI_StreamStart( p_input, p_avi, i );
}
break;
case( AUDIO_ES ):
{
b_stream_audio = AVI_StreamStart( p_input, p_avi, i );
}
{
b_stream_audio = AVI_StreamStart( p_input, p_avi, i );
}
{
msg_Warn( p_input, "no video stream found" );
}
{
msg_Warn( p_input, "no video stream found" );
}
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 );
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 );
if( p_avi->b_seekable )
{
AVI_ChunkGoto( p_input, p_movi );
* Function to convert pts to chunk or byte
*****************************************************************************/
* 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 *
mtime_t i_pts )
{
return (mtime_t)((int64_t)i_pts *
static inline mtime_t AVI_PTSToByte( avi_stream_t *p_info,
mtime_t i_pts )
{
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 /
(int64_t)p_info->i_samplesize *
(int64_t)p_info->i_rate /
(int64_t)p_info->i_scale /
static mtime_t AVI_GetPTS( avi_stream_t *p_info )
{
static mtime_t AVI_GetPTS( avi_stream_t *p_info )
{
if( p_info->i_samplesize )
{
/* we need a valid entry we will emulate one */
if( p_info->i_samplesize )
{
/* we need a valid entry we will emulate one */
- i_len = p_info->i_idxposb;
+ i_len = p_info->i_idxposb;
/* no valid entry use only offset*/
}
}
/* no valid entry use only offset*/
}
}
}
static int AVI_StreamChunkFind( input_thread_t *p_input,
}
static int AVI_StreamChunkFind( input_thread_t *p_input,
+ unsigned int i_stream )
{
demux_sys_t *p_avi = p_input->p_demux_data;
avi_packet_t avi_pk;
{
demux_sys_t *p_avi = p_input->p_demux_data;
avi_packet_t avi_pk;
{
/* add this chunk to the index */
AVIIndexEntry_t index;
{
/* add this chunk to the index */
AVIIndexEntry_t index;
index.i_id = avi_pk.i_fourcc;
index.i_id = avi_pk.i_fourcc;
AVI_GetKeyFlag(p_avi->pp_info[avi_pk.i_stream]->i_codec,
avi_pk.i_peek);
index.i_pos = avi_pk.i_pos;
AVI_GetKeyFlag(p_avi->pp_info[avi_pk.i_stream]->i_codec,
avi_pk.i_peek);
index.i_pos = avi_pk.i_pos;
if( AVI_PacketNext( p_input ) )
{
return VLC_EGENERIC;
if( AVI_PacketNext( p_input ) )
{
return VLC_EGENERIC;
/* be sure that i_ck will be a valid index entry */
static int AVI_SetStreamChunk( 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];
{
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;
p_stream->i_idxposc = i_ck;
p_stream->i_idxposb = 0;
/* XXX FIXME up to now, we assume that all chunk are one after one */
/* 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 )
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 */
p_stream->p_index[p_stream->i_idxnb - 1].i_length ) )
{
/* index is valid to find the ck */
- 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 ;
p_stream->p_index[i_idxposc].i_length <= i_byte)
{
i_idxmin = i_idxposc ;
else
{
p_stream->i_idxposc = i_idxposc;
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;
}
}
}
p_stream->p_index[i_idxposc].i_lengthtotal;
return VLC_SUCCESS;
}
}
}
static int AVI_StreamSeek( input_thread_t *p_input,
demux_sys_t *p_avi,
static int AVI_StreamSeek( input_thread_t *p_input,
demux_sys_t *p_avi,
mtime_t i_date )
{
#define p_stream p_avi->pp_info[i_stream]
mtime_t i_oldpts;
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_oldpts = AVI_GetPTS( p_stream );
if( !p_stream->i_samplesize )
{
if( AVI_SetStreamChunk( p_input,
AVI_PTSToChunk( p_stream, i_date ) ) )
{
return VLC_EGENERIC;
}
AVI_PTSToChunk( p_stream, i_date ) ) )
{
return VLC_EGENERIC;
}
"old:"I64Fd" %s new "I64Fd,
"old:"I64Fd" %s new "I64Fd,
i_oldpts > i_date ? ">" : "<",
i_date );
if( i_date < 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,
AVIIF_KEYFRAME ) )
{
if( AVI_SetStreamChunk( p_input,
!( p_stream->p_index[p_stream->i_idxposc].i_flags &
AVIIF_KEYFRAME ) )
{
!( 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;
p_stream->i_idxposc + 1 ) )
{
return VLC_EGENERIC;
*****************************************************************************
* Returns -1 in case of error, 0 in case of EOF, 1 otherwise
*****************************************************************************/
*****************************************************************************
* 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;
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 );
i_date / 1000000,
i_percent );
uint64_t i_pos;
/* use i_percent to create a true i_date */
uint64_t i_pos;
/* use i_percent to create a true i_date */
"mmh, seeking without index at %d%%"
" work only for interleaved file", i_percent );
"mmh, seeking without index at %d%%"
" work only for interleaved file", i_percent );
return( -1 );
}
i_percent = __MAX( i_percent, 0 );
return( -1 );
}
i_percent = __MAX( i_percent, 0 );
/* try to find chunk that is at i_percent or the file */
/* 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 */
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];
i_stream < p_avi->i_streams; i_stream++ )
{
p_stream = p_avi->pp_info[i_stream];
msg_Err( p_input, "cannot find any selected stream" );
return( -1 );
}
msg_Err( p_input, "cannot find any selected stream" );
return( -1 );
}
/* be sure that the index exit */
/* 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 );
}
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 */
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" );
i_stream, p_stream->i_idxposc + 1 ) )
{
msg_Err( p_input, "cannot seek" );
// if( p_stream->b_activated )
{
AVI_StreamSeek( p_input, p_avi, i_stream, i_date );
// 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 ),
* Returns -1 in case of error, 0 in case of EOF, 1 otherwise
*****************************************************************************/
typedef struct avi_stream_toread_s
* 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;
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 )
{
// 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 )
{
vlc_bool_t b_stream;
// cannot be more than 100 stream (dcXX or wbXX)
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;
demux_sys_t *p_avi = p_input->p_demux_data;
{
AVI_StreamStop( p_input, p_avi, i_stream );
}
{
AVI_StreamStop( p_input, p_avi, i_stream );
}
(mtime_t)p_avi->i_length *
(mtime_t)AVI_TellAbsolute( p_input ) /
(mtime_t)p_input->stream.p_selected_area->i_size;
(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 );
p_input->stream.p_selected_area->i_size;
// input_ClockInit( p_input->stream.p_selected_program );
/* 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,
/* 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_time += 100*1000; /* read 100ms */
p_avi->i_time += 100*1000; /* read 100ms */
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 )
{
p_stream->p_index[p_stream->i_idxposc].i_pos;
if( p_stream->i_idxposb > 0 )
{
toread[i_stream].i_posf = -1;
}
toread[i_stream].i_posf = -1;
}
if( p_stream->i_samplesize )
{
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
__ABS( i_dpts ) );
}
else
toread[i_stream].i_toread = AVI_PTSToChunk( p_stream,
__ABS( i_dpts ) );
}
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
}
if( i_dpts < 0 )
{
toread[i_stream].i_toread *= -1;
}
#undef p_stream
}
for( ;; )
{
#define p_stream p_avi->pp_info[i_stream]
vlc_bool_t b_done;
pes_packet_t *p_pes;
off_t i_pos;
for( ;; )
{
#define p_stream p_avi->pp_info[i_stream]
vlc_bool_t b_done;
pes_packet_t *p_pes;
off_t i_pos;
+ 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++ )
{
/* search for first chunk to be read */
for( i = 0, b_done = VLC_TRUE, i_pos = -1; i < p_avi->i_streams; i++ )
{
// return( b_stream ? 1 : 0 );
return( 1 );
}
// return( b_stream ? 1 : 0 );
return( 1 );
}
if( i_pos == -1 )
{
/* no valid index, we will parse directly the stream */
if( i_pos == -1 )
{
/* no valid index, we will parse directly the stream */
{
/* add this chunk to the index */
AVIIndexEntry_t index;
{
/* add this chunk to the index */
AVIIndexEntry_t index;
index.i_id = avi_pk.i_fourcc;
index.i_id = avi_pk.i_fourcc;
AVI_GetKeyFlag(p_avi->pp_info[avi_pk.i_stream]->i_codec,
avi_pk.i_peek);
index.i_pos = avi_pk.i_pos;
AVI_GetKeyFlag(p_avi->pp_info[avi_pk.i_stream]->i_codec,
avi_pk.i_peek);
index.i_pos = avi_pk.i_pos;
/* read thoses data */
if( p_stream->i_samplesize )
{
/* 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 );
p_stream->i_idxposb,
100 * 1024 ); // 10Ko max
// toread[i_stream].i_toread );
}
p_pes->i_pts = AVI_GetPTS( p_stream );
}
p_pes->i_pts = AVI_GetPTS( p_stream );
/* read data */
if( p_stream->i_samplesize )
{
/* read data */
if( p_stream->i_samplesize )
{
}
toread[i_stream].i_toread -= i_size;
p_stream->i_idxposb += i_size;
}
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;
p_stream->p_index[p_stream->i_idxposc].i_length )
{
p_stream->i_idxposb = 0;
- 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;
}
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;
}
}
b_stream = VLC_TRUE; // at least one read succeed
}
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 =
if( p_stream->p_es && p_stream->p_es->p_decoder_fifo )
{
p_pes->i_dts =
input_ClockGetTS( p_input,
p_input->stream.p_selected_program,
p_pes->i_pts * 9/100);
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
input_DecodePES( p_stream->p_es->p_decoder_fifo, p_pes );
}
else
demux_sys_t *p_avi = p_input->p_demux_data;
avi_stream_t *p_stream_master;
vlc_bool_t b_audio;
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;
/* *** 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 *** */
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]
i_stream < p_avi->i_streams; i_stream++ )
{
#define p_stream p_avi->pp_info[i_stream]
}
p_avi->i_pcr = AVI_GetPTS( p_stream_master ) * 9 / 100;
}
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]
for( i_packet = 0; i_packet < 10; i_packet++)
{
#define p_stream p_avi->pp_info[avi_pk.i_stream]
case AVIFOURCC_idx1:
return( 0 ); // eof
default:
case AVIFOURCC_idx1:
return( 0 ); // eof
default:
"seems to have lost position, resync" );
if( AVI_PacketSearch( p_input ) )
{
"seems to have lost position, resync" );
if( AVI_PacketSearch( p_input ) )
{
/* do will send this packet to decoder ? */
if( ( !b_audio && avi_pk.i_cat == AUDIO_ES )||
!p_stream->p_es ||
/* do will send this packet to decoder ? */
if( ( !b_audio && avi_pk.i_cat == AUDIO_ES )||
!p_stream->p_es ||
else
{
/* it's a selected stream, check for time */
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 */
AVI_GetPTS( p_stream_master ) )< 600*1000 )
{
/* load it and send to decoder */
- 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 );
}
AVI_GetPTS( p_stream ) * 9/100);
input_DecodePES( p_stream->p_es->p_decoder_fifo, p_pes );
}
* avi.h : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* 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 <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 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
* 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
off_t i_pos;
uint32_t i_size;
vlc_fourcc_t i_type; // only for AVIFOURCC_LIST
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
uint8_t i_peek[8]; //first 8 bytes
- int i_stream;
- int i_cat;
+ unsigned int i_stream;
+ unsigned int i_cat;
{
vlc_bool_t b_activated;
{
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;
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;
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 */
{
mtime_t i_time;
mtime_t i_length;
{
mtime_t i_time;
mtime_t i_length;
vlc_bool_t b_seekable;
avi_chunk_t ck_root;
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 */
off_t i_movi_begin;
off_t i_movi_lastchunk_pos; /* XXX position of last valid chunk */
/* number of streams and information */
/* 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
#ifdef __AVI_SUBTITLE__
subtitle_demux_t *p_sub;
#endif
* libavi.c :
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* 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 <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
if( AVI_ChunkRead( p_input, p_chk, p_container, b_seekable ) ||
( AVI_TellAbsolute( 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;
__EVEN( p_chk->common.p_father->common.i_chunk_size ) ) )
{
break;
avi_chunk_t *p_chk,
vlc_bool_t b_seekable )
{
avi_chunk_t *p_chk,
vlc_bool_t b_seekable )
{
+ unsigned int i_count, i_index;
-static int AVI_ChunkFunctionFind( int i_fourcc )
+static int AVI_ChunkFunctionFind( vlc_fourcc_t i_fourcc )
for( i_index = 0; ; i_index++ )
{
if( ( AVI_Chunk_Function[i_index].i_fourcc == i_fourcc )||
for( i_index = 0; ; i_index++ )
{
if( ( AVI_Chunk_Function[i_index].i_fourcc == i_fourcc )||
if( AVI_ChunkRead( p_input, p_chk, p_root, b_seekable ) ||
( AVI_TellAbsolute( 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;
__EVEN( p_chk->common.p_father->common.i_chunk_size ) ) )
{
break;
* libavi.h : LibAVI library
******************************************************************************
* Copyright (C) 2001 VideoLAN
* 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 <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
typedef struct avi_chunk_idx1_s
{
AVI_CHUNK_COMMON
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;
idx1_entry_t *entry;
} avi_chunk_idx1_t;
* libmp4.c : LibMP4 library for mp4 module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* 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 <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
MP4_Box_t *p_box;
if( MP4_TellStream( p_stream ) + 8 >
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 );
{
/* there is no box to load */
return( 0 );
int MP4_ReadBoxContainer( 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 );
{
/* container is empty, 8 stand for the first header in this box */
return( 1 );
if( ( p_box->data.p_ftyp->i_compatible_brands_count = i_read / 4 ) )
{
if( ( p_box->data.p_ftyp->i_compatible_brands_count = i_read / 4 ) )
{
p_box->data.p_ftyp->i_compatible_brands =
calloc( p_box->data.p_ftyp->i_compatible_brands_count, sizeof(uint32_t));
p_box->data.p_ftyp->i_compatible_brands =
calloc( p_box->data.p_ftyp->i_compatible_brands_count, sizeof(uint32_t));
int MP4_ReadBox_mvhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_mvhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
#ifdef MP4_VERBOSE
char s_creation_time[128];
char s_modification_time[128];
#ifdef MP4_VERBOSE
char s_creation_time[128];
char s_modification_time[128];
int MP4_ReadBox_tkhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_tkhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
#ifdef MP4_VERBOSE
char s_creation_time[128];
char s_modification_time[128];
#ifdef MP4_VERBOSE
char s_creation_time[128];
char s_modification_time[128];
int MP4_ReadBox_tref( 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 );
{
/* container is empty, 8 stand for the first header in this box */
return( 1 );
int MP4_ReadBox_mdhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_mdhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
uint16_t i_language;
#ifdef MP4_VERBOSE
char s_creation_time[128];
uint16_t i_language;
#ifdef MP4_VERBOSE
char s_creation_time[128];
int MP4_ReadBox_vmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_vmhd( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_vmhd_t );
MP4_READBOX_ENTER( MP4_Box_data_vmhd_t );
int MP4_ReadBox_stts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_stts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_stts_t );
MP4_GETVERSIONFLAGS( p_box->data.p_stts );
MP4_READBOX_ENTER( MP4_Box_data_stts_t );
MP4_GETVERSIONFLAGS( p_box->data.p_stts );
int MP4_ReadBox_ctts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_ctts( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_ctts_t );
MP4_GETVERSIONFLAGS( p_box->data.p_ctts );
MP4_READBOX_ENTER( MP4_Box_data_ctts_t );
MP4_GETVERSIONFLAGS( p_box->data.p_ctts );
static int MP4_ReadLengthDescriptor( uint8_t **pp_peek, int64_t *i_read )
{
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;
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 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 );
MP4_READBOX_ENTER( MP4_Box_data_esds_t );
}
if( es_descriptor.b_url )
{
}
if( es_descriptor.b_url )
{
MP4_GET1BYTE( i_len );
es_descriptor.psz_URL = calloc( sizeof(char), i_len + 1 );
MP4_GET1BYTE( i_len );
es_descriptor.psz_URL = calloc( sizeof(char), i_len + 1 );
int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_sample_soun_t );
MP4_READBOX_ENTER( MP4_Box_data_sample_soun_t );
#if 0
int MP4_ReadBox_sample_mp4a( 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 )
{
MP4_READBOX_ENTER( MP4_Box_data_sample_mp4a_t );
MP4_READBOX_ENTER( MP4_Box_data_sample_mp4a_t );
int MP4_ReadBox_sample_vide( 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 )
{
MP4_READBOX_ENTER( MP4_Box_data_sample_vide_t );
MP4_READBOX_ENTER( MP4_Box_data_sample_vide_t );
int MP4_ReadBox_stsz( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_stsz( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_stsz_t );
MP4_READBOX_ENTER( MP4_Box_data_stsz_t );
int MP4_ReadBox_stsc( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_stsc( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_stsc_t );
MP4_READBOX_ENTER( MP4_Box_data_stsc_t );
int MP4_ReadBox_stco_co64( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_stco_co64( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_co64_t );
MP4_READBOX_ENTER( MP4_Box_data_co64_t );
int MP4_ReadBox_stss( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_stss( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_stss_t );
MP4_READBOX_ENTER( MP4_Box_data_stss_t );
int MP4_ReadBox_stsh( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_stsh( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_stsh_t );
MP4_READBOX_ENTER( MP4_Box_data_stsh_t );
int MP4_ReadBox_stdp( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_stdp( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_stdp_t );
MP4_READBOX_ENTER( MP4_Box_data_stdp_t );
int MP4_ReadBox_padb( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_padb( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_padb_t );
MP4_READBOX_ENTER( MP4_Box_data_padb_t );
int MP4_ReadBox_elst( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
int MP4_ReadBox_elst( MP4_Stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_padb_t );
MP4_READBOX_ENTER( MP4_Box_data_padb_t );
int MP4_ReadBox_cprt( MP4_Stream_t *p_stream, 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 );
MP4_READBOX_ENTER( MP4_Box_data_cprt_t );
int MP4_ReadBox( MP4_Stream_t *p_stream, MP4_Box_t *p_box, MP4_Box_t *p_father )
{
int i_result;
int MP4_ReadBox( MP4_Stream_t *p_stream, MP4_Box_t *p_box, MP4_Box_t *p_father )
{
int i_result;
if( !MP4_ReadBoxCommon( p_stream, p_box ) )
{
if( !MP4_ReadBoxCommon( p_stream, p_box ) )
{
*****************************************************************************/
int MP4_CountBox( MP4_Box_t *p_box, uint32_t i_type )
{
*****************************************************************************/
int MP4_CountBox( MP4_Box_t *p_box, uint32_t i_type )
{
MP4_Box_t *p_child;
if( !p_box )
MP4_Box_t *p_child;
if( !p_box )
*****************************************************************************/
void MP4_BoxFree( input_thread_t *p_input, MP4_Box_t *p_box )
{
*****************************************************************************/
void MP4_BoxFree( input_thread_t *p_input, MP4_Box_t *p_box )
{
MP4_Box_t *p_child;
MP4_Box_t *p_next;
MP4_Box_t *p_child;
MP4_Box_t *p_next;
static void __MP4_BoxDumpStructure( input_thread_t *p_input,
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 )
memset( str, (uint8_t)' ', 512 );
for( i = 0; i < i_level; i++ )
{
memset( str, (uint8_t)' ', 512 );
for( i = 0; i < i_level; i++ )
{
*****************************************************************************/
static void __get_token( char **ppsz_path, char **ppsz_token, int *pi_number )
{
*****************************************************************************/
static void __get_token( char **ppsz_path, char **ppsz_token, int *pi_number )
{
if( !*ppsz_path[0] )
{
*ppsz_token = NULL;
if( !*ppsz_path[0] )
{
*ppsz_token = NULL;
{
char *psz_path;
#if !defined(HAVE_VASPRINTF) || defined(SYS_DARWIN)
{
char *psz_path;
#if !defined(HAVE_VASPRINTF) || defined(SYS_DARWIN)
* mp4.c : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* 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 <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
MP4_Box_t *p_mvhd;
MP4_Box_t *p_trak;
MP4_Box_t *p_mvhd;
MP4_Box_t *p_trak;
/* I need to seek */
if( !p_input->stream.b_seekable )
{
/* I need to seek */
if( !p_input->stream.b_seekable )
{
static int MP4Demux( input_thread_t *p_input )
{
demux_sys_t *p_demux = p_input->p_demux_data;
static int MP4Demux( input_thread_t *p_input )
{
demux_sys_t *p_demux = p_input->p_demux_data;
/* XXX beurk, beuRK and BEURK,
but only way I've found to detect seek from interface */
/* XXX beurk, beuRK and BEURK,
but only way I've found to detect seek from interface */
static int MP4Seek ( input_thread_t *p_input, mtime_t i_date )
{
demux_sys_t *p_demux = p_input->p_demux_data;
static int MP4Seek ( input_thread_t *p_input, mtime_t i_date )
{
demux_sys_t *p_demux = p_input->p_demux_data;
/* First update update global time */
p_demux->i_time = i_date * p_demux->i_timescale / 1000000;
/* First update update global time */
p_demux->i_time = i_date * p_demux->i_timescale / 1000000;
* MP4End: frees unused data
*****************************************************************************/
static void __MP4End ( vlc_object_t * p_this )
* MP4End: frees unused data
*****************************************************************************/
static void __MP4End ( vlc_object_t * p_this )
- 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;
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++ )
{
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 )
i_chunk < p_demux->track[i_track].i_chunk_count; i_chunk++ )
{
if( p_demux->track[i_track].chunk )
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;
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;
+ unsigned int i_chunk_last;
MP4_Box_t *p_stss;
if( !p_track->b_ok ||
MP4_Box_t *p_stss;
if( !p_track->b_ok ||
/* *** Try to find nearest sync points *** */
if( ( p_stss = MP4_BoxGet( p_track->p_stbl, "stss" ) ) )
{
/* *** 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++ )
{
p_track->i_track_ID );
for( i_index = 0; i_index < p_stss->data.p_stss->i_entry_count; i_index++ )
{
track_data_mp4_t *p_demux_track,
MP4_Box_t * p_trak )
{
track_data_mp4_t *p_demux_track,
MP4_Box_t * p_trak )
{
MP4_Box_t *p_tkhd = MP4_BoxGet( p_trak, "tkhd" );
MP4_Box_t *p_tref = MP4_BoxGet( p_trak, "tref" );
MP4_Box_t *p_tkhd = MP4_BoxGet( p_trak, "tkhd" );
MP4_Box_t *p_tref = MP4_BoxGet( p_trak, "tref" );
MP4_Box_t *p_co64; /* give offset for each chunk, same for stco and co64 */
MP4_Box_t *p_stsc;
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" ) )&&
if( ( !(p_co64 = MP4_BoxGet( p_demux_track->p_stbl, "stco" ) )&&
static void MP4_StartDecoder( input_thread_t *p_input,
track_data_mp4_t *p_demux_track )
{
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;
uint8_t *p_init;
BITMAPINFOHEADER *p_bih;
track_data_mp4_t *p_demux_track,
pes_packet_t **pp_pes )
{
track_data_mp4_t *p_demux_track,
pes_packet_t **pp_pes )
{
off_t i_pos;
data_packet_t *p_data;
off_t i_pos;
data_packet_t *p_data;
* mp4.h : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* 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 <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 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
* 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
uint32_t i_avgbytespersec;
uint16_t i_blockalign;
uint16_t i_bitspersample;
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;
imediatly following this header. */
} waveformatex_t;
uint32_t i_sample_count; /* how many samples in this chunk */
uint32_t i_sample_first; /* index of the first sample in this chunk */
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 */
much memory and with fast acces */
/* with this we can calculate dts/pts without waste memory */
uint32_t *p_sample_count_dts;
uint32_t *p_sample_delta_dts; /* dts delta */
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 */
but quickly *add* support for edts and seeking */
/* display size only ! */
int i_width;
int i_height;
/* 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 */
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 */
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;
chunk_data_mp4_t *chunk; /* always defined for each chunk */
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;
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*/
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 */
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;
MP4_Box_t *p_sample; /* actual SampleEntry to make life simpler */
} track_data_mp4_t;
*****************************************************************************/
struct demux_sys_t
{
*****************************************************************************/
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;
-
- 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 */
track_data_mp4_t *track; /* array of track */
};
static inline uint64_t MP4_GetTrackPos( track_data_mp4_t *p_track )
{
};
static inline uint64_t MP4_GetTrackPos( track_data_mp4_t *p_track )
{
if( p_track->i_sample_size )
{
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
{
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];
i_sample < p_track->i_sample; i_sample++ )
{
i_pos += p_track->p_sample_size[i_sample];
/* Return time in µs of a track */
static inline mtime_t MP4_GetTrackPTS( 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;
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;
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;
{
if( i_sample > p_track->chunk[p_track->i_chunk].p_sample_count_dts[i_index] )
{
{
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
{
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
{
p_track->chunk[p_track->i_chunk].p_sample_delta_dts[i_index];
i_sample = 0;
break;
}
}
p_track->chunk[p_track->i_chunk].p_sample_delta_dts[i_index];
i_sample = 0;
break;
}
}
(mtime_t)p_track->i_timescale ) );
}
(mtime_t)p_track->i_timescale ) );
}
* ps.c : Program Stream input module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* 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 <massiot@via.ecp.fr>
*
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
else
{
/* (We have to do it ourselves) */
else
{
/* (We have to do it ourselves) */
/* FIXME: we should do multiple passes in case an audio type
* is not present */
/* FIXME: we should do multiple passes in case an audio type
* is not present */
* system.c: helper module for TS, PS and PES management
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* 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 <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
* 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.
* 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
* 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
static inline size_t MoveChunk( byte_t * p_dest, data_packet_t ** pp_data_src,
byte_t ** pp_src, size_t i_buf_len )
{
static inline size_t MoveChunk( byte_t * p_dest, data_packet_t ** pp_data_src,
byte_t ** pp_src, size_t i_buf_len )
{
- 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 );
{
if( p_dest != NULL )
memcpy( p_dest, *pp_src, i_buf_len );
- size_t i_init_len = i_buf_len;
+ size_t i_init_len = i_buf_len;
return( i_init_len - i_buf_len );
}
*pp_src = (*pp_data_src)->p_payload_start;
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 );
- 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) )
if ( p_es->i_pes_real_size &&
(p_es->i_pes_real_size != p_pes->i_pes_size) )
i_max_len = MoveChunk( p_full_header, &p_data, &p_byte, 12 );
if( i_max_len < 2 )
{
i_max_len = MoveChunk( p_full_header, &p_data, &p_byte, 12 );
if( i_max_len < 2 )
{
"PES packet too short to have a MPEG-2 header" );
input_DeletePES( p_input->p_method_data,
p_pes );
"PES packet too short to have a MPEG-2 header" );
input_DeletePES( p_input->p_method_data,
p_pes );
}
p_pes->i_rate = p_input->stream.control.i_rate;
p_pes->p_first = 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
/* 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
+ p_data->p_payload_start[5] + 6;
}
else
+ p_data->p_payload_start[5] + 6;
}
else
p_es->i_pes_real_size = 0;
p_es->i_pes_real_size = 0;
/* Size of the payload carried in the data packet */
p_pes->i_pes_size += (p_data->p_payload_end
- p_data->p_payload_start);
/* 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 )
{
/* We can check if the packet is finished */
if( p_pes->i_pes_size == p_es->i_pes_real_size )
{
(stream_ps_data_t *)p_input->stream.p_demux_data;
byte_t * p_byte;
byte_t * p_end;
(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 )
{
if( p_data->p_demux_start + 10 > p_data->p_payload_end )
{
while( p_byte + 4 <= p_end )
{
es_descriptor_t * p_es = NULL;
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) */
/* FIXME: there will be a problem with private streams... (same
* stream_id) */
- else if( i_error < SIZE ) \
+ else if( (size_t)i_error < SIZE ) \
{ \
/* EOF */ \
return( 0 ); \
{ \
/* EOF */ \
return( 0 ); \
static es_descriptor_t * ParsePS( input_thread_t * p_input,
data_packet_t * p_data )
{
static es_descriptor_t * ParsePS( input_thread_t * p_input,
data_packet_t * p_data )
{
es_descriptor_t * p_es = NULL;
i_code = p_data->p_demux_start[3];
if( i_code > 0xBC ) /* ES start 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 );
/* This is a PES packet. Find out if we want it or not. */
i_id = GetID( p_data );
DecodePSM( p_input, p_data );
b_trash = 1;
break;
DecodePSM( p_input, p_data );
b_trash = 1;
break;
case 0x1B9: /* PROGRAM_END_CODE */
b_trash = 1;
break;
case 0x1B9: /* PROGRAM_END_CODE */
b_trash = 1;
break;
default:
/* This should not happen */
b_trash = 1;
default:
/* This should not happen */
b_trash = 1;
/*
* TS Demultiplexing
*/
/*
* TS Demultiplexing
*/
static void DemuxTS( input_thread_t * p_input, data_packet_t * p_data,
psi_callback_t pf_psi_callback )
{
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 */
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 */
/* Find out the elementary stream. */
vlc_mutex_lock( &p_input->stream.stream_lock );
/* 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]->
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]->
p_es= input_FindES( p_input, i_pid );
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 != 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
{
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;
}
else if( p_es->p_decoder_fifo == NULL && !b_psi )
{
}
else if( p_es->p_decoder_fifo == NULL && !b_psi )
{
}
vlc_mutex_unlock( &p_input->stream.control.control_lock );
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
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 */
* may still be null. Who said it was ugly ?
* I have written worse. --Meuuh */
((p_es->p_decoder_fifo != NULL) || b_psi || b_pcr ) )
{
p_es->c_packets++;
((p_es->p_decoder_fifo != NULL) || b_psi || b_pcr ) )
{
p_es->c_packets++;
{
/* p[4] is adaptation_field_length minus one */
p_data->p_payload_start += 5 + p[4];
{
/* 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 */
/* The adaptation field can be limited to the
* adaptation_field_length byte, so that there is nothing to do:
* skip this possibility */
p_data->b_discard_payload = 1;
p_es->c_invalid_packets++;
}
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
/* Now we are sure that the byte containing flags is present:
* read it */
else
"discontinuity_indicator encountered by TS demux "
"(position read: %d, saved: %d)",
p[5] & 0x80, p_es_demux->i_continuity_counter );
"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;
/* 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;
}
/* 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 */
} /* valid TS adaptation field ? */
} /* length > 0 */
} /* has adaptation field */
} /* not continuous */
} /* continuity */
} /* if selected or PCR */
} /* not continuous */
} /* continuity */
} /* if selected or PCR */
/* Handle PCR */
if( b_pcr && b_adaptation && (p[5] & 0x10) && p[4]>=7 )
{
/* Handle PCR */
if( b_pcr && b_adaptation && (p[5] & 0x10) && p[4]>=7 )
{
( (mtime_t)p[9] << 1 ) |
( (mtime_t)p[10] >> 7 );
/* Call the pace control. */
( (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]->
i_dummy ++ )
{
if( ( ( pgrm_ts_data_t * ) p_input->stream.pp_programs[i_dummy]->
/* Trash the packet if it has no payload or if it isn't selected */
if( b_trash )
{
/* Trash the packet if it has no payload or if it isn't selected */
if( b_trash )
{
else
{
/* The payload carries a PES stream */
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 );
* mpeg_ts.c : Transport Stream input module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* 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 <henri@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr>
*
* Authors: Henri Fallon <henri@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr>
* 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.
* 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
* 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
#ifdef MODULE_NAME_IS_ts_dvbpsi
p_stream_data->p_pat_handle = (dvbpsi_handle *)
#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 )
{
if( p_stream_data->p_pat_handle == NULL )
{
/* 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. */
/* 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. */
p_demux_data->p_psi_section->b_is_complete = 1;
vlc_mutex_unlock( &p_input->stream.stream_lock );
p_demux_data->p_psi_section->b_is_complete = 1;
vlc_mutex_unlock( &p_input->stream.stream_lock );
/*****************************************************************************
* DemuxPSI : makes up complete PSI data
*****************************************************************************/
/*****************************************************************************
* 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;
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)
p_demux_data = (es_ts_data_t *)p_es->p_demux_data;
#define p_psi (p_demux_data->p_psi_section)
/* This is the begining of a new section */
/* 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;
}
{
msg_Warn( p_input, "invalid PSI packet" );
p_psi->b_trash = 1;
}
{
p_psi->i_section_length = ((p[1] & 0xF) << 8) | p[2];
p_psi->b_section_complete = 0;
{
p_psi->i_section_length = ((p[1] & 0xF) << 8) | p[2];
p_psi->b_section_complete = 0;
{
/* New Section of an already started PSI */
p_psi->b_section_complete = 0;
{
/* 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,
if( p_psi->i_version_number != (( p[5] >> 1 ) & 0x1f) )
{
msg_Warn( p_input,
if( !p_psi->b_trash )
{
/* read */
if( !p_psi->b_trash )
{
/* read */
( p_psi->i_section_length - p_psi->i_read_in_section ) )
{
/* The end of the section is in this TS packet */
( 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->i_section_length - p_psi->i_read_in_section) );
p_psi->b_section_complete = 1;
p_psi->b_section_complete = 1;
(p_psi->i_section_length - p_psi->i_read_in_section);
(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 */
if( p_psi->i_section_number == p_psi->i_last_section_number )
{
/* This was the last section of PSI */
input_DeletePacket( p_input->p_method_data, p_data );
input_DeletePacket( p_input->p_method_data, p_data );
pgrm_descriptor_t * p_pgrm;
es_descriptor_t * p_current_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;
int i_section_length, i_program_id, i_pmt_pid;
int i_loop, i_current_section;
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;
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
#define p_psi (p_demux_data->p_psi_section)
/* Not so fast, Mike ! If the PAT version has changed, we first check
i_section_length = ((u32)(p_current_data[1] & 0xF) << 8) |
p_current_data[2];
i_current_section = (u8)p_current_data[6];
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++ )
for( i_loop = 0;
( i_loop < (i_section_length - 9) / 4 ) && !b_changed;
i_loop++ )
p_current_data += 3 + i_section_length;
} while( ( i_current_section < p_psi->i_last_section_number )
p_current_data += 3 + i_section_length;
} while( ( i_current_section < p_psi->i_last_section_number )
- /* 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;
* 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 */
p_current_data = p_psi->buffer;
/* Delete all programs */
{
input_DelProgram( p_input, p_input->stream.pp_programs[0] );
}
{
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];
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 )
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 )
i_pmt_pid = ( ((u32)*(p_current_data + i_loop * 4 + 10) & 0x1F)
<< 8 )
| *(p_current_data + i_loop * 4 + 11);
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 */
/* 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 ) );
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;
/* 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;
/* 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;
}
}
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 );
p_current_data += 3 + i_section_length;
} while( i_current_section < p_psi->i_last_section_number );
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;
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)
#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;
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;
p_current_section = p_psi->buffer;
p_current_data = p_psi->buffer;
/* For the moment we ignore program descriptors */
p_current_data += 12 + i_prog_info_length;
/* 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 )
{
* p_current_section + i_section_length -1 */
while( p_current_data < p_current_section + i_section_length -1 )
{
*(p_current_data + 2);
i_es_info_length = ( ((u32)*(p_current_data + 3) & 0xF) << 8 ) |
*(p_current_data + 4);
*(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 */
/* 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 ) );
(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 )
* the required ones */
{
switch( i_stream_type )
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_data += 5 + i_es_info_length;
}
/* Go to the beginning of the next section*/
p_current_data += 3 + i_section_length;
} while( i_current_section < p_psi->i_last_section_number );
p_pgrm_data->i_pmt_version = p_psi->i_version_number;
} while( i_current_section < p_psi->i_last_section_number );
p_pgrm_data->i_pmt_version = p_psi->i_version_number;
else
p_input->pf_set_program( p_input, p_es->p_pgrm );
}
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 );
}
/* 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
/*
#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
*****************************************************************************/
*/
/*****************************************************************************
* 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;
vlc_bool_t b_unit_start )
{
es_ts_data_t * p_es_demux_data;
switch( p_es_demux_data->i_psi_type)
{
case PSI_IS_PAT:
switch( p_es_demux_data->i_psi_type)
{
case PSI_IS_PAT:
( 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_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_handle ) p_pgrm_demux_data->p_pmt_handle,
p_data->p_demux_start );
break;
default:
msg_Warn( p_input, "received unknown PSI in DemuxPSI" );
}
( 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
*****************************************************************************/
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;
{
dvbpsi_pat_program_t * p_pgrm;
pgrm_descriptor_t * p_new_pgrm;
stream_ts_data_t * p_stream_data;
vlc_mutex_lock( &p_input->stream.stream_lock );
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;
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 */
p_stream_data->i_pat_version == PAT_UNINITIALIZED )
{
/* Delete all programs */
{
input_DelProgram( p_input, p_input->stream.pp_programs[0] );
}
{
input_DelProgram( p_input, p_input->stream.pp_programs[0] );
}
/* treat the new programs list */
p_pgrm = p_new_pat->p_first_program;
/* 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 */
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;
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,
/* Add the PMT ES to this program */
p_current_es = input_AddES( p_input, p_new_pgrm,
(u16) p_pgrm->i_pid,
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 = (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 )
{
p_es_demux->p_psi_section = malloc( sizeof( psi_section_t ) );
if ( p_es_demux->p_psi_section == NULL )
{
p_input->b_error = 1;
return;
}
p_input->b_error = 1;
return;
}
p_es_demux->p_psi_section->b_is_complete = 0;
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,
/* 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 )
p_input );
if( p_pgrm_demux->p_pmt_handle == NULL )
- 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 );
p_stream_data->i_pat_version = p_new_pat->i_version;
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
/*****************************************************************************
* HandlePMT: will treat a PMT returned by dvbpsi
*****************************************************************************/
/*****************************************************************************
* 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" );
{
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 );
vlc_mutex_lock( &p_input->stream.stream_lock );
p_pgrm = input_FindProgram( p_input, p_new_pmt->i_program_number );
if( p_pgrm == NULL )
p_pgrm = input_FindProgram( p_input, p_new_pmt->i_program_number );
if( p_pgrm == NULL )
p_pgrm_demux = (pgrm_ts_data_t *)p_pgrm->p_demux_data;
p_pgrm_demux->i_pcr_pid = p_new_pmt->i_pcr_pid;
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_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 )
{
(u16)p_es->i_pid, sizeof( es_ts_data_t ) );
if( p_new_es == NULL )
{
/* if no program is selected :*/
if( !p_input->stream.p_selected_program )
{
/* if no program is selected :*/
if( !p_input->stream.p_selected_program )
{
{
p_input->pf_set_program( p_input, p_pgrm );
}
{
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;
}
p_pgrm_demux->i_pmt_version = p_new_pmt->i_version;
p_input->stream.b_changed = 1;
}
* wav.c : wav file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* 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 <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
p_input->stream.p_selected_program,
p_demux->i_pcr );
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) )
* gtk_common.h: private Gtk+ interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* 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 <sam@zoy.org>
*
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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.
* 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
* 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
vlc_bool_t b_slider_free; /* slider status */
/* menus handlers */
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
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
/* The window labels for DVD mode */
GtkLabel * p_label_title;
GtkLabel * p_label_chapter;
/* The window labels for DVD mode */
GtkLabel * p_label_title;
GtkLabel * p_label_chapter;
- gint i_part; /* current chapter */
+ guint i_part; /* current chapter */
};
/*****************************************************************************
};
/*****************************************************************************
* gtk.c : Gtk+ plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* 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 <sam@zoy.org>
*
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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.
* 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
* 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
* gtk_callbacks.c : Callbacks for the Gtk+ plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* 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 <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
* Julien BLACHE <jb@technologeek.org>
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
* Julien BLACHE <jb@technologeek.org>
* 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 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
* 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
gpointer user_data )
{
intf_thread_t *p_intf = GtkGetIntf( 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);
if( GTK_WIDGET_VISIBLE(p_intf->p_sys->p_window) )
{
gtk_widget_hide( p_intf->p_sys->p_window);
{
gtk_widget_show( p_intf->p_sys->p_window );
}
{
gtk_widget_show( p_intf->p_sys->p_window );
}
{
intf_thread_t * p_intf;
input_area_t * p_area;
{
intf_thread_t * p_intf;
input_area_t * p_area;
p_intf = GtkGetIntf( button );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
p_intf = GtkGetIntf( button );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
if( i_id < p_intf->p_sys->p_input->stream.i_area_nb )
{
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 );
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 );
* menu.c : functions to handle menu items.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* 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 <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr>
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 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
* 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
void GtkPopupAudioToggle ( GtkCheckMenuItem *, gpointer );
void GtkMenubarSubtitleToggle( GtkCheckMenuItem *, gpointer );
void GtkPopupSubtitleToggle ( 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,
void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) );
static gint GtkRadioMenu( intf_thread_t *, GtkWidget *, GSList *,
char *, int, int, int,
void GtkMenubarAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
void GtkMenubarAudioToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
GtkMenubarAudioToggle, b_audio_update );
}
GtkMenubarAudioToggle, b_audio_update );
}
void GtkMenubarSubtitleToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
{
void GtkMenubarSubtitleToggle( 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;
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 );
p_intf->p_sys->p_popup ), "popup_navigation" ) );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
{
p_item_selected = p_item;
}
{
p_item_selected = p_item;
}
gtk_widget_show( p_item );
/* setup signal hanling */
gtk_widget_show( p_item );
/* setup signal hanling */
}
/*****************************************************************************
}
/*****************************************************************************
- * 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,
* by the input. Usefull for multi-programs streams such as DVB ones.
*****************************************************************************/
static gint GtkProgramMenu( gpointer p_data,
GtkWidget * p_item_active;
GSList * p_group;
char psz_name[ GTK_MENU_LABEL_SIZE ];
GtkWidget * p_item_active;
GSList * p_group;
char psz_name[ GTK_MENU_LABEL_SIZE ];
/* cast */
p_intf = (intf_thread_t *)p_data;
/* cast */
p_intf = (intf_thread_t *)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';
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 ) );
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 ) );
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
/* activation will call signals so we can only do it
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 )
{
* We have to release the lock since input_ToggleES needs it */
if( p_item_active != NULL )
{
GtkWidget * p_item_active;
GSList * p_group;
char psz_name[ GTK_MENU_LABEL_SIZE ];
GtkWidget * p_item_active;
GSList * p_group;
char psz_name[ GTK_MENU_LABEL_SIZE ];
+ guint i_item;
+ guint i;
p_intf = (intf_thread_t *)p_data;
p_intf = (intf_thread_t *)p_data;
gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
/* acitvation will call signals so we can only do it
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 )
{
* We have to release the lock since input_ToggleES needs it */
if( p_item_active != NULL )
{
* -cascaded lists of chapters for each title
*****************************************************************************/
static gint GtkTitleMenu( 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 ];
{
intf_thread_t * p_intf;
char psz_name[ GTK_MENU_LABEL_SIZE ];
GtkWidget * p_item;
GSList * p_title_group;
GSList * p_chapter_group;
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;
/* cast */
p_intf = (intf_thread_t*)p_data;
{
p_title_item = gtk_menu_item_new_with_label( psz_name );
{
p_title_item = gtk_menu_item_new_with_label( psz_name );
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;
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 */
for( i_chapter = 0 ; i_chapter < i_chapter_nb ; i_chapter++ )
{
/* we group chapters in packets of ten for small screens */
snprintf( psz_name, GTK_MENU_LABEL_SIZE,
_("Chapter %d"), i_chapter + 1 );
psz_name[ GTK_MENU_LABEL_SIZE - 1 ] = '\0';
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(
p_item = gtk_radio_menu_item_new_with_label(
p_chapter_group, psz_name );
p_chapter_group = gtk_radio_menu_item_group(
es_descriptor_t * p_spu_es;
GtkWidget * p_menubar_menu;
GtkWidget * p_popup_menu;
es_descriptor_t * p_spu_es;
GtkWidget * p_menubar_menu;
GtkWidget * p_popup_menu;
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 |
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 |
p_intf->p_sys->b_program_update;
if( p_intf->p_sys->b_program_update )
p_intf->p_sys->b_program_update;
if( p_intf->p_sys->b_program_update )
pgrm_descriptor_t * p_pgrm;
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;
if( p_intf->p_sys->p_input->stream.p_new_program )
{
p_pgrm = p_intf->p_sys->p_input->stream.p_new_program;
p_pgrm = p_intf->p_sys->p_input->stream.p_selected_program;
}
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->p_window ), "menubar_program" ) );
GtkProgramMenu( p_intf, p_menubar_menu, p_pgrm,
GtkMenubarProgramToggle );
p_intf->p_sys->b_program_update = 1;
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;
}
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 )
if( p_intf->p_sys->b_title_update )
- 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,
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,
- 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
p_intf->p_sys->p_popup ), "popup_navigation" ) );
GtkTitleMenu( p_intf, p_popup_menu, GtkPopupNavigationToggle );
#if 0
on_menubar_chapter_toggle );
#endif
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,
p_intf->p_sys->p_window ), "menubar_chapter" ) );
GtkRadioMenu( p_intf, p_menubar_menu, NULL, _("Chapter"), 1,
GtkMenubarChapterToggle );
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 );
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 );
/* find audio root menu */
p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_window ), "menubar_audio" ) );
/* 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->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 = 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;
}
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" ) );
/* 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->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 = 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;
}
p_intf->p_sys->b_spu_update = 0;
}
* gtk_preferences.c: functions to handle the preferences dialog box.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* 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 <gbazin@netcourrier.com>
* Loïc Minier <lool@via.ecp.fr>
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Loïc Minier <lool@via.ecp.fr>
* GtkConfigApply: store the changes to the config inside the modules
* configuration structure and clear the hash table.
****************************************************************************/
* 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;
{
intf_thread_t *p_intf;
GHashTable *hash_table;
gtk_widget_set_sensitive( apply_button, FALSE );
}
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) ) );
}
{
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) ) );
}
{
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 )
* GtkModuleHighlighted: display module description when an entry is selected
* in the clist, and activate the configure button if necessary.
****************************************************************************/
* 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;
{
intf_thread_t *p_intf;
GtkWidget *config_button;
/****************************************************************************
* GtkModuleConfigure: display module configuration dialog box.
****************************************************************************/
/****************************************************************************
* 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;
{
module_t *p_module;
intf_thread_t *p_intf;
/****************************************************************************
* GtkModuleSelected: select module.
****************************************************************************/
/****************************************************************************
* GtkModuleSelected: select module.
****************************************************************************/
-void GtkModuleSelected( GtkButton *button, gpointer user_data )
+static void GtkModuleSelected( GtkButton *button, gpointer user_data )
{
module_t *p_module;
GtkWidget *widget;
{
module_t *p_module;
GtkWidget *widget;
* ipv4.c: IPv4 network abstraction layer
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* 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 <massiot@via.ecp.fr>
* Mathias Kretschmer <mathias@research.att.com>
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Mathias Kretschmer <mathias@research.att.com>
* 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.
* 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
* 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
else
{
struct hostent * p_hostent;
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
/* Try to convert address directly from in_addr - this will work if
* psz_address is dotted decimal. */
#ifdef HAVE_ARPA_INET_H
msg_Warn( p_this, "cannot configure socket (SO_RCVBUF)" );
#endif
}
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 */
/* 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 */
msg_Warn( p_this, "socket buffer size is 0x%x instead of 0x%x",
i_opt, 0x80000 );
}
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 ;
/* 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) ) ) )
{
/* Check if this is a multicast socket */
if (IN_MULTICAST( ntohl( inet_addr(psz_bind_addr) ) ) )
{
}
if ( BuildAddr( &sock, psz_bind_win32, i_bind_port ) == -1 )
#else
}
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 )
{
msg_Dbg( p_this, "could not build local address" );
#if defined( WIN32 ) || defined( UNDER_CE )
/* Bind it */
if( bind( i_handle, (struct sockaddr *)&sock, sizeof( sock ) ) < 0 )
{
/* Bind it */
if( bind( i_handle, (struct sockaddr *)&sock, sizeof( sock ) ) < 0 )
{
#if !defined( UNDER_CE ) && !defined( SYS_BEOS )
/* Join the multicast group if the socket is a multicast address */
#ifndef IN_MULTICAST
#if !defined( UNDER_CE ) && !defined( SYS_BEOS )
/* Join the multicast group if the socket is a multicast address */
#ifndef IN_MULTICAST
/* Connect the socket */
if( connect( i_handle, (struct sockaddr *) &sock,
sizeof( sock ) ) == (-1) )
/* Connect the socket */
if( connect( i_handle, (struct sockaddr *) &sock,
sizeof( sock ) ) == (-1) )
* crop.c : Crop video plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* 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 <sam@zoy.org>
*
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
static void UpdateStats( 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;
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;
- 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;
}
{
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;
{
p_vout->p_sys->i_lastchange = 0;
return;
* xcommon.c: Functions common to the X11 and XVideo plugins
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* 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 <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
static int NewPicture ( vout_thread_t *, picture_t * );
static void FreePicture ( vout_thread_t *, picture_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 *,
Display *, EXTRA_ARGS, int, int );
#ifdef HAVE_SYS_SHM_H
static IMAGE_TYPE *CreateShmImage ( vout_thread_t *,
- 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
i_chroma, (char*)&i_chroma );
}
else
while( XCheckWindowEvent( p_vout->p_sys->p_display,
p_vout->p_sys->p_win->base_window,
StructureNotifyMask | KeyPressMask |
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 )
{
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;
{
/* Update dimensions */
p_vout->i_changes |= VOUT_SIZE_CHANGE;
/* We may have keys like F1 trough F12, ESC ... */
x_key_symbol = XKeycodeToKeysym( p_vout->p_sys->p_display,
xevent.xkey.keycode, 0 );
/* We may have keys like F1 trough F12, ESC ... */
x_key_symbol = XKeycodeToKeysym( p_vout->p_sys->p_display,
xevent.xkey.keycode, 0 );
+ switch( (int)x_key_symbol )
{
case XK_Escape:
if( p_vout->b_fullscreen )
{
case XK_Escape:
if( p_vout->b_fullscreen )
default:
/* "Normal Keys"
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. */
* with XLookupString, we don't have to care about
* keymaps. */
p_vout->p_sys->i_time_mouse_last_moved = mdate();
if( ! p_vout->p_sys->b_mouse_pointer_visible )
{
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 ? */
}
}
/* Reparent move -- XXX: why are we getting this ? */
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 );
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 */
#ifdef MODULE_NAME_IS_x11
/* We need to signal the vout thread about the size change because it
* is doing the rescaling */
XResizeWindow( p_vout->p_sys->p_display,
p_vout->p_sys->p_win->video_window, i_width, i_height );
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 );
}
XMoveWindow( p_vout->p_sys->p_display,
p_vout->p_sys->p_win->video_window, i_x, i_y );
}
{
/* WM_DELETE_WINDOW is not supported by window manager */
msg_Warn( p_vout, "missing or bad window manager" );
{
/* 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 */
/* Creation of a graphic context that doesn't generate a GraphicsExpose
* event when using functions like XCopyArea */
XSelectInput( p_vout->p_sys->p_display, p_win->base_window,
StructureNotifyMask | KeyPressMask |
XSelectInput( p_vout->p_sys->p_display, p_win->base_window,
StructureNotifyMask | KeyPressMask |
- ButtonPressMask | ButtonReleaseMask |
+ ButtonPressMask | ButtonReleaseMask |
PointerMotionMask );
#ifdef MODULE_NAME_IS_x11
PointerMotionMask );
#ifdef MODULE_NAME_IS_x11
p_vout->p_sys->i_xvport, p_vout->output.i_chroma,
#else
p_vout->p_sys->p_visual,
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 );
p_vout->p_sys->i_bytes_per_pixel,
#endif
p_vout->output.i_width, p_vout->output.i_height );
/* Look for the first available port supporting this format */
for( i_port = p_adaptor[i_adaptor].base_id;
/* 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++ )
{
&& ( i_selected_port == -1 );
i_port++ )
{
/* Under XFree4.0, the list contains pixmap formats available
* through all video depths ; so we have to check against current
* depth. */
/* 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
{
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;
* xcommon.h: Defines common to the X11 and XVideo plugins
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* 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 <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
Window base_window; /* base window */
Window video_window; /* sub-window for displaying video */
GC gc; /* graphic context instance handler */
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;
Atom wm_protocols;
Atom wm_delete_window;
#else
Colormap colormap; /* colormap used (8bpp only) */
#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 */
#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
#ifdef DPMSINFO_IN_DPMS_H
BOOL b_ss_dpms; /* DPMS mode */
#endif
* decoders.
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* 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 <massiot@via.ecp.fr>
*
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* 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.
* 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
* 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
/* Access */
p_input->p_access = NULL;
/* Access */
p_input->p_access = NULL;
p_input->i_bufsize = 0;
p_input->i_mtu = 0;
p_input->i_bufsize = 0;
p_input->i_mtu = 0;
while( !p_input->b_die && !p_input->b_error && !p_input->b_eof )
{
while( !p_input->b_die && !p_input->b_error && !p_input->b_eof )
{
+ unsigned int i, i_count;
/* Reinitialize buffer manager. */
input_AccessReinit( 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
p_input->stream.p_new_program );
/* Escape all decoders for the stream discontinuity they
}
p_input->stream.p_new_program = NULL;
}
}
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 )
if( p_input->stream.p_new_area )
{
if( p_input->stream.b_seekable && p_input->pf_set_area != NULL )
if( psz_parser[0] == '/' && psz_parser[1] == '/' )
{
psz_parser += 2 ;
if( psz_parser[0] == '/' && psz_parser[1] == '/' )
{
psz_parser += 2 ;
p_input->psz_name = psz_parser ;
p_input->psz_name = psz_parser ;
/* Free info structures */
msg_Dbg( p_input, "freeing info structures...");
input_DelInfo( 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 */
input_DumpStream( p_input );
/* Free all ES and destroy all decoder threads */
* input_dec.c: Functions for the management of decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* 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 <massiot@via.ecp.fr>
*
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* 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.
* 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
* 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
*****************************************************************************/
void input_EscapeDiscontinuity( input_thread_t * p_input )
{
*****************************************************************************/
void input_EscapeDiscontinuity( input_thread_t * p_input )
{
for( i_es = 0; i_es < p_input->stream.i_selected_es_number; i_es++ )
{
for( i_es = 0; i_es < p_input->stream.i_selected_es_number; i_es++ )
{
*****************************************************************************/
void input_EscapeAudioDiscontinuity( input_thread_t * p_input )
{
*****************************************************************************/
void input_EscapeAudioDiscontinuity( input_thread_t * p_input )
{
for( i_es = 0; i_es < p_input->stream.i_selected_es_number; i_es++ )
{
for( i_es = 0; i_es < p_input->stream.i_selected_es_number; i_es++ )
{
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->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;
p_fifo->p_stream_ctrl = &p_input->stream.control;
p_fifo->p_sout = p_input->stream.p_sout;
* input_ext-intf.c: services to the interface
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* 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 <massiot@via.ecp.fr>
*
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
*****************************************************************************/
void input_DumpStream( input_thread_t * p_input )
{
*****************************************************************************/
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,
#define S p_input->stream
msg_Dbg( p_input, "dumping stream ID 0x%x [OK:%d/D:%d]", S.i_stream_id,
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999-2002 VideoLAN
* 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 <massiot@via.ecp.fr>
*
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* 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.
* 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
* 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
p_input->stream.pp_programs = NULL;
p_input->stream.p_selected_program = NULL;
p_input->stream.p_new_program = NULL;
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 )
if( i_data_len )
{
if ( (p_input->stream.p_demux_data = malloc( i_data_len )) == NULL )
{
free( p_input->stream.pp_selected_es );
}
{
free( p_input->stream.pp_selected_es );
}
if( p_input->stream.p_demux_data != NULL )
{
free( p_input->stream.p_demux_data );
if( p_input->stream.p_demux_data != NULL )
{
free( p_input->stream.p_demux_data );
/*****************************************************************************
* input_FindProgram: returns a pointer to a program described by its ID
*****************************************************************************/
/*****************************************************************************
* 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 )
for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
{
for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
{
*****************************************************************************/
void input_DelProgram( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm )
{
*****************************************************************************/
void input_DelProgram( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm )
{
+ 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;
/* Find the program in the programs table */
for( i_pgrm_index = 0; i_pgrm_index < p_input->stream.i_pgrm_number;
*****************************************************************************/
int input_SetProgram( input_thread_t * p_input, pgrm_descriptor_t * p_new_prg )
{
*****************************************************************************/
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 )
{
if ( p_input->stream.p_selected_program )
{
*****************************************************************************/
void input_DelArea( input_thread_t * p_input, input_area_t * p_area )
{
*****************************************************************************/
void input_DelArea( input_thread_t * p_input, input_area_t * p_area )
{
+ 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;
/* Find the area in the areas table */
for( i_area_index = 0; i_area_index < p_input->stream.i_area_nb;
/*****************************************************************************
* input_FindES: returns a pointer to an ES described by its ID
*****************************************************************************/
/*****************************************************************************
* 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 )
for( i = 0; i < p_input->stream.i_es_number; i++ )
{
for( i = 0; i < p_input->stream.i_es_number; i++ )
{
*****************************************************************************/
void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
{
*****************************************************************************/
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 */
pgrm_descriptor_t * p_pgrm;
/* Find the ES in the ES table */
int input_UnselectES( input_thread_t * p_input, es_descriptor_t * p_es )
{
int input_UnselectES( input_thread_t * p_input, es_descriptor_t * p_es )
{
+ unsigned int i_index = 0;
* cpu.c: CPU detection code
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* 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 <sam@zoy.org>
* Christophe Massiot <massiot@via.ecp.fr>
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Christophe Massiot <massiot@via.ecp.fr>
volatile vlc_bool_t b_amd;
/* Needed for x86 CPU capabilities detection */
volatile vlc_bool_t b_amd;
/* Needed for x86 CPU capabilities detection */
asm volatile ( "pushl %%ebx\n\t" \
"cpuid\n\t" \
"movl %%ebx,%1\n\t" \
asm volatile ( "pushl %%ebx\n\t" \
"cpuid\n\t" \
"movl %%ebx,%1\n\t" \
"=r" ( i_ebx ), \
"=c" ( i_ecx ), \
"=d" ( i_edx ) \
"=r" ( i_ebx ), \
"=c" ( i_ecx ), \
"=d" ( i_edx ) \
: "cc" );
# if defined( CAN_COMPILE_SSE ) || defined ( CAN_COMPILE_3DNOW ) \
: "cc" );
# if defined( CAN_COMPILE_SSE ) || defined ( CAN_COMPILE_3DNOW ) \