cdread

package
v0.0.0-...-8c41b54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2023 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CD_CUE_ENTRY_TYPE_PREGAP = 0
	CD_CUE_ENTRY_TYPE_INDEX  = 1
)
View Source
const (
	FILE_FLAGS_EXISTENCE       = 0x01
	FILE_FLAGS_DIRECTORY       = 0x02
	FILE_FLAGS_ASSOCIATED_FILE = 0x04
	FILE_FLAGS_RECORD          = 0x08
	FILE_FLAGS_PROTECTED       = 0x10
	FILE_FLAGS_MULTIEXTENT     = 0x80
)
View Source
const (
	TRACK_TYPE_AUDIO          = 0
	TRACK_TYPE_MODE1_RAW      = 1
	TRACK_TYPE_MODE2_RAW      = 2
	TRACK_TYPE_MODE2_CDXA_RAW = 3
	TRACK_TYPE_ISO            = 4
	TRACK_TYPE_UNK            = -1
)
View Source
const (
	MODE_DATA = 0 // Es pot ficar 0. En CD-XA ignora els
	// sectors Form2 .
	MODE_CDXA = 1 // Torna tots els sectors (cadascun en la
	// grandària que toque).
	MODE_CDXA_MEDIA_ONLY = 2 // Ignora sectors Form1
)

Açò sols afecta als CD-XA

View Source
const LOGICAL_SECTOR_SIZE = 2048
View Source
const SECTOR_SIZE = 0x930

Variables

This section is empty.

Functions

func BCD

func BCD(num int) uint8

func CheckTrackIsMode2CDXA

func CheckTrackIsMode2CDXA(tr TrackReader) (bool, error)

Aquesta funció comprova si un track en mode2 és CDXA o no. No té sentit cridar a questa funció si el track no és mode2.

Types

type CD

type CD interface {

	// Torna un string amb el nom del format de la imatge.
	Format() string

	// Torna una estructura amb informació sobre l'estructura del CD.
	Info() *Info

	// Torna un lector de bytes d'un track.
	TrackReader(session int, track int, mode int) (TrackReader, error)
}

func Open

func Open(file_name string) (CD, error)

Obté una estructura CD que serveix per a llegir els tracks de ls la imatge del fitxer proporcionat.

func OpenCue

func OpenCue(file_name string) (CD, error)

func OpenIso

func OpenIso(file_name string) (CD, error)

func OpenMds

func OpenMds(file_name string) (CD, error)

type ISO

type ISO struct {

	// Públic
	PrimaryVolume ISO_PrimaryVolume
	// contains filtered or unexported fields
}

Segueix una aproximació greedy.

func ReadISO

func ReadISO(cd CD, session int, track int) (*ISO, error)

func (*ISO) Root

func (self *ISO) Root() (*ISO_Directory, error)

Torna el directori arrel.

type ISO_DateTime

type ISO_DateTime struct {
	Year    string
	Month   string
	Day     string
	Hour    string
	Minute  string
	Second  string
	HSecond string
	GMT     int // Intervals de 15 minuts des de -48 (oest) fins 52 (est)
	Empty   bool
}

type ISO_DateTimeRecord

type ISO_DateTimeRecord struct {
	Year   int
	Month  uint8
	Day    uint8
	Hour   uint8
	Minute uint8
	Second uint8
	GMT    int
	Empty  bool
}

type ISO_Directory

type ISO_Directory struct {
	// contains filtered or unexported fields
}

func (*ISO_Directory) Begin

func (self *ISO_Directory) Begin() (*ISO_DirectoryIter, error)

type ISO_DirectoryIter

type ISO_DirectoryIter struct {
	// contains filtered or unexported fields
}

func (*ISO_DirectoryIter) DateTime

func (self *ISO_DirectoryIter) DateTime() *ISO_DateTimeRecord

func (*ISO_DirectoryIter) End

func (self *ISO_DirectoryIter) End() (end bool)

func (*ISO_DirectoryIter) Flags

func (self *ISO_DirectoryIter) Flags() uint8

func (*ISO_DirectoryIter) GetDirectory

func (self *ISO_DirectoryIter) GetDirectory() (*ISO_Directory, error)

func (*ISO_DirectoryIter) GetFileReader

func (self *ISO_DirectoryIter) GetFileReader() (*_ISO_FileReader, error)

func (*ISO_DirectoryIter) Id

func (self *ISO_DirectoryIter) Id() string

func (*ISO_DirectoryIter) Next

func (self *ISO_DirectoryIter) Next() error

func (*ISO_DirectoryIter) Size

func (self *ISO_DirectoryIter) Size() uint32

type ISO_PrimaryVolume

type ISO_PrimaryVolume struct {

	// Part pública
	Version          uint8
	SystemIdentifier string
	VolumeIdentifier string
	VolumeSpaceSize  uint32 // Number of Logical Blocks in which the
	// volume is recorded.
	VolumeSetSize uint16 // The size of the set in this logical
	// volume (number of disks).
	VolumeSequenceNumber uint16 // The number of this disk in the Volume Set.
	LogicalBlockSize     uint16 // The size in bytes of a logical
	// block. NB: This means that a
	// logical block on a CD could be
	// something other than 2 KiB!
	VolumeSetIdentifier string // Identifier of the volume set of
	// which this volume is a member.
	PublisherIdentifier string // The volume publisher. For extended
	// publisher information, the first
	// byte should be 0x5F, followed by
	// the filename of a file in the root
	// directory. If not specified, all
	// bytes should be 0x20.
	DataPreparerIdentifier string // The identifier of the person(s) who
	// prepared the data for this
	// volume. For extended preparation
	// information, the first byte should
	// be 0x5F, followed by the filename
	// of a file in the root directory. If
	// not specified, all bytes should be
	// 0x20.
	ApplicationIdentifier string // Identifies how the data are
	// recorded on this volume. For
	// extended information, the first
	// byte should be 0x5F, followed by
	// the filename of a file in the root
	// directory. If not specified, all
	// bytes should be 0x20.  IGNORE coses
	// de la Path Table
	CopyrightFileIdentifier string // Filename of a file in the root
	// directory that contains copyright
	// information for this volume
	// set. If not specified, all bytes
	// should be 0x20.
	AbstractFileIdentifier string // Filename of a file in the root
	// directory that contains abstract
	// information for this volume
	// set. If not specified, all bytes
	// should be 0x20.
	BiblioFileIdentifier string // Filename of a file in the root
	// directory that contains
	// bibliographic information for this
	// volume set. If not specified, all
	// bytes should be 0x20.
	VolumeCreation       ISO_DateTime
	VolumeModification   ISO_DateTime
	VolumeExpiration     ISO_DateTime
	VolumeEffective      ISO_DateTime
	FileStructureVersion uint8
	// contains filtered or unexported fields
}

type IndexInfo

type IndexInfo struct {
	Id  uint8 // Identificador en BCD 99 (01h..99h) Pot existir una 0.
	Pos Position
}

type Info

type Info struct {
	Sessions []SessionInfo
	Tracks   []TrackInfo
}

type Position

type Position struct {
	Minutes uint8 // BCD, 74, (00h..73h)
	Seconds uint8 // BCD, 60, (00h..59h)
	Sector  uint8 // BCD, 75, (00h..74h)
}

func GetPosition

func GetPosition(sec_ind int64) Position

Tradueix un índex de sector en una estructura de tipus Position.

type SessionInfo

type SessionInfo struct {
	Tracks []TrackInfo
}

type TrackInfo

type TrackInfo struct {
	Id            uint8 // Identificador en BCD 99 (01h..99h)
	Indexes       []IndexInfo
	PosLastSector Position // Posició absoluta de l'últim sector del
	// track
	Type int
}

type TrackReader

type TrackReader interface {

	// Tanca el lector. Deprés de tancat no es pot llegir.
	Close() error

	// Funciona exactament com la interfície Reader.
	Read(b []byte) (n int, err error)

	// Mou el lector al principi del sector (0 és el primer sector del
	// track) indicat.
	Seek(sector int64) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL