Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: ID3v2 TAG Footer Reading goes wrong

by no_slogan (Deacon)
on Jan 06, 2014 at 15:28 UTC ( #1069537=note: print w/replies, xml ) Need Help??

in reply to ID3v2 TAG Footer Reading goes wrong

Please read How do I post a question effectively? We don't know what problem you're having.

It looks like you're reading the frame header, but not the frame data. Your code will try to interpret the data from the first frame as another frame header.

You can't count on the last frame having id "TYER".

01000000 is an octal constant. You probably mean it to be binary, which would be written 0b01000000.

  • Comment on Re: ID3v2 TAG Footer Reading goes wrong

Replies are listed 'Best First'.
Re^2: ID3v2 TAG Footer Reading goes wrong
by thanos1983 (Vicar) on Jan 06, 2014 at 22:17 UTC

    To: no_slogan, I am sorry for the previous post I did not explain how my code is operating and what problems I am facing with. Based on you suggestiongs that where clear I understand what you meant and I modified the code accordinly. Please take another look, I have added as much explanation as possible and the outputs that I am getting. Again thank you for your time and effort to assist me.

      The basic problem still seems to be that you're not doing anything about the frame data. You might try something like this:

      $position = 10; $id3_end = 10 + $id3_size; while ($position < $id3_end) { seek FH, $position, SEEK_SET; # read $frame_id, $frame_size, and $frame_flags $position += 10 + $frame_size; last if $frame_id =~ /\W/ || $position > $id3_end; # do something with $frame_id }

      The "last if" line is a sanity check, because some ID3 writers leave a mess behind them.

        To: Anonymous Monk,

        Thanks for the suggestion and possible really interesting implementation to my code. While I was working with my code I came with another possible mistake that I trying to explain but for the moment not successfully. I noticed that the sync_safe process at the header:

        $mp3_size = ($memory[0] & 0xFF) | (( $memory[1] & 0xFF ) << 7) | (( $memory[2] & 0xFF ) << 14) | (( $memory[3] & 0xFF ) << 21);

        If I do print Dumper(@memory); before the sync_safe process, it will print out:

        $VAR1 = 0; $VAR2 = 0; $VAR3 = 5; $VAR4 = 59;

        After the sync_safe process if I do print Dumper(@memory); again, it will print out:

        $VAR1 = 123813888;

        I am curious, I know that the sync_safe process is shifting 7 bits to the left of eac byte. So no I am comfused is it operating correctly? or am I doing something wrong?

        Maybe I am missing something really basic here and this is the reason that I do not understand. Sorry for asking too many questions but since I am going through the learning curve process I have so many queries that I can not find information that will provide me a clear answer.

        Thank you again for your time and effort.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1069537]
What's the matter? Cat got your tongue?...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2018-03-17 07:20 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (223 votes). Check out past polls.