diff options
author | Michael Roitzsch <mroi@users.sourceforge.net> | 2003-03-08 14:11:52 +0000 |
---|---|---|
committer | Michael Roitzsch <mroi@users.sourceforge.net> | 2003-03-08 14:11:52 +0000 |
commit | 3e6ea60cd46d69cfb663d52c7853751d456210ae (patch) | |
tree | 5fcee38b900267b50bc5f99203a0286049d5d81d /src/libspudec | |
parent | 33b1749ad986f19df42e61be870cb7953db46ac6 (diff) | |
download | xine-lib-3e6ea60cd46d69cfb663d52c7853751d456210ae.tar.gz xine-lib-3e6ea60cd46d69cfb663d52c7853751d456210ae.tar.bz2 |
first step towards fixing the DVD menu highlighting problems
The problem arises because of inconsistent usage of libdvdread's functions regarding
NAV packet reading: libspudec and the dxr3 spu decoder use some of these functions,
but they used to have private copies of the relevant files of libdvdread. These do
not work any more now, since the internal layout of NAV packets in libdvdread
changed lately. So we should always use the functions from current libdvdread.
Please note that highlights might not work yet.
The next step will be to sync libdvdnav. Stay tuned.
CVS patchset: 4371
CVS date: 2003/03/08 14:11:52
Diffstat (limited to 'src/libspudec')
-rw-r--r-- | src/libspudec/Makefile.am | 7 | ||||
-rw-r--r-- | src/libspudec/bswap.h | 87 | ||||
-rw-r--r-- | src/libspudec/nav_print.c | 279 | ||||
-rw-r--r-- | src/libspudec/nav_print.h | 49 | ||||
-rw-r--r-- | src/libspudec/nav_read.c | 223 | ||||
-rw-r--r-- | src/libspudec/nav_read.h | 41 | ||||
-rw-r--r-- | src/libspudec/nav_types.h | 301 | ||||
-rw-r--r-- | src/libspudec/spu.c | 8 | ||||
-rw-r--r-- | src/libspudec/spu_decoder_api.h | 6 | ||||
-rw-r--r-- | src/libspudec/xine_decoder.c | 3 |
10 files changed, 16 insertions, 988 deletions
diff --git a/src/libspudec/Makefile.am b/src/libspudec/Makefile.am index 99b397316..4e0f2ea5a 100644 --- a/src/libspudec/Makefile.am +++ b/src/libspudec/Makefile.am @@ -7,15 +7,16 @@ XINE_LIB = $(top_builddir)/src/xine-engine/libxine.la xineplug_decode_spu_la_SOURCES = \ nav_read.c \ - nav_print.c \ spu.c \ xine_decoder.c +AM_CFLAGS = -I../input/libdvdread + xineplug_decode_spu_la_LIBADD = $(XINE_LIB) xineplug_decode_spu_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@ -noinst_HEADERS = spu.h nav_read.h bswap.h nav_print.h -include_HEADERS = spu_decoder_api.h nav_types.h +noinst_HEADERS = spu.h +include_HEADERS = spu_decoder_api.h $(XINE_LIB): @cd $(top_builddir)/src/xine-engine && $(MAKE) diff --git a/src/libspudec/bswap.h b/src/libspudec/bswap.h deleted file mode 100644 index 23e2863b4..000000000 --- a/src/libspudec/bswap.h +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (C) 2000, 2001 Billy Biggs <vektor@dumbterm.net>, - * Håkan Hjort <d95hjort@dtek.chalmers.se> - * - * 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 of the License, or - * (at your option) any later version. - * - * This program 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 BSWAP_H_INCLUDED -#define BSWAP_H_INCLUDED - -#include <config.h> - -#if defined(WORDS_BIGENDIAN) -/* All bigendian systems are fine, just ignore the swaps. */ -#define B2N_16(x) (void)(x) -#define B2N_32(x) (void)(x) -#define B2N_64(x) (void)(x) - -#else - -#if defined(__linux__) -#include <byteswap.h> -#define B2N_16(x) x = bswap_16(x) -#define B2N_32(x) x = bswap_32(x) -#define B2N_64(x) x = bswap_64(x) - -#elif defined(__NetBSD__) -#include <sys/endian.h> -#define B2N_16(x) BE16TOH(x) -#define B2N_32(x) BE32TOH(x) -#define B2N_64(x) BE64TOH(x) - -#elif defined(__OpenBSD__) -#include <sys/endian.h> -#define B2N_16(x) x = swap16(x) -#define B2N_32(x) x = swap32(x) -#define B2N_64(x) x = swap64(x) - -/* This is a slow but portable implementation, it has multiple evaluation - * problems so beware. - * FreeBSD and Solaris don't have <byteswap.h> or any other such - * functionality! - */ - -#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) -#define B2N_16(x) \ - x = ((((x) & 0xff00) >> 8) | \ - (((x) & 0x00ff) << 8)) -#define B2N_32(x) \ - x = ((((x) & 0xff000000) >> 24) | \ - (((x) & 0x00ff0000) >> 8) | \ - (((x) & 0x0000ff00) << 8) | \ - (((x) & 0x000000ff) << 24)) -#define B2N_64(x) \ - x = ((((x) & 0xff00000000000000) >> 56) | \ - (((x) & 0x00ff000000000000) >> 40) | \ - (((x) & 0x0000ff0000000000) >> 24) | \ - (((x) & 0x000000ff00000000) >> 8) | \ - (((x) & 0x00000000ff000000) << 8) | \ - (((x) & 0x0000000000ff0000) << 24) | \ - (((x) & 0x000000000000ff00) << 40) | \ - (((x) & 0x00000000000000ff) << 56)) - -#else - -/* If there isn't a header provided with your system with this functionality - * add the relevant || define( ) to the portable implementation above. - */ -#error "You need to add endian swap macros for you're system" - -#endif - -#endif /* WORDS_BIGENDIAN */ - -#endif /* BSWAP_H_INCLUDED */ diff --git a/src/libspudec/nav_print.c b/src/libspudec/nav_print.c deleted file mode 100644 index 48111578b..000000000 --- a/src/libspudec/nav_print.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (C) 2000 Håkan Hjort <d95hjort@dtek.chalmers.se> - * - * Much of the contents in this file is based on VOBDUMP. - * - * VOBDUMP: a program for examining DVD .VOB filse - * - * Copyright 1998, 1999 Eric Smith <eric@brouhaha.com> - * - * VOBDUMP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. Note that I am not - * granting permission to redistribute or modify VOBDUMP under the - * terms of any later version of the General Public License. - * - * This program is distributed in the hope that it will be useful (or - * at least amusing), 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 - */ - -#include <stdio.h> -#include <inttypes.h> -#include "xineutils.h" - -#include "config.h" // Needed for WORDS_BIGENDIAN -#include "nav_types.h" -#include "nav_print.h" - - -void print_time(dvd_time_t *dtime) { - const char *rate; - XINE_ASSERT(((dtime->hour>>4) < 0xa) && ((dtime->hour&0xf) < 0xa),"?"); - XINE_ASSERT(((dtime->minute>>4) < 0x7) && ((dtime->minute&0xf) < 0xa),"?"); - XINE_ASSERT(((dtime->second>>4) < 0x7) && ((dtime->second&0xf) < 0xa), "?"); - XINE_ASSERT((dtime->frame_u&0xf) < 0xa, "?"); - - printf("%02x:%02x:%02x.%02x", - dtime->hour, - dtime->minute, - dtime->second, - dtime->frame_u & 0x3f); - switch((dtime->frame_u & 0xc0) >> 6) { - case 1: - rate = "25.00"; - break; - case 3: - rate = "29.97"; - break; - default: - rate = "(please send a bug report)"; - break; - } - printf(" @ %s fps", rate); -} - - -void navPrint_PCI_GI(pci_gi_t *pci_gi) { - int i; - - printf("pci_gi:\n"); - 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("e_eltm "); - print_time(&pci_gi->e_eltm); - printf("\n"); - - printf("vobu_isrc \""); - for(i = 0; i < 32; i++) { - char c = pci_gi->vobu_isrc[i]; - if((c >= ' ') && (c <= '~')) - printf("%c", c); - else - printf("."); - } - printf("\"\n"); -} - -void navPrint_NSML_AGLI(nsml_agli_t *nsml_agli) { - int i, j = 0; - - for(i = 0; i < 9; i++) - j |= nsml_agli->nsml_agl_dsta[i]; - if(j == 0) - return; - - printf("nsml_agli:\n"); - for(i = 0; i < 9; i++) - if(nsml_agli->nsml_agl_dsta[i]) - printf("nsml_agl_c%d_dsta 0x%08x\n", i + 1, - nsml_agli->nsml_agl_dsta[i]); -} - -void navPrint_HL_GI(hl_gi_t *hl_gi, int *btngr_ns, int *btn_ns) { - - if((hl_gi->hli_ss & 0x03) == 0) - return; - - 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); - - *btngr_ns = hl_gi->btngr_ns; - printf("btngr_ns %d\n", hl_gi->btngr_ns); - printf("btngr%d_dsp_ty 0x%02x\n", 1, hl_gi->btngr1_dsp_ty); - printf("btngr%d_dsp_ty 0x%02x\n", 2, hl_gi->btngr2_dsp_ty); - printf("btngr%d_dsp_ty 0x%02x\n", 3, hl_gi->btngr3_dsp_ty); - - printf("btn_ofn %d\n", hl_gi->btn_ofn); - *btn_ns = hl_gi->btn_ns; - printf("btn_ns %d\n", hl_gi->btn_ns); - printf("nsl_btn_ns %d\n", hl_gi->nsl_btn_ns); - printf("fosl_btnn %d\n", hl_gi->fosl_btnn); - printf("foac_btnn %d\n", hl_gi->foac_btnn); -} - -void navPrint_BTN_COLIT(btn_colit_t *btn_colit) { - int i, j; - - j = 0; - for(i = 0; i < 6; i++) - j |= btn_colit->btn_coli[i/2][i&1]; - if(j == 0) - return; - - printf("btn_colit:\n"); - for(i = 0; i < 3; i++) - for(j = 0; j < 2; j++) - printf("btn_cqoli %d %s_coli: %08x\n", - i, (j == 0) ? "sl" : "ac", - btn_colit->btn_coli[i][j]); -} - -void navPrint_BTNIT(btni_t *btni_table, int btngr_ns, int btn_ns) { - int i, j; - - printf("btnit:\n"); - printf("btngr_ns: %i\n", btngr_ns); - printf("btn_ns: %i\n", btn_ns); - - if(btngr_ns == 0) - return; - - for(i = 0; i < btngr_ns; i++) { - for(j = 0; j < (36 / btngr_ns); j++) { - if(j < btn_ns) { - btni_t *btni = &btni_table[(36 / btngr_ns) * i + j]; - - printf("group %d btni %d: ", i+1, j+1); - printf("btn_coln %d, auto_action_mode %d\n", - btni->btn_coln, btni->auto_action_mode); - printf("coords (%d, %d) .. (%d, %d)\n", - btni->x_start, btni->y_start, btni->x_end, btni->y_end); - - printf("up %d, ", btni->up); - printf("down %d, ", btni->down); - printf("left %d, ", btni->left); - printf("right %d\n", btni->right); - - // ifoPrint_COMMAND(&btni->cmd); - printf("\n"); - } - } - } -} - -void navPrint_HLI(hli_t *hli) { - int btngr_ns = 0, btn_ns = 0; - - printf("hli:\n"); - navPrint_HL_GI(&hli->hl_gi, & btngr_ns, & btn_ns); - navPrint_BTN_COLIT(&hli->btn_colit); - navPrint_BTNIT(hli->btnit, btngr_ns, btn_ns); -} - -void navPrint_PCI(pci_t *pci) { - printf("pci packet:\n"); - navPrint_PCI_GI(&pci->pci_gi); - navPrint_NSML_AGLI(&pci->nsml_agli); - navPrint_HLI(&pci->hli); -} - -static void navPrint_DSI_GI(dsi_gi_t *dsi_gi) { - printf("dsi_gi:\n"); - printf("nv_pck_scr 0x%08x\n", dsi_gi->nv_pck_scr); - printf("nv_pck_lbn 0x%08x\n", dsi_gi->nv_pck_lbn ); - printf("vobu_ea 0x%08x\n", dsi_gi->vobu_ea); - printf("vobu_1stref_ea 0x%08x\n", dsi_gi->vobu_1stref_ea); - printf("vobu_2ndref_ea 0x%08x\n", dsi_gi->vobu_2ndref_ea); - printf("vobu_3rdref_ea 0x%08x\n", dsi_gi->vobu_3rdref_ea); - printf("vobu_vob_idn 0x%04x\n", dsi_gi->vobu_vob_idn); - printf("vobu_c_idn 0x%02x\n", dsi_gi->vobu_c_idn); - printf("c_eltm "); - print_time(&dsi_gi->c_eltm); - printf("\n"); -} - -static void navPrint_SML_PBI(sml_pbi_t *sml_pbi) { - printf("sml_pbi:\n"); - printf("category 0x%04x\n", sml_pbi->category); - if(sml_pbi->category & 0x8000) - printf("VOBU is in preunit\n"); - if(sml_pbi->category & 0x4000) - printf("VOBU is in ILVU\n"); - if(sml_pbi->category & 0x2000) - printf("VOBU at the beginning of ILVU\n"); - if(sml_pbi->category & 0x1000) - printf("VOBU at end of PREU of ILVU\n"); - - printf("ilvu_ea 0x%08x\n", sml_pbi->ilvu_ea); - printf("nxt_ilvu_sa 0x%08x\n", sml_pbi->ilvu_sa); - printf("nxt_ilvu_size 0x%04x\n", sml_pbi->size); - - printf("vob_v_s_s_ptm 0x%08x\n", sml_pbi->vob_v_s_s_ptm); - printf("vob_v_e_e_ptm 0x%08x\n", sml_pbi->vob_v_e_e_ptm); - - /* $$$ more code needed here */ -} - -static void navPrint_SML_AGLI(sml_agli_t *sml_agli) { - int i; - printf("sml_agli:\n"); - for(i = 0; i < 9; i++) { - printf("agl_c%d address: 0x%08x size 0x%04x\n", i, - sml_agli->data[i].address, sml_agli->data[i].size); - } -} - -static void navPrint_VOBU_SRI(vobu_sri_t *vobu_sri) { - int i; - int stime[19] = { 240, 120, 60, 20, 15, 14, 13, 12, 11, - 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; - printf("vobu_sri:\n"); - printf("Next VOBU with Video %08x\n", vobu_sri->next_video); - for(i = 0; i < 19; i++) { - printf("%3.1f %08x ", stime[i]/2.0, vobu_sri->fwda[i]); - } - printf("\n"); - printf("Next VOBU %08x\n", vobu_sri->next_vobu); - printf("--\n"); - printf("Prev VOBU %08x\n", vobu_sri->prev_vobu); - for(i = 0; i < 19; i++) { - printf("%3.1f %08x ", stime[18 - i]/2.0, vobu_sri->bwda[i]); - } - printf("\n"); - printf("Prev VOBU with Video %08x\n", vobu_sri->prev_video); -} - -static void navPrint_SYNCI(synci_t *synci) { - int i; - - printf("synci:\n"); - /* $$$ more code needed here */ - for(i = 0; i < 8; i++) - printf("%04x ", synci->a_synca[i]); - for(i = 0; i < 32; i++) - printf("%08x ", synci->sp_synca[i]); -} - -void navPrint_DSI(dsi_t *dsi) { - printf("dsi packet:\n"); - navPrint_DSI_GI(&dsi->dsi_gi); - navPrint_SML_PBI(&dsi->sml_pbi); - navPrint_SML_AGLI(&dsi->sml_agli); - navPrint_VOBU_SRI(&dsi->vobu_sri); - navPrint_SYNCI(&dsi->synci); -} - - diff --git a/src/libspudec/nav_print.h b/src/libspudec/nav_print.h deleted file mode 100644 index 96bad19cd..000000000 --- a/src/libspudec/nav_print.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (C) 2001 Billy Biggs <vektor@dumbterm.net>, - * Håkan Hjort <d95hjort@dtek.chalmers.se> - * - * 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 of the License, or (at - * your option) any later version. - * - * This program 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., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef NAV_PRINT_H_INCLUDED -#define NAV_PRINT_H_INCLUDED - -#include <stdio.h> -#include "nav_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * This file provides example functions for printing information about the NAV - * packet to stdout. - */ - -void navPrint_PCI(pci_t *pci); -void navPrint_DSI(dsi_t *dsi); -void print_time(dvd_time_t *dtime); -void navPrint_PCI_GI(pci_gi_t *pci_gi); -void navPrint_NSML_AGLI(nsml_agli_t *nsml_agli); -void navPrint_HL_GI(hl_gi_t *hl_gi, int *btngr_ns, int *btn_ns); -void navPrint_BTN_COLIT(btn_colit_t *btn_colit); -void navPrint_BTNIT(btni_t *btni_table, int btngr_ns, int btn_ns); -void navPrint_HLI(hli_t *hli); - - -#ifdef __cplusplus -}; -#endif -#endif /* NAV_PRINT_H_INCLUDED */ diff --git a/src/libspudec/nav_read.c b/src/libspudec/nav_read.c index 79a695f0f..2c3b355f5 100644 --- a/src/libspudec/nav_read.c +++ b/src/libspudec/nav_read.c @@ -1,222 +1 @@ -/** - * Copyright (C) 2000 Håkan Hjort <d95hjort@dtek.chalmers.se> - * - * 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 of the License, or - * (at your option) any later version. - * - * This program 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 - */ - -#include <stdio.h> -#include <string.h> -#include <inttypes.h> -#include "xineutils.h" - -#include "config.h" // Needed for WORDS_BIGENDIAN -#include "bswap.h" -#include "nav_types.h" -#include "nav_read.h" -#include "nav_print.h" - -/* -#define LOG_NAV_READ -#define STRICT -*/ - -void nav_read_pci(pci_t *pci, unsigned char *buffer) { - int i, j; - - XINE_ASSERT(sizeof(pci_t) == (PCI_BYTES - 1), "Incorrect pci_t size: %d", sizeof(pci_t)); // -1 for substream id - - memcpy(pci, buffer, sizeof(pci_t)); - - /* Endian conversions */ - - /* pci pci_gi */ - B2N_32(pci->pci_gi.nv_pck_lbn); - B2N_16(pci->pci_gi.vobu_cat); - B2N_32(pci->pci_gi.vobu_s_ptm); - B2N_32(pci->pci_gi.vobu_e_ptm); - B2N_32(pci->pci_gi.vobu_se_e_ptm); - - /* pci nsml_agli */ - for(i = 0; i < 9; i++) - B2N_32(pci->nsml_agli.nsml_agl_dsta[i]); - - /* pci hli hli_gi */ - B2N_16(pci->hli.hl_gi.hli_ss); - B2N_32(pci->hli.hl_gi.hli_s_ptm); - B2N_32(pci->hli.hl_gi.hli_e_ptm); - B2N_32(pci->hli.hl_gi.btn_se_e_ptm); - - /* pci hli btn_colit */ - for(i = 0; i < 3; i++) - for(j = 0; j < 2; j++) - B2N_32(pci->hli.btn_colit.btn_coli[i][j]); - - - /* pci hli btni */ - /* There are some issues with this bitfiled with some compilers - because they stradle word boundaries. */ - -#if !defined(WORDS_BIGENDIAN) - for(i = 0; i < 36; i++) { -#if 0 /* Wierd Sun CC code that does not work */ - unsigned char m[6]; - memcpy(m, &pci->hli.btnit[i], 6); - pci->hli.btnit[i].zero1 = (m[1] >> 2); - pci->hli.btnit[i].x_start = (m[0] << 4) | (m[1] >> 4); - pci->hli.btnit[i].x_end = (m[1] << 8) | m[2]; - pci->hli.btnit[i].y_start = (m[3] << 4) | (m[4] >> 4); - pci->hli.btnit[i].y_end = (m[4] << 8) | m[5]; - pci->hli.btnit[i].zero2 = (m[4] >> 2); - pci->hli.btnit[i].btn_coln = (m[0] >> 6); - pci->hli.btnit[i].auto_action_mode = (m[3] >> 6); -#else - char tmp[6], swap; - memcpy(tmp, &(pci->hli.btnit[i]), 6); - /* This is a B2N_24() */ - swap = tmp[0]; tmp[0] = tmp[2]; tmp[2] = swap; - /* This is a B2N_24() */ - swap = tmp[3]; tmp[3] = tmp[5]; tmp[5] = swap; - memcpy(&(pci->hli.btnit[i]), tmp, 6); -#endif - } -#endif - - /* Debug */ -#ifdef LOG_NAV_READ - navPrint_PCI(pci); -#endif - -#ifdef STRICT - /* Asserts */ - - /* pci pci gi */ - XINE_ASSERT(pci->pci_gi.zero1 == 0, "pci->pci_gi.zero1 != 0"); - - /* pci hli hli_gi */ - XINE_ASSERT(pci->hli.hl_gi.zero1 == 0, "pci->hli.hl_gi.zero1 != 0"); - XINE_ASSERT(pci->hli.hl_gi.zero2 == 0, "pci->hli.hl_gi.zero2 != 0"); - XINE_ASSERT(pci->hli.hl_gi.zero3 == 0, "pci->hli.hl_gi.zero3 != 0"); - XINE_ASSERT(pci->hli.hl_gi.zero4 == 0, "pci->hli.hl_gi.zero4 != 0"); - XINE_ASSERT(pci->hli.hl_gi.zero5 == 0, "pci->hli.hl_gi.zero5 != 0"); - - /* Are there buttons defined here? */ - if((pci->hli.hl_gi.hli_ss & 0x03) != 0) { - XINE_ASSERT(pci->hli.hl_gi.btn_ns != 0, "pci->li.hl_gi.btn_ns == 0"); - XINE_ASSERT(pci->hli.hl_gi.btngr_ns != 0, "pci->li.hl_gi.btngr_ns == 0"); - } else { - XINE_ASSERT((pci->hli.hl_gi.btn_ns != 0 && pci->hli.hl_gi.btngr_ns != 0) - || (pci->hli.hl_gi.btn_ns == 0 && pci->hli.hl_gi.btngr_ns == 0), - "pci->hli.hl_gi.btn_ns & pci->hli.hl_gi.btngr_ns are not both the same"); - } - - /* pci hli btnit */ - -#if NDEBUG - for(i = 0; i < pci->hli.hl_gi.btngr_ns; i++) { - for(j = 0; j < (36 / pci->hli.hl_gi.btngr_ns); j++) { - int n = (36 / pci->hli.hl_gi.btngr_ns) * i + j; - XINE_ASSERT(pci->hli.btnit[n].zero1 == 0,"pci->hli.btnit[%d].zero1 != 0", n); - XINE_ASSERT(pci->hli.btnit[n].zero2 == 0,"pci->hli.btnit[%d].zero2 != 0", n); - XINE_ASSERT(pci->hli.btnit[n].zero3 == 0,"pci->hli.btnit[%d].zero3 != 0", n); - XINE_ASSERT(pci->hli.btnit[n].zero4 == 0,"pci->hli.btnit[%d].zero4 != 0", n); - XINE_ASSERT(pci->hli.btnit[n].zero5 == 0,"pci->hli.btnit[%d].zero5 != 0", n); - XINE_ASSERT(pci->hli.btnit[n].zero6 == 0,"pci->hli.btnit[%d].zero6 != 0", n); - - if (j < pci->hli.hl_gi.btn_ns) { - XINE_ASSERT(pci->hli.btnit[n].x_start <= pci->hli.btnit[n].x_end,"?"); - XINE_ASSERT(pci->hli.btnit[n].y_start <= pci->hli.btnit[n].y_end,"?"); - XINE_ASSERT(pci->hli.btnit[n].up <= pci->hli.hl_gi.btn_ns,"?"); - XINE_ASSERT(pci->hli.btnit[n].down <= pci->hli.hl_gi.btn_ns,"?"); - XINE_ASSERT(pci->hli.btnit[n].left <= pci->hli.hl_gi.btn_ns,"?"); - XINE_ASSERT(pci->hli.btnit[n].right <= pci->hli.hl_gi.btn_ns,"?"); - //vmcmd_verify(pci->hli.btnit[n].cmd); - } else { - int k; - XINE_ASSERT(pci->hli.btnit[n].btn_coln == 0,"pci->hli.btnit[%d].btn_coln != 0", n); - XINE_ASSERT(pci->hli.btnit[n].auto_action_mode == 0,"pci->hli.btnit[%d].auto_action_mode != 0", n); - XINE_ASSERT(pci->hli.btnit[n].x_start == 0,"pci->hli.btnit[%d].x_start != 0", n); - XINE_ASSERT(pci->hli.btnit[n].y_start == 0,"pci->hli.btnit[%d].y_start != 0", n); - XINE_ASSERT(pci->hli.btnit[n].x_end == 0,"pci->hli.btnit[%d].x_end != 0", n); - XINE_ASSERT(pci->hli.btnit[n].y_end == 0,"pci->hli.btnit[%d].y_end != 0", n); - XINE_ASSERT(pci->hli.btnit[n].up == 0,"pci->hli.btnit[%d].up != 0", n); - XINE_ASSERT(pci->hli.btnit[n].down == 0,"pci->hli.btnit[%d].down != 0", n); - XINE_ASSERT(pci->hli.btnit[n].left == 0,"pci->hli.btnit[%d].left != 0", n); - XINE_ASSERT(pci->hli.btnit[n].right == 0,"pci->hli.btnit[%d].right != 0", n); - for (k = 0; k < 8; k++) - XINE_ASSERT(pci->hli.btnit[n].cmd.bytes[k] == 0,"pci->hli.btnit[%d].cmd.bytes[%d] != 0", n, k); //CHECK_ZERO? - } - } - } -#endif -#endif -} - -void nav_read_dsi(dsi_t *dsi, unsigned char *buffer) { - int i; - - XINE_ASSERT(sizeof(dsi_t) == (DSI_BYTES - 1), "sizeof dsi_t is incorrect: %d", sizeof(dsi_t)); // -1 for substream id - - memcpy(dsi, buffer, sizeof(dsi_t)); - - /* Endian conversions */ - - /* dsi dsi gi */ - B2N_32(dsi->dsi_gi.nv_pck_scr); - B2N_32(dsi->dsi_gi.nv_pck_lbn); - B2N_32(dsi->dsi_gi.vobu_ea); - B2N_32(dsi->dsi_gi.vobu_1stref_ea); - B2N_32(dsi->dsi_gi.vobu_2ndref_ea); - B2N_32(dsi->dsi_gi.vobu_3rdref_ea); - B2N_16(dsi->dsi_gi.vobu_vob_idn); - - /* dsi sml pbi */ - B2N_16(dsi->sml_pbi.category); - B2N_32(dsi->sml_pbi.ilvu_ea); - B2N_32(dsi->sml_pbi.ilvu_sa); - B2N_16(dsi->sml_pbi.size); - B2N_32(dsi->sml_pbi.vob_v_s_s_ptm); - B2N_32(dsi->sml_pbi.vob_v_e_e_ptm); - - /* dsi sml agli */ - for(i = 0; i < 9; i++) { - B2N_32(dsi->sml_agli.data[ i ].address); - B2N_16(dsi->sml_agli.data[ i ].size); - } - - /* dsi vobu sri */ - B2N_32(dsi->vobu_sri.next_video); - for(i = 0; i < 19; i++) - B2N_32(dsi->vobu_sri.fwda[i]); - B2N_32(dsi->vobu_sri.next_vobu); - B2N_32(dsi->vobu_sri.prev_vobu); - for(i = 0; i < 19; i++) - B2N_32(dsi->vobu_sri.bwda[i]); - B2N_32(dsi->vobu_sri.prev_video); - - /* dsi synci */ - for(i = 0; i < 8; i++) - B2N_16(dsi->synci.a_synca[i]); - for(i = 0; i < 32; i++) - B2N_32(dsi->synci.sp_synca[i]); - - -#ifdef STRICT - /* Asserts */ - - /* dsi dsi gi */ - XINE_ASSERT(dsi->dsi_gi.zero1 == 0, "dsi->dsi_gi.zero1 != 0"); -#endif -} - +#include "../input/libdvdread/nav_read.c" diff --git a/src/libspudec/nav_read.h b/src/libspudec/nav_read.h deleted file mode 100644 index ba4dc4dca..000000000 --- a/src/libspudec/nav_read.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (C) 2000, 2001 Håkan Hjort <d95hjort@dtek.chalmers.se>. - * - * 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 of the License, or - * (at your option) any later version. - * - * This program 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 NAV_READ_H_INCLUDED -#define NAV_READ_H_INCLUDED - -#include "nav_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Reads the PCI packet which begins at buffer into pci. - */ -void nav_read_pci(pci_t *pci, unsigned char *buffer); - -/** - * Reads the DSI packet which begins at buffer into dsi. - */ -void nav_read_dsi(dsi_t *dsi, unsigned char *buffer); - -#ifdef __cplusplus -}; -#endif -#endif /* NAV_READ_H_INCLUDED */ diff --git a/src/libspudec/nav_types.h b/src/libspudec/nav_types.h deleted file mode 100644 index aa54a329c..000000000 --- a/src/libspudec/nav_types.h +++ /dev/null @@ -1,301 +0,0 @@ -#ifndef NAV_TYPES_H_INCLUDED -#define NAV_TYPES_H_INCLUDED - -/* - * Copyright (C) 2000, 2001, 2002 Håkan Hjort <d95hjort@dtek.chalmers.se> - * - * The data structures in this file should represent the layout of the - * pci and dsi packets as they are stored in the stream. Information - * found by reading the source to VOBDUMP is the base for the structure - * and names of these data types. - * - * VOBDUMP: a program for examining DVD .VOB files. - * Copyright 1998, 1999 Eric Smith <eric@brouhaha.com> - * - * VOBDUMP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. Note that I am not - * granting permission to redistribute or modify VOBDUMP under the terms - * of any later version of the General Public License. - * - * This program is distributed in the hope that it will be useful (or at - * least amusing), 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 - */ - -#include <inttypes.h> -#include "../input/libdvdread/ifo_types.h" /* only dvd_time_t, vm_cmd_t and user_ops_t */ - - -#undef ATTRIBUTE_PACKED -#undef PRAGMA_PACK_BEGIN -#undef PRAGMA_PACK_END - -#if defined(__GNUC__) -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) -#define ATTRIBUTE_PACKED __attribute__ ((packed)) -#define PRAGMA_PACK 0 -#endif -#endif - -#if !defined(ATTRIBUTE_PACKED) -#define ATTRIBUTE_PACKED -#define PRAGMA_PACK 1 -#endif - - -/* The length including the substream id byte. */ -#define PCI_BYTES 0x3d4 -#define DSI_BYTES 0x3fa - -#define PS2_PCI_SUBSTREAM_ID 0x00 -#define PS2_DSI_SUBSTREAM_ID 0x01 - -/* Remove this */ -#define DSI_START_BYTE 1031 - - -#if PRAGMA_PACK -#pragma pack(1) -#endif - - -/** - * PCI General Information - */ -typedef struct { - uint32_t nv_pck_lbn; /**< sector address of this nav pack */ - uint16_t vobu_cat; /**< 'category' of vobu */ - uint16_t zero1; /**< reserved */ - user_ops_t vobu_uop_ctl; /**< UOP of vobu */ - uint32_t vobu_s_ptm; /**< start presentation time of vobu */ - uint32_t vobu_e_ptm; /**< end presentation time of vobu */ - uint32_t vobu_se_e_ptm; /**< end ptm of sequence end in vobu */ - dvd_time_t e_eltm; /**< Cell elapsed time */ - char vobu_isrc[32]; -} ATTRIBUTE_PACKED pci_gi_t; - -/** - * Non Seamless Angle Information - */ -typedef struct { - uint32_t nsml_agl_dsta[9]; /**< address of destination vobu in AGL_C#n */ -} ATTRIBUTE_PACKED nsml_agli_t; - -/** - * Highlight General Information - * - * For btngrX_dsp_ty the bits have the following meaning: - * 000b: normal 4/3 only buttons - * XX1b: wide (16/9) buttons - * X1Xb: letterbox buttons - * 1XXb: pan&scan buttons - */ -typedef struct { - uint16_t hli_ss; /**< status, only low 2 bits 0: no buttons, 1: different 2: equal 3: eual except for button cmds */ - uint32_t hli_s_ptm; /**< start ptm of hli */ - uint32_t hli_e_ptm; /**< end ptm of hli */ - uint32_t btn_se_e_ptm; /**< end ptm of button select */ -#ifdef WORDS_BIGENDIAN - unsigned int zero1 : 2; /**< reserved */ - unsigned int btngr_ns : 2; /**< number of button groups 1, 2 or 3 with 36/18/12 buttons */ - unsigned int zero2 : 1; /**< reserved */ - unsigned int btngr1_dsp_ty : 3; /**< display type of subpic stream for button group 1 */ - unsigned int zero3 : 1; /**< reserved */ - unsigned int btngr2_dsp_ty : 3; /**< display type of subpic stream for button group 2 */ - unsigned int zero4 : 1; /**< reserved */ - unsigned int btngr3_dsp_ty : 3; /**< display type of subpic stream for button group 3 */ -#else - unsigned int btngr1_dsp_ty : 3; - unsigned int zero2 : 1; - unsigned int btngr_ns : 2; - unsigned int zero1 : 2; - unsigned int btngr3_dsp_ty : 3; - unsigned int zero4 : 1; - unsigned int btngr2_dsp_ty : 3; - unsigned int zero3 : 1; -#endif - uint8_t btn_ofn; /**< button offset number range 0-255 */ - uint8_t btn_ns; /**< number of valid buttons <= 36/18/12 (low 6 bits) */ - uint8_t nsl_btn_ns; /**< number of buttons selectable by U_BTNNi (low 6 bits) nsl_btn_ns <= btn_ns */ - uint8_t zero5; /**< reserved */ - uint8_t fosl_btnn; /**< forcedly selected button (low 6 bits) */ - uint8_t foac_btnn; /**< forcedly activated button (low 6 bits) */ -} ATTRIBUTE_PACKED hl_gi_t; - - -/** - * Button Color Information Table - * Each entry beeing a 32bit word that contains the color indexs and alpha - * values to use. They are all represented by 4 bit number and stored - * like this [Ci3, Ci2, Ci1, Ci0, A3, A2, A1, A0]. The actual palette - * that the indexes reference is in the PGC. - * @TODO split the uint32_t into a struct - */ -typedef struct { - uint32_t btn_coli[3][2]; /**< [button color number-1][select:0/action:1] */ -} ATTRIBUTE_PACKED btn_colit_t; - -/** - * Button Information - */ -typedef struct { -#ifdef WORDS_BIGENDIAN - unsigned int btn_coln : 2; /**< button color number */ - unsigned int x_start : 10; /**< x start offset within the overlay */ - unsigned int zero1 : 2; /**< reserved */ - unsigned int x_end : 10; /**< x end offset within the overlay */ - - unsigned int auto_action_mode : 2; /**< 0: no, 1: activated if selected */ - unsigned int y_start : 10; /**< y start offset within the overlay */ - unsigned int zero2 : 2; /**< reserved */ - unsigned int y_end : 10; /**< y end offset within the overlay */ - - unsigned int zero3 : 2; /**< reserved */ - unsigned int up : 6; /**< button index when pressing up */ - unsigned int zero4 : 2; /**< reserved */ - unsigned int down : 6; /**< button index when pressing down */ - unsigned int zero5 : 2; /**< reserved */ - unsigned int left : 6; /**< button index when pressing left */ - unsigned int zero6 : 2; /**< reserved */ - unsigned int right : 6; /**< button index when pressing right */ -#else - unsigned int x_end : 10; - unsigned int zero1 : 2; - unsigned int x_start : 10; - unsigned int btn_coln : 2; - - unsigned int y_end : 10; - unsigned int zero2 : 2; - unsigned int y_start : 10; - unsigned int auto_action_mode : 2; - - unsigned int up : 6; - unsigned int zero3 : 2; - unsigned int down : 6; - unsigned int zero4 : 2; - unsigned int left : 6; - unsigned int zero5 : 2; - unsigned int right : 6; - unsigned int zero6 : 2; -#endif - vm_cmd_t cmd; -} ATTRIBUTE_PACKED btni_t; - -/** - * Highlight Information - */ -typedef struct { - hl_gi_t hl_gi; - btn_colit_t btn_colit; - btni_t btnit[36]; -} ATTRIBUTE_PACKED hli_t; - -/** - * PCI packet - */ -typedef struct { - pci_gi_t pci_gi; - nsml_agli_t nsml_agli; - hli_t hli; - uint8_t zero1[189]; -} ATTRIBUTE_PACKED pci_t; - - - - -/** - * DSI General Information - */ -typedef struct { - uint32_t nv_pck_scr; - uint32_t nv_pck_lbn; /**< sector address of this nav pack */ - uint32_t vobu_ea; /**< end address of this VOBU */ - uint32_t vobu_1stref_ea; /**< end address of the 1st reference image */ - uint32_t vobu_2ndref_ea; /**< end address of the 2nd reference image */ - uint32_t vobu_3rdref_ea; /**< end address of the 3rd reference image */ - uint16_t vobu_vob_idn; /**< VOB Id number that this VOBU is part of */ - uint8_t zero1; /**< reserved */ - uint8_t vobu_c_idn; /**< Cell Id number that this VOBU is part of */ - dvd_time_t c_eltm; /**< Cell elapsed time */ -} ATTRIBUTE_PACKED dsi_gi_t; - -/** - * Seamless Playback Information - */ -typedef struct { - uint16_t category; /**< 'category' of seamless VOBU */ - uint32_t ilvu_ea; /**< end address of interleaved Unit */ - uint32_t ilvu_sa; /**< start address of next interleaved unit */ - uint16_t size; /**< size of next interleaved unit */ - uint32_t vob_v_s_s_ptm; /**< video start ptm in vob */ - uint32_t vob_v_e_e_ptm; /**< video end ptm in vob */ - struct { - uint32_t stp_ptm1; - uint32_t stp_ptm2; - uint32_t gap_len1; - uint32_t gap_len2; - } vob_a[8]; -} ATTRIBUTE_PACKED sml_pbi_t; - -/** - * Seamless Angle Infromation for one angle - */ -typedef struct { - uint32_t address; /**< offset to next ILVU, high bit is before/after */ - uint16_t size; /**< byte size of the ILVU pointed to by address */ -} ATTRIBUTE_PACKED sml_agl_data_t; - -/** - * Seamless Angle Infromation - */ -typedef struct { - sml_agl_data_t data[9]; -} ATTRIBUTE_PACKED sml_agli_t; - -/** - * VOBU Search Information - */ -typedef struct { - uint32_t next_video; /**< Next vobu that contains video */ - uint32_t fwda[19]; /**< Forwards, time */ - uint32_t next_vobu; - uint32_t prev_vobu; - uint32_t bwda[19]; /**< Backwards, time */ - uint32_t prev_video; -} ATTRIBUTE_PACKED vobu_sri_t; - -#define SRI_END_OF_CELL 0x3fffffff - -/** - * Synchronous Information - */ -typedef struct { - uint16_t a_synca[8]; /**< offset to first audio packet for this VOBU */ - uint32_t sp_synca[32]; /**< offset to first subpicture packet */ -} ATTRIBUTE_PACKED synci_t; - -/** - * DSI packet - */ -typedef struct { - dsi_gi_t dsi_gi; - sml_pbi_t sml_pbi; - sml_agli_t sml_agli; - vobu_sri_t vobu_sri; - synci_t synci; - uint8_t zero1[471]; -} ATTRIBUTE_PACKED dsi_t; - - -#if PRAGMA_PACK -#pragma pack() -#endif - -#endif /* NAV_TYPES_H_INCLUDED */ diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c index 069632a22..2b6f45841 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.61 2003/02/28 02:51:50 storri Exp $ + * $Id: spu.c,v 1.62 2003/03/08 14:11:53 mroi Exp $ * */ @@ -109,7 +109,7 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) { int btngr_ns = 0, btn_ns = 0; printf("libspudec:nav_PCI\n"); #endif - nav_read_pci(&pci, p+1); + navRead_PCI(&pci, p+1); #ifdef LOG_NAV printf("libspudec:nav:hli_ss=%u, hli_s_ptm=%u, hli_e_ptm=%u, btn_sl_e_ptm=%u pts=%lli\n", pci.hli.hl_gi.hli_ss, @@ -142,7 +142,7 @@ void spudec_decode_nav(spudec_decoder_t *this, buf_element_t *buf) { #ifdef LOG_NAV printf("NAV DSI packet\n"); #endif - nav_read_dsi(&dsi, p+1); + navRead_DSI(&dsi, p+1); // self->vobu_start = self->dsi.dsi_gi.nv_pck_lbn; // self->vobu_length = self->dsi.dsi_gi.vobu_ea; @@ -436,7 +436,7 @@ void spudec_process (spudec_decoder_t *this, uint32_t stream_id) { #ifdef LOG_BUTTON fprintf(stderr, "libspudec: add_event type=%d : current time=%lld, spu vpts=%lli\n", this->event.event_type, - this->stream->metronom->get_current_time(this->stream->metronom), + this->stream->xine->clock->get_current_time(this->stream->metronom), this->event.vpts); #endif ovl_instance->add_event(ovl_instance, (void *)&this->event); diff --git a/src/libspudec/spu_decoder_api.h b/src/libspudec/spu_decoder_api.h index a6fa2995f..4bd725338 100644 --- a/src/libspudec/spu_decoder_api.h +++ b/src/libspudec/spu_decoder_api.h @@ -26,6 +26,12 @@ #define SPU_DECODER_IFACE_VERSION 13 +#ifdef XINE_COMPILE +#include "input/libdvdread/nav_types.h" +#else +#include "nav_types.h" +#endif + /* * generic xine spu decoder plugin interface */ diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c index 4673fb5de..034bde576 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.93 2003/02/28 02:51:50 storri Exp $ + * $Id: xine_decoder.c,v 1.94 2003/03/08 14:11:53 mroi Exp $ * * stuff needed to turn libspu into a xine decoder plugin */ @@ -39,7 +39,6 @@ #include "spu.h" #include "nav_types.h" #include "nav_read.h" -#include "nav_print.h" /* #define LOG_DEBUG 1 |