C语言获取音频文件元数据 - libmtag

jopen 13年前
     <div id="p_fullcontent" class="detail">     <p><a style="color:#000000;text-decoration:none;" href="/misc/goto?guid=4959500882559381236">libmtag</a> 是一个 C 语言库用来获取 MP3、OGG 和 Flac 文件的元信息。同时也提供 Python 和 Ruby 语言绑定的版本。</p>     <p>示例代码:</p>     <p><strong>C</strong><br /> </p>     <pre class="brush:cpp; toolbar: true; auto-links: false;">mtag_file_t *file; mtag_tag_t *tag;  file = mtag_file_new("song.mp3");  tag = mtag_file_tag(file); printf(”%s - %s\n”, mtag_tag_get(tag, “artist”), mtag_tag_get(tag, “title”));  mtag_tag_set(tag, "artist", "foo"); mtag_file_save(file);  mtag_file_free(file);</pre>     <br />     <strong>Ruby</strong>     <br />     <br />     <pre class="brush:ruby; toolbar: true; auto-links: false;">file = MTag::File.new(fn) print(”%s - %s\n” % [file.tag.artist, file.tag.title]) file.tag.artist = "foo" file.save</pre>     <br />     <strong>Python</strong>     <br />     <br />     <pre class="brush:python; toolbar: true; auto-links: false;">file = libmtag.File(fn) print "%s - %s" % (file.tag().get("artist"), file.tag().get("title")) file.tag().set("artist", "foo") file.save()</pre>     <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1326628806750" target="_blank">http://www.open-open.com/lib/view/home/1326628806750</a></p>     <p></p>    </div>