⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 id3lib-manual.php

📁 本人收集整理的一份c/c++跨平台网络库
💻 PHP
字号:
<?php
$subsection=0;

function printHeader($string) {
    global $subsection;
    echo  "<FONT SIZE=\"+";
    echo 3-$subsection ;
    echo  "\">$string</FONT>\n";
    echo  "<P>";
    $subsection++;
    return;
}

function startSection() {
    $subsection++;
    echo  "<OL>\n";
}

function endSection() {
    global $subsection;
    echo  "</OL>\n";
    echo  "<P>\n";
    $subsection--;
}

function startCode() {
    global $subsection;

/*
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="3"><TR><TD ALIGN="center" BGCOLOR="#EEEEEE"><B><FONT FACE="Lucida,Verdana,Helvetica,Arial"><FONT COLOR="#000000">navigator</FONT></FONT></B></TD></TR><TR><TD BGCOLOR="#FFFFFF"><SMALL><FONT FACE="Lucida,Verdana,Helvetica,Arial">
*/ 

    echo  "<TABLE WIDTH=\"";
    echo 100-(($subsection+1)*5);
    echo  "%\" BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\"><TR><TD BGCOLOR=\"000000\" align=center>";
    echo  "<TABLE WIDTH=\"100%\" BORDER=\"0\" CELLSPACING=\"1\" CELLPADDING=\"3\"><TR><TD BGCOLOR=\"b0b0b0\">\n";
    echo  "<TT><PRE>";
}

function endCode() {
    global $subsection;
    echo  "</PRE></TT>\n";
    echo  "</TD></TR></TABLE>";
    echo  "</TD></TR></TABLE>\n";
}

?>
<HEAD>
<TITLE>Documentation for ID3Lib 3.05</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<CENTER>
<FONT SIZE="+3">
Documentation for<BR>
ID3Lib 3.05<P>
</FONT>

<FONT SIZE="+1">
Copyright Dirk Mahoney<BR>
22 November 1998
</FONT>
</CENTER>

<BLOCKQUOTE>
ID3Lib is a C++ class library for manipulating ID3v2 tags.  ID3Lib 3.05 conforms to all ID3v2 standards up to and including the ID3v2-3.0 informal standard.
</BLOCKQUOTE>

<P>
<?php printHeader( "Introduction"); ?>
<?php startSection() ?>
    No intro. Let's go!
<?php endSection() ?>

<?php printHeader( "License Agreement"); ?>
<?php startSection() ?>
The authors have released ID3Lib as Public Domain (PD) and claim no copyright, patent or other intellectual property protection in this work.  This means that it may be modified, redistributed and used in commercial and non-commercial software or hardware without restrictions.  ID3Lib is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
<P>
The ID3Lib authors encourage improvements and optimisations to be sent to the ID3Lib coordinator, currently Dirk Mahoney (dirk@id3.org).  Approved submissions may be altered, and will be included and released under these terms.
<?php endSection() ?>

<?php printHeader( "The ID3_Tag Class"); ?>
<?php startSection() ?>
<P>
This is the "container" class for everything else.  It is through an ID3_Tag object that most of the productive stuff happens.  Let's look at what's required to start using ID3v2 tags.

<?php startCode(); ?>
#include "id3_tag.h"
<?php endCode(); ?>

This simple #include does it all.  In order to read an existing tag

<?php startCode(); ?>
ID3_Tag myTag;

myTag.Link ( "something.mp3" );
<?php endCode(); ?>

That is all there is to it.  Now all you have to do is use the ::Find() member function to locate the frames you are interested in:

<?php startCode(); ?>
ID3_Frame *myFrame;

if ( myFrame = myTag.Find ( ID3FID_TITLE ) )
{
      char title[ 1024 ];

      myFrame->Field ( ID3FN_TEXT ).Get ( title, 1024 );

      cout << "Title: " << title << endl;
}
<?php endCode(); ?>

This code snippet locates the TITLE frame and copies the contents of the text field into a buffer and displays the buffer.  Not difficult eh?

When using the ::Link() facility of an ID3_Tag object, you automatically gain access to any ID3v1/1.1, ID3v2 and Lyrics3 v2.0 tags present in the file.  The class will automatically parse and convert any of these foreign tag formats into ID3v2 tags.  Also, ID3Lib will correctly parse any correctly formatted 'CDM' frames from the unreleased 2.01 draft that ID3Lib 2.16 supports.
<P>
Okay, let's analyse the ID3_Tag class function-by-function to see what an application can do with it.
<P>
<?php printHeader( "The ID3_Tag Constructor"); ?>
<?php startSection() ?>
The ID3_Tag constructor can be called without any parameters.  Alternatively, it can accept a single parameter that is a pointer to a file name.  If this file exists, it will be opened and all ID3Lib-supported tags will be parsed and converted to ID3v2 if necessary.  After the conversion, the file will remain unchanged, and will continue to do so until you use the ID3_Tag::Update() function on the tag (if you choose to ID3_Tag::Update() at all).  This will be discussed later.
<?php endSection() ?>

<?php printHeader( "ID3_Tag::Clear()"); ?>
<?php startSection() ?>
This function takes no parameters and simply clears the object and disassociates it from any files.  It frees any resources for which the object is responsible, and the object is now free to be used again for any new or existing tag.
<?php endSection() ?>

<?php printHeader( "ID3_Tag::HasChanged()"); ?>
<?php startSection() ?>
This function takes no parameters but returns a boolean indicating whether the tag has been altered since the last parse, render or update.  If you have a tag linked to a file, you do not need this function since the ID3_Tag::Update() function will check for changes before writing the tag.
<P>
This function is primarily intended as a status indicator for applications and for applications that use the ID3_Tag::Parse() and ID3_Tag::Render() functions.
<P>
Setting a field, changing the ID of an attached frame, setting or changing grouping or encryption IDs and clearing a frame or field all constitute a change to the tag, as do calls to the ID3_Tag::SetUnsync(), ID3_Tag::SetExtendedHeader() and ID3_Tag::SetPadding() and ID3_Tag::SetCompression() functions.

<?php startCode(); ?>
if ( myTag.HasChanged() )
{
    // render and output the tag
    ...
}
<?php endCode(); ?>
<?php endSection() ?>

<?php printHeader( "ID3_Tag::SetVersion()"); ?>
<?php startSection(); ?>
This function has been removed from 3.05.  ID3Lib will now always create tags using the latest version of the standard.
<?php endSection(); ?>

<?php printHeader( "ID3_Tag::SetUnsync()"); ?>
<?php startSection(); ?>
This call takes a single boolean parameter and tells the object whether you wish the resulting binary tag to be unsynchronised if unsync is required.  If you call this function with 'false' as the parameter, the binary tag will not be unsync'ed, regardless of whether the tag should be.  This option is useful when the file is only going to be used by ID3v2-compliant software.  See the ID3v2 standard document for further details on unsync.
<P>
By default, tags are created without unsync.

<?php startCode(); ?>
myTag.SetUnsync ( false );
<?php endCode(); ?>
<?php endSection(); ?>

<?php printHeader( "ID3_Tag::SetExtendedHeader()"); ?>
<?php startSection(); ?>
This function tells the tag whether to create an extended header when rendering the tag.  This option is currently ignored as ID3Lib doesn't yet create extended headers.  This option only applies when rendering tags for ID3v2 versions that support extended headers.
<P>
By default, ID3Lib will generate extended headers for all tags in which extended headers are supported.

<?php startCode(); ?>
myTag.SetExtendedHeader ( true );
<?php endCode(); ?>
<?php endSection(); ?>

<?php printHeader( "ID3_Tag::SetCompression()"); ?>
<?php startSection(); ?>
Under ID3v2-3.0, there is support for the compression of data in tags.  The current standard defines compression on a frame-by-frame basis using the zlib data compression standard.  Using this call, you tell the object whether to attempt to compress frames or not.  If a frame doesn't compress well, it will not be compressed, regardless of this setting.  This function takes a single boolean parameter.  By default, ID3Lib will attempt to compress all the frames in a tag.

<?php startCode(); ?>
myTag.SetCompression ( true );
<?php endCode(); ?>

When creating tags for a version of ID3v2 in which compression isn't defined, the tags are simply rendered without compression to ensure compliance to the relevant version of the standard.
<?php endSection(); ?>

<?php printHeader( "ID3_Tag::SetPadding()"); ?>
<?php startSection(); ?>
When using ID3v2 tags in association with files, ID3Lib can optionally add padding to the tags to ensure minimal file write times when updating the tag in the future.
<P> 
When the padding option is switched on, ID3Lib automatically creates padding according the 'ID3v2 Programming Guidelines'.  Specifically, enough padding will be added to round out the entire file (song plus tag) to an even multiple of 2K.  Padding will only be created when the tag is attached to a file and that file is not empty (aside from a pre-existing tag).
<P>
My own addition to the guidelines for padding, and that which ID3Lib follows is that if frames are removed from a pre-existing tag (or the tag simply shrinks because of other reasons), the new tag will continue to stay the same size as the old tag (with padding making the difference of course) until such time as the padding is greater than 4K.  When this happens, the padding will be reduced and the new tag will be smaller than the old.
<P>
By default, padding is switched on.
<P>
<?php startCode(); ?>
myTag.SetPadding ( false );
<?php endCode(); ?>

An alternate form of the SetPadding() function has been removed from 3.05.

<?php startCode(); ?>
myTag.SetPadding ( true ); // switch padding on
myTag.SetPadding ( 1024 ); // add 1K of padding
<?php endCode(); ?>

<?php endSection(); ?>

<?php printHeader( "ID3_Tag::SetFileSize()"); ?>
<?php startSection(); ?>
This function has been removed from 3.05.
<?php endSection(); ?>

<?php printHeader( "ID3_Tag::AddFrame() and operator<<()"); ?>
<?php startSection(); ?>
To attach a frame object (see later) to a tag object, you can use the ID3_Tag::AddFrame() function or the << operator.  To use the ID3_Tag::AddFrame() function, simply supply as it's sole parameter a pointer to the ID3_Frame object you wish to attach.  Even though the 'id3_tag.h' file says that ID3_Tag::AddFrame also takes a boolean parameter, this parameter is for internal use only 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -