forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help with uuencoded data

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
sakya



Joined: 28 Apr 2006
Posts: 190

PostPosted: Thu Feb 21, 2008 10:21 pm    Post subject: Help with uuencoded data Reply with quote

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
View user's profile Send private message Visit poster's website
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Fri Feb 22, 2008 6:21 am    Post subject: Reply with quote

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
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Fri Feb 22, 2008 6:31 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
sakya



Joined: 28 Apr 2006
Posts: 190

PostPosted: Fri Feb 22, 2008 8:04 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group