Code Monkey home page Code Monkey logo

Comments (2)

Youlean avatar Youlean commented on June 3, 2024

I manage to fix the issue. The solution is to seek to the file start before processing the metadata. Also, I have added some code to skip the unknown Pro Tools metadata.

DRWAV_PRIVATE drwav_uint64 drwav__metadata_process_unknown_chunk(drwav__metadata_parser* pParser, const drwav_uint8* pChunkId, drwav_uint64 chunkSize, drwav_metadata_location location)
{
    drwav_uint64 bytesRead = 0;

    if (location == drwav_metadata_location_invalid) {
        return 0;
    }

    /* Skip unknown these chunks */
    if (drwav_fourcc_equal(pChunkId, "data") || 
        drwav_fourcc_equal(pChunkId, "ds64") || 
        drwav_fourcc_equal(pChunkId, "fmt ") || 
        drwav_fourcc_equal(pChunkId, "fact")) {
        return 0;
    }

    /* Skip unknown Pro Tools chunks */
    if (drwav_fourcc_equal(pChunkId, "minf") ||
        drwav_fourcc_equal(pChunkId, "elm1") ||
        drwav_fourcc_equal(pChunkId, "regn") ||
        drwav_fourcc_equal(pChunkId, "umid") ||
        drwav_fourcc_equal(pChunkId, "DGDA") ||
        drwav_fourcc_equal(pChunkId, "JUNK")) {
      return 0;
    }

----------------------------------------------------------------------------------------

/* Store cursor before ds64 as we will need it to seek to the file start in order to capture metadata that is before the ds64 and fmt */
    drwav_uint64 cursorBeforeDs64 = cursor;

    /* For RF64, the "ds64" chunk must come next, before the "fmt " chunk. */`

----------------------------------------------------------------------------------------

    /* Set cursor and seek to a position before ds64 and fmt in order to capture metadata that is before the ds64 and fmt */
    cursor = cursorBeforeDs64;

    if (!drwav__seek_from_start(pWav->onSeek, cursor, pWav->pUserData)) {
      return DRWAV_FALSE;
    }

    /* Basic validation. */

from dr_libs.

mackron avatar mackron commented on June 3, 2024

Thanks for reporting this. I've finally got around to addressing this. It's in the dev branch if you were wanting to try it.

from dr_libs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.