Jump to content

Recommended Posts

hi,

 

i think ive finally understood the spec and after looking at a number of files in a hex editor-have possibly worked out a way i can read the data in, even tho the comments are varying in size:

 

could someone have a brief look over this, and see if it makes sense (I think it does) just about to try and code it!

 

address 109 specifies length of vendor field => 1.0 === Xiph.Org libVorbis I 20020717

 

 

 

 

 

1) address 142 says how many comments to expec=>6

 

2 ) 146 specifies length of 1st comment 15 btes => TITLE

 

3) 165 specifies bytes for length of artist comment => 15

 

 

4) 184 specifies album length==13

 

5) 201 track commnt length=13

 

6) 218 specifies date lengh=9

 

 

7) 231 specifies genre length (13)

 

 

the actual length of a comment frame varies, depending obviously on the fileb)

 

i.e. Artist for 'Aqua' is goig to require less bytes (4) than say Prince would (5)

same applies to all the comment fields

 

so need to

address 109 is static in all files 109 specifies the length of vendor field

and address 142 is also static - the number of user comments to expect

 

146 -> the location specifying the length of first comment is also static

 

so,

 

need to read 1 byte in at location 109:

 

a) read in the vendor field

b) read in 1 byte at address 142, telling us the number of comments to expect

c) read 146 to get the length of the first comment ->

 

value of size of next comment proceeeds directly after end of a comment,

 

so if we read 6 as the value for comment, we know we need to read 6 bytes in then read x+1 to get the length of the next comment

 

each fram also has a 3 byte seperator between it (char 0) NULL

 

 

so we read 1 byte location 109, then read in the value this holds + 3 (3 bytes for the 3 NULL spacers between comments)

 

 

 

 

we then read the next 1 byte in 142) telling us number of comments to expect

 

read 146 (always same) to get the length of first comment -> then read value held at 146+3 (3byte spacer)

 

so if 146 holds 30, we read the next 33 bytes in

 

 

we then read 1 byte again-directly after each comment the value of the next comment is held proceeded by the 3 spacers

 

thanks guys

Link to comment
https://forums.phpfreaks.com/topic/51698-reading-in-a-file-ogg-think-ive-got-it/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.