blob: f039c5f25f7798eace9fe11b750ddd106eb8d7d9 (
plain)
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
|
/***************************************************************************
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"
//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:
SoundSourceM4A(QString qFileName);
~SoundSourceM4A();
Result open();
long seek(long);
int initializeDecoder();
unsigned read(unsigned long size, const SAMPLE*);
unsigned long length();
Result parseHeader();
static QList<QString> supportedFileExtensions();
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 void freeFileExtensions(char **exts)
{
for (int i(0); exts[i]; ++i) free(exts[i]);
free(exts);
}
} // namespace Mixxx
#endif
|