Giter Site home page Giter Site logo

zephray / id3v2lib-e Goto Github PK

View Code? Open in Web Editor NEW

This project forked from larsbs/id3v2lib

0.0 0.0 1.0 54 KB

id3v2lib-e is a library written in C to read id3 tags from mp3 files for microcontrollers.

License: BSD 2-Clause "Simplified" License

C 96.54% Makefile 0.70% C++ 2.76%

id3v2lib-e's Introduction

id3v2lib-e

id3v2lib is a library written in C to read and edit id3 tags from mp3 files. It is focused on the ease of use. As it is a personal project, the software is provided "as is" without warranty of any kind.

The id3v2lib-e is a fork of the original id3v2lib adapted to be used in memory limited embedded devices, such as microcontrollers. All editing functions are removed, and it no longer caches the tag content in the memory, instead it only caches minimal meta data for fast link list traversing and read the actual content from filesystem upon request. This greatly reduces the memory requirement from around 3x the tag size (~1MB assuming 640x640 JPEG cover art) to < 1 KB.

It is licensed under BSD License. See LICENSE for details.

What it can do?

id3v2lib-e can read id3 v2.3 and v2.4 tags from mp3 files. It can read a small subset of tags by default. Specifically, the most used tags:

  • Title
  • Album
  • Artist
  • Album Artist
  • Comment
  • Genre
  • Year
  • Track
  • Disc Number
  • Album Cover

However, it can be extended, in a very easy manner, to read other id3 tags.

Building id3v2lib-e

By default, cross-compiling is not configured in the Makefile. The easiest way of integrating this into your ARM, RISC-V or other processor based project is simply copy all files into your project.

Usage

You only have to include the main header of the library:

#include <id3v2lib.h>
	
int main(int argc, char* argv[])
{
	// Etc..
}

And when compiling, link against the static library:

$ gcc -o example example.c -lid3v2

Main functions

File functions

This functions interacts directly with the file to edit. This functions are:

  • ID3v2_tag* load_tag(const char* filename)

Note this function also saves the file pointer into the tag struct and can be accessed through tag->file.

Tag functions

This functions interacts with the tags in the file. They are classified in three groups:

Getter functions

Retrieve information from a tag, they have the following name pattern:

  • tag_get_[frame] where frame is the name of the desired field from which to obtain information. It can be one of the previously mentioned tags.

Examples

Load tags

ID3v2_tag* tag = load_tag("file.mp3"); // Load the full tag from the file
if(tag == NULL)
{
	tag = new_tag();
}
	
// Load the fields from the tag
ID3v2_frame* artist_frame = tag_get_artist(tag->file, tag); // Get the full artist frame
// We need to parse the frame content to make readable
ID3v2_frame_text_content* artist_content = parse_text_frame_content(artist_frame); 
printf("ARTIST: %s\n", artist_content->data); // Show the artist info
	
ID3v2_frame* title_frame = tag_get_title(tag->file, tag);
ID3v2_frame_text_content* title_content = parse_text_frame_content(title_frame);
printf("TITLE: %s\n", title_content->data);

ID3v2_frame* cover_frame = tag_get_album_cover(tag);
ID3v2_frame_apic_content *cover_content = parse_apic_frame_content(tag->file, frame);
printf("Image type: %s, offset in original file: %d\n", cover_content->mime_type, cover_content->offset);

Projects

If your project is using this library, let me know it and I will put it here.

Copyright

Copyright (c) 2013 Lorenzo Ruiz. Copyright (c) 2020 Wenting Zhang. See LICENSE for details.

Questions?

If you have any questions, please feel free to ask me. I will try to answer it ASAP.

id3v2lib-e's People

Contributors

larsbs avatar kontinuation avatar timtam avatar kdeng00 avatar moritzschaefer avatar hopeseekr avatar zephray avatar briansorahan avatar comicsansms avatar koffeinflummi avatar

Forkers

vehar

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.