[Ffmpeg-devel] [PATCH] allow ffmpeg to read mp3s beginning with partial frames

Matti Hamalainen mhamalai
Sat Sep 9 21:17:23 CEST 2006


On Sat, 9 Sep 2006, Victor Voros wrote:

> 
> Andreas ?man wrote
> > 
> > I have to disagree. With this new patch ffmpeg still thinks some of my 
> > files are mp3-files (especially .ts-files)
> > 
> > However, having bumped into the same problem I've had a patch that fixes 
> > the problem (without generating any false positives). It searches the 
> > first 4k of the file for two consecutive mp3-frames.
> 
> This looks more reliable and works with all the problematic mp3 files I can find. Can I make a suggestion. The line 
> 
> header = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
> 
> be replaced with
> 
> memcpy(&header,buf,sizeof(header));
> 
> I know the libav* is riddled with the former style however under mingw for x86 memcpy gives me 2 instructions vs about a dozen for the first style. I Moreover the second style is a hell of a lot clearer and less prone to error. I suspect the former was better in days gone by when memcpy was not inlined and resulted in a function call and a loop. Also since the PIII (I think) 32-bit loads on a non-4-byte-boundary are as fast as they are on a 4-byte boundary. This was not the case on older intels. 

Apparently you have not heard about architechtures with differing 
endianess?

-- 
] ccr/TNSP^DKD^pWp :: ccr(at)tnsp(dot)org :: http://ccr.tnsp.org/
] Fingerprint: 0466 95ED 96DF 3701 C71D   D62D 10A6 28A6 1374 C112



More information about the ffmpeg-devel mailing list