Implement xml media type.

This commit is contained in:
2019-03-31 20:30:27 +01:00
parent 5b92838bdc
commit b36c664740
3 changed files with 105 additions and 5 deletions

View File

@@ -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

View File

@@ -34,7 +34,7 @@
#include <dicformat.h>
// 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;
}
}

View File

@@ -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*/)
{