summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Courtier-Dutton <jcdutton@users.sourceforge.net>2002-01-05 18:14:27 +0000
committerJames Courtier-Dutton <jcdutton@users.sourceforge.net>2002-01-05 18:14:27 +0000
commit0cf443ad6d0913eb7addfbca4539589124219f4b (patch)
tree06b8fed52a4eb0de8ab49426c206d24aca463da5
parentf62c4a0fe12cba680523de4a8ade43693c8f73fe (diff)
downloadxine-lib-0cf443ad6d0913eb7addfbca4539589124219f4b.tar.gz
xine-lib-0cf443ad6d0913eb7addfbca4539589124219f4b.tar.bz2
Fix NAV packet demux.
CVS patchset: 1340 CVS date: 2002/01/05 18:14:27
-rw-r--r--src/demuxers/demux_mpeg_block.c24
-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
-rw-r--r--src/xine-engine/video_decoder.c5
-rw-r--r--src/xine-engine/video_overlay.c14
8 files changed, 88 insertions, 37 deletions
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c
index ec03ac8ba..2b14fab06 100644
--- a/src/demuxers/demux_mpeg_block.c
+++ b/src/demuxers/demux_mpeg_block.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: demux_mpeg_block.c,v 1.71 2002/01/04 00:23:06 jcdutton Exp $
+ * $Id: demux_mpeg_block.c,v 1.72 2002/01/05 18:14:27 jcdutton Exp $
*
* demultiplexer for mpeg 1/2 program streams
*
@@ -100,7 +100,7 @@ typedef struct demux_mpeg_block_s {
static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_mode) {
buf_element_t *buf = NULL;
- unsigned char *p;
+ uint8_t *p;
int bMpeg1=0;
uint32_t header_len;
uint32_t PTS;
@@ -283,6 +283,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
printf ("demux_mpeg_block: scr %d last_scr %d diff %d\n",
scr, this->last_scr, scr_diff);
#endif
+
if (abs(scr_diff) > 60000) {
@@ -310,6 +311,16 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
packet_len = p[4] << 8 | p[5];
stream_id = p[3];
+ if (stream_id == 0xbf) { /* NAV Packet */
+ buf->content = p;
+ buf->size = packet_len;
+ buf->type = BUF_SPU_NAV;
+ buf->PTS = 0; /* NAV packets do not have PES values */
+ buf->input_pos = this->input->get_current_pos(this->input);
+ this->video_fifo->put (this->video_fifo, buf);
+ return ;
+ }
+
if (bMpeg1) {
if (stream_id == 0xBF) {
@@ -505,15 +516,6 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m
return ;
}
- } else if (stream_id == 0xbf) { /* NAV Packet */
- buf->content = p-9;
- buf->size = packet_len;
- buf->type = BUF_SPU_NAV;
- buf->PTS = PTS;
- buf->input_pos = this->input->get_current_pos(this->input);
- this->video_fifo->put (this->video_fifo, buf);
- return ;
-
} else if ((stream_id >= 0xbc) && ((stream_id & 0xf0) == 0xe0)) {
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
}
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index 4c7a7c85e..4573e56e9 100644
--- a/src/xine-engine/video_decoder.c
+++ b/src/xine-engine/video_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: video_decoder.c,v 1.68 2002/01/04 00:23:06 jcdutton Exp $
+ * $Id: video_decoder.c,v 1.69 2002/01/05 18:14:27 jcdutton Exp $
*
*/
@@ -119,8 +119,9 @@ void *video_decoder_loop (void *this_gen) {
spu_decoder = update_spu_decoder(this, buf->type);
- if (spu_decoder)
+ if (spu_decoder) {
spu_decoder->decode_data (spu_decoder, buf);
+ }
xine_profiler_stop_count (prof_spu_decode);
break;
diff --git a/src/xine-engine/video_overlay.c b/src/xine-engine/video_overlay.c
index 0859ef76b..e6001b746 100644
--- a/src/xine-engine/video_overlay.c
+++ b/src/xine-engine/video_overlay.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_overlay.c,v 1.8 2001/12/16 20:46:17 miguelfreitas Exp $
+ * $Id: video_overlay.c,v 1.9 2002/01/05 18:14:27 jcdutton Exp $
*
*/
@@ -341,7 +341,9 @@ static void video_overlay_event( video_overlay_t *this, int vpts ) {
#ifdef LOG_DEBUG
video_overlay_print_overlay( this->video_overlay_events[this_event].event->object.overlay ) ;
#endif
- internal_video_overlay_free_handle( this, handle );
+ /* This should not happen, the calling routine should do the free */
+ /* FIXME: Need to add new event to free handle */
+/* internal_video_overlay_free_handle( this, handle ); */
this->video_overlay_objects[handle].handle = handle;
if( this->video_overlay_objects[handle].overlay ) {
@@ -365,7 +367,9 @@ static void video_overlay_event( video_overlay_t *this, int vpts ) {
free(this->video_overlay_events[this_event].event->object.overlay);
this->video_overlay_events[this_event].event->object.overlay = NULL;
remove_showing_handle( this, handle );
- internal_video_overlay_free_handle( this, handle );
+ /* This should not happen, the calling routine should do the free */
+ /* FIXME: Need to add new event to free handle */
+ /* internal_video_overlay_free_handle( this, handle ); */
break;
case EVENT_HIDE_MENU:
@@ -375,7 +379,9 @@ static void video_overlay_event( video_overlay_t *this, int vpts ) {
free(this->video_overlay_events[this_event].event->object.overlay);
this->video_overlay_events[this_event].event->object.overlay = NULL;
remove_showing_handle( this, handle );
- internal_video_overlay_free_handle( this, handle );
+ /* This should not happen, the calling routine should do the free */
+ /* FIXME: Need to add new event to free handle */
+ /* internal_video_overlay_free_handle( this, handle ); */
break;
case EVENT_MENU_SPU: