aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorBartlomiej Wolowiec <bartek.wolowiec@gmail.com>2008-04-07 20:54:08 +0000
committerBartlomiej Wolowiec <bartek.wolowiec@gmail.com>2008-04-07 20:54:08 +0000
commitc09ed33e186ea0ba4ab96599bd69aea462aabeda (patch)
treede7576a064c9ad042ed55f3a155896eb6c57c6cb /libavcodec
parent0a5754c3b729cf8fc9b938ac0724ee7261aa1606 (diff)
downloadffmpeg-c09ed33e186ea0ba4ab96599bd69aea462aabeda.tar.gz
Corrections of errors in aac_ac3_parser
Originally committed as revision 12759 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/aac_ac3_parser.c9
-rw-r--r--libavcodec/aac_ac3_parser.h1
-rw-r--r--libavcodec/aac_parser.c2
-rw-r--r--libavcodec/ac3_parser.c2
4 files changed, 11 insertions, 3 deletions
diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
index e920b7f88c..a1284f7518 100644
--- a/libavcodec/aac_ac3_parser.c
+++ b/libavcodec/aac_ac3_parser.c
@@ -44,13 +44,19 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1,
if((len=s->sync(s->state, s, &s->need_next_header, &s->new_frame_start)))
break;
}
- i-= s->header_size;
+ i-= s->header_size -1;
if(len>0){
s->remaining_size = len + i;
if(pc->index+i > 0 && s->new_frame_start){
s->remaining_size -= i; // remaining_size=len
output_frame:
+ if(!s->frame_in_buffer && 0){
+ s->frame_in_buffer=1;
+ buf+=i;
+ buf_size-=i;
+ continue;
+ }
ff_combine_frame(pc, i, &buf, &buf_size);
*poutbuf = buf;
*poutbuf_size = buf_size;
@@ -72,6 +78,7 @@ output_frame:
return i;
}
+ s->frame_in_buffer=1;
}else{
break;
}
diff --git a/libavcodec/aac_ac3_parser.h b/libavcodec/aac_ac3_parser.h
index d5b78f7bc4..2049dc7097 100644
--- a/libavcodec/aac_ac3_parser.h
+++ b/libavcodec/aac_ac3_parser.h
@@ -43,6 +43,7 @@ typedef struct AACAC3ParseContext {
int need_next_header;
int new_frame_start;
+ int frame_in_buffer;
} AACAC3ParseContext;
int ff_aac_ac3_parse(AVCodecParserContext *s1,
diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c
index ddf82819be..9fbef864a1 100644
--- a/libavcodec/aac_parser.c
+++ b/libavcodec/aac_parser.c
@@ -34,7 +34,7 @@ static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info,
int size, rdb, ch, sr;
uint64_t tmp = be2me_64(state);
- init_get_bits(&bits, (uint8_t *)&tmp, AAC_HEADER_SIZE * 8);
+ init_get_bits(&bits, ((uint8_t *)&tmp)+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8);
if(get_bits(&bits, 12) != 0xfff)
return 0;
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index 57cd87f10d..a1d57e4c6e 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -130,7 +130,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
uint64_t tmp = be2me_64(state);
AC3HeaderInfo hdr;
- err = ff_ac3_parse_header((uint8_t *)&tmp, &hdr);
+ err = ff_ac3_parse_header(((uint8_t *)&tmp)+8-AC3_HEADER_SIZE, &hdr);
if(err < 0)
return 0;