Commit d21d510c authored by Christophe Massiot's avatar Christophe Massiot

* Portability : changed off64_t to off_t and activated appropriate

  GNU/Linux options ;
* Changed fseek() to fseeko() for 64-bit offsets ;
* Reset frame predictors on a stream discontinuity.
parent 785049d7
......@@ -44,16 +44,21 @@ DEFINE += -DSTATS
endif
# PROGRAM_BUILD is a complete identification of the build
# ( we can't use fancy options with date since OSes like Solaris
# or FreeBSD have strange date implementations )
# (we can't use fancy options with date since OSes like Solaris
# or FreeBSD have strange date implementations)
PROGRAM_BUILD = `date` $(USER)
# XXX: beos does not support hostname
# XXX: beos does not support hostname (how lame...)
#PROGRAM_BUILD = `date` $(USER)@`hostname`
# DEFINE will contain some of the constants definitions decided in Makefile,
# including SYS_xx. It will be passed to C compiler.
DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr a-z. A-Z_)
# On Linux activate 64-bit off_t (by default under BSD)
ifneq (,$(findstring linux,$(SYS)))
DEFINE += -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98
endif
################################################################################
# Tuning and other variables - do not change anything except if you know
# exactly what you are doing
......
......@@ -2,7 +2,7 @@
* input.h: structures of the input not exported to other modules
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input.h,v 1.27 2001/02/08 13:52:34 massiot Exp $
* $Id: input.h,v 1.28 2001/02/08 17:44:12 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -109,7 +109,7 @@ static __inline__ void input_NullPacket( input_thread_t * p_input,
if( p_pes != NULL )
{
p_pes->b_messed_up = 1;
p_pes->b_discontinuity = 1;
p_es->p_last->p_next = p_pad_data;
p_es->p_last = p_pad_data;
}
......@@ -124,10 +124,8 @@ static __inline__ void input_NullPacket( input_thread_t * p_input,
p_pes->i_rate = p_input->stream.control.i_rate;
p_pes->p_first = p_pad_data;
p_pes->b_messed_up = p_pes->b_discontinuity = 1;
p_pes->b_discontinuity = 1;
input_DecodePES( p_es->p_decoder_fifo, p_pes );
}
p_es->b_discontinuity = 0;
}
......@@ -2,7 +2,7 @@
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-dec.h,v 1.21 2001/02/08 13:52:34 massiot Exp $
* $Id: input_ext-dec.h,v 1.22 2001/02/08 17:44:12 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
......@@ -53,8 +53,6 @@ typedef struct data_packet_s
typedef struct pes_packet_s
{
/* PES properties */
boolean_t b_messed_up; /* At least one of the data packets
* has a questionable content */
boolean_t b_data_alignment; /* used to find the beginning of
* a video or audio unit */
boolean_t b_discontinuity; /* This packet doesn't follow the
......
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.17 2001/02/08 13:52:34 massiot Exp $
* $Id: input_ext-intf.h,v 1.18 2001/02/08 17:44:12 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -60,7 +60,6 @@ typedef struct es_descriptor_s
struct pes_packet_s * p_pes; /* Current PES */
struct data_packet_s * p_last; /* The last packet gathered at present */
int i_pes_real_size; /* as indicated by the header */
boolean_t b_discontinuity; /* Stream changed */
/* Decoder information */
struct decoder_fifo_s * p_decoder_fifo;
......@@ -115,7 +114,6 @@ typedef struct pgrm_descriptor_s
count_t c_average_count;
/* counter used to compute dynamic average values */
int i_synchro_state;
boolean_t b_discontinuity;
/* Demultiplexer data */
void * p_demux_data;
......
......@@ -2,7 +2,7 @@
* dvd_css.c: Functions for DVD authentification and unscrambling
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.c,v 1.2 2001/02/08 06:41:56 stef Exp $
* $Id: dvd_css.c,v 1.3 2001/02/08 17:44:12 massiot Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -32,7 +32,6 @@
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <malloc.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#ifdef HAVE_SYS_DVDIO_H
......@@ -930,7 +929,7 @@ int CSSGetKeys( css_t * p_css )
DVD_key_t my_key;
title_key_t title_key[MaxKeys] ;
int i_title;
off64_t i_pos = 0;
off_t i_pos = 0;
int i_bytes_read;
int i_best_plen;
int i_best_p;
......@@ -948,7 +947,7 @@ int CSSGetKeys( css_t * p_css )
i_pos = p_css->p_title_key[i_title].i;
do
{
i_pos = lseek64( i_fd, i_pos, SEEK_SET );
i_pos = lseek( i_fd, i_pos, SEEK_SET );
i_bytes_read = read( i_fd, pi_buf, 0x800 );
if( pi_buf[0x14] & 0x30 ) // PES_scrambling_control
{
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* dvd_ifo.h: Structures for ifo parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.h,v 1.1 2001/02/08 04:43:27 sam Exp $
* $Id: dvd_ifo.h,v 1.2 2001/02/08 17:44:12 massiot Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -477,9 +477,9 @@ typedef struct ifo_s
/* File descriptor for the device */
int i_fd;
/* Offset to video_ts.ifo on the device */
off64_t i_off;
off_t i_off;
/* Position of stream pointer */
off64_t i_pos;
off_t i_pos;
/* Error Management */
boolean_t b_error;
/* Structure described in video_ts */
......
......@@ -10,7 +10,7 @@
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.4 2001/02/08 11:22:41 massiot Exp $
* $Id: input_dvd.c,v 1.5 2001/02/08 17:44:12 massiot Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -83,8 +83,7 @@ static void DVDInit ( struct input_thread_s * );
static void DVDOpen ( struct input_thread_s * );
static void DVDClose ( struct input_thread_s * );
static void DVDEnd ( struct input_thread_s * );
/* FIXME : DVDSeek should be on 64 bits ? Is it possible in input ? */
static int DVDSeek ( struct input_thread_s *, off_t );
static void DVDSeek ( struct input_thread_s *, off_t );
static int DVDRewind ( struct input_thread_s * );
/*****************************************************************************
......@@ -148,7 +147,7 @@ static int DVDCheckCSS( input_thread_t * p_input )
static void DVDInit( input_thread_t * p_input )
{
thread_dvd_data_t * p_method;
off64_t i_start;
off_t i_start;
if( (p_method = malloc( sizeof(thread_dvd_data_t) )) == NULL )
{
......@@ -166,7 +165,7 @@ static void DVDInit( input_thread_t * p_input )
p_method->i_title = 0;
lseek64( p_input->i_handle, 0, SEEK_SET );
lseek( p_input->i_handle, 0, SEEK_SET );
/* Reading structures initialisation */
input_NetlistInit( p_input, 4096, 4096, DVD_LB_SIZE,
......@@ -207,7 +206,7 @@ static void DVDInit( input_thread_t * p_input )
i_start = p_method->ifo.p_vts[0].i_pos +
p_method->ifo.p_vts[0].mat.i_tt_vobs_ssector *DVD_LB_SIZE;
i_start = lseek64( p_input->i_handle, i_start, SEEK_SET );
i_start = lseek( p_input->i_handle, i_start, SEEK_SET );
intf_Msg( "VOB start at : %lld", (long long)i_start );
/* Initialize ES structures */
......@@ -258,7 +257,7 @@ static void DVDInit( input_thread_t * p_input )
break;
}
}
lseek64( p_input->i_handle, i_start, SEEK_SET );
lseek( p_input->i_handle, i_start, SEEK_SET );
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.i_tell = 0;
if( p_demux_data->b_has_PSM )
......@@ -351,8 +350,7 @@ static void DVDOpen( input_thread_t * p_input )
{
intf_Msg( "input: opening DVD %s", p_input->p_source );
p_input->i_handle = open( p_input->p_source,
O_RDONLY | O_NONBLOCK | O_LARGEFILE );
p_input->i_handle = open( p_input->p_source, O_RDONLY | O_NONBLOCK );
if( p_input->i_handle == -1 )
{
......@@ -519,7 +517,7 @@ static int DVDRewind( input_thread_t * p_input )
* input and translate chronological position from input to logical postion
* on the device
*****************************************************************************/
static int DVDSeek( input_thread_t * p_input, off_t i_off )
static void DVDSeek( input_thread_t * p_input, off_t i_off )
{
return( -1 );
return;
}
......@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ps.c,v 1.3 2001/02/08 13:52:35 massiot Exp $
* $Id: input_ps.c,v 1.4 2001/02/08 17:44:12 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -132,7 +132,7 @@ static void PSInit( input_thread_t * p_input )
p_input->b_error = 1;
return;
}
fseek( p_method->stream, 0, SEEK_SET );
rewind( p_method->stream );
/* FIXME : detect if InitStream failed */
input_InitStream( p_input, sizeof( stream_ps_data_t ) );
......@@ -181,7 +181,7 @@ static void PSInit( input_thread_t * p_input )
break;
}
}
fseek( p_method->stream, 0, SEEK_SET );
rewind( p_method->stream );
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.i_tell = 0;
if( p_demux_data->b_has_PSM )
......@@ -439,7 +439,7 @@ static void PSSeek( input_thread_t * p_input, off_t i_position )
p_method = (thread_ps_data_t *)p_input->p_plugin_data;
/* A little bourrin but should work for a while --Meuuh */
fseek( p_method->stream, i_position, SEEK_SET );
fseeko( p_method->stream, i_position, SEEK_SET );
p_input->stream.i_tell = i_position;
}
......@@ -499,7 +499,7 @@ static pes_packet_t * NewPES( void * p_garbage )
return NULL;
}
p_pes->b_messed_up = p_pes->b_data_alignment = p_pes->b_discontinuity =
p_pes->b_data_alignment = p_pes->b_discontinuity =
p_pes->i_pts = p_pes->i_dts = 0;
p_pes->i_pes_size = 0;
p_pes->p_first = NULL;
......
......@@ -96,7 +96,7 @@ void input_Pause( input_thread_t * p_input )
*****************************************************************************/
void input_Seek( input_thread_t * p_input, off_t i_position )
{
intf_Msg( "input: seeking position %d/%d", i_position,
intf_Msg( "input: seeking position %lld/%lld", i_position,
p_input->stream.i_size );
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.i_seek = i_position;
......
......@@ -2,7 +2,7 @@
* input_netlist.c: netlist management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_netlist.c,v 1.29 2001/02/08 01:34:42 stef Exp $
* $Id: input_netlist.c,v 1.30 2001/02/08 17:44:12 massiot Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
......@@ -311,7 +311,6 @@ struct pes_packet_s * input_NetlistNewPES( void * p_method_data )
vlc_mutex_unlock (&p_netlist->lock);
/* initialize PES */
p_return->b_messed_up =
p_return->b_data_alignment =
p_return->b_discontinuity =
p_return->i_pts = p_return->i_dts = 0;
......
......@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_programs.c,v 1.30 2001/02/08 13:52:35 massiot Exp $
* $Id: input_programs.c,v 1.31 2001/02/08 17:44:12 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -152,7 +152,6 @@ pgrm_descriptor_t * input_AddProgram( input_thread_t * p_input,
p_input->stream.pp_programs[i_pgrm_index]->i_synchro_state
= SYNCHRO_START;
p_input->stream.pp_programs[i_pgrm_index]->b_discontinuity = 0;
p_input->stream.pp_programs[i_pgrm_index]->p_vout
= p_input->p_default_vout;
......@@ -279,7 +278,6 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
/* Init its values */
p_es->i_id = i_es_id;
p_es->b_discontinuity = 0;
p_es->p_pes = NULL;
p_es->p_decoder_fifo = NULL;
p_es->b_audio = 0;
......@@ -400,7 +398,7 @@ void input_DumpStream( input_thread_t * p_input )
#define S p_input->stream
intf_Msg( "input info: Dumping stream ID 0x%x", S.i_stream_id );
if( S.b_seekable )
intf_Msg( "input info: seekable stream, position: %d/%d",
intf_Msg( "input info: seekable stream, position: %lld/%lld",
S.i_tell, S.i_size );
else
intf_Msg( "input info: %s", S.b_pace_control ? "pace controlled" :
......
......@@ -2,7 +2,7 @@
* mpeg_system.c: TS, PS and PES management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: mpeg_system.c,v 1.33 2001/02/08 13:52:35 massiot Exp $
* $Id: mpeg_system.c,v 1.34 2001/02/08 17:44:12 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -164,7 +164,6 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
/* PES_packet_length is set and != total received payload */
/* Warn the decoder that the data may be corrupt. */
intf_WarnMsg( 3, "PES sizes do not match : packet corrupted" );
p_pes->b_messed_up = 1;
}
switch( p_es->i_stream_id )
......@@ -414,7 +413,7 @@ void input_GatherPES( input_thread_t * p_input, data_packet_t * p_data,
/* If we lost data, insert a NULL data packet (philosophy : 0 is quite
* often an escape sequence in decoders, so that should make them wait
* for the next start code). */
if( b_packet_lost || p_es->b_discontinuity )
if( b_packet_lost )
{
input_NullPacket( p_input, p_es );
}
......@@ -964,7 +963,7 @@ void input_DemuxTS( input_thread_t * p_input, data_packet_t * p_data )
/* 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->b_discontinuity = 1;
p_es->p_pgrm->i_synchro_state = SYNCHRO_REINIT;
/* There also may be a continuity_counter
* discontinuity: resynchronise our counter with
......
......@@ -2,7 +2,7 @@
* video_parser.c : video parser thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_parser.c,v 1.71 2001/02/07 15:32:26 massiot Exp $
* $Id: video_parser.c,v 1.72 2001/02/08 17:44:13 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -537,5 +537,28 @@ static void BitstreamCallback ( bit_stream_t * p_bit_stream,
DECODER_FIFO_START( *p_bit_stream->p_decoder_fifo )->i_dts;
p_vpar->sequence.i_current_rate =
DECODER_FIFO_START( *p_bit_stream->p_decoder_fifo )->i_rate;
if( DECODER_FIFO_START( *p_bit_stream->p_decoder_fifo )->b_discontinuity )
{
/* Escape the current picture and reset the picture predictors. */
p_vpar->picture.b_error = 1;
if( p_vpar->sequence.p_forward != NULL )
{
vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_forward );
}
if( p_vpar->sequence.p_backward != NULL )
{
vout_DatePicture( p_vpar->p_vout, p_vpar->sequence.p_backward,
vpar_SynchroDate( p_vpar ) );
vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_backward );
}
p_vpar->sequence.p_forward = p_vpar->sequence.p_backward = NULL;
}
}
if( p_bit_stream->p_data->b_discard_payload )
{
/* 1 packet messed up, trash the slice. */
p_vpar->picture.b_error = 1;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment