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/StreamState.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/StreamState.java')
-rw-r--r-- | songdbj/org/tritonus/lowlevel/ogg/StreamState.java | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/songdbj/org/tritonus/lowlevel/ogg/StreamState.java b/songdbj/org/tritonus/lowlevel/ogg/StreamState.java new file mode 100644 index 0000000000..34b970c5e2 --- /dev/null +++ b/songdbj/org/tritonus/lowlevel/ogg/StreamState.java | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | * StreamState.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 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU Library General Public License as published | ||
12 | * by the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program 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 Library General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU Library General Public | ||
21 | * License along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
23 | */ | ||
24 | |||
25 | /* | ||
26 | |<--- this code is formatted to fit into 80 columns --->| | ||
27 | */ | ||
28 | |||
29 | package org.tritonus.lowlevel.ogg; | ||
30 | |||
31 | import org.tritonus.share.TDebug; | ||
32 | |||
33 | |||
34 | /** Wrapper for ogg_stream_state. | ||
35 | */ | ||
36 | public class StreamState | ||
37 | { | ||
38 | static | ||
39 | { | ||
40 | Ogg.loadNativeLibrary(); | ||
41 | if (TDebug.TraceOggNative) | ||
42 | { | ||
43 | setTrace(true); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | |||
48 | /** | ||
49 | * Holds the pointer to ogg_stream_state | ||
50 | * for the native code. | ||
51 | * This must be long to be 64bit-clean. | ||
52 | */ | ||
53 | private long m_lNativeHandle; | ||
54 | |||
55 | |||
56 | |||
57 | public StreamState() | ||
58 | { | ||
59 | if (TDebug.TraceOggNative) { TDebug.out("StreamState.<init>(): begin"); } | ||
60 | int nReturn = malloc(); | ||
61 | if (nReturn < 0) | ||
62 | { | ||
63 | throw new RuntimeException("malloc of ogg_stream_state failed"); | ||
64 | } | ||
65 | if (TDebug.TraceOggNative) { TDebug.out("StreamState.<init>(): end"); } | ||
66 | } | ||
67 | |||
68 | |||
69 | |||
70 | public void finalize() | ||
71 | { | ||
72 | // TODO: call free() | ||
73 | // call super.finalize() first or last? | ||
74 | // and introduce a flag if free() has already been called? | ||
75 | } | ||
76 | |||
77 | |||
78 | |||
79 | private native int malloc(); | ||
80 | public native void free(); | ||
81 | |||
82 | |||
83 | |||
84 | /** Calls ogg_stream_init(). | ||
85 | */ | ||
86 | public native int init(int nSerialNo); | ||
87 | |||
88 | /** Calls ogg_stream_clear(). | ||
89 | */ | ||
90 | public native int clear(); | ||
91 | |||
92 | /** Calls ogg_stream_reset(). | ||
93 | */ | ||
94 | public native int reset(); | ||
95 | |||
96 | /** Calls ogg_stream_destroy(). | ||
97 | */ | ||
98 | public native int destroy(); | ||
99 | |||
100 | /** Calls ogg_stream_eos(). | ||
101 | */ | ||
102 | public native boolean isEOSReached(); | ||
103 | |||
104 | |||
105 | |||
106 | /** Calls ogg_stream_packetin(). | ||
107 | */ | ||
108 | public native int packetIn(Packet packet); | ||
109 | |||
110 | |||
111 | /** Calls ogg_stream_pageout(). | ||
112 | */ | ||
113 | public native int pageOut(Page page); | ||
114 | |||
115 | |||
116 | /** Calls ogg_stream_flush(). | ||
117 | */ | ||
118 | public native int flush(Page page); | ||
119 | |||
120 | |||
121 | /** Calls ogg_stream_pagein(). | ||
122 | */ | ||
123 | public native int pageIn(Page page); | ||
124 | |||
125 | |||
126 | /** Calls ogg_stream_packetout(). | ||
127 | */ | ||
128 | public native int packetOut(Packet packet); | ||
129 | |||
130 | |||
131 | /** Calls ogg_stream_packetpeek(). | ||
132 | */ | ||
133 | public native int packetPeek(Packet packet); | ||
134 | |||
135 | |||
136 | private static native void setTrace(boolean bTrace); | ||
137 | } | ||
138 | |||
139 | |||
140 | |||
141 | |||
142 | |||
143 | /*** StreamState.java ***/ | ||