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/com/jcraft/jogg/Packet.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/com/jcraft/jogg/Packet.java')
-rw-r--r-- | songdbj/com/jcraft/jogg/Packet.java | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/songdbj/com/jcraft/jogg/Packet.java b/songdbj/com/jcraft/jogg/Packet.java new file mode 100644 index 0000000000..22a8a5439b --- /dev/null +++ b/songdbj/com/jcraft/jogg/Packet.java | |||
@@ -0,0 +1,82 @@ | |||
1 | /* JOrbis | ||
2 | * Copyright (C) 2000 ymnk, JCraft,Inc. | ||
3 | * | ||
4 | * Written by: 2000 ymnk<ymnk@jcraft.com> | ||
5 | * | ||
6 | * Many thanks to | ||
7 | * Monty <monty@xiph.org> and | ||
8 | * The XIPHOPHORUS Company http://www.xiph.org/ . | ||
9 | * JOrbis has been based on their awesome works, Vorbis codec. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU Library General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 of | ||
14 | * the License, or (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 | package com.jcraft.jogg; | ||
27 | |||
28 | public class Packet{ | ||
29 | public byte[] packet_base; | ||
30 | public int packet; | ||
31 | public int bytes; | ||
32 | public int b_o_s; | ||
33 | public int e_o_s; | ||
34 | |||
35 | public long granulepos; | ||
36 | |||
37 | public long packetno; // sequence number for decode; the framing | ||
38 | // knows where there's a hole in the data, | ||
39 | // but we need coupling so that the codec | ||
40 | // (which is in a seperate abstraction | ||
41 | // layer) also knows about the gap | ||
42 | |||
43 | /* | ||
44 | // TEST | ||
45 | static int sequence=0; | ||
46 | static int lastno=0; | ||
47 | void checkpacket(int len, int no, int pos){ | ||
48 | if(bytes!=len){ | ||
49 | System.err.println("incorrect packet length!"); | ||
50 | System.exit(1); | ||
51 | } | ||
52 | if(granulepos!=pos){ | ||
53 | System.err.println("incorrect packet position!"); | ||
54 | System.exit(1); | ||
55 | } | ||
56 | |||
57 | // packet number just follows sequence/gap; adjust the input number | ||
58 | // for that | ||
59 | if(no==0){ | ||
60 | sequence=0; | ||
61 | } | ||
62 | else{ | ||
63 | sequence++; | ||
64 | if(no>lastno+1) | ||
65 | sequence++; | ||
66 | } | ||
67 | lastno=no; | ||
68 | if(packetno!=sequence){ | ||
69 | System.err.println("incorrect packet sequence "+packetno+" != "+sequence); | ||
70 | System.exit(1); | ||
71 | } | ||
72 | |||
73 | // Test data | ||
74 | for(int j=0;j<bytes;j++){ | ||
75 | if((packet_base[packet+j]&0xff)!=((j+no)&0xff)){ | ||
76 | System.err.println("body data mismatch at pos "+ j+": "+(packet_base[packet+j]&0xff)+"!="+((j+no)&0xff)+"!\n"); | ||
77 | System.exit(1); | ||
78 | } | ||
79 | } | ||
80 | } | ||
81 | */ | ||
82 | } | ||