mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Revert "Add a tool to inspect audio files, only MP4 is implemented for now"
This reverts commit 45b0279b41
.
This commit is contained in:
parent
dbe6be778b
commit
c6f7ad3e83
@ -5,7 +5,6 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../taglib
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v1
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v2
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mp4
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../bindings/c/ )
|
||||
|
||||
if(ENABLE_STATIC)
|
||||
@ -47,12 +46,5 @@ ADD_EXECUTABLE(strip-id3v1 strip-id3v1.cpp)
|
||||
TARGET_LINK_LIBRARIES(strip-id3v1 tag )
|
||||
|
||||
|
||||
########### next target ###############
|
||||
|
||||
ADD_EXECUTABLE(inspect inspect.cpp)
|
||||
|
||||
TARGET_LINK_LIBRARIES(inspect tag )
|
||||
|
||||
|
||||
endif(BUILD_EXAMPLES)
|
||||
|
||||
|
@ -1,61 +0,0 @@
|
||||
/* Copyright (C) 2012 Lukas Lalinsky <lalinsky@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <fileref.h>
|
||||
#include <mp4file.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace TagLib;
|
||||
|
||||
#define MAYBE_PRINT_DESC(_Type) \
|
||||
if(dynamic_cast<_Type *>(f.file())) { \
|
||||
cout << dynamic_cast<_Type *>(f.file())->toString().to8Bit(true) << endl; \
|
||||
found = 1; \
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// process the command line args
|
||||
|
||||
for(int i = 1; i < argc; i++) {
|
||||
|
||||
cout << "******************** \"" << argv[i] << "\"********************" << endl;
|
||||
|
||||
FileRef f(argv[i]);
|
||||
|
||||
bool found = 0;
|
||||
if(!f.isNull() && f.file()) {
|
||||
MAYBE_PRINT_DESC(MP4::File);
|
||||
MAYBE_PRINT_DESC(File);
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
cout << "could not find any information about the file" << endl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -24,7 +24,6 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "audioproperties.h"
|
||||
#include "tstringlist.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
@ -50,13 +49,3 @@ AudioProperties::AudioProperties(ReadStyle)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
String
|
||||
AudioProperties::toString() const
|
||||
{
|
||||
StringList desc;
|
||||
desc.append("Audio");
|
||||
desc.append(String::number(length()) + " seconds");
|
||||
desc.append(String::number(bitrate()) + " kbps");
|
||||
return desc.toString(", ");
|
||||
}
|
||||
|
@ -27,7 +27,6 @@
|
||||
#define TAGLIB_AUDIOPROPERTIES_H
|
||||
|
||||
#include "taglib_export.h"
|
||||
#include "tstring.h"
|
||||
|
||||
namespace TagLib {
|
||||
|
||||
@ -87,8 +86,6 @@ namespace TagLib {
|
||||
*/
|
||||
virtual int channels() const = 0;
|
||||
|
||||
String toString() const;
|
||||
|
||||
protected:
|
||||
|
||||
/*!
|
||||
|
@ -149,16 +149,3 @@ MP4::File::save()
|
||||
return d->tag->save();
|
||||
}
|
||||
|
||||
String
|
||||
MP4::File::toString() const
|
||||
{
|
||||
StringList desc;
|
||||
if(d->properties) {
|
||||
desc.append(d->properties->toString());
|
||||
}
|
||||
if(d->tag) {
|
||||
desc.append(d->tag->toString());
|
||||
}
|
||||
return desc.toString("\n");
|
||||
}
|
||||
|
||||
|
@ -100,11 +100,6 @@ namespace TagLib {
|
||||
*/
|
||||
bool save();
|
||||
|
||||
/*!
|
||||
* Description of the file.
|
||||
*/
|
||||
String toString() const;
|
||||
|
||||
private:
|
||||
|
||||
void read(bool readProperties, Properties::ReadStyle audioPropertiesStyle);
|
||||
|
@ -26,7 +26,6 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#include <taglib.h>
|
||||
#include <tdebug.h>
|
||||
@ -37,11 +36,10 @@ using namespace TagLib;
|
||||
class MP4::Item::ItemPrivate : public RefCounter
|
||||
{
|
||||
public:
|
||||
ItemPrivate() : RefCounter(), valid(true), atomDataType(MP4::TypeUndefined), type(MP4::Item::TypeUndefined) {}
|
||||
ItemPrivate() : RefCounter(), valid(true), atomDataType(TypeUndefined) {}
|
||||
|
||||
bool valid;
|
||||
AtomDataType atomDataType;
|
||||
ItemType type;
|
||||
union {
|
||||
bool m_bool;
|
||||
int m_int;
|
||||
@ -88,35 +86,30 @@ MP4::Item::Item(bool value)
|
||||
{
|
||||
d = new ItemPrivate;
|
||||
d->m_bool = value;
|
||||
d->type = TypeBool;
|
||||
}
|
||||
|
||||
MP4::Item::Item(int value)
|
||||
{
|
||||
d = new ItemPrivate;
|
||||
d->m_int = value;
|
||||
d->type = TypeInt;
|
||||
}
|
||||
|
||||
MP4::Item::Item(uchar value)
|
||||
{
|
||||
d = new ItemPrivate;
|
||||
d->m_byte = value;
|
||||
d->type = TypeByte;
|
||||
}
|
||||
|
||||
MP4::Item::Item(uint value)
|
||||
{
|
||||
d = new ItemPrivate;
|
||||
d->m_uint = value;
|
||||
d->type = TypeUInt;
|
||||
}
|
||||
|
||||
MP4::Item::Item(long long value)
|
||||
{
|
||||
d = new ItemPrivate;
|
||||
d->m_longlong = value;
|
||||
d->type = TypeLongLong;
|
||||
}
|
||||
|
||||
MP4::Item::Item(int value1, int value2)
|
||||
@ -124,28 +117,24 @@ MP4::Item::Item(int value1, int value2)
|
||||
d = new ItemPrivate;
|
||||
d->m_intPair.first = value1;
|
||||
d->m_intPair.second = value2;
|
||||
d->type = TypeIntPair;
|
||||
}
|
||||
|
||||
MP4::Item::Item(const ByteVectorList &value)
|
||||
{
|
||||
d = new ItemPrivate;
|
||||
d->m_byteVectorList = value;
|
||||
d->type = TypeByteVectorList;
|
||||
}
|
||||
|
||||
MP4::Item::Item(const StringList &value)
|
||||
{
|
||||
d = new ItemPrivate;
|
||||
d->m_stringList = value;
|
||||
d->type = TypeStringList;
|
||||
}
|
||||
|
||||
MP4::Item::Item(const MP4::CoverArtList &value)
|
||||
{
|
||||
d = new ItemPrivate;
|
||||
d->m_coverArtList = value;
|
||||
d->type = TypeCoverArtList;
|
||||
}
|
||||
|
||||
void MP4::Item::setAtomDataType(MP4::AtomDataType type)
|
||||
@ -218,46 +207,3 @@ MP4::Item::isValid() const
|
||||
return d->valid;
|
||||
}
|
||||
|
||||
String
|
||||
MP4::Item::toString() const
|
||||
{
|
||||
StringList desc;
|
||||
char tmp[256];
|
||||
switch (d->type) {
|
||||
case TypeBool:
|
||||
return d->m_bool ? "true" : "false";
|
||||
case TypeInt:
|
||||
sprintf(tmp, "%d", d->m_int);
|
||||
return tmp;
|
||||
case TypeIntPair:
|
||||
sprintf(tmp, "%d/%d", d->m_intPair.first, d->m_intPair.second);
|
||||
return tmp;
|
||||
case TypeByte:
|
||||
sprintf(tmp, "%d", d->m_byte);
|
||||
return tmp;
|
||||
case TypeUInt:
|
||||
sprintf(tmp, "%u", d->m_uint);
|
||||
return tmp;
|
||||
case TypeLongLong:
|
||||
sprintf(tmp, "%lld", d->m_longlong);
|
||||
return tmp;
|
||||
case TypeStringList:
|
||||
return d->m_stringList.toString(" / ");
|
||||
case TypeByteVectorList:
|
||||
for(int i = 0; i < d->m_byteVectorList.size(); i++) {
|
||||
sprintf(tmp, "[%d bytes of data]", d->m_byteVectorList[i].size());
|
||||
desc.append(tmp);
|
||||
}
|
||||
return desc.toString(", ");
|
||||
case TypeCoverArtList:
|
||||
for(int i = 0; i < d->m_coverArtList.size(); i++) {
|
||||
sprintf(tmp, "[%d bytes of data]", d->m_coverArtList[i].data().size());
|
||||
desc.append(tmp);
|
||||
}
|
||||
return desc.toString(", ");
|
||||
case TypeUndefined:
|
||||
return "[unknown]";
|
||||
}
|
||||
return String();
|
||||
}
|
||||
|
||||
|
@ -41,19 +41,6 @@ namespace TagLib {
|
||||
int first, second;
|
||||
};
|
||||
|
||||
enum ItemType {
|
||||
TypeUndefined = 0,
|
||||
TypeBool,
|
||||
TypeInt,
|
||||
TypeIntPair,
|
||||
TypeByte,
|
||||
TypeUInt,
|
||||
TypeLongLong,
|
||||
TypeStringList,
|
||||
TypeByteVectorList,
|
||||
TypeCoverArtList,
|
||||
};
|
||||
|
||||
Item();
|
||||
Item(const Item &item);
|
||||
Item &operator=(const Item &item);
|
||||
@ -82,12 +69,8 @@ namespace TagLib {
|
||||
ByteVectorList toByteVectorList() const;
|
||||
CoverArtList toCoverArtList() const;
|
||||
|
||||
ItemType type() const;
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
String toString() const;
|
||||
|
||||
private:
|
||||
class ItemPrivate;
|
||||
ItemPrivate *d;
|
||||
|
@ -38,13 +38,7 @@ using namespace TagLib;
|
||||
class MP4::Properties::PropertiesPrivate
|
||||
{
|
||||
public:
|
||||
PropertiesPrivate() : length(0), bitrate(0), sampleRate(0), channels(0), bitsPerSample(0), encrypted(false), format(Unknown) {}
|
||||
|
||||
enum Format {
|
||||
Unknown = 0,
|
||||
AAC = 1,
|
||||
ALAC = 2,
|
||||
};
|
||||
PropertiesPrivate() : length(0), bitrate(0), sampleRate(0), channels(0), bitsPerSample(0), encrypted(false) {}
|
||||
|
||||
int length;
|
||||
int bitrate;
|
||||
@ -52,7 +46,6 @@ public:
|
||||
int channels;
|
||||
int bitsPerSample;
|
||||
bool encrypted;
|
||||
Format format;
|
||||
};
|
||||
|
||||
MP4::Properties::Properties(File *file, MP4::Atoms *atoms, ReadStyle style)
|
||||
@ -125,7 +118,6 @@ MP4::Properties::Properties(File *file, MP4::Atoms *atoms, ReadStyle style)
|
||||
file->seek(atom->offset);
|
||||
data = file->readBlock(atom->length);
|
||||
if(data.mid(20, 4) == "mp4a") {
|
||||
d->format = PropertiesPrivate::AAC;
|
||||
d->channels = data.mid(40, 2).toShort();
|
||||
d->bitsPerSample = data.mid(42, 2).toShort();
|
||||
d->sampleRate = data.mid(46, 4).toUInt();
|
||||
@ -146,7 +138,6 @@ MP4::Properties::Properties(File *file, MP4::Atoms *atoms, ReadStyle style)
|
||||
}
|
||||
}
|
||||
else if (data.mid(20, 4) == "alac") {
|
||||
d->format = PropertiesPrivate::ALAC;
|
||||
if (atom->length == 88 && data.mid(56, 4) == "alac") {
|
||||
d->bitsPerSample = data.at(69);
|
||||
d->channels = data.at(73);
|
||||
@ -202,23 +193,3 @@ MP4::Properties::isEncrypted() const
|
||||
return d->encrypted;
|
||||
}
|
||||
|
||||
String
|
||||
MP4::Properties::toString() const
|
||||
{
|
||||
String format;
|
||||
if(d->format == PropertiesPrivate::AAC) {
|
||||
format = "AAC";
|
||||
}
|
||||
else if(d->format == PropertiesPrivate::ALAC) {
|
||||
format = "ALAC";
|
||||
}
|
||||
else {
|
||||
format = "Unknown";
|
||||
}
|
||||
StringList desc;
|
||||
desc.append("MPEG-4 audio (" + format + ")");
|
||||
desc.append(String::number(length()) + " seconds");
|
||||
desc.append(String::number(bitrate()) + " kbps");
|
||||
return desc.toString(", ");
|
||||
}
|
||||
|
||||
|
@ -50,8 +50,6 @@ namespace TagLib {
|
||||
virtual int bitsPerSample() const;
|
||||
bool isEncrypted() const;
|
||||
|
||||
String toString() const;
|
||||
|
||||
private:
|
||||
class PropertiesPrivate;
|
||||
PropertiesPrivate *d;
|
||||
|
@ -759,13 +759,3 @@ MP4::Tag::itemListMap()
|
||||
return d->items;
|
||||
}
|
||||
|
||||
String
|
||||
MP4::Tag::toString() const
|
||||
{
|
||||
StringList desc;
|
||||
for(MP4::ItemListMap::Iterator i = d->items.begin(); i != d->items.end(); i++) {
|
||||
desc.append(i->first + "=" + i->second.toString());
|
||||
}
|
||||
return desc.toString("\n");
|
||||
}
|
||||
|
||||
|
@ -67,8 +67,6 @@ namespace TagLib {
|
||||
|
||||
ItemListMap &itemListMap();
|
||||
|
||||
String toString() const;
|
||||
|
||||
private:
|
||||
AtomDataList parseData2(Atom *atom, TagLib::File *file, int expectedFlags = -1, bool freeForm = false);
|
||||
TagLib::ByteVectorList parseData(Atom *atom, TagLib::File *file, int expectedFlags = -1, bool freeForm = false);
|
||||
|
@ -178,17 +178,3 @@ void Tag::duplicate(const Tag *source, Tag *target, bool overwrite) // static
|
||||
target->setTrack(source->track());
|
||||
}
|
||||
}
|
||||
|
||||
String Tag::toString() const
|
||||
{
|
||||
StringList desc;
|
||||
desc.append("title=" + title());
|
||||
desc.append("artist=" + artist());
|
||||
desc.append("album=" + album());
|
||||
desc.append("comment=" + comment());
|
||||
desc.append("genre=" + genre());
|
||||
desc.append("year=" + String::number(year()));
|
||||
desc.append("track=" + String::number(track()));
|
||||
return desc.toString("\n");
|
||||
}
|
||||
|
||||
|
@ -182,8 +182,6 @@ namespace TagLib {
|
||||
*/
|
||||
static void duplicate(const Tag *source, Tag *target, bool overwrite = true);
|
||||
|
||||
String toString() const;
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* Construct a Tag. This is protected since tags should only be instantiated
|
||||
|
@ -489,20 +489,6 @@ bool File::isWritable(const char *file)
|
||||
|
||||
}
|
||||
|
||||
String File::toString() const
|
||||
{
|
||||
StringList desc;
|
||||
AudioProperties *properties = audioProperties();
|
||||
if(properties) {
|
||||
desc.append(properties->toString());
|
||||
}
|
||||
Tag *t = tag();
|
||||
if(t) {
|
||||
desc.append(t->toString());
|
||||
}
|
||||
return desc.toString("\n");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// protected members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -247,11 +247,6 @@ namespace TagLib {
|
||||
*/
|
||||
static bool isWritable(const char *name);
|
||||
|
||||
/*!
|
||||
* Description of the file.
|
||||
*/
|
||||
String toString() const;
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* Construct a File object and opens the \a file. \a file should be a
|
||||
|
Loading…
Reference in New Issue
Block a user