[MPlayer-cvslog] r26958 - in trunk/libmpdemux: demuxer.c demuxer.h
nicodvb
subversion at mplayerhq.hu
Mon Jun 2 12:17:49 CEST 2008
Author: nicodvb
Date: Mon Jun 2 12:17:48 2008
New Revision: 26958
Log:
added and reused demux_flush() instead of emptying the demux_stream buffers;
patch by Bryan Henderson - giraffedata gmail com
Modified:
trunk/libmpdemux/demuxer.c
trunk/libmpdemux/demuxer.h
Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c (original)
+++ trunk/libmpdemux/demuxer.c Mon Jun 2 12:17:48 2008
@@ -943,6 +943,12 @@ demuxer_t* demux_open(stream_t *vs,int f
}
+void demux_flush(demuxer_t *demuxer) {
+ ds_free_packs(demuxer->video);
+ ds_free_packs(demuxer->audio);
+ ds_free_packs(demuxer->sub);
+}
+
int demux_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
demux_stream_t *d_audio=demuxer->audio;
demux_stream_t *d_video=demuxer->video;
@@ -963,11 +969,9 @@ if(!demuxer->seekable){
return 0;
}
+ demux_flush(demuxer);
// clear demux buffers:
- if(sh_audio){ ds_free_packs(d_audio);sh_audio->a_buffer_len=0;}
- ds_free_packs(d_video);
- ds_free_packs(demuxer->sub);
-
+ if(sh_audio) sh_audio->a_buffer_len=0;
demuxer->stream->eof=0; // clear eof flag
demuxer->video->eof=0;
demuxer->audio->eof=0;
@@ -1197,14 +1201,7 @@ int demuxer_seek_chapter(demuxer_t *demu
chapter += current;
}
- if(demuxer->video->sh)
- ds_free_packs(demuxer->video);
-
- if(demuxer->audio->sh)
- ds_free_packs(demuxer->audio);
-
- if(demuxer->sub->id >= 0)
- ds_free_packs(demuxer->sub);
+ demux_flush(demuxer);
ris = stream_control(demuxer->stream, STREAM_CTRL_SEEK_TO_CHAPTER, &chapter);
if(ris != STREAM_UNSUPPORTED)
@@ -1369,14 +1366,7 @@ int demuxer_set_angle(demuxer_t *demuxer
angles = demuxer_angles_count(demuxer);
if((angles < 1) || (angle > angles)) return -1;
- if(demuxer->video->sh)
- ds_free_packs(demuxer->video);
-
- if(demuxer->audio->sh)
- ds_free_packs(demuxer->audio);
-
- if(demuxer->sub->id >= 0)
- ds_free_packs(demuxer->sub);
+ demux_flush(demuxer);
ris = stream_control(demuxer->stream, STREAM_CTRL_SET_ANGLE, &angle);
if(ris == STREAM_UNSUPPORTED) return -1;
Modified: trunk/libmpdemux/demuxer.h
==============================================================================
--- trunk/libmpdemux/demuxer.h (original)
+++ trunk/libmpdemux/demuxer.h Mon Jun 2 12:17:48 2008
@@ -369,6 +369,7 @@ static inline int avi_stream_id(unsigned
}
demuxer_t* demux_open(stream_t *stream,int file_format,int aid,int vid,int sid,char* filename);
+void demux_flush(demuxer_t *demuxer);
int demux_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags);
demuxer_t* new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd);
More information about the MPlayer-cvslog
mailing list