summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2002-03-22 17:38:21 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2002-03-22 17:38:21 +0000
commitf5f8a1b77fcf14b73a4ed63bb5e7c55de52d7023 (patch)
treee62342474b8dd54d4e697add22bfb5d8c15a7c56 /src
parent57971d8942669e4290cc1e24bdbe892780f4120c (diff)
downloadxine-lib-f5f8a1b77fcf14b73a4ed63bb5e7c55de52d7023.tar.gz
xine-lib-f5f8a1b77fcf14b73a4ed63bb5e7c55de52d7023.tar.bz2
performance improvements for slower systems
CVS patchset: 1615 CVS date: 2002/03/22 17:38:21
Diffstat (limited to 'src')
-rw-r--r--src/libdivx4/xine_decoder.c23
-rw-r--r--src/xine-engine/video_out.c13
2 files changed, 25 insertions, 11 deletions
diff --git a/src/libdivx4/xine_decoder.c b/src/libdivx4/xine_decoder.c
index 3622f0206..249d37393 100644
--- a/src/libdivx4/xine_decoder.c
+++ b/src/libdivx4/xine_decoder.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_decoder.c,v 1.21 2002/03/19 16:17:08 f1rmb Exp $
+ * $Id: xine_decoder.c,v 1.22 2002/03/22 17:38:21 miguelfreitas Exp $
*
* xine decoder plugin using divx4
*
@@ -121,6 +121,7 @@ typedef struct divx4_decoder_s {
OpenDivx cannot, so the user can set it in .xinerc. If 0, can_handle
only returns MPEG4, yielding 311 to ffmpeg */
int can_handle_311;
+ int skipframes;
} divx4_decoder_t;
#define VIDEOBUFSIZE 128*1024
@@ -380,6 +381,8 @@ static void divx4_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
this->buf = malloc( VIDEOBUFSIZE );
this->bufsize = VIDEOBUFSIZE;
+
+ this->skipframes = 0;
}
return;
}
@@ -401,6 +404,9 @@ static void divx4_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size);
this->size += buf->size;
+
+ if (buf->decoder_flags & BUF_FLAG_FRAMERATE)
+ this->video_step = buf->decoder_info[0];
if (buf->decoder_flags & BUF_FLAG_FRAME_END) { /* need to decode a frame */
/* allocate image (taken from ffmpeg plugin) */
@@ -409,6 +415,7 @@ static void divx4_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
IMGFMT_YV12,
VO_BOTH_FIELDS);
+ img->pts = buf->pts;
img->duration = this->video_step;
/* setup the decode frame parameters, as demonstrated by avifile.
Old versions used DEC_YV12, but that was basically wrong and just
@@ -425,18 +432,20 @@ static void divx4_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
else
ret = this->decore((unsigned long)this, DEC_OPT_FRAME, &frame, 0);
- if (ret != DEC_OK) {
- printf("divx4: decore DEC_OPT_FRAME command returned %s.\n",
- decore_retval(ret));
+ if (ret != DEC_OK || this->skipframes) {
+ if( !this->skipframes )
+ printf("divx4: decore DEC_OPT_FRAME command returned %s.\n",
+ decore_retval(ret));
img->bad_frame = 1; /* better skip this one */
}
else {
divx4_copy_frame(this, img, pict);
+ img->bad_frame = 0;
}
- /* this again from ffmpeg plugin */
- img->pts = buf->pts;
- img->draw(img);
+ this->skipframes = img->draw(img);
+ if( this->skipframes < 0 )
+ this->skipframes = 0;
img->free(img);
this->size = 0;
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 4306826f8..002ce4982 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out.c,v 1.85 2002/03/22 13:33:22 miguelfreitas Exp $
+ * $Id: video_out.c,v 1.86 2002/03/22 17:38:21 miguelfreitas Exp $
*
* frame allocation / queuing / scheduling / output functions
*/
@@ -397,7 +397,10 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) {
without it decoder may try to free our backup. */
this->img_backup = img;
this->backup_is_logo = 0;
- this->redraw_needed = 1;
+
+ /* wait 4 frames before drawing this one.
+ this allow slower systems to recover. */
+ this->redraw_needed = 4;
} else {
pthread_mutex_lock (&img->mutex);
@@ -467,7 +470,7 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts) {
this->redraw_needed = 1;
}
- if (this->img_backup && this->redraw_needed) {
+ if (this->img_backup && (this->redraw_needed==1)) {
#ifdef LOG
printf("video_out: generating still frame (cur_vpts = %lld) \n",
@@ -487,7 +490,9 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts) {
return img;
} else {
-
+
+ if( this->redraw_needed )
+ this->redraw_needed--;
#ifdef LOG
printf ("video_out: no frame, but no backup frame\n");
#endif