1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-18 21:06:00 +00:00

move resync_audio_stream after seeking to demuxer.c

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16878 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2005-10-30 09:19:05 +00:00
parent 9e15dfe7fc
commit 2912984517
15 changed files with 3 additions and 44 deletions

View File

@ -14,8 +14,6 @@
#include "bswap.h"
#include "ms_hdr.h"
extern void resync_audio_stream(sh_audio_t *sh_audio);
typedef struct {
uint8_t *buf;
uint64_t size; /// amount of time of data packets pushed to demuxer->audio (in bytes)
@ -248,7 +246,6 @@ static void demux_aac_seek(demuxer_t *demuxer, float rel_seek_secs, int flags)
}
}
sh_audio->delay = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)priv->bitrate;
resync_audio_stream(sh_audio);
}

View File

@ -359,7 +359,6 @@ static int demux_asf_fill_buffer(demuxer_t *demux, demux_stream_t *ds){
#include "stheader.h"
extern void resync_audio_stream(sh_audio_t *sh_audio);
extern void skip_audio_frame(sh_audio_t *sh_audio);
static void demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,int flags){
@ -390,7 +389,6 @@ static void demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,int flags){
ds_fill_buffer(d_video);
if(sh_audio){
ds_fill_buffer(d_audio);
resync_audio_stream(sh_audio);
}
if (d_video->id < 0)

View File

@ -44,7 +44,6 @@ typedef struct mp3_hdr {
} mp3_hdr_t;
extern void free_sh_audio(sh_audio_t* sh);
extern void resync_audio_stream(sh_audio_t *sh_audio);
extern void print_wave_header(WAVEFORMATEX *h);
int hr_mp3_seek = 0;
@ -496,7 +495,6 @@ static void demux_audio_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
if(len > 0)
high_res_mp3_seek(demuxer,len);
sh_audio->delay = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
resync_audio_stream(sh_audio);
return;
}
@ -527,9 +525,6 @@ static void demux_audio_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
}
stream_seek(s,pos);
resync_audio_stream(sh_audio);
}
static void demux_close_audio(demuxer_t* demuxer) {

View File

@ -617,7 +617,6 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
}
//extern float initial_pts_delay;
extern void resync_audio_stream(sh_audio_t *sh_audio);
void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,int flags){
avi_priv_t *priv=demuxer->priv;
@ -806,7 +805,6 @@ void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,int flags){
demux_read_data(d_audio,NULL,skip_audio_bytes);
//d_audio->pts=0; // PTS is outdated because of the raw data skipping
}
resync_audio_stream(sh_audio);
// sh_audio->timer=-skip_audio_secs;

View File

@ -3117,7 +3117,6 @@ demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, int flags)
free_cached_dps (demuxer);
if (!(flags & 2)) /* time in secs */
{
void resync_audio_stream(sh_audio_t *sh_audio);
mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
stream_t *s = demuxer->stream;
int64_t target_timecode = 0, diff, min_diff=0xFFFFFFFL;
@ -3228,15 +3227,11 @@ demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, int flags)
clear_subtitles(demuxer, 0, 1);
demux_mkv_fill_buffer(demuxer, NULL);
if(demuxer->audio->sh != NULL)
resync_audio_stream((sh_audio_t *) demuxer->audio->sh);
}
else if ((demuxer->movi_end <= 0) || !(flags & 1))
mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] seek unsupported flags\n");
else
{
void resync_audio_stream(sh_audio_t *sh_audio);
mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
stream_t *s = demuxer->stream;
uint64_t target_filepos;
@ -3274,9 +3269,6 @@ demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, int flags)
clear_subtitles(demuxer, 0, 1);
demux_mkv_fill_buffer(demuxer, NULL);
if(demuxer->audio->sh != NULL)
resync_audio_stream((sh_audio_t *) demuxer->audio->sh);
}
}

View File

@ -181,7 +181,6 @@ static void demux_mpc_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
if (!sh_audio) return;
sh_audio->delay = priv->last_pts - (ds_tell_pts(demuxer->audio) -
sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
resync_audio_stream(sh_audio);
}
static void demux_close_mpc(demuxer_t* demuxer) {

View File

@ -669,7 +669,6 @@ do{
return 1;
}
extern void resync_audio_stream(sh_audio_t *sh_audio);
extern void skip_audio_frame(sh_audio_t *sh_audio);
void demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,int flags){
@ -733,7 +732,6 @@ void demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,int flags){
ds_fill_buffer(d_video);
if(sh_audio){
ds_fill_buffer(d_audio);
resync_audio_stream(sh_audio);
}
while(1){

View File

@ -1390,8 +1390,6 @@ demuxer_t* init_avi_with_ogg(demuxer_t* demuxer) {
}
extern void resync_audio_stream(sh_audio_t *sh_audio);
static void demux_ogg_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) {
ogg_demuxer_t* ogg_d = demuxer->priv;
ogg_sync_state* sync = &ogg_d->sync;
@ -1558,8 +1556,6 @@ static void demux_ogg_seek(demuxer_t *demuxer,float rel_seek_secs,int flags) {
vo_osd_changed(OSDTYPE_SUBTITLE);
clear_sub = -1;
demux_ogg_add_packet(ds,os,ds->id,&op);
if(sh_audio)
resync_audio_stream(sh_audio);
return;
}
}

View File

@ -30,8 +30,6 @@ m_option_t demux_rawaudio_opts[] = {
};
extern void resync_audio_stream(sh_audio_t *sh_audio);
static demuxer_t* demux_rawaudio_open(demuxer_t* demuxer) {
sh_audio_t* sh_audio;
WAVEFORMATEX* w;
@ -95,7 +93,6 @@ static void demux_rawaudio_seek(demuxer_t *demuxer,float rel_seek_secs,int flags
pos -= (pos % (sh_audio->channels * sh_audio->samplesize) );
stream_seek(s,pos);
sh_audio->delay= (pos-ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len) / (float)(sh_audio->wf->nAvgBytesPerSec);
resync_audio_stream(sh_audio);
// printf("demux_rawaudio: streamtell=%d\n",(int)stream_tell(demuxer->stream));
}

View File

@ -1748,8 +1748,6 @@ static void demux_close_real(demuxer_t *demuxer)
return;
}
extern void resync_audio_stream(sh_audio_t * sh_audio);
/* please upload RV10 samples WITH INDEX CHUNK */
static int demux_seek_real(demuxer_t *demuxer, float rel_seek_secs, int flags)
{
@ -1840,8 +1838,6 @@ static int demux_seek_real(demuxer_t *demuxer, float rel_seek_secs, int flags)
stream_seek(demuxer->stream, next_offset);
demux_real_fill_buffer(demuxer, NULL);
if (sh_audio)
resync_audio_stream(sh_audio);
return 1;
}

View File

@ -223,7 +223,6 @@ typedef struct {
#define IS_VIDEO(x) (((x) == VIDEO_MPEG1) || ((x) == VIDEO_MPEG2) || ((x) == VIDEO_MPEG4) || ((x) == VIDEO_H264) || ((x) == VIDEO_AVC))
static int ts_parse(demuxer_t *demuxer, ES_stream_t *es, unsigned char *packet, int probe);
extern void resync_audio_stream( sh_audio_t *sh_audio );
static uint8_t get_packet_size(const unsigned char *buf, int size)
{
@ -2991,7 +2990,6 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet,
}
extern void resync_audio_stream(sh_audio_t *sh_audio);
extern void skip_audio_frame(sh_audio_t *sh_audio);
static void reset_fifos(ts_priv_t* priv, int a, int v, int s)
@ -3096,7 +3094,6 @@ static void demux_seek_ts(demuxer_t *demuxer, float rel_seek_secs, int flags)
if(sh_audio != NULL)
{
ds_fill_buffer(d_audio);
resync_audio_stream(sh_audio);
}
while(sh_video != NULL)

View File

@ -45,7 +45,6 @@
#include "stheader.h"
#include "../sub_cc.h"
extern void resync_audio_stream( sh_audio_t *sh_audio );
extern void skip_audio_frame( sh_audio_t *sh_audio );
extern int sub_justify;
@ -1313,7 +1312,6 @@ static void demux_seek_ty( demuxer_t *demuxer, float rel_seek_secs, int flags )
if( sh_audio )
{
ds_fill_buffer( d_audio );
resync_audio_stream( sh_audio );
}
while( 1 )

View File

@ -9,8 +9,6 @@
#include "stheader.h"
#include "../libmpcodecs/vqf.h"
extern void resync_audio_stream(sh_audio_t *sh_audio);
static int demux_probe_vqf(demuxer_t* demuxer)
{
char buf[KEYWORD_BYTES];
@ -195,7 +193,6 @@ static void demux_seek_vqf(demuxer_t *demuxer,float rel_seek_secs,int flags){
pos -= (pos % (sh_audio->channels * sh_audio->samplesize) );
stream_seek(s,pos);
resync_audio_stream(sh_audio);
#endif
}

View File

@ -199,8 +199,6 @@ static void cleanup_plugins(){
// ============================ mplayer demuxer stuff ===============
//extern void resync_audio_stream(sh_audio_t *sh_audio);
static int demux_xmms_open(demuxer_t* demuxer) {
InputPlugin* ip = NULL;
sh_audio_t* sh_audio;

View File

@ -21,6 +21,7 @@
#include "../libaf/af_format.h"
#include "../libvo/fastmemcpy.h"
extern void resync_audio_stream(sh_audio_t *sh_audio);
// Demuxer list
extern demuxer_desc_t demuxer_desc_rawaudio;
@ -856,6 +857,8 @@ if(!demuxer->seekable){
if (demuxer->desc->seek)
demuxer->desc->seek(demuxer,rel_seek_secs,flags);
if (sh_audio) resync_audio_stream(sh_audio);
return 1;
}