summaryrefslogtreecommitdiff
path: root/src/libspudec/nav_read.c
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2003-03-08 14:11:52 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2003-03-08 14:11:52 +0000
commit3e6ea60cd46d69cfb663d52c7853751d456210ae (patch)
tree5fcee38b900267b50bc5f99203a0286049d5d81d /src/libspudec/nav_read.c
parent33b1749ad986f19df42e61be870cb7953db46ac6 (diff)
downloadxine-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/nav_read.c')
-rw-r--r--src/libspudec/nav_read.c223
1 files changed, 1 insertions, 222 deletions
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"