Mercurial > libavcodec.hg
comparison parser.c @ 4104:04ff8026d9c0 libavcodec
dont set the sampling rate just because 1 mp3 packet header says so (fixes playback speed on some old mencoder generated avis which where then dumped to mp3)
author | michael |
---|---|
date | Mon, 30 Oct 2006 02:19:55 +0000 |
parents | eddcc352c0dc |
children | daae66c03857 |
comparison
equal
deleted
inserted
replaced
4103:4da24acf4e20 | 4104:04ff8026d9c0 |
---|---|
664 buf_size -= len; | 664 buf_size -= len; |
665 s->inbuf_ptr += len; | 665 s->inbuf_ptr += len; |
666 } | 666 } |
667 if ((s->inbuf_ptr - s->inbuf) >= MPA_HEADER_SIZE) { | 667 if ((s->inbuf_ptr - s->inbuf) >= MPA_HEADER_SIZE) { |
668 got_header: | 668 got_header: |
669 sr= avctx->sample_rate; | |
670 header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) | | 669 header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) | |
671 (s->inbuf[2] << 8) | s->inbuf[3]; | 670 (s->inbuf[2] << 8) | s->inbuf[3]; |
672 | 671 |
673 ret = mpa_decode_header(avctx, header); | 672 ret = mpa_decode_header(avctx, header, &sr); |
674 if (ret < 0) { | 673 if (ret < 0) { |
675 s->header_count= -2; | 674 s->header_count= -2; |
676 /* no sync found : move by one byte (inefficient, but simple!) */ | 675 /* no sync found : move by one byte (inefficient, but simple!) */ |
677 memmove(s->inbuf, s->inbuf + 1, s->inbuf_ptr - s->inbuf - 1); | 676 memmove(s->inbuf, s->inbuf + 1, s->inbuf_ptr - s->inbuf - 1); |
678 s->inbuf_ptr--; | 677 s->inbuf_ptr--; |
692 if (decode_header(s, header) == 1) { | 691 if (decode_header(s, header) == 1) { |
693 s->frame_size = -1; | 692 s->frame_size = -1; |
694 } | 693 } |
695 #endif | 694 #endif |
696 } | 695 } |
697 if(s->header_count <= 0) | 696 if(s->header_count > 1) |
698 avctx->sample_rate= sr; //FIXME ugly | 697 avctx->sample_rate= sr; |
699 } | 698 } |
700 } else | 699 } else |
701 #if 0 | 700 #if 0 |
702 if (s->frame_size == -1) { | 701 if (s->frame_size == -1) { |
703 /* free format : find next sync to compute frame size */ | 702 /* free format : find next sync to compute frame size */ |