Commit f6cc8a39 authored by Laurent Aimar's avatar Laurent Aimar

Convert stream to system timestamp after the decoder.

- This is needed for proper seek/pause/fast forward/...
- The decoder/packetizer do not need to scale packet length anymore as the
decoder thread do it.
parent 4c247f8a
...@@ -147,8 +147,31 @@ struct encoder_t ...@@ -147,8 +147,31 @@ struct encoder_t
* @} * @}
*/ */
/**
* This function returns a specific input attachment (using its name).
*
* You MUST release the returned value.
*/
VLC_EXPORT( input_attachment_t *, decoder_GetInputAttachment, ( decoder_t *, const char *psz_name ) LIBVLC_USED ); VLC_EXPORT( input_attachment_t *, decoder_GetInputAttachment, ( decoder_t *, const char *psz_name ) LIBVLC_USED );
/**
* This function gives all input attachments at once.
*
* You MUST release the returned values
*/
VLC_EXPORT( int, decoder_GetInputAttachments, ( decoder_t *p_dec, input_attachment_t ***ppp_attachment, int *pi_attachment ) ); VLC_EXPORT( int, decoder_GetInputAttachments, ( decoder_t *p_dec, input_attachment_t ***ppp_attachment, int *pi_attachment ) );
/**
* This function converts a decoder timestamp into a display date comparable
* to mdate().
* You MUST use it *only* for gathering statistics about speed.
*/
VLC_EXPORT( mtime_t, decoder_GetDisplayDate, ( decoder_t *, mtime_t ) LIBVLC_USED ); VLC_EXPORT( mtime_t, decoder_GetDisplayDate, ( decoder_t *, mtime_t ) LIBVLC_USED );
/**
* This function returns the current input rate.
* You MUST use it *only* for gathering statistics about speed.
*/
VLC_EXPORT( int, decoder_GetDisplayRate, ( decoder_t * ) );
#endif /* _VLC_CODEC_H */ #endif /* _VLC_CODEC_H */
...@@ -45,5 +45,5 @@ VLC_EXPORT( void, decoder_SynchroTrash, ( decoder_synchro_t * ) ); ...@@ -45,5 +45,5 @@ VLC_EXPORT( void, decoder_SynchroTrash, ( decoder_synchro_t * ) );
VLC_EXPORT( void, decoder_SynchroDecode, ( decoder_synchro_t * ) ); VLC_EXPORT( void, decoder_SynchroDecode, ( decoder_synchro_t * ) );
VLC_EXPORT( void, decoder_SynchroEnd, ( decoder_synchro_t *, int, bool ) ); VLC_EXPORT( void, decoder_SynchroEnd, ( decoder_synchro_t *, int, bool ) );
VLC_EXPORT( mtime_t, decoder_SynchroDate, ( decoder_synchro_t * ) LIBVLC_USED ); VLC_EXPORT( mtime_t, decoder_SynchroDate, ( decoder_synchro_t * ) LIBVLC_USED );
VLC_EXPORT( void, decoder_SynchroNewPicture, ( decoder_synchro_t *, int, int, mtime_t, mtime_t, int, bool ) ); VLC_EXPORT( void, decoder_SynchroNewPicture, ( decoder_synchro_t *, int, int, mtime_t, mtime_t, bool ) );
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_codec.h> #include <vlc_codec.h>
#include <vlc_aout.h> #include <vlc_aout.h>
#include <vlc_input.h>
#include <vlc_block_helper.h> #include <vlc_block_helper.h>
#include <vlc_bits.h> #include <vlc_bits.h>
...@@ -84,8 +83,6 @@ struct decoder_sys_t ...@@ -84,8 +83,6 @@ struct decoder_sys_t
mtime_t i_pts; mtime_t i_pts;
int i_frame_size, i_bit_rate; int i_frame_size, i_bit_rate;
unsigned int i_rate, i_channels, i_channels_conf; unsigned int i_rate, i_channels, i_channels_conf;
int i_input_rate;
}; };
enum { enum {
...@@ -147,7 +144,6 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer ) ...@@ -147,7 +144,6 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
aout_DateSet( &p_sys->end_date, 0 ); aout_DateSet( &p_sys->end_date, 0 );
p_sys->bytestream = block_BytestreamInit(); p_sys->bytestream = block_BytestreamInit();
p_sys->i_input_rate = INPUT_RATE_DEFAULT;
/* Set output properties */ /* Set output properties */
p_dec->fmt_out.i_cat = AUDIO_ES; p_dec->fmt_out.i_cat = AUDIO_ES;
...@@ -207,9 +203,6 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -207,9 +203,6 @@ static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return NULL; return NULL;
} }
if( (*pp_block)->i_rate > 0 )
p_sys->i_input_rate = (*pp_block)->i_rate;
block_BytestreamPush( &p_sys->bytestream, *pp_block ); block_BytestreamPush( &p_sys->bytestream, *pp_block );
while( 1 ) while( 1 )
...@@ -408,8 +401,7 @@ static aout_buffer_t *GetAoutBuffer( decoder_t *p_dec ) ...@@ -408,8 +401,7 @@ static aout_buffer_t *GetAoutBuffer( decoder_t *p_dec )
if( p_buf == NULL ) return NULL; if( p_buf == NULL ) return NULL;
p_buf->start_date = aout_DateGet( &p_sys->end_date ); p_buf->start_date = aout_DateGet( &p_sys->end_date );
p_buf->end_date = aout_DateIncrement( &p_sys->end_date, p_buf->end_date = aout_DateIncrement( &p_sys->end_date, A52_FRAME_NB );
A52_FRAME_NB * p_sys->i_input_rate / INPUT_RATE_DEFAULT );
return p_buf; return p_buf;
} }
...@@ -428,9 +420,7 @@ static block_t *GetSoutBuffer( decoder_t *p_dec ) ...@@ -428,9 +420,7 @@ static block_t *GetSoutBuffer( decoder_t *p_dec )
p_block->i_pts = p_block->i_dts = aout_DateGet( &p_sys->end_date ); p_block->i_pts = p_block->i_dts = aout_DateGet( &p_sys->end_date );
p_block->i_length = p_block->i_length =
aout_DateIncrement( &p_sys->end_date, aout_DateIncrement( &p_sys->end_date, A52_FRAME_NB ) - p_block->i_pts;
A52_FRAME_NB * p_sys->i_input_rate / INPUT_RATE_DEFAULT ) -
p_block->i_pts;
return p_block; return p_block;
} }
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_aout.h> #include <vlc_aout.h>
#include <vlc_codec.h> #include <vlc_codec.h>
#include <vlc_input.h>
/* ffmpeg header */ /* ffmpeg header */
#ifdef HAVE_LIBAVCODEC_AVCODEC_H #ifdef HAVE_LIBAVCODEC_AVCODEC_H
...@@ -82,8 +81,6 @@ struct decoder_sys_t ...@@ -82,8 +81,6 @@ struct decoder_sys_t
/* */ /* */
int i_reject_count; int i_reject_count;
int i_input_rate;
}; };
/***************************************************************************** /*****************************************************************************
...@@ -207,7 +204,6 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -207,7 +204,6 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
p_sys->p_samples = NULL; p_sys->p_samples = NULL;
p_sys->i_samples = 0; p_sys->i_samples = 0;
p_sys->i_reject_count = 0; p_sys->i_reject_count = 0;
p_sys->i_input_rate = INPUT_RATE_DEFAULT;
aout_DateSet( &p_sys->end_date, 0 ); aout_DateSet( &p_sys->end_date, 0 );
if( p_dec->fmt_in.audio.i_rate ) if( p_dec->fmt_in.audio.i_rate )
...@@ -240,8 +236,7 @@ static aout_buffer_t *SplitBuffer( decoder_t *p_dec ) ...@@ -240,8 +236,7 @@ static aout_buffer_t *SplitBuffer( decoder_t *p_dec )
} }
p_buffer->start_date = aout_DateGet( &p_sys->end_date ); p_buffer->start_date = aout_DateGet( &p_sys->end_date );
p_buffer->end_date = aout_DateIncrement( &p_sys->end_date, p_buffer->end_date = aout_DateIncrement( &p_sys->end_date, i_samples );
i_samples * p_sys->i_input_rate / INPUT_RATE_DEFAULT );
memcpy( p_buffer->p_buffer, p_sys->p_samples, p_buffer->i_nb_bytes ); memcpy( p_buffer->p_buffer, p_sys->p_samples, p_buffer->i_nb_bytes );
...@@ -265,9 +260,6 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block ) ...@@ -265,9 +260,6 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
p_block = *pp_block; p_block = *pp_block;
if( p_block->i_rate > 0 )
p_sys->i_input_rate = p_block->i_rate;
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{ {
block_Release( p_block ); block_Release( p_block );
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_codec.h> #include <vlc_codec.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#include <vlc_input.h> /* hmmm, just for INPUT_RATE_DEFAULT */
#include <vlc_codecs.h> /* BITMAPINFOHEADER */ #include <vlc_codecs.h> /* BITMAPINFOHEADER */
/* ffmpeg header */ /* ffmpeg header */
...@@ -100,7 +99,7 @@ static void ffmpeg_CopyPicture ( decoder_t *, picture_t *, AVFrame * ); ...@@ -100,7 +99,7 @@ static void ffmpeg_CopyPicture ( decoder_t *, picture_t *, AVFrame * );
static int ffmpeg_GetFrameBuf ( struct AVCodecContext *, AVFrame * ); static int ffmpeg_GetFrameBuf ( struct AVCodecContext *, AVFrame * );
static int ffmpeg_ReGetFrameBuf( struct AVCodecContext *, AVFrame * ); static int ffmpeg_ReGetFrameBuf( struct AVCodecContext *, AVFrame * );
static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *, AVFrame * ); static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *, AVFrame * );
static void ffmpeg_NextPts( decoder_t *, int i_block_rate ); static void ffmpeg_NextPts( decoder_t * );
static uint32_t ffmpeg_CodecTag( vlc_fourcc_t fcc ) static uint32_t ffmpeg_CodecTag( vlc_fourcc_t fcc )
{ {
...@@ -617,7 +616,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) ...@@ -617,7 +616,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
if( !b_drawpicture && p_pic ) if( !b_drawpicture && p_pic )
p_dec->pf_vout_buffer_del( p_dec, p_pic ); p_dec->pf_vout_buffer_del( p_dec, p_pic );
ffmpeg_NextPts( p_dec, p_block->i_rate ); ffmpeg_NextPts( p_dec );
continue; continue;
} }
...@@ -671,7 +670,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) ...@@ -671,7 +670,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
int i; int i;
p_pic->date = p_sys->i_pts; p_pic->date = p_sys->i_pts;
ffmpeg_NextPts( p_dec, p_block->i_rate ); ffmpeg_NextPts( p_dec );
if( p_sys->b_first_frame ) if( p_sys->b_first_frame )
{ {
...@@ -1007,7 +1006,7 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context, ...@@ -1007,7 +1006,7 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
} }
} }
static void ffmpeg_NextPts( decoder_t *p_dec, int i_block_rate ) static void ffmpeg_NextPts( decoder_t *p_dec )
{ {
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
...@@ -1020,16 +1019,14 @@ static void ffmpeg_NextPts( decoder_t *p_dec, int i_block_rate ) ...@@ -1020,16 +1019,14 @@ static void ffmpeg_NextPts( decoder_t *p_dec, int i_block_rate )
{ {
p_sys->i_pts += INT64_C(1000000) * p_sys->i_pts += INT64_C(1000000) *
(2 + p_sys->p_ff_pic->repeat_pict) * (2 + p_sys->p_ff_pic->repeat_pict) *
p_dec->fmt_in.video.i_frame_rate_base * p_dec->fmt_in.video.i_frame_rate_base /
i_block_rate / INPUT_RATE_DEFAULT /
(2 * p_dec->fmt_in.video.i_frame_rate); (2 * p_dec->fmt_in.video.i_frame_rate);
} }
else if( p_sys->p_context->time_base.den > 0 ) else if( p_sys->p_context->time_base.den > 0 )
{ {
p_sys->i_pts += INT64_C(1000000) * p_sys->i_pts += INT64_C(1000000) *
(2 + p_sys->p_ff_pic->repeat_pict) * (2 + p_sys->p_ff_pic->repeat_pict) *
p_sys->p_context->time_base.num * p_sys->p_context->time_base.num /
i_block_rate / INPUT_RATE_DEFAULT /
(2 * p_sys->p_context->time_base.den); (2 * p_sys->p_context->time_base.den);
} }
} }
...@@ -85,8 +85,9 @@ struct decoder_sys_t ...@@ -85,8 +85,9 @@ struct decoder_sys_t
struct subpicture_sys_t struct subpicture_sys_t
{ {
decoder_t *p_dec; decoder_t *p_dec;
void *p_subs_data; void *p_subs_data;
int i_subs_len; int i_subs_len;
mtime_t i_stream_system_delta;
}; };
/***************************************************************************** /*****************************************************************************
...@@ -165,8 +166,6 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -165,8 +166,6 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return NULL; return NULL;
p_block = *pp_block; p_block = *pp_block;
if( p_block->i_rate != 0 )
p_block->i_length = p_block->i_length * p_block->i_rate / INPUT_RATE_DEFAULT;
*pp_block = NULL; *pp_block = NULL;
if( p_block->i_buffer == 0 || p_block->p_buffer[0] == '\0' ) if( p_block->i_buffer == 0 || p_block->p_buffer[0] == '\0' )
...@@ -203,6 +202,8 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -203,6 +202,8 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
} }
memcpy( p_spu->p_sys->p_subs_data, p_block->p_buffer, memcpy( p_spu->p_sys->p_subs_data, p_block->p_buffer,
p_block->i_buffer ); p_block->i_buffer );
p_spu->p_sys->i_stream_system_delta =
p_block->i_pts - decoder_GetDisplayDate( p_dec, p_block->i_pts );
p_spu->i_start = p_block->i_pts; p_spu->i_start = p_block->i_pts;
p_spu->i_stop = p_block->i_pts + p_block->i_length; p_spu->i_stop = p_block->i_pts + p_block->i_length;
...@@ -241,7 +242,7 @@ static void PreRender( spu_t *p_spu, subpicture_t *p_subpic, ...@@ -241,7 +242,7 @@ static void PreRender( spu_t *p_spu, subpicture_t *p_subpic,
} }
static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic, static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
const video_format_t *p_fmt, mtime_t ts ) const video_format_t *p_fmt, mtime_t i_ts )
{ {
decoder_t *p_dec = p_subpic->p_sys->p_dec; decoder_t *p_dec = p_subpic->p_sys->p_dec;
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
...@@ -308,7 +309,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic, ...@@ -308,7 +309,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
csri_frame.pixfmt = CSRI_F_BGRA; csri_frame.pixfmt = CSRI_F_BGRA;
csri_frame.planes[0] = (unsigned char*)p_spu_region->p_picture->Y_PIXELS; csri_frame.planes[0] = (unsigned char*)p_spu_region->p_picture->Y_PIXELS;
csri_frame.strides[0] = p_spu_region->p_picture->Y_PITCH; csri_frame.strides[0] = p_spu_region->p_picture->Y_PITCH;
csri_render( p_sys->p_instance, &csri_frame, ts * 0.000001 ); csri_render( p_sys->p_instance, &csri_frame, (i_ts + p_subpic->p_sys->i_stream_system_delta) * 0.000001 );
} }
} }
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_input.h>
#include <vlc_aout.h> #include <vlc_aout.h>
#include <vlc_codec.h> #include <vlc_codec.h>
#include <vlc_input.h>
#include <faad.h> #include <faad.h>
...@@ -73,8 +73,6 @@ struct decoder_sys_t ...@@ -73,8 +73,6 @@ struct decoder_sys_t
uint32_t pi_channel_positions[MAX_CHANNEL_POSITIONS]; uint32_t pi_channel_positions[MAX_CHANNEL_POSITIONS];
bool b_sbr, b_ps; bool b_sbr, b_ps;
int i_input_rate;
}; };
static const uint32_t pi_channels_in[MAX_CHANNEL_POSITIONS] = static const uint32_t pi_channels_in[MAX_CHANNEL_POSITIONS] =
...@@ -188,8 +186,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -188,8 +186,6 @@ static int Open( vlc_object_t *p_this )
p_sys->i_buffer = p_sys->i_buffer_size = 0; p_sys->i_buffer = p_sys->i_buffer_size = 0;
p_sys->p_buffer = NULL; p_sys->p_buffer = NULL;
p_sys->i_input_rate = INPUT_RATE_DEFAULT;
/* Faad2 can't deal with truncated data (eg. from MPEG TS) */ /* Faad2 can't deal with truncated data (eg. from MPEG TS) */
p_dec->b_need_packetized = true; p_dec->b_need_packetized = true;
...@@ -215,9 +211,6 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -215,9 +211,6 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
return NULL; return NULL;
} }
if( p_block->i_rate > 0 )
p_sys->i_input_rate = p_block->i_rate;
/* Remove ADTS header if we have decoder specific config */ /* Remove ADTS header if we have decoder specific config */
if( p_dec->fmt_in.i_extra && p_block->i_buffer > 7 ) if( p_dec->fmt_in.i_extra && p_block->i_buffer > 7 )
{ {
...@@ -431,8 +424,7 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -431,8 +424,7 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
} }
p_out->start_date = aout_DateGet( &p_sys->date ); p_out->start_date = aout_DateGet( &p_sys->date );
p_out->end_date = aout_DateIncrement( &p_sys->date, p_out->end_date = aout_DateIncrement( &p_sys->date, frame.samples / frame.channels );
(frame.samples / frame.channels) * p_sys->i_input_rate / INPUT_RATE_DEFAULT );
DoReordering( (uint32_t *)p_out->p_buffer, samples, DoReordering( (uint32_t *)p_out->p_buffer, samples,
frame.samples / frame.channels, frame.channels, frame.samples / frame.channels, frame.channels,
......
...@@ -103,8 +103,9 @@ static void DecSysHold( decoder_sys_t *p_sys ); ...@@ -103,8 +103,9 @@ static void DecSysHold( decoder_sys_t *p_sys );
struct subpicture_sys_t struct subpicture_sys_t
{ {
decoder_sys_t *p_dec_sys; decoder_sys_t *p_dec_sys;
void *p_subs_data; void *p_subs_data;
int i_subs_len; int i_subs_len;
mtime_t i_stream_system_delta;
}; };
typedef struct typedef struct
...@@ -218,24 +219,9 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -218,24 +219,9 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_block = *pp_block; p_block = *pp_block;
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{ {
msg_Dbg( p_dec, "Resetting libass track after time discontinuity" );
/* We need to reset our tracks for the time discontinuity to be
* handled */
vlc_mutex_lock( p_sys->p_ass->p_lock );
if( p_sys->p_track )
ass_free_track( p_sys->p_track );
p_sys->p_track = ass_new_track( p_sys->p_ass->p_library );
if( p_sys->p_track )
ass_process_codec_private( p_sys->p_track,
p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra );
vlc_mutex_unlock( p_sys->p_ass->p_lock );
block_Release( p_block ); block_Release( p_block );
return NULL; return NULL;
} }
if( p_block->i_rate != 0 )
p_block->i_length = p_block->i_length * p_block->i_rate / INPUT_RATE_DEFAULT;
*pp_block = NULL; *pp_block = NULL;
if( p_block->i_buffer == 0 || p_block->p_buffer[0] == '\0' ) if( p_block->i_buffer == 0 || p_block->p_buffer[0] == '\0' )
...@@ -271,6 +257,8 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -271,6 +257,8 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
} }
memcpy( p_spu->p_sys->p_subs_data, p_block->p_buffer, memcpy( p_spu->p_sys->p_subs_data, p_block->p_buffer,
p_block->i_buffer ); p_block->i_buffer );
p_spu->p_sys->i_stream_system_delta =
p_block->i_pts - decoder_GetDisplayDate( p_dec, p_block->i_pts );
p_spu->i_start = p_block->i_pts; p_spu->i_start = p_block->i_pts;
p_spu->i_stop = p_block->i_pts + p_block->i_length; p_spu->i_stop = p_block->i_pts + p_block->i_length;
...@@ -354,7 +342,8 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic, ...@@ -354,7 +342,8 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
/* */ /* */
int i_changed; int i_changed;
ass_image_t *p_img = ass_render_frame( p_ass->p_renderer, p_sys->p_track, i_ts/1000, &i_changed ); ass_image_t *p_img = ass_render_frame( p_ass->p_renderer, p_sys->p_track,
(i_ts + p_subpic->p_sys->i_stream_system_delta)/1000, &i_changed );
if( !i_changed && !b_fmt_changed ) if( !i_changed && !b_fmt_changed )
{ {
......
...@@ -57,7 +57,6 @@ struct decoder_sys_t ...@@ -57,7 +57,6 @@ struct decoder_sys_t
mtime_t i_current_pts; mtime_t i_current_pts;
mtime_t i_previous_dts; mtime_t i_previous_dts;
mtime_t i_current_dts; mtime_t i_current_dts;
int i_current_rate;
picture_t * p_picture_to_destroy; picture_t * p_picture_to_destroy;
bool b_garbage_pic; bool b_garbage_pic;
bool b_after_sequence_header; /* is it the next frame after bool b_after_sequence_header; /* is it the next frame after
...@@ -247,7 +246,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -247,7 +246,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if ( p_sys->b_slice_i ) if ( p_sys->b_slice_i )
{ {
decoder_SynchroNewPicture( p_sys->p_synchro, decoder_SynchroNewPicture( p_sys->p_synchro,
I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate, I_CODING_TYPE, 2, 0, 0,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
decoder_SynchroDecode( p_sys->p_synchro ); decoder_SynchroDecode( p_sys->p_synchro );
decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 ); decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
...@@ -283,8 +282,6 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -283,8 +282,6 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->i_current_dts = p_block->i_dts; p_sys->i_current_dts = p_block->i_dts;
} }
p_sys->i_current_rate = p_block->i_rate;
mpeg2_buffer( p_sys->p_mpeg2dec, p_block->p_buffer, mpeg2_buffer( p_sys->p_mpeg2dec, p_block->p_buffer,
p_block->p_buffer + p_block->i_buffer ); p_block->p_buffer + p_block->i_buffer );
...@@ -355,7 +352,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -355,7 +352,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
/* Intra-slice refresh. Simulate a blank I picture. */ /* Intra-slice refresh. Simulate a blank I picture. */
msg_Dbg( p_dec, "intra-slice refresh stream" ); msg_Dbg( p_dec, "intra-slice refresh stream" );
decoder_SynchroNewPicture( p_sys->p_synchro, decoder_SynchroNewPicture( p_sys->p_synchro,
I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate, I_CODING_TYPE, 2, 0, 0,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
decoder_SynchroDecode( p_sys->p_synchro ); decoder_SynchroDecode( p_sys->p_synchro );
decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 ); decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
...@@ -405,7 +402,6 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -405,7 +402,6 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE, p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE,
p_sys->p_info->current_picture->nb_fields == 1 ? 2 : p_sys->p_info->current_picture->nb_fields == 1 ? 2 :
p_sys->p_info->current_picture->nb_fields, i_pts, i_dts, p_sys->p_info->current_picture->nb_fields, i_pts, i_dts,
p_sys->i_current_rate,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
if( !p_dec->b_pace_control && !p_sys->b_preroll && if( !p_dec->b_pace_control && !p_sys->b_preroll &&
...@@ -455,7 +451,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -455,7 +451,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->b_garbage_pic ); p_sys->b_garbage_pic );
p_sys->b_garbage_pic = 0; p_sys->b_garbage_pic = 0;
if ( p_sys->p_picture_to_destroy != p_pic ) if( p_sys->p_picture_to_destroy != p_pic )
{ {
p_pic->date = decoder_SynchroDate( p_sys->p_synchro ); p_pic->date = decoder_SynchroDate( p_sys->p_synchro );
} }
...@@ -535,7 +531,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -535,7 +531,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( p_sys->b_slice_i ) if( p_sys->b_slice_i )
{ {
decoder_SynchroNewPicture( p_sys->p_synchro, decoder_SynchroNewPicture( p_sys->p_synchro,
I_CODING_TYPE, 2, 0, 0, p_sys->i_current_rate, I_CODING_TYPE, 2, 0, 0,
p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ); p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
decoder_SynchroDecode( p_sys->p_synchro ); decoder_SynchroDecode( p_sys->p_synchro );
decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 ); decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_codec.h> #include <vlc_codec.h>
#include <vlc_aout.h> #include <vlc_aout.h>
#include <vlc_input.h>
#include <vlc_block_helper.h> #include <vlc_block_helper.h>
...@@ -68,8 +67,6 @@ struct decoder_sys_t ...@@ -68,8 +67,6 @@ struct decoder_sys_t
unsigned int i_layer, i_bit_rate; unsigned int i_layer, i_bit_rate;
bool b_discontinuity; bool b_discontinuity;
int i_input_rate;
}; };
enum { enum {
...@@ -160,7 +157,6 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -160,7 +157,6 @@ static int OpenDecoder( vlc_object_t *p_this )
aout_DateSet( &p_sys->end_date, 0 ); aout_DateSet( &p_sys->end_date, 0 );
p_sys->bytestream = block_BytestreamInit(); p_sys->bytestream = block_BytestreamInit();
p_sys->b_discontinuity = false; p_sys->b_discontinuity = false;