diff options
author | Eduard Hasenleithner <ehasenle@users.sourceforge.net> | 2001-08-16 12:33:00 +0000 |
---|---|---|
committer | Eduard Hasenleithner <ehasenle@users.sourceforge.net> | 2001-08-16 12:33:00 +0000 |
commit | f97eaa174cdc767a986550c710a98bb2877a01f1 (patch) | |
tree | 28a20c6a8abc26c4ae9b1ceffeb298b3beb41deb | |
parent | 5e0c7d8f50c9b2173444b1a8f87af97fe2286410 (diff) | |
download | xine-lib-f97eaa174cdc767a986550c710a98bb2877a01f1.tar.gz xine-lib-f97eaa174cdc767a986550c710a98bb2877a01f1.tar.bz2 |
clut_t is now stored in machine endianess. Simplifies the transfer
of the clut from the input plugin.
CVS patchset: 434
CVS date: 2001/08/16 12:33:00
-rw-r--r-- | src/input/input_plugin.h | 12 | ||||
-rw-r--r-- | src/libspudec/spu.h | 12 | ||||
-rw-r--r-- | src/libspudec/xine_decoder.c | 16 | ||||
-rw-r--r-- | src/video_out/alphablend.c | 12 | ||||
-rw-r--r-- | src/video_out/alphablend.h | 7 |
5 files changed, 24 insertions, 35 deletions
diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index d788d3bd1..fa4e0a656 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -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: input_plugin.h,v 1.10 2001/07/18 21:38:16 f1rmb Exp $ + * $Id: input_plugin.h,v 1.11 2001/08/16 12:33:00 ehasenle Exp $ */ #ifndef HAVE_INPUT_PLUGIN_H @@ -35,16 +35,6 @@ extern "C" { #define INPUT_PLUGIN_IFACE_VERSION 2 -#ifndef CLUT_T -#define CLUT_T -typedef struct { /* CLUT == Color LookUp Table */ - uint8_t foo : 8; /* UNKNOWN: 0x00? */ - uint8_t y : 8; - uint8_t cr : 8; - uint8_t cb : 8; -} __attribute__ ((packed)) clut_t; -#endif - /* * Return pointer of allocate/cleaned memory size *size*. */ diff --git a/src/libspudec/spu.h b/src/libspudec/spu.h index 6899c7af8..42de3a9ea 100644 --- a/src/libspudec/spu.h +++ b/src/libspudec/spu.h @@ -19,7 +19,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: spu.h,v 1.3 2001/08/13 12:52:33 ehasenle Exp $ + * $Id: spu.h,v 1.4 2001/08/16 12:33:00 ehasenle Exp $ * * This file was originally part of the OMS program. * @@ -35,16 +35,6 @@ #include <inttypes.h> #include "video_out.h" -#ifndef CLUT_T -#define CLUT_T -typedef struct { // CLUT == Color LookUp Table - uint8_t:8; - uint8_t y:8; - uint8_t cr:8; - uint8_t cb:8; -} __attribute__ ((packed)) clut_t; -#endif - typedef struct spu_clut_struct { #ifdef WORDS_BIGENDIAN uint8_t entry0 : 4; diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c index 7e87c8822..1900ae384 100644 --- a/src/libspudec/xine_decoder.c +++ b/src/libspudec/xine_decoder.c @@ -19,7 +19,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.9 2001/08/15 09:07:16 ehasenle Exp $ + * $Id: xine_decoder.c,v 1.10 2001/08/16 12:33:00 ehasenle Exp $ * * stuff needed to turn libspu into a xine decoder plugin */ @@ -35,11 +35,13 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#include <byteswap.h> #include "spu.h" #include "buffer.h" #include "events.h" #include "xine_internal.h" +#include "video_out/alphablend.h" static clut_t __default_clut[] = { {y: 0x00, cr: 0x80, cb:0x80}, @@ -123,10 +125,20 @@ void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { spudec_decoder_t *this = (spudec_decoder_t *) this_gen; if (buf->type == BUF_SPU_CLUT) { - memcpy(this->state.clut, buf->content, sizeof(int32_t)*16); + if (buf->content[0]) { /* cheap endianess detection */ + memcpy(this->state.clut, buf->content, sizeof(uint32_t)*16); + } else { + int i; + uint32_t *clut = (uint32_t*) buf->content; + for (i = 0; i < 16; i++) + this->state.clut[i] = bswap_32(clut[i]); + } return; } + if (buf->decoder_info[0] == 0) /* skip preview data */ + return; + if (buf->PTS) { metronom_t *metronom = this->ovl_src.metronom; uint32_t pts = metronom->got_spu_packet(metronom, buf->PTS, 0); diff --git a/src/video_out/alphablend.c b/src/video_out/alphablend.c index b86968c43..bba685418 100644 --- a/src/video_out/alphablend.c +++ b/src/video_out/alphablend.c @@ -33,17 +33,7 @@ #include <inttypes.h> #include "video_out.h" - -/* FIXME: CLUT_T should go elsewhere. */ -#ifndef CLUT_T -#define CLUT_T -typedef struct { // CLUT == Color LookUp Table - uint8_t:8; - uint8_t y:8; - uint8_t cr:8; - uint8_t cb:8; -} __attribute__ ((packed)) clut_t; -#endif +#include "alphablend.h" #define BLEND_COLOR(dst, src, mask, o) ((((src&mask)*o + ((dst&mask)*(0x0f-o)))/0xf) & mask) diff --git a/src/video_out/alphablend.h b/src/video_out/alphablend.h index 6043c6071..66f4e512b 100644 --- a/src/video_out/alphablend.h +++ b/src/video_out/alphablend.h @@ -28,6 +28,13 @@ #include "video_out.h" +typedef struct { /* CLUT == Color LookUp Table */ + uint8_t cb : 8; + uint8_t cr : 8; + uint8_t y : 8; + uint8_t foo : 8; +} __attribute__ ((packed)) clut_t; + void blend_rgb16 (uint8_t * img, vo_overlay_t * overlay, int width, int height); void blend_rgb24 (uint8_t * img, vo_overlay_t * overlay, int width, |