Two Short Questions (maybe long answers) binary search

MJCM

Member
Joined
Jun 17, 2004
Messages
22
Location
SE-Asia
Programming Experience
1-3
Hi,

I am a beginner in VB.NET(2005) and I have 2 questions !

1) Is it possible in a listview to number the individual lines?

2) Is it possible to search in a binary file. The reason why i ask this, is because i want to get the title and the artist out of a m4a file. And i found out with a hex editor that these strings are in every m4a file in a different location. (Not like IDv1.1 & 2.0 or 2.2).
I am looking especially for "ART" (8 Bits, 65 82 84).

I tried it like,
Dim _test As Byte() = My.Computer.FileSystem.ReadAllBytes("D:\A.M4A")
and i tried it also with the binaryreader (with Peekchar). But finding these strings after each other, so i know i am in the right place, is proving a little bit to difficult for me.

If anyone could point me in the right direction, it would be much appreciated

Thx
MJCM
 
Addition

Hi,

I was just thinking, but is it possible to search a binary file with REGEX ?

If so, could somone post me an example who to do this ?

Thx in advance
Mjcm
 
For question 1: do you mean you want to visually add the numbers to the listbox? so it looks like the winamp playlist? I dont think there is a built in way, you'd have to manually change the control yourself i think. The easiest way to do something similar is use a datagridview and just change its appearence and add the numbers yourself. There was another dude here who wrote his own media player (the thread is in here somewhere) so you should just ask him.
To do this with a datagridview is easy, its just a matter of either changing the row headers or setting the values of cells in a specific column.

For question 2: just add a link to a m4a file and someone here will have a look for you. if its binary its a matter of casing the values for the ones you're looking for and manipulating the file (which is tedious in all aspects). There might be some way to do this with specialised classes but I dont use binary files so I wouldnt know.
 
Hi, thanks for your answers,

just a remark on your answers on question 2.
The M4a file (is just a Itunes encoded file)
I was thinking if it is possible to convert the Byte Array to a String array, and then joining them to a another string array.

For example
Byte Array contains
65, 82 , 84
Conversion to String Array
A, R, T,
Joining the String Array
ART

I know it looks a bit farfetched, but if it is possible it could work. But i am also experi with the regex, I think that would be ideal, so i am still waiting if someone could give me some examples.

Thanks
MJCM
 
1) why dont you use a list view or datagrid (or other grid) and have a column full of incrementing numbers? If youre making a playlist type app, make it a grid, a grid is based on a model of data, and make the model's view add a line number. note.. dont make the line number a part of the model, because its the VIEW that does the sorting of any modfel of data.. if you sort by different, then your line numbers will change if they come from the model

i.e.
MODEL
-------
abba - Tragedy, 4:23
z z top - sharp dressed man, 5:21

VIEW (sort by name asc)
---------
1, abba - Tragedy, 4:23
2, z z top - sharp dressed man, 5:21

VIEW (sort by name desc)
---------------
1, z z top - sharp dressed man, 5:21
2, abba - Tragedy, 4:23

thn put it into a list or grid



-

i'm looking into the tags.. it seems that its just people guessing itunes tags format.. no real spec
i dont think they would be put in a random place in the file though... thats just not sensible for so many reasons. either there is a fixed location in the file that holds references or a way to calculate the tag position.. its sparked my curiousity so i'll check it out!
 
Hi thanks, but about the tags, i will give you some examples (results gathered with winhex by the way) This is were Nam is found (Title of Song) in different m4a file sizes !

File Size Page Offset

2069204 40 5c53
5032775 65 94CF
2858120 55 7E2F

So you so, in each file in different locations.

Regards
MJCM
 
erm. any chance you can send me those files via www.megaupload.com or something? i dont understand what Page means, and whether offset is relative to the page or the file ends.. so i'd like to use UltraEdit (hex editor that im familiar with) to take a look.. ta
 
Cjard,
to upload the files is a little bit difficult, because i am connected via a Modem Line, and you know how slow these are. These are just MP3's converted with iTunes to M4a (all are 128 Kbits). It seems that the info is located depending on the file size (but i am not exactly sure.)

Regards
MJCM
 
can you pass some links then to e.g. m4a files or torrents. I'm not overly concerned with the legality of the links because I'm using them for educational/research purposes i dont mind downloading a few tracks.. There must be some site that provides them free though, maybe unsigned bands or indie efforts like mp3.com provides?
 
Cjard,

do you have mp3's stored on your Pc ?? If yes, then download Itunes and convert them. there even other programs to convert them like http://www.dbpoweramp.com/dmc.htm.

That's the easiest way, else use edonkey or emule. I am not able to use any of these programs because of my slow connection.

Regards
MJCM
 
sure. i got dbpa, i took itunes off cause i didnt like it. i also dont like converting files from mp3 to other things because of quality loss so ive never used dbpa for this but i will try! :)
 
mp4 tags appeared on the end of the file in all my tests but remember that mp4 is a container format.. they might be allowed to appear elsewhere depending on the container layout


the tag varies in length, but appears to have some kind of header describing the number of tag fields present. its quite a bit for me to work out now, and i hve much work to do, but i reckon the best route would be to write to the makers of some tagging software and jsut ask them how they did it. fastest route i can think of right now.. :)
 
Back
Top