Giter Site home page Giter Site logo

pdmp3's Introduction

PDMP3

Public domain mp3 decoder

This project is a fork of the mp3 decoder written by Krister Lagerstrom as part of a master's thesis. This version implements a subset op the libmpg123 API which should be a 100% compatible replacement. If it's not that is considered a bug. In theory more libmpg123 compatible functions could be implemented quite easily.

Available functions for the streaming API are: ` pdmp3_handle *pdmp3_new(const char *decoder,int *error); void pdmp3_delete(pdmp3_handle *id); int pdmp3_open_feed(pdmp3_handle *id); int pdmp3_feed(pdmp3_handle *id,const unsigned char *in,size_t size); int pdmp3_read(pdmp3_handle *id,unsigned char *outmemory,size_t outsize,size_t *done); int pdmp3_decode(pdmp3_handle *id,const unsigned char *in,size_t insize,unsigned char *out,size_t outsize,size_t *done); int pdmp3_getformat(pdmp3_handle *id,long *rate,int *channels,int *encoding);

int pdmp3_info(pdmp3_handle *id,struct pdpm3_frameinfo *info);

int pdmp3_meta_check(pdmp3_handle *id); int pdmp3_id3(pdmp3_handle *id,pdmp3_id3v1 **v1,pdmp3_id3v2 **v2); `

The following code allows approximating the duration of the current stream if the length of the stream is known:

` struct pdpm3_frameinfo info; int enc, channels; long rate;

if (pdmp3_getformat(handle->id, &rate, &channels, &enc) == MPG123_OK) { struct pdpm3_frameinfo info; if (pdmp3_info(handle->id,&info) == MPG123_OK) { double no_samples = (double)rate/(info.bitrate/8.0)*file_size_bytes; } } `

TODO

  • cleanup,
  • switch to bitfields,
  • fix some of the horribly nested logic

License: My work is placed in the public domain. You may do whatever you wish with it, including using it for commercial applications.

The thesis and original code are available at:

From the abstract:

Digital compression of audio data is important due to the bandwidth and storage limitations inherent in networks and computers. Algorithms based on perceptual coding are effective and have become feasible with faster computers. The ISO standard 11172-3 MPEG-1 layer III (a.k.a. MP3) is a perceptual codec that is presently very common for compression of CD quality music. An MP3 decoder has a complex structure and is computationally demanding.

The purpose of this master's thesis is to present a tutorial on the standard. We have analysed several algorithms suitable for implementing an MP3 decoder, their advantages and disadvantages with respect to speed, memory demands and implementation complexity. We have also designed and implemented a portable reference MP3 decoder in C.

If you are trying to implement an mp3 decoder and found the 11172-3 reference to be vague, the thesis is a a good read.

Some other good references are:

pdmp3's People

Contributors

ermarch avatar technosaurus avatar

Stargazers

Rumia_Chnnel avatar  avatar Krister Lagerström avatar Alexander Irbis avatar Lion avatar Andreas Mattsson avatar

Watchers

James Cloos avatar Krister Lagerström avatar Lion avatar adalin avatar

Forkers

sahwar

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.