Thursday 15 May 2014

c++ - MP3 Frame Header Detection FFF/FFE sync issue -


I want to parse an MP3 file and search for all the frames in the Variable Bit Rate (VBR) MP3 file. I have looked at the entire internet and could not get the proper solution to detect the new frame header sync. By other posts it says that I should look for FFE or FFF, but I do not know it properly in my program. I do not understand how should I look for FFF or FFE? I get FFE 0xF and the next byte as 0xFE, but how does FFF get, how do I get the headers from this to build 1 to 11 bits? I have seen, which is related to all other topics and websites, such as MP3 is the place for reference, and its source code, but my question is that I guess in CMPA * files which are not given in source code Go download.

  Do {uiFrame = getc (pFile); If break (EOF == uiFrame); CntSize ++; If (0xFF == uiFrame) {uiFrame = getc (pFile); If break (EOF == uiFrame); If ((0xE == uiFrame)) // || (0xE0 == uiFrame)) {if (1! = UiFrameCount) printf ("\ n Frame size% d \ n \ n", cntSize - PrevoiusFrameSize); Printf ("frame found in byte% d", cntSize); Prevocefrasmism = CNTS; Checkflag = 1; UiFrameCount ++; } CntSize ++; }} While (1! = Checkflag);   

When I execute the above version or any type of code, then I can get 1 to 6 frames, but if I use the program from the above link If I do, test my 8855 frame MP3 file

Thank you for your help.

Edit: After, any help on this matter will be greatly appreciated because I am running out of Google's ideas and pages for answers. Most of the issues were understood by giving a quick reply to Mark Bi, but after reflecting the answer to it, I am now only detecting 4 frames, above the one, the code is the part that identifies the frame, Am I doing something wrong?

  Do {uiFrame = getc (pFile); If break (EOF == uiFrame); CntSize ++; If (0xFF == uiFrame) {uiFrame = getc (pFile); If break (EOF == uiFrame); UiShift = uiFrame & gt; & Gt; 4; If ((0xE == uiShift) || (0xF == uiShift)) {if (1! = UiFrameCount) printf ("\ n frame size% d \ n \ n", cntSize - PrevoiusFrameSize); Printf ("frame found in byte% d", cntSize); Prevocefrasmism = CNTS; Checkflag = 1; UiFrameCount ++; } CntSize ++; }} While (1! = Checkflag); Headers 3 Nibles (aka 1.5 bytes), so you need to do some transfer. In pseudo code:  
  $ data = 'FFEABCDEF ....' ^^^ - 3 nibble header $ nibble1 = $ data [0]; $ Nibble2 = $ data [1] & gt; & Gt; 4; // Separate third distorted if ($ nibble1 == 'FF') & amp; Amp; ($ Nibble2 == 'F') || ($ nibble2 == 'E')) {...}    

No comments:

Post a Comment