[FFmpeg-devel] [PATCH] LATM Bitstream Filter & Parser
Peter Holik
peter
Thu May 28 10:52:44 CEST 2009
> On Tuesday 26 May 2009 07:52:36 pm Paul Kendall wrote:
>> On Tuesday 26 May 2009 07:30:30 pm Reimar D?ffinger wrote:
>> > On Tue, May 26, 2009 at 06:51:30PM +1200, Paul Kendall wrote:
>> > > > > + /* parser only codecs */
>> > > >
>> > > > parser-only
>> > >
>> > > Yes, the comment relates to the other patch I mentioned about separate
>> > > parser selection.
>> >
>> > You misunderstood, you need a "-" between parser and only, I think
>> > otherwise the statement does not make sense.
>>
>> Sorry, have added the dash.
>>
> Latest patch included, I also also changed the parser to that when it returns
> packets it sets the codec_id to CODEC_ID_AAC, which means that the AAC codec
> is used.
Please help me to understand:
latm_find_frame_end is called with a AVPacket read from a Stream.
What is if the size of the Packet is smaller than a frame?
+static int latm_find_frame_end(AVCodecParserContext *s1, const uint8_t *buf,
+ int buf_size)
+{
+ LATMParseContext *s = s1->priv_data;
+ ParseContext *pc = &s->pc;
+ int pic_found, i;
+ uint32_t state;
+
+ pic_found = pc->frame_start_found;
+ state = pc->state;
+
+ for (i = 0; !pic_found && i < buf_size; i++) {
+ state = (state<<8) | buf[i];
+ if ((state & LATM_MASK) == LATM_HEADER) {
+ pic_found = 1;
+ s->count = i - 2;
+ break;
+ }
+ }
+
+ if (pic_found) {
+ /* EOF considered as end of frame */
+ if (buf_size == 0)
+ return 0;
+ if ((state & LATM_SIZE_MASK) + s->count + 3 <= buf_size) {
if the Packet is smaller (buf_size is the size of the Packet) then
"(state & LATM_SIZE_MASK) + s->count + 3 <= buf_size" can not be true?
+ pc->frame_start_found = 0;
+ pc->state = -1;
+ return (state & LATM_SIZE_MASK) + s->count + 3;
thanks Peter
More information about the ffmpeg-devel
mailing list