forked from mixxxdj/mixxx
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsoundsourcem4a.h
More file actions
125 lines (106 loc) · 3.52 KB
/
Copy pathsoundsourcem4a.h
File metadata and controls
125 lines (106 loc) · 3.52 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
/***************************************************************************
soundsourcem4a.h - mp4/m4a decoder
-------------------
copyright : (C) 2008 by Garth Dahlstrom
email : ironstorm@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* 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 SOUNDSOURCEM4A_H
#define SOUNDSOURCEM4A_H
#ifdef __MP4V2__
#include <mp4v2/mp4v2.h>
#else
#include <mp4.h>
#endif
#include <neaacdec.h>
#include <QString>
#include "soundsource.h"
#include "defs_version.h"
#include "m4a/ip.h"
#include "util/defs.h"
#include <QtDebug>
//As per QLibrary docs: http://doc.trolltech.com/4.6/qlibrary.html#resolve
#ifdef Q_OS_WIN
#define MY_EXPORT __declspec(dllexport)
#else
#define MY_EXPORT
#endif
namespace Mixxx {
class SoundSourceM4A : public SoundSource {
public:
explicit SoundSourceM4A(QString qFileName);
~SoundSourceM4A();
Result open();
long seek(long);
int initializeDecoder();
unsigned read(unsigned long size, const SAMPLE*);
unsigned long length();
Result parseHeader();
QImage parseCoverArt();
static QList<QString> supportedFileExtensions();
static QList<QString> supportedMimeType();
private:
int trackId;
unsigned long filelength;
MP4FileHandle mp4file;
input_plugin_data ipd;
};
extern "C" MY_EXPORT const char* getMixxxVersion()
{
return VERSION;
}
extern "C" MY_EXPORT int getSoundSourceAPIVersion()
{
return MIXXX_SOUNDSOURCE_API_VERSION;
}
extern "C" MY_EXPORT SoundSource* getSoundSource(QString filename)
{
return new SoundSourceM4A(filename);
}
extern "C" MY_EXPORT char** supportedFileExtensions()
{
QList<QString> exts = SoundSourceM4A::supportedFileExtensions();
//Convert to C string array.
char** c_exts = (char**)malloc((exts.count() + 1) * sizeof(char*));
for (int i = 0; i < exts.count(); i++)
{
QByteArray qba = exts[i].toUtf8();
c_exts[i] = strdup(qba.constData());
qDebug() << c_exts[i];
}
c_exts[exts.count()] = NULL; //NULL terminate the list
return c_exts;
}
extern "C" MY_EXPORT char** supportedMimeTypes()
{
QList<QString> mimes = SoundSourceM4A::supportedMimeTypes();
//Convert to C string array.
char** c_mime = (char**)malloc((mimes.count() + 1) * sizeof(char*));
for (int i = 0; i < mimes.count(); i++)
{
QByteArray qba = mimes[i].toUtf8();
c_mime[i] = strdup(qba.constData());
qDebug() << c_mime[i];
}
c_mime[mimes.count()] = NULL; //NULL terminate the list
return c_mime;
}
extern "C" MY_EXPORT void freeFileExtensions(char **exts)
{
for (int i(0); exts[i]; ++i) free(exts[i]);
free(exts);
}
extern "C" MY_EXPORT void freeMimeTypes(char **mimes)
{
for (int i(0); mimes[i]; ++i) free(mimes[i]);
free(mimes);
}
} // namespace Mixxx
#endif