1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
/*************************************************************************
CodecBase.h - base class for Encoder and Decoder
-------------------
begin : Mon Mar 11 2002
copyright : (C) 2002 by Thomas Eschenbacher
email : Thomas.Eschenbacher@gmx.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CODEC_BASE_H
#define CODEC_BASE_H
#include "config.h"
#include "libkwave_export.h"
#include <QtGlobal>
#include <QList>
#include <QString>
#include <QStringList>
#include "libkwave/Compression.h"
class QMimeType;
class QUrl;
namespace Kwave
{
class LIBKWAVE_EXPORT CodecBase
{
public:
/** simplified mime type: contains only name and list of patterns */
typedef struct {
QString name;
QString description;
QStringList patterns;
} MimeType;
/** Constructor */
CodecBase();
/** Destructor */
virtual ~CodecBase();
/** Returns true if the given mime type is supported */
virtual bool supports(const QMimeType &mimetype);
/** Returns true if the given mime type is supported */
virtual bool supports(const QString &mimetype_name);
/** Returns a list of supported file extensions */
virtual QStringList extensions(const QString &mimetype_name) const;
/** Returns a list of supported mime types */
virtual const QList<CodecBase::MimeType> mimeTypes();
/** Returns a list of supported compression types */
virtual const QList<Kwave::Compression::Type> compressionTypes();
/**
* Adds a new mime type to the internal list of supported mime
* types. First it tries to find the mime type in the system,
* if none was found, a new mime type is created, using the
* passed parameters. The system's mime types are always preferred
* over the passed 'built-ins'.
* @param name the mime type's name (may also be a comma separated list)
* @param description verbose description
* @param patterns list of file patterns, passed as a single string,
* separated by "; "
*/
virtual void addMimeType(const char *name,
const QString &description,
const char *patterns);
/**
* Adds a new compression type to the internal list of supported
* compression types.
* @param compression the compression type
*/
virtual void addCompression(Kwave::Compression::Type compression);
/**
* Tries to find the name of a mime type by a URL. If not found, it
* returns the default mime type, never an empty string.
* @param url a QUrl, only the filename's extension will be inspected
* @return name of the mime type or the default mime type
*/
virtual QString mimeTypeOf(const QUrl &url);
private:
/** list of supported mime types */
QList<MimeType> m_supported_mime_types;
/** list of supported compression types */
QList<Kwave::Compression::Type> m_supported_compression_types;
};
}
#endif /* CODEC_BASE_H */
//***************************************************************************
//***************************************************************************
|