From bf6b1747ae4bad46dbbf5fa2189a18b45c1d6b38 Mon Sep 17 00:00:00 2001 From: Daniel Caujolle-Bert Date: Mon, 13 Oct 2003 11:47:11 +0000 Subject: Add vcdx plugin(CVS) and dependent libs(no CVS, broken API). Ability to use external libs (--with-external-vcdnav), disable vcdx build and build old vcd instead (--disable-vcdx). This last feature is useful since vcdx take /hours/ to start playback, that can help people who don't want vcd navigation. Remove all .la files, even in subdirs (eg: post) CVS patchset: 5505 CVS date: 2003/10/13 11:47:11 --- src/input/vcd/libvcd/vcd_read.c | 108 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 src/input/vcd/libvcd/vcd_read.c (limited to 'src/input/vcd/libvcd/vcd_read.c') diff --git a/src/input/vcd/libvcd/vcd_read.c b/src/input/vcd/libvcd/vcd_read.c new file mode 100644 index 000000000..97db8899a --- /dev/null +++ b/src/input/vcd/libvcd/vcd_read.c @@ -0,0 +1,108 @@ +/* + $Id: vcd_read.c,v 1.1 2003/10/13 11:47:12 f1rmb Exp $ + + Copyright (C) 2001,2003 Herbert Valerio Riedel + Copyright (C) 2003 Rocky Bernstein + + 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 "vcd_read.h" +#include "assert.h" +#include +#include +#include + +#ifdef HAVE_STRING_H +#include +#endif + +bool +read_pvd(CdIo *cdio, iso9660_pvd_t *pvd) +{ + if (cdio_read_mode2_sector (cdio, pvd, ISO_PVD_SECTOR, false)) { + vcd_error ("error reading PVD sector (%d)", ISO_PVD_SECTOR); + return false; + } + + if (pvd->type != ISO_VD_PRIMARY) { + vcd_error ("unexpected PVD type %d", pvd->type); + return false; + } + + if (strncmp (pvd->id, ISO_STANDARD_ID, strlen (ISO_STANDARD_ID))) + { + vcd_error ("unexpected ID encountered (expected `" + ISO_STANDARD_ID "', got `%.5s'", pvd->id); + return false; + } + return true; +} + +bool +read_entries(CdIo *cdio, EntriesVcd *entries) +{ + if (cdio_read_mode2_sector (cdio, entries, ENTRIES_VCD_SECTOR, false)) { + vcd_error ("error reading Entries sector (%d)", ENTRIES_VCD_SECTOR); + return false; + } + + /* analyze signature/type */ + + if (!strncmp (entries->ID, ENTRIES_ID_VCD, sizeof (entries->ID))) + return true; + else if (!strncmp (entries->ID, "ENTRYSVD", sizeof (entries->ID))) { + vcd_warn ("found (non-compliant) SVCD ENTRIES.SVD signature"); + return true; + } else { + vcd_error ("unexpected ID signature encountered `%.8s'", entries->ID); + return false; + } +} + +bool +read_info(CdIo *cdio, InfoVcd *info, vcd_type_t *vcd_type) +{ + if (cdio_read_mode2_sector (cdio, info, INFO_VCD_SECTOR, false)) { + vcd_error ("error reading Info sector (%d)", INFO_VCD_SECTOR); + return false; + } + + *vcd_type = vcd_files_info_detect_type (info); + + /* analyze signature/type */ + + switch (*vcd_type) + { + case VCD_TYPE_VCD: + case VCD_TYPE_VCD11: + case VCD_TYPE_VCD2: + case VCD_TYPE_SVCD: + case VCD_TYPE_HQVCD: + vcd_debug ("%s detected", vcdinf_get_format_version_str(*vcd_type)); + break; + case VCD_TYPE_INVALID: + vcd_error ("unknown ID encountered -- maybe not a proper (S)VCD?"); + return false; + break; + default: + vcd_assert_not_reached (); + break; + } + + return true; +} + -- cgit v1.2.3