internal static extern int WWFlacRW_GetDecodedMetadata(int id, out Metadata metaReturn);
internal static extern int WWFlacRW_EncodeInit(Metadata meta);
public int GetDecodedMetadata(out Metadata meta) { NativeMethods.Metadata nMeta; int result = NativeMethods.WWFlacRW_GetDecodedMetadata(mId, out nMeta); meta = new Metadata(); if (0 <= result) { meta.sampleRate = nMeta.sampleRate; meta.channels = nMeta.channels; meta.bitsPerSample = nMeta.bitsPerSample; meta.pictureBytes = nMeta.pictureBytes; meta.totalSamples = nMeta.totalSamples; meta.titleStr = nMeta.titleStr; meta.albumStr = nMeta.albumStr; meta.artistStr = nMeta.artistStr; meta.albumArtistStr = nMeta.albumArtistStr; meta.genreStr = nMeta.genreStr; meta.dateStr = nMeta.dateStr; meta.trackNumberStr = nMeta.trackNumberStr; meta.discNumberStr = nMeta.discNumberStr; meta.pictureMimeTypeStr = nMeta.pictureMimeTypeStr; meta.pictureDescriptionStr = nMeta.pictureDescriptionStr; meta.md5sum = nMeta.md5sum; } return result; }
public Metadata(Metadata rhs) { sampleRate = rhs.sampleRate; channels = rhs.channels; bitsPerSample = rhs.bitsPerSample; pictureBytes = rhs.pictureBytes; totalSamples = rhs.totalSamples; SafeCopy(rhs.titleStr, ref titleStr); SafeCopy(rhs.artistStr, ref artistStr); SafeCopy(rhs.albumStr, ref albumStr); SafeCopy(rhs.albumArtistStr, ref albumArtistStr); SafeCopy(rhs.genreStr, ref genreStr); SafeCopy(rhs.dateStr, ref dateStr); SafeCopy(rhs.trackNumberStr, ref trackNumberStr); SafeCopy(rhs.discNumberStr, ref discNumberStr); SafeCopy(rhs.pictureMimeTypeStr, ref pictureMimeTypeStr); SafeCopy(rhs.pictureDescriptionStr, ref pictureDescriptionStr); if (rhs.md5sum != null && rhs.md5sum.Length != 0) { md5sum = new byte[rhs.md5sum.Length]; System.Array.Copy(rhs.md5sum, md5sum, md5sum.Length); } else { md5sum = new byte[NativeMethods.WWFLAC_MD5SUM_BYTES]; } }
public int EncodeInit(Metadata meta) { var nMeta = new NativeMethods.Metadata(); nMeta.sampleRate = meta.sampleRate; nMeta.channels = meta.channels; nMeta.bitsPerSample = meta.bitsPerSample; nMeta.pictureBytes = meta.pictureBytes; nMeta.totalSamples = meta.totalSamples; nMeta.titleStr = meta.titleStr; nMeta.albumStr = meta.albumStr; nMeta.artistStr = meta.artistStr; nMeta.albumArtistStr = meta.albumArtistStr; nMeta.genreStr = meta.genreStr; nMeta.dateStr = meta.dateStr; nMeta.trackNumberStr = meta.trackNumberStr; nMeta.discNumberStr = meta.discNumberStr; nMeta.pictureMimeTypeStr = meta.pictureMimeTypeStr; nMeta.pictureDescriptionStr = meta.pictureDescriptionStr; nMeta.md5sum = meta.md5sum; mId = NativeMethods.WWFlacRW_EncodeInit(nMeta); return mId; }