diff --git a/include/dicformat/decls.h b/include/dicformat/decls.h index 66fbbbe..83d0676 100644 --- a/include/dicformat/decls.h +++ b/include/dicformat/decls.h @@ -113,6 +113,8 @@ uint32_t edc_cd_compute(void *context, uint32_t edc, const uint8_t *src, int siz int32_t read_track_sector(void *context, uint8_t *data, uint64_t sectorAddress, uint32_t *length, uint8_t track); -static int32_t GetMediaTagTypeForDataType(int32_t type); +int32_t GetMediaTagTypeForDataType(int32_t type); + +int32_t GetXmlMediaType(int32_t type); #endif //LIBDICFORMAT_DECLS_H diff --git a/src/helpers.c b/src/helpers.c index d475cd2..9ff6b1f 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -34,7 +34,7 @@ #include // Converts between image data type and dic media tag type -static int32_t GetMediaTagTypeForDataType(int32_t type) +int32_t GetMediaTagTypeForDataType(int32_t type) { switch(type) { @@ -110,3 +110,103 @@ static int32_t GetMediaTagTypeForDataType(int32_t type) default: return -1; } } + +// Get the CICM XML media type from DIC media type +int32_t GetXmlMediaType(int32_t type) +{ + switch(type) + { + case CD: + case CDDA: + case CDG: + case CDEG: + case CDI: + case CDIREADY: + case CDROM: + case CDROMXA: + case CDPLUS: + case CDMO: + case CDR: + case CDRW: + case CDMRW: + case VCD: + case SVCD: + case PCD: + case SACD: + case DDCD: + case DDCDR: + case DDCDRW: + case DTSCD: + case CDMIDI: + case CDV: + case DVDROM: + case DVDR: + case DVDRW: + case DVDPR: + case DVDPRW: + case DVDPRWDL: + case DVDRDL: + case DVDPRDL: + case DVDRAM: + case DVDRWDL: + case DVDDownload: + case HDDVDROM: + case HDDVDRAM: + case HDDVDR: + case HDDVDRW: + case HDDVDRDL: + case HDDVDRWDL: + case BDROM: + case BDR: + case BDRE: + case BDRXL: + case BDREXL: + case EVD: + case FVD: + case HVD: + case CBHD: + case HDVMD: + case VCDHD: + case SVOD: + case FDDVD: + case LD: + case LDROM: + case LDROM2: + case LVROM: + case MegaLD: + case PS1CD: + case PS2CD: + case PS2DVD: + case PS3DVD: + case PS3BD: + case PS4BD: + case UMD: + case XGD: + case XGD2: + case XGD3: + case XGD4: + case MEGACD: + case SATURNCD: + case GDROM: + case GDR: + case SuperCDROM2: + case JaguarCD: + case ThreeDO: + case PCFX: + case NeoGeoCD: + case GOD: + case WOD: + case WUOD: + case CDTV: + case CD32: + case Nuon: + case Playdia: + case Pippin: + case FMTOWNS: + case MilCD: + case VideoNow: + case VideoNowColor: + case VideoNowXp: return OpticalDisc; + default: return BlockMedia; + } +} diff --git a/src/open.c b/src/open.c index f45c0ff..184e79a 100644 --- a/src/open.c +++ b/src/open.c @@ -1154,9 +1154,7 @@ void *open(const char *filepath) ctx->imageInfo.CreationTime = ctx->header.creationTime; ctx->imageInfo.LastModificationTime = ctx->header.lastWrittenTime; - - // TODO: GetXmlMediaType - // imageInfo.XmlMediaType = GetXmlMediaType(header.mediaType); + ctx->imageInfo.XmlMediaType = GetXmlMediaType(ctx->header.mediaType); if(ctx->geometryBlock.identifier != GeometryBlock/* && ctx->imageInfo.XmlMediaType == XmlMediaType.BlockMedia*/) {