| View previous topic :: View next topic |
| Author |
Message |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Thu Feb 21, 2008 10:21 pm Post subject: Help with uuencoded data |
|
|
Hi! :)
This question is not really psp related...but I try to ask. ;)
In OGG Vorbis and FLAC you can add the cover art and this will be saved in a comment named COVERART_UUENCODED.
I'm trying to retrieve the cover art but it seems I'm unable to do it.
I found no documentation on the web, but (from the name) I guess the string is uuencoded.
I tried to uudecode the data with this function that gets 4 encoded chars and outputs the corresponding 3 decoded chars (at least I think so):
| Code: | /* single-character decode */
#define DEC(c) (((c) - ' ') & 077)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// UUDECODE: decodes a group of 4 characters (outputs 3 characters)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void uudecode(char *encoded, char *decoded, int outCharNumber){
int c1 = 0;
int c2 = 0;
int c3 = 0;
c1 = DEC(*encoded) << 2 | DEC(encoded[1]) >> 4;
c2 = DEC(encoded[1]) << 4 | DEC(encoded[2]) >> 2;
c3 = DEC(encoded[2]) << 6 | DEC(encoded[3]);
if (outCharNumber >= 1)
decoded[0] = c1;
if (outCharNumber >= 2)
decoded[1] = c2;
if (outCharNumber >= 3)
decoded[2] = c3;
decoded[3] = '\0';
} |
I tried to write to a file the decoded data but I don't obtain a valid jpeg file.
Can someone help me decoding this data, please? :)
Here you can download the encoded data and my "decoded" data.
http://upload2.net/page/download/EsH7bkFmMPAGLkL/uudecodeTest.rar.html
Many thanks
Ciaooo
Sakya |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Fri Feb 22, 2008 6:21 am Post subject: |
|
|
Your "encoded" data isn't just plain uuencode, it has NULL bytes.
What tool are you using to embed the coverart? Just check the source for that. |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Fri Feb 22, 2008 6:31 am Post subject: |
|
|
As I understand it, it's base64 encoded, not uuencoded. From RFC2045:
| Code: | Table 1: The Base64 Alphabet
Value Encoding Value Encoding Value Encoding Value Encoding
0 A 17 R 34 i 51 z
1 B 18 S 35 j 52 0
2 C 19 T 36 k 53 1
3 D 20 U 37 l 54 2
4 E 21 V 38 m 55 3
5 F 22 W 39 n 56 4
6 G 23 X 40 o 57 5
7 H 24 Y 41 p 58 6
8 I 25 Z 42 q 59 7
9 J 26 a 43 r 60 8
10 K 27 b 44 s 61 9
11 L 28 c 45 t 62 +
12 M 29 d 46 u 63 /
13 N 30 e 47 v
14 O 31 f 48 w (pad) =
15 P 32 g 49 x
16 Q 33 h 50 y
The encoded output stream must be represented in lines of no more
than 76 characters each. All line breaks or other characters not
found in Table 1 must be ignored by decoding software. In base64
data, characters other than those in Table 1, line breaks, and other
white space probably indicate a transmission error, about which a
warning message or even a message rejection might be appropriate
under some circumstances. |
|
|
| Back to top |
|
 |
sakya
Joined: 28 Apr 2006 Posts: 190
|
Posted: Fri Feb 22, 2008 8:04 am Post subject: |
|
|
Hi! :)
| jimparis wrote: | Your "encoded" data isn't just plain uuencode, it has NULL bytes.
What tool are you using to embed the coverart? Just check the source for that. |
I have no source of the tool I used...
Ok, I'll try base64.
Many thanks for your help. :)
Ciaooo
Sakya |
|
| Back to top |
|
 |
|