On sobota, 29 marca 2008, Michael Niedermayer wrote:
On Sat, Mar 29, 2008 at 12:19:43AM +0100, Bartlomiej Wolowiec wrote:
3.change of ff_aac_ac3_parse to make it react correctly to result returned in flag.
According to suggestions, I wrote new patch to AAC/AC3 parser.
Current data about the stream are taken from frames FRAME_START and FRAME_COMPLETE. It will be improved in the next patch. -- Bartlomiej Wolowiec
Index: libavcodec/aac_ac3_parser.c =================================================================== --- libavcodec/aac_ac3_parser.c (wersja 12623) +++ libavcodec/aac_ac3_parser.c (kopia robocza) @@ -29,35 +29,50 @@ const uint8_t *buf, int buf_size) { AACAC3ParseContext *s = s1->priv_data; - AACAC3FrameFlag frame_flag; const uint8_t *buf_ptr; int len;
*poutbuf = NULL; *poutbuf_size = 0;
+ if(s->frame_ptr == NULL) { + //after sending package of data in the end there was one new header + memcpy(s->inbuf, s->frame_start, s->header_size); + s->frame_start = s->inbuf; + s->frame_ptr = s->frame_start + s->header_size; + }
Instead of this i think you could just return a smaller number. We do have code in the parser that does what is needed to move this to the begin (search for overread) in parser*.
I've searched, but I haven't found anything appropriate. Majority of solutions is based on ff_combine_frame and it seeks 4 byte signature, but here, beside the signature other parameters shoulf be read (minimum 7 bytes forward should be in the buffer). Could you tell me what solution do you mean?
@@ -43,6 +44,7 @@ int sample_rate; int bit_rate; int samples; + AACAC3FrameFlag frame_flag; } AACAC3ParseContext;
why?
Because of the code below, I need to know if the frame should be send instantly or stay in the buffer and wait for next frames: + if(s->frame_flag == FRAME_COMPLETE) { *poutbuf = s->inbuf; *poutbuf_size = s->frame_size; - s->inbuf_ptr = s->inbuf; - s->frame_size = 0; + s->frame_start = s->inbuf; + s->frame_ptr = s->frame_start; break; -- Bartlomiej Wolowiec