diff options
author | Thomas Hellström <totte67@users.sourceforge.net> | 2004-11-13 19:32:51 +0000 |
---|---|---|
committer | Thomas Hellström <totte67@users.sourceforge.net> | 2004-11-13 19:32:51 +0000 |
commit | a213a237d17cd0fb00611fe56380a94e3b675638 (patch) | |
tree | fe2becd5ec1174361acf90e0977c8bd4f5c1690c /src/libmpeg2 | |
parent | c6a1bafda333d15e7b5559cc085200a3c930a13c (diff) | |
download | xine-lib-a213a237d17cd0fb00611fe56380a94e3b675638.tar.gz xine-lib-a213a237d17cd0fb00611fe56380a94e3b675638.tar.bz2 |
Fixed segfault when seeking with the "xvmc" and "xxmc" plugins playing
files with IDCT / mocomp XvMC acceleration.
Cleaned up some ugly xvmc / xxmc naming.
CVS patchset: 7122
CVS date: 2004/11/13 19:32:51
Diffstat (limited to 'src/libmpeg2')
-rw-r--r-- | src/libmpeg2/Makefile.am | 2 | ||||
-rw-r--r-- | src/libmpeg2/decode.c | 8 | ||||
-rw-r--r-- | src/libmpeg2/mpeg2.h | 2 | ||||
-rw-r--r-- | src/libmpeg2/mpeg2_internal.h | 5 | ||||
-rw-r--r-- | src/libmpeg2/slice_xvmc.c | 12 | ||||
-rw-r--r-- | src/libmpeg2/slice_xvmc_vld.c | 22 | ||||
-rw-r--r-- | src/libmpeg2/xvmc.h | 30 | ||||
-rw-r--r-- | src/libmpeg2/xvmc_vld.h | 34 | ||||
-rw-r--r-- | src/libmpeg2/xxmc.h | 13 |
9 files changed, 94 insertions, 34 deletions
diff --git a/src/libmpeg2/Makefile.am b/src/libmpeg2/Makefile.am index 78351525d..7bec5f8b0 100644 --- a/src/libmpeg2/Makefile.am +++ b/src/libmpeg2/Makefile.am @@ -28,4 +28,4 @@ xineplug_decode_mpeg2_la_SOURCES = \ xineplug_decode_mpeg2_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) xineplug_decode_mpeg2_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@ -noinst_HEADERS = vlc.h mpeg2.h xxmc.h mpeg2_internal.h idct_mlib.h vis.h +noinst_HEADERS = vlc.h mpeg2.h xvmc.h xvmc_vld.h mpeg2_internal.h idct_mlib.h vis.h diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index 2d8830a84..a6102ea15 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -41,7 +41,7 @@ #include "mpeg2.h" #include "mpeg2_internal.h" #include "xineutils.h" -#include "xxmc.h" +#include "xvmc_vld.h" /* #define LOG_PAN_SCAN @@ -642,7 +642,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, break; case XINE_XVMC_ACCEL_IDCT: case XINE_XVMC_ACCEL_MOCOMP: - mpeg2_xvmc_slice (picture, code, buffer); + mpeg2_xvmc_slice (mpeg2dec, picture, code, buffer); break; default: mpeg2_slice (picture, code, buffer); @@ -656,7 +656,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, break; } case XINE_IMGFMT_XVMC: - mpeg2_xvmc_slice (picture, code, buffer); + mpeg2_xvmc_slice (mpeg2dec, picture, code, buffer); break; default: mpeg2_slice (picture, code, buffer); @@ -764,7 +764,7 @@ void mpeg2_discontinuity (mpeg2dec_t * mpeg2dec) { * Move to libmpeg2_accel.c * int libmpeg2_accel_discontinuity(mpeg2dec_t *); */ - mpeg2dec->xxmc_last_slice_code=-1; + mpeg2dec->xvmc_last_slice_code=-1; /* * End of discontinuity accel code. */ diff --git a/src/libmpeg2/mpeg2.h b/src/libmpeg2/mpeg2.h index b2ecf669e..679400d3e 100644 --- a/src/libmpeg2/mpeg2.h +++ b/src/libmpeg2/mpeg2.h @@ -59,7 +59,7 @@ typedef struct mpeg2dec_s { /* a spu decoder for possible closed captions */ spu_decoder_t *cc_dec; - int xxmc_last_slice_code; + int xvmc_last_slice_code; unsigned xxmc_mb_pic_height; } mpeg2dec_t ; diff --git a/src/libmpeg2/mpeg2_internal.h b/src/libmpeg2/mpeg2_internal.h index cb00a830b..6a9c9a775 100644 --- a/src/libmpeg2/mpeg2_internal.h +++ b/src/libmpeg2/mpeg2_internal.h @@ -284,8 +284,7 @@ extern mpeg2_mc_t mpeg2_mc_vis; /* slice.c */ void mpeg2_slice (picture_t * picture, int code, uint8_t * buffer); -/* slice_xvmc.c */ -void mpeg2_xvmc_slice (picture_t * picture, int code, uint8_t * buffer); - /* stats.c */ void mpeg2_stats (int code, uint8_t * buffer); + + diff --git a/src/libmpeg2/slice_xvmc.c b/src/libmpeg2/slice_xvmc.c index 1f6176e78..c4d2a5ff0 100644 --- a/src/libmpeg2/slice_xvmc.c +++ b/src/libmpeg2/slice_xvmc.c @@ -35,6 +35,8 @@ #include "attributes.h" #include "accel_xvmc.h" +#include "xvmc.h" + #define MOTION_ACCEL XINE_VO_MOTION_ACCEL #define IDCT_ACCEL XINE_VO_IDCT_ACCEL @@ -1694,7 +1696,7 @@ static inline int slice_xvmc_init (picture_t * picture, int code) #undef bit_ptr } -void mpeg2_xvmc_slice (picture_t * picture, int code, uint8_t * buffer) +void mpeg2_xvmc_slice (mpeg2dec_t *mpeg2dec, picture_t * picture, int code, uint8_t * buffer) { #define bit_buf (picture->bitstream_buf) #define bits (picture->bitstream_bits) @@ -1702,6 +1704,12 @@ void mpeg2_xvmc_slice (picture_t * picture, int code, uint8_t * buffer) cpu_state_t cpu_state; xine_xvmc_t *xvmc = (xine_xvmc_t *) picture->current_frame->accel_data; + if (1 == code) { + mpeg2dec->xvmc_last_slice_code = 0; + } + if (code != mpeg2dec->xvmc_last_slice_code + 1) + return; + bitstream_init (picture, buffer); if (slice_xvmc_init (picture, code)) @@ -1928,6 +1936,7 @@ void mpeg2_xvmc_slice (picture_t * picture, int code, uint8_t * buffer) default: /* end of slice, or error */ if (mpeg2_cpu_state_restore) mpeg2_cpu_state_restore (&cpu_state); + mpeg2dec->xvmc_last_slice_code++; return; } } @@ -2027,6 +2036,7 @@ void mpeg2_xvmc_slice (picture_t * picture, int code, uint8_t * buffer) } } } + mpeg2dec->xvmc_last_slice_code++; #undef bit_buf #undef bits #undef bit_ptr diff --git a/src/libmpeg2/slice_xvmc_vld.c b/src/libmpeg2/slice_xvmc_vld.c index 3da94237b..006aea275 100644 --- a/src/libmpeg2/slice_xvmc_vld.c +++ b/src/libmpeg2/slice_xvmc_vld.c @@ -21,7 +21,7 @@ #include "video_out.h" #include "mpeg2.h" #include "mpeg2_internal.h" -#include "xxmc.h" +#include "xvmc_vld.h" static uint8_t zig_zag_scan[64] ATTR_ALIGN(16) = { @@ -117,10 +117,10 @@ void mpeg2_xxmc_slice( mpeg2dec_t *mpeg2dec, picture_t *picture, int code, */ if (picture->second_field) { - mpeg2dec->xxmc_last_slice_code = (xxmc->decoded) ? 0 : -1; + mpeg2dec->xvmc_last_slice_code = (xxmc->decoded) ? 0 : -1; xxmc->decoded = 0; } else { - mpeg2dec->xxmc_last_slice_code = 0; + mpeg2dec->xvmc_last_slice_code = 0; } mb_frame_height = @@ -188,11 +188,11 @@ void mpeg2_xxmc_slice( mpeg2dec_t *mpeg2dec, picture_t *picture, int code, xxmc->proc_xxmc_begin( frame ); if (xxmc->result != 0) { xxmc->proc_xxmc_flush( frame ); - mpeg2dec->xxmc_last_slice_code=-1; + mpeg2dec->xvmc_last_slice_code=-1; } } - if ((code == mpeg2dec->xxmc_last_slice_code + 1) && + if ((code == mpeg2dec->xvmc_last_slice_code + 1) && code <= mpeg2dec->xxmc_mb_pic_height) { /* @@ -208,7 +208,7 @@ void mpeg2_xxmc_slice( mpeg2dec_t *mpeg2dec, picture_t *picture, int code, xxmc->proc_xxmc_slice( frame ); if (xxmc->result != 0) { xxmc->proc_xxmc_flush( frame ); - mpeg2dec->xxmc_last_slice_code=-1; + mpeg2dec->xvmc_last_slice_code=-1; return; } @@ -228,7 +228,7 @@ void mpeg2_xxmc_slice( mpeg2dec_t *mpeg2dec, picture_t *picture, int code, * Keep track of slices. */ - mpeg2dec->xxmc_last_slice_code++; + mpeg2dec->xvmc_last_slice_code++; } } else { @@ -238,7 +238,7 @@ void mpeg2_xxmc_slice( mpeg2dec_t *mpeg2dec, picture_t *picture, int code, */ lprintf("libmpeg2: VLD XvMC: Slice error.\n"); - mpeg2dec->xxmc_last_slice_code = -1; + mpeg2dec->xvmc_last_slice_code = -1; xxmc->proc_xxmc_flush( frame ); return; } @@ -252,14 +252,14 @@ void mpeg2_xxmc_vld_frame_complete(mpeg2dec_t *mpeg2dec, picture_t *picture, int *xxmc = (xine_xxmc_t *) frame->accel_data; if (xxmc->decoded) return; - if (mpeg2dec->xxmc_last_slice_code >= 1) { + if (mpeg2dec->xvmc_last_slice_code >= 1) { xxmc->proc_xxmc_flush( frame ); if (xxmc->result) { - mpeg2dec->xxmc_last_slice_code=-1; + mpeg2dec->xvmc_last_slice_code=-1; return; } xxmc->decoded = 1; - mpeg2dec->xxmc_last_slice_code++; + mpeg2dec->xvmc_last_slice_code++; if (picture->picture_structure == 3 || picture->second_field) { if (xxmc->result == 0) frame->bad_frame = 0; diff --git a/src/libmpeg2/xvmc.h b/src/libmpeg2/xvmc.h new file mode 100644 index 000000000..3abecdb77 --- /dev/null +++ b/src/libmpeg2/xvmc.h @@ -0,0 +1,30 @@ +/* + * mpeg2_internal.h + * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org> + * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> + * + * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. + * See http://libmpeg2.sourceforge.net/ for updates. + * + * mpeg2dec is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * mpeg2dec is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _XVMC_H +#include "mpeg2.h" + +/* slice_xvmc.c */ +void mpeg2_xvmc_slice (mpeg2dec_t *mpeg2dec, picture_t * picture, int code, uint8_t * buffer); + +#endif diff --git a/src/libmpeg2/xvmc_vld.h b/src/libmpeg2/xvmc_vld.h new file mode 100644 index 000000000..adc4a7a04 --- /dev/null +++ b/src/libmpeg2/xvmc_vld.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2004 The Unichrome project. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTIES OR REPRESENTATIONS; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + */ + +#ifndef _XVMC_VLD_H +#define _XVMC_VLD_H + +#include "accel_xvmc.h" +#include "xvmc.h" + +extern void mpeg2_xxmc_slice( mpeg2dec_t *mpeg2dec, picture_t *picture, + int code, uint8_t *buffer); +extern void mpeg2_xxmc_choose_coding(mpeg2dec_t *mpeg2dec, picture_t *picture, + double aspect_ratio, int flags); + +extern void mpeg2_xxmc_vld_frame_complete(mpeg2dec_t *mpeg2dec, picture_t *picture, int code); + + +#endif diff --git a/src/libmpeg2/xxmc.h b/src/libmpeg2/xxmc.h deleted file mode 100644 index 222ead11b..000000000 --- a/src/libmpeg2/xxmc.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _XXMC_H -#define _XXMC_H - -#include "accel_xvmc.h" - -extern void mpeg2_xxmc_slice( mpeg2dec_t *mpeg2dec, picture_t *picture, - int code, uint8_t *buffer); -extern void mpeg2_xxmc_choose_coding(mpeg2dec_t *mpeg2dec, picture_t *picture, - double aspect_ratio, int flags); - -extern void mpeg2_xxmc_vld_frame_complete(mpeg2dec_t *mpeg2dec, picture_t *picture, int code); - -#endif |