comparison raw.c @ 3237:4fa7ec10b57e libavformat

Compute AC3 frame CRC for stronger raw AC3 format probing. Closes issue64.
author andoma
date Mon, 21 Apr 2008 15:20:53 +0000
parents 2a4192999b55
children db733a434b2c
comparison
equal deleted inserted replaced
3236:57baf1166899 3237:4fa7ec10b57e
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */ 21 */
22 #include "avformat.h" 22 #include "avformat.h"
23 #include "ac3_parser.h" 23 #include "ac3_parser.h"
24 #include "raw.h" 24 #include "raw.h"
25 #include "crc.h"
25 26
26 #ifdef CONFIG_MUXERS 27 #ifdef CONFIG_MUXERS
27 /* simple formats */ 28 /* simple formats */
28 static int flac_write_header(struct AVFormatContext *s) 29 static int flac_write_header(struct AVFormatContext *s)
29 { 30 {
427 buf2 = buf; 428 buf2 = buf;
428 429
429 for(frames = 0; buf2 < end; frames++) { 430 for(frames = 0; buf2 < end; frames++) {
430 if(ff_ac3_parse_header(buf2, &hdr) < 0) 431 if(ff_ac3_parse_header(buf2, &hdr) < 0)
431 break; 432 break;
433 if(buf2 + hdr.frame_size > end ||
434 av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf2 + 2, hdr.frame_size - 2))
435 break;
432 buf2 += hdr.frame_size; 436 buf2 += hdr.frame_size;
433 } 437 }
434 max_frames = FFMAX(max_frames, frames); 438 max_frames = FFMAX(max_frames, frames);
435 if(buf == p->buf) 439 if(buf == p->buf)
436 first_frames = frames; 440 first_frames = frames;