diff options
author | Michiel Van Der Kolk <not.valid@email.address> | 2005-07-11 15:42:37 +0000 |
---|---|---|
committer | Michiel Van Der Kolk <not.valid@email.address> | 2005-07-11 15:42:37 +0000 |
commit | 9fee0ec4ca0c5b7a334cc29dbb58e76c7a4c736e (patch) | |
tree | 4c304cd4151020bd5494d279ee68a105ae3a5a3a /songdbj/org/tritonus/lowlevel/ogg/Ogg.java | |
parent | dfa8ecbe609ca8ea194d08560a44fb9a92e94b4b (diff) | |
download | rockbox-9fee0ec4ca0c5b7a334cc29dbb58e76c7a4c736e.tar.gz rockbox-9fee0ec4ca0c5b7a334cc29dbb58e76c7a4c736e.zip |
Songdb java version, source. only 1.5 compatible
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7101 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'songdbj/org/tritonus/lowlevel/ogg/Ogg.java')
-rw-r--r-- | songdbj/org/tritonus/lowlevel/ogg/Ogg.java | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/songdbj/org/tritonus/lowlevel/ogg/Ogg.java b/songdbj/org/tritonus/lowlevel/ogg/Ogg.java new file mode 100644 index 0000000000..1ad6bde789 --- /dev/null +++ b/songdbj/org/tritonus/lowlevel/ogg/Ogg.java | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * Ogg.java | ||
3 | * | ||
4 | * This file is part of Tritonus: http://www.tritonus.org/ | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * Copyright (c) 2000 - 2001 by Matthias Pfisterer | ||
9 | * | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU Library General Public License as published | ||
13 | * by the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU Library General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU Library General Public | ||
22 | * License along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | /* | ||
28 | |<--- this code is formatted to fit into 80 columns --->| | ||
29 | */ | ||
30 | |||
31 | package org.tritonus.lowlevel.ogg; | ||
32 | |||
33 | import org.tritonus.share.TDebug; | ||
34 | |||
35 | |||
36 | /** libogg loading. | ||
37 | */ | ||
38 | public class Ogg | ||
39 | { | ||
40 | private static boolean sm_bIsLibraryAvailable = false; | ||
41 | |||
42 | |||
43 | |||
44 | static | ||
45 | { | ||
46 | Ogg.loadNativeLibrary(); | ||
47 | } | ||
48 | |||
49 | |||
50 | |||
51 | public static void loadNativeLibrary() | ||
52 | { | ||
53 | if (TDebug.TraceOggNative) { TDebug.out("Ogg.loadNativeLibrary(): begin"); } | ||
54 | |||
55 | if (! isLibraryAvailable()) | ||
56 | { | ||
57 | loadNativeLibraryImpl(); | ||
58 | } | ||
59 | if (TDebug.TraceOggNative) { TDebug.out("Ogg.loadNativeLibrary(): end"); } | ||
60 | } | ||
61 | |||
62 | |||
63 | |||
64 | /** Load the native library for ogg vorbis. | ||
65 | |||
66 | This method actually does the loading of the library. Unlike | ||
67 | {@link loadNativeLibrary() loadNativeLibrary()}, it does not | ||
68 | check if the library is already loaded. | ||
69 | |||
70 | */ | ||
71 | private static void loadNativeLibraryImpl() | ||
72 | { | ||
73 | if (TDebug.TraceOggNative) { TDebug.out("Ogg.loadNativeLibraryImpl(): loading native library tritonusvorbis"); } | ||
74 | try | ||
75 | { | ||
76 | System.loadLibrary("tritonusvorbis"); | ||
77 | // only reached if no exception occures | ||
78 | sm_bIsLibraryAvailable = true; | ||
79 | } | ||
80 | catch (Error e) | ||
81 | { | ||
82 | if (TDebug.TraceOggNative || | ||
83 | TDebug.TraceAllExceptions) | ||
84 | { | ||
85 | TDebug.out(e); | ||
86 | } | ||
87 | // throw e; | ||
88 | } | ||
89 | if (TDebug.TraceOggNative) { TDebug.out("Ogg.loadNativeLibraryImpl(): loaded"); } | ||
90 | } | ||
91 | |||
92 | |||
93 | |||
94 | /** Returns whether the libraries are installed correctly. | ||
95 | */ | ||
96 | public static boolean isLibraryAvailable() | ||
97 | { | ||
98 | return sm_bIsLibraryAvailable; | ||
99 | } | ||
100 | } | ||
101 | |||
102 | |||
103 | |||
104 | /*** Ogg.java ***/ | ||