Commit 4ebb78dd authored by Christophe Massiot's avatar Christophe Massiot

* Fixed miscellaneous alignment problems (alpha/sparc ports) ;

* Added a fps display when toggling 'i' ;
* Fixed a bug in the video parser where one picture buffer was not
released at quit time ;
* Broke the mux_rate calculation, but hey guys ! it was already broken and
nobody noticed it.
parent 917d2574
......@@ -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.23 2001/03/02 03:32:46 stef Exp $
* $Id: input_ext-dec.h,v 1.24 2001/03/02 13:20:28 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
......@@ -208,7 +208,7 @@ u32 UnalignedGetBits( struct bit_stream_s *, unsigned int );
*****************************************************************************/
static __inline__ void AlignWord( bit_stream_t * p_bit_stream )
{
while( (p_bit_stream->p_byte - p_bit_stream->p_data->p_buffer)
while( (ptrdiff_t)p_bit_stream->p_byte
& (sizeof(WORD_TYPE) - 1) )
{
if( p_bit_stream->p_byte < p_bit_stream->p_end )
......
......@@ -197,9 +197,7 @@ typedef struct vout_thread_s
p_vout_font_t p_default_font; /* default font */
p_vout_font_t p_large_font; /* large font */
#ifdef STATS
count_t c_loops;
#endif
} vout_thread_t;
/* Flags for changes - these flags are set in the i_changes field when another
......
......@@ -167,7 +167,7 @@ char * input_OffsetToTime( input_thread_t * p_input, char * psz_buffer,
if( p_input->stream.i_mux_rate )
{
i_seconds = i_offset * 50 / p_input->stream.i_mux_rate;
i_seconds = i_offset / 50 / p_input->stream.i_mux_rate;
snprintf( psz_buffer, OFFSETTOTIME_MAX_SIZE, "%d:%02d:%02d",
(int) (i_seconds / (60 * 60)),
(int) (i_seconds / 60 % 60),
......
......@@ -2,7 +2,7 @@
* mpeg_system.c: TS, PS and PES management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: mpeg_system.c,v 1.39 2001/03/02 03:32:46 stef Exp $
* $Id: mpeg_system.c,v 1.40 2001/03/02 13:20:29 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -64,6 +64,7 @@ static void input_DecodePMT( input_thread_t *, es_descriptor_t *);
*****************************************************************************
* Small utility function used to parse discontinuous headers safely. Copies
* i_buf_len bytes of data to a buffer and returns the size copied.
* It also solves some alignment problems on non-IA-32, non-PPC processors.
* This is a variation on the theme of input_ext-dec.h:GetChunk().
*****************************************************************************/
static __inline__ size_t MoveChunk( byte_t * p_dest,
......@@ -223,8 +224,9 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
}
p_pes->i_pts = input_ClockGetTS( p_input, p_es->p_pgrm,
( ((mtime_t)(p_full_header[2] & 0x0E) << 29) |
(((mtime_t)U16_AT(p_full_header + 3) << 14) - (1 << 14)) |
((mtime_t)U16_AT(p_full_header + 5) >> 1) ) );
(((mtime_t)U32_AT(p_full_header + 2) & 0xFFFE00) << 6) |
((mtime_t)p_full_header[5] << 7) |
((mtime_t)p_full_header[6] >> 1) ) );
if( b_has_dts )
{
......@@ -314,8 +316,9 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
p_pes->i_pts = input_ClockGetTS( p_input, p_es->p_pgrm,
( ((mtime_t)(p_ts[0] & 0x0E) << 29) |
(((mtime_t)U16_AT(p_ts + 1) << 14) - (1 << 14)) |
((mtime_t)U16_AT(p_ts + 3) >> 1) ) );
(((mtime_t)U32_AT(p_ts) & 0xFFFE00) << 6) |
((mtime_t)p_ts[3] << 7) |
((mtime_t)p_ts[4] >> 1) ) );
if( b_has_dts )
{
......@@ -333,8 +336,9 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es )
p_pes->i_dts = input_ClockGetTS( p_input,
p_es->p_pgrm,
( ((mtime_t)(p_ts[0] & 0x0E) << 29) |
(((mtime_t)U16_AT(p_ts + 1) << 14) - (1 << 14)) |
((mtime_t)U16_AT(p_ts + 3) >> 1) ) );
(((mtime_t)U32_AT(p_ts) & 0xFFFE00) << 6) |
((mtime_t)p_ts[3] << 7) |
((mtime_t)p_ts[4] >> 1) ) );
}
}
}
......@@ -503,6 +507,8 @@ static u16 GetID( data_packet_t * p_data )
i_id = p_data->p_payload_start[3]; /* stream_id */
if( i_id == 0xBD )
{
/* FIXME : this is not valid if the header is split in multiple
* packets */
/* stream_private_id */
i_id |= p_data->p_payload_start[ 9 + p_data->p_payload_start[8] ] << 8;
}
......@@ -511,6 +517,8 @@ static u16 GetID( data_packet_t * p_data )
/*****************************************************************************
* DecodePSM: Decode the Program Stream Map information
*****************************************************************************
* FIXME : loads are not aligned in this function
*****************************************************************************/
static void DecodePSM( input_thread_t * p_input, data_packet_t * p_data )
{
......@@ -647,8 +655,8 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
u32 i_code;
es_descriptor_t * p_es = NULL;
i_code = U32_AT( p_data->p_payload_start );
if( i_code > 0x1BC ) /* ES start code */
i_code = p_data->p_payload_start[3];
if( i_code > 0xBC ) /* ES start code */
{
u16 i_id;
int i_dummy;
......@@ -791,27 +799,50 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
if( (p_data->p_payload_start[4] & 0xC0) == 0x40 )
{
/* MPEG-2 */
byte_t p_header[14];
byte_t * p_byte;
p_byte = p_data->p_payload_start;
if( MoveChunk( p_header, &p_data, &p_byte, 14 ) != 14 )
{
intf_WarnMsg( 3, "Packet too short to have a header" );
b_trash = 1;
break;
}
scr_time =
((mtime_t)(p_data->p_payload_start[4] & 0x38) << 27) |
((mtime_t)(U32_AT(p_data->p_payload_start + 4) & 0x03FFF800)
((mtime_t)(p_header[4] & 0x38) << 27) |
((mtime_t)(U32_AT(p_header + 4) & 0x03FFF800)
<< 4) |
((mtime_t)(U32_AT(p_data->p_payload_start + 6) & 0x03FFF800)
((( ((mtime_t)U16_AT(p_header + 6) << 16)
| (mtime_t)U16_AT(p_header + 8) ) & 0x03FFF800)
>> 11);
/* mux_rate */
i_mux_rate = (U32_AT(p_data->p_payload_start + 10) & 0xFFFFFC00);
i_mux_rate = (( ((u32)U16_AT(p_header + 10) << 16)
| (u32)U16_AT(p_header + 12) ) & 0xFFFFFC00)
>> 11;
}
else
{
/* MPEG-1 SCR is like PTS. */
byte_t p_header[12];
byte_t * p_byte;
p_byte = p_data->p_payload_start;
if( MoveChunk( p_header, &p_data, &p_byte, 12 ) != 12 )
{
intf_WarnMsg( 3, "Packet too short to have a header" );
b_trash = 1;
break;
}
scr_time =
((mtime_t)(p_data->p_payload_start[4] & 0x0E) << 29) |
(((mtime_t)U16_AT(p_data->p_payload_start + 5) << 14)
- (1 << 14)) |
((mtime_t)U16_AT(p_data->p_payload_start + 7) >> 1);
((mtime_t)(p_header[4] & 0x0E) << 29) |
(((mtime_t)U32_AT(p_header + 4) & 0xFFFE00) << 6) |
((mtime_t)p_header[7] << 7) |
((mtime_t)p_header[8] >> 1);
/* mux_rate */
i_mux_rate = (U32_AT(p_data->p_payload_start + 8) & 0x8FFFFE);
i_mux_rate = (U32_AT(p_header + 8) & 0x8FFFFE) >> 11;
}
/* Call the pace control. */
input_ClockManageRef( p_input, p_input->stream.pp_programs[0],
......
......@@ -979,15 +979,28 @@ static void RunThread( vout_thread_t *p_vout)
p_subpic = NULL;
display_date = 0;
current_date = mdate();
#ifdef STATS
p_vout->c_loops++;
if( !(p_vout->c_loops % VOUT_STATS_NB_LOOPS) )
{
#ifdef STATS
intf_Msg("vout stats: picture heap: %d/%d",
p_vout->i_pictures, VOUT_MAX_PICTURES);
}
#endif
if( p_vout->b_info )
{
long i_fps = VOUT_FPS_SAMPLES * 1000000 * 10 /
( p_vout->p_fps_sample[ (p_vout->c_fps_samples - 1)
% VOUT_FPS_SAMPLES ] -
p_vout->p_fps_sample[ p_vout->c_fps_samples
% VOUT_FPS_SAMPLES ] );
intf_Msg( "vout stats: %li.%i fps",
i_fps / 10, (int)i_fps % 10 );
}
}
/*
* Find the picture to display - this operation does not need lock,
* since only READY_PICTUREs are handled
......
......@@ -2,7 +2,7 @@
* video_parser.c : video parser thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_parser.c,v 1.76 2001/02/20 15:03:00 massiot Exp $
* $Id: video_parser.c,v 1.77 2001/03/02 13:20:29 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -424,6 +424,10 @@ static void EndThread( vpar_thread_t *p_vpar )
vpar_SynchroDate( p_vpar ) );
vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_backward );
}
if( p_vpar->picture.p_picture != NULL )
{
vout_DestroyPicture( p_vpar->p_vout, p_vpar->picture.p_picture );
}
#ifdef STATS
intf_Msg("vpar stats: %d loops among %d sequence(s)",
......
......@@ -2,7 +2,7 @@
* vpar_headers.c : headers parsing
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_headers.c,v 1.79 2001/02/19 19:08:59 massiot Exp $
* $Id: vpar_headers.c,v 1.80 2001/03/02 13:20:29 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
......@@ -474,6 +474,19 @@ static void PictureHeader( vpar_thread_t * p_vpar )
{
ReferenceUpdate( p_vpar, I_CODING_TYPE, NULL );
ReferenceUpdate( p_vpar, I_CODING_TYPE, NULL );
if( p_vpar->picture.p_picture != NULL )
{
#ifdef VDEC_SMP
int i_mb;
for( i_mb = 0; p_vpar->picture.pp_mb[i_mb] != NULL; i_mb++ )
{
vpar_DestroyMacroblock( &p_vpar->vfifo,
p_vpar->picture.pp_mb[i_mb] );
}
#endif
vout_DestroyPicture( p_vpar->p_vout, p_vpar->picture.p_picture );
}
p_vpar->sequence.b_expect_discontinuity = 0;
}
......
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