summaryrefslogtreecommitdiff
path: root/src/libspudec
diff options
context:
space:
mode:
Diffstat (limited to 'src/libspudec')
-rw-r--r--src/libspudec/Makefile.am4
-rw-r--r--src/libspudec/nav_print.c12
-rw-r--r--src/libspudec/nav_types.h2
-rw-r--r--src/libspudec/spu.c24
-rw-r--r--src/libspudec/xine_decoder.c40
5 files changed, 62 insertions, 20 deletions
diff --git a/src/libspudec/Makefile.am b/src/libspudec/Makefile.am
index 13a81a31c..5d36fa13f 100644
--- a/src/libspudec/Makefile.am
+++ b/src/libspudec/Makefile.am
@@ -6,10 +6,10 @@ libdir = $(XINE_PLUGINDIR)
lib_LTLIBRARIES = xineplug_decode_spu.la
-xineplug_decode_spu_la_SOURCES = spu.c xine_decoder.c nav_read.c
+xineplug_decode_spu_la_SOURCES = spu.c xine_decoder.c nav_read.c nav_print.c
xineplug_decode_spu_la_LDFLAGS = -avoid-version -module
-noinst_HEADERS = spu.h nav_read.h bswap.h nav_types.h
+noinst_HEADERS = spu.h nav_read.h bswap.h nav_print.h nav_types.h
include_HEADERS = spu_decoder_api.h
##
diff --git a/src/libspudec/nav_print.c b/src/libspudec/nav_print.c
index f40d42cb7..c72e64444 100644
--- a/src/libspudec/nav_print.c
+++ b/src/libspudec/nav_print.c
@@ -66,9 +66,9 @@ static void navPrint_PCI_GI(pci_gi_t *pci_gi) {
printf("nv_pck_lbn 0x%08x\n", pci_gi->nv_pck_lbn);
printf("vobu_cat 0x%04x\n", pci_gi->vobu_cat);
printf("vobu_uop_ctl 0x%08x\n", *(uint32_t*)&pci_gi->vobu_uop_ctl);
- printf("vobu_s_ptm 0x%08x\n", pci_gi->vobu_s_ptm);
- printf("vobu_e_ptm 0x%08x\n", pci_gi->vobu_e_ptm);
- printf("vobu_se_e_ptm 0x%08x\n", pci_gi->vobu_se_e_ptm);
+ printf("vobu_s_ptm %u\n", pci_gi->vobu_s_ptm);
+ printf("vobu_e_ptm %u\n", pci_gi->vobu_e_ptm);
+ printf("vobu_se_e_ptm %u\n", pci_gi->vobu_se_e_ptm);
printf("e_eltm ");
print_time(&pci_gi->e_eltm);
printf("\n");
@@ -106,9 +106,9 @@ static void navPrint_HL_GI(hl_gi_t *hl_gi, int *btngr_ns, int *btn_ns) {
printf("hl_gi:\n");
printf("hli_ss 0x%01x\n", hl_gi->hli_ss & 0x03);
- printf("hli_s_ptm 0x%08x\n", hl_gi->hli_s_ptm);
- printf("hli_e_ptm 0x%08x\n", hl_gi->hli_e_ptm);
- printf("btn_se_e_ptm 0x%08x\n", hl_gi->btn_se_e_ptm);
+ printf("hli_s_ptm %u\n", hl_gi->hli_s_ptm);
+ printf("hli_e_ptm %u\n", hl_gi->hli_e_ptm);
+ printf("btn_se_e_ptm %u\n", hl_gi->btn_se_e_ptm);
*btngr_ns = hl_gi->btngr_ns;
printf("btngr_ns %d\n", hl_gi->btngr_ns);
diff --git a/src/libspudec/nav_types.h b/src/libspudec/nav_types.h
index 6b8bbfa0b..032bdedf7 100644
--- a/src/libspudec/nav_types.h
+++ b/src/libspudec/nav_types.h
@@ -183,7 +183,7 @@ typedef struct {
unsigned int zero1 : 2;
unsigned int btngr_ns : 2;
unsigned int zero2 : 1;
- unsigned int btngr1_dsp_ty : 3;
+ unsigned int btngr1_dsp_ty : 3; /* type=1 for Widescreen, type=4 for Pan/Scan */
unsigned int zero3 : 1;
unsigned int btngr2_dsp_ty : 3;
unsigned int zero4 : 1;
diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c
index d089bea05..1b0289f93 100644
--- a/src/libspudec/spu.c
+++ b/src/libspudec/spu.c
@@ -35,7 +35,7 @@
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: spu.c,v 1.27 2001/11/30 00:53:51 f1rmb Exp $
+ * $Id: spu.c,v 1.28 2002/01/05 18:14:27 jcdutton Exp $
*
*/
@@ -129,7 +129,7 @@ int spu_next_event(spu_state_t *state, spu_seq_t* seq, int pts)
return state->next_pts <= pts;
}
-#define CMD_SPU_MENU 0x00
+#define CMD_SPU_FORCE_DISPLAY 0x00
#define CMD_SPU_SHOW 0x01
#define CMD_SPU_HIDE 0x02
#define CMD_SPU_SET_PALETTE 0x03
@@ -187,15 +187,24 @@ void spu_do_commands(spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl)
state->cur_colors[2] = clut->entry1;
state->cur_colors[1] = clut->entry2;
state->cur_colors[0] = clut->entry3;
-
+
/* This is a bit out of context for now */
ovl->color[3] = state->clut[clut->entry0];
ovl->color[2] = state->clut[clut->entry1];
ovl->color[1] = state->clut[clut->entry2];
ovl->color[0] = state->clut[clut->entry3];
+ if ( (clut->entry0 | clut->entry1 | clut->entry2 | clut->entry3) == 0) {
+ ovl->color[3] = 0x108080;
+ ovl->color[2] = 0x808080;
+ ovl->color[1] = 0xb08080;
+ ovl->color[0] = 0x108080;
+ }
+
#ifdef LOG_DEBUG
printf ("spu: \tclut [%x %x %x %x]\n",
ovl->color[0], ovl->color[1], ovl->color[2], ovl->color[3]);
+ printf ("spu: \tclut base [%x %x %x %x]\n",
+ clut->entry0, clut->entry1, clut->entry2, clut->entry3);
#endif
state->modified = 1;
buf += 3;
@@ -209,6 +218,13 @@ void spu_do_commands(spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl)
ovl->trans[2] = trans->entry1;
ovl->trans[1] = trans->entry2;
ovl->trans[0] = trans->entry3;
+ if ( (trans->entry0 | trans->entry1 | trans->entry2 | trans->entry3) == 0) {
+ ovl->trans[3] = 15;
+ ovl->trans[2] = 15;
+ ovl->trans[1] = 15;
+ ovl->trans[0] = 0;
+ }
+
#ifdef LOG_DEBUG
printf ("spu: \ttrans [%d %d %d %d]\n",
ovl->trans[0], ovl->trans[1], ovl->trans[2], ovl->trans[3]);
@@ -253,7 +269,7 @@ void spu_do_commands(spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl)
buf += 5;
break;
- case CMD_SPU_MENU:
+ case CMD_SPU_FORCE_DISPLAY:
#ifdef LOG_DEBUG
printf ("spu: \tForce Display/Menu\n");
#endif
diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c
index c040fd735..42c8ef300 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.49 2002/01/05 10:31:31 jcdutton Exp $
+ * $Id: xine_decoder.c,v 1.50 2002/01/05 18:14:27 jcdutton Exp $
*
* stuff needed to turn libspu into a xine decoder plugin
*/
@@ -40,6 +40,7 @@
#include "spu.h"
#include "nav_types.h"
#include "nav_read.h"
+#include "nav_print.h"
/*
#define LOG_DEBUG 1
@@ -173,7 +174,7 @@ static void spu_process (spudec_decoder_t *this, uint32_t stream_id) {
}
#ifdef LOG_DEBUG
- spudec_print_overlay( &this->overlay );
+ /* spudec_print_overlay( &this->overlay ); */
printf ("spu: forced display:%s\n", this->state.menu ? "Yes" : "No" );
#endif
@@ -184,8 +185,19 @@ static void spu_process (spudec_decoder_t *this, uint32_t stream_id) {
if (this->state.need_clut)
spu_discover_clut(&this->state, &this->overlay);
- if (this->state.menu == 0) {
+ //if (this->state.menu == 0) {
+ if (1) {
/* Subtitle */
+ if( this->menu_handle < 0 )
+ this->menu_handle = this->vo_out->overlay_source->get_handle(this->vo_out->overlay_source,1);
+
+ if( this->menu_handle < 0 ) {
+ printf("libspudec: No video_overlay handles left for menu\n");
+ return;
+ }
+ this->event.object.handle = this->menu_handle;
+
+/*******************************
if( this->spu_stream_state[stream_id].overlay_handle < 0 ) {
this->spu_stream_state[stream_id].overlay_handle =
this->vo_out->overlay_source->get_handle(this->vo_out->overlay_source, 0);
@@ -197,11 +209,16 @@ static void spu_process (spudec_decoder_t *this, uint32_t stream_id) {
}
this->event.object.handle = this->spu_stream_state[stream_id].overlay_handle;
-
+*********************************/
+
xine_fast_memcpy(this->event.object.overlay,
&this->overlay,
sizeof(vo_overlay_t));
this->overlay.rle=NULL;
+ /* For force display menus */
+ if ( !(this->state.visible) ) {
+ this->state.visible = EVENT_SHOW_SPU;
+ }
this->event.event_type = this->state.visible;
@@ -231,6 +248,7 @@ static void spu_process (spudec_decoder_t *this, uint32_t stream_id) {
this->overlay.rle=NULL;
this->event.event_type = EVENT_MENU_SPU;
+ //this->event.event_type = EVENT_SHOW_SPU;
}
/* if !vpts then we are near a discontinuity but video_out havent detected
@@ -253,14 +271,16 @@ static void spu_process (spudec_decoder_t *this, uint32_t stream_id) {
}
static void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) {
- uint8_t *p = buf->content;
+ uint8_t *p;
uint32_t packet_len;
uint32_t stream_id;
uint32_t header_len;
pci_t *pci;
dsi_t *dsi;
+
+ p = buf->content;
if (p[0] || p[1] || (p[2] != 1)) {
- printf("demux error! %02x %02x %02x (should be 0x000001) \n",p[0],p[1],p[2]);
+ printf("libspudec:spudec_decode_nav:nav demux error! %02x %02x %02x (should be 0x000001) \n",p[0],p[1],p[2]);
return;
}
pci=xine_xmalloc(sizeof(pci_t));
@@ -291,9 +311,15 @@ static void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) {
pci->hli.hl_gi.hli_e_ptm,
pci->hli.hl_gi.btn_se_e_ptm,
buf->PTS);
- printf("libspudec:nav:btn_sn=%u, btn_ns=%u, fosl_btnn=%u, foac_btnn=%u\n",
+ printf("libspudec:nav:btn_sn/ofn=%u, btn_ns=%u, fosl_btnn=%u, foac_btnn=%u\n",
pci->hli.hl_gi.btn_ofn, pci->hli.hl_gi.btn_ns,
pci->hli.hl_gi.fosl_btnn, pci->hli.hl_gi.foac_btnn);
+ printf("btngr_ns %d\n", pci->hli.hl_gi.btngr_ns);
+ printf("btngr%d_dsp_ty 0x%02x\n", 1, pci->hli.hl_gi.btngr1_dsp_ty);
+ printf("btngr%d_dsp_ty 0x%02x\n", 2, pci->hli.hl_gi.btngr2_dsp_ty);
+ printf("btngr%d_dsp_ty 0x%02x\n", 3, pci->hli.hl_gi.btngr3_dsp_ty);
+ //navPrint_PCI(pci);
+
#endif
}