The name of VBRHeader causes confusion
Categories
(Core :: Audio/Video: Playback, enhancement, P3)
Tracking
()
People
(Reporter: chunmin, Unassigned)
Details
The name of the struct describing the header type of the mp3 files is confusing. The name is VBRHeader. It looks like it is for VBR file, but it may contain a CBR file actually.
MP3 header has two types: Xing and VBRI. The tag value within Xing header is either Xing or Info; The tag within VBRI header is VBRI.
A mp3 file with a Xing header whose tag value is Info means its audio is encoded by a constant bitrate (CBR). For example, the header of the mp3 encoded by lame is Xing and it's header tag is Info. This can be verified by ffmpeg commands: $ ffmpeg -f lavfi -i "sine=frequency=441:duration=5" sine_441hz_5s.wav && ffmpeg -i sine_441hz_5s.wav -codec:a libmp3lame -b:a 256k sine_441hz_5s_xing_cbr.mp3. On the other hand, if the tag value is Xing, then it means the audio is encoded by variable bitrate (VBR).
In our implementation, the header data, whatever Xing or VBRI, will be paresd into VBRHeader. That means the header data of a CBR mp3 with a Info tag in Xing header will be parsed into a VBRHeader object.
Then it leads to a confusing expression: VBRInfo().IsValid() is true for a CBR file. At the first glance, VBRInfo().IsValid() looks like it indicates the file is VBR and !VBRInfo().IsValid() indicates the file is CBR. One example is here.
Logically, the CBR is indeed a special case of VBR. However, when we refer VBR, we usually means "it's not a CBR". Changing the name of VBRHeader and VBRInfo() may be helpful.
| Reporter | ||
Updated•7 years ago
|
Updated•4 years ago
|
Description
•