Debian Codegraph @

src/engine/verifier.cpp

raw symbols SCIP
1 /* fre:ac - free audio converter
2 * Copyright (C) 2001-2020 Robert Kausch <[email protected]>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation, either version 2 of
7 * the License, or (at your option) any later version.
8 *
9 * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
10 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
11 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */
12
13 #include <engine/verifier.h>
14
15 using namespace BoCA;
16 using namespace BoCA::AS;
17
18 freac::Verifier::Verifier(const BoCA::Config *iConfiguration) : Component(iConfiguration)
19 {
20 verifier = NIL;
21 }
22
23 freac::Verifier::~Verifier()
24 {
25 Destroy();
26 }
27
28 Bool freac::Verifier::Create(const Track &track)
29 {
30 Registry &boca = Registry::Get();
31
32 /* Create verifier component.
33 */
34 verifier = boca.CreateVerifierForTrack(track, configuration);
35
36 if (verifier == NIL) return False;
37
38 /* Activate verifier.
39 */
40 verifier->SetConfiguration(configuration);
41 verifier->SetAudioTrackInfo(track);
42 verifier->Activate();
43
44 return True;
45 }
46
47 Bool freac::Verifier::Destroy()
48 {
49 if (verifier == NIL) return False;
50
51 Registry &boca = Registry::Get();
52
53 verifier->Deactivate();
54
55 SetErrorInfo(verifier->GetErrorState(), verifier->GetErrorString());
56
57 boca.DeleteComponent(verifier);
58
59 verifier = NIL;
60
61 return True;
62 }
63
64 Int freac::Verifier::Process(Buffer<UnsignedByte> &buffer)
65 {
66 if (verifier == NIL) return 0;
67
68 return verifier->ProcessData(buffer);
69 }
70
71 Bool freac::Verifier::Verify()
72 {
73 if (verifier == NIL) return True;
74
75 Bool result = verifier->Verify();
76
77 SetErrorInfo(verifier->GetErrorState(), verifier->GetErrorString());
78
79 return result;
80 }