/libtunepimp-0.5.3/lib/analyzer.h
C Header | 93 lines | 55 code | 12 blank | 26 comment | 0 complexity | 8ed2347893671a4119cfa6d7292e5d87 MD5 | raw file
Possible License(s): LGPL-2.1, LGPL-3.0, GPL-2.0, LGPL-2.0
1/*----------------------------------------------------------------------------
2
3 libtunepimp -- The MusicBrainz tagging library.
4 Let a thousand taggers bloom!
5
6 Copyright (C) Robert Kaye 2003
7
8 This file is part of libtunepimp.
9
10 libtunepimp is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 libtunepimp is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with libtunepimp; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
24 $Id: analyzer.h 8359 2006-08-07 20:34:50Z luks $
25
26----------------------------------------------------------------------------*/
27#ifndef __ANALYZER_H__
28#define __ANALYZER_H__
29
30#include "thread.h"
31#include "semaphore.h"
32#include "track.h"
33#include "plugin.h"
34
35#define ANALYZER_REDO_STRING "<redo>"
36
37enum PUIDResult
38{
39 eOk,
40 eFileNotFound,
41 eDecodeError,
42 eCannotConnect,
43 eOutOfMemory,
44 eNoPUID,
45 eNoClientId,
46 eOtherError
47};
48
49class TunePimp;
50class FileCache;
51class SubmitInfo;
52class WatchdogThread;
53class Plugins;
54class Track;
55
56class Analyzer : public Thread
57{
58 public:
59 Analyzer(TunePimp *tunePimp,
60 Plugins *plugins,
61 FileCache *cache,
62 WatchdogThread *watchdog);
63 virtual ~Analyzer(void);
64
65 void wake(void);
66 void threadMain(void);
67
68 void setProxy(const std::string &proxyServer, short proxyPort)
69 {
70 this->proxyServer = proxyServer;
71 this->proxyPort = proxyPort;
72 };
73
74 private:
75
76 PUIDResult calculatePUID(Plugin *plugin, const std::string &fileName, std::string &err,
77 std::string &puidId, unsigned long &duration, Metadata &mdata);
78 void setError(Track *track, PUIDResult retVal);
79
80 TunePimp *tunePimp;
81 Plugins *plugins;
82 FileCache *cache;
83 bool exitThread;
84 Semaphore *sem;
85 unsigned lastWake;
86 SubmitInfo *submitInfo;
87 std::string proxyServer;
88 short proxyPort;
89 WatchdogThread *dog;
90};
91
92#endif
93