annotate parser.h @ 7047:4b5b586a3dd0 libavcodec

Support decoding of sample_g726.asf.
author michael
date Mon, 16 Jun 2008 23:12:50 +0000
parents 9234c354dd3c
children c4a4495715dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4150
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
1 /*
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
2 * AVCodecParser prototypes and definitions
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
3 * Copyright (c) 2003 Fabrice Bellard.
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
4 * Copyright (c) 2003 Michael Niedermayer.
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
5 *
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
6 * This file is part of FFmpeg.
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
7 *
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
12 *
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
16 * Lesser General Public License for more details.
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
17 *
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
21 */
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
22
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
23 #ifndef FFMPEG_PARSER_H
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
24 #define FFMPEG_PARSER_H
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
25
4911
b6a4f6c5623c parser.h uses AVCodecContext so it needs to include avcodec.h
aurel
parents: 4855
diff changeset
26 #include "avcodec.h"
4855
40f3a7f2b1fd Move AC3 header parsing code together with the rest of the AC3 parsing code.
diego
parents: 4795
diff changeset
27
4150
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
28 typedef struct ParseContext{
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
29 uint8_t *buffer;
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
30 int index;
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
31 int last_index;
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
32 unsigned int buffer_size;
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
33 uint32_t state; ///< contains the last few bytes in MSB order
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
34 int frame_start_found;
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
35 int overread; ///< the number of bytes which where irreversibly read from the next frame
4795
522e52c630bd typos/grammar
diego
parents: 4177
diff changeset
36 int overread_index; ///< the index into ParseContext.buffer of the overread bytes
4150
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
37 } ParseContext;
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
38
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
39 struct MpegEncContext;
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
40
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
41 typedef struct ParseContext1{
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
42 ParseContext pc;
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
43 /* XXX/FIXME PC1 vs. PC */
6996
9234c354dd3c small spelling/wording fixes
diego
parents: 6995
diff changeset
44 /* MPEG-2-specific */
4150
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
45 AVRational frame_rate;
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
46 int progressive_sequence;
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
47 int width, height;
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
48
6996
9234c354dd3c small spelling/wording fixes
diego
parents: 6995
diff changeset
49 /* XXX: suppress that, needed by MPEG-4 */
4150
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
50 struct MpegEncContext *enc;
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
51 int first_picture;
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
52 } ParseContext1;
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
53
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
54 #define END_NOT_FOUND (-100)
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
55
4931
0d1cc37d9430 make some parser parameters const to avoid casting const to non-const
aurel
parents: 4911
diff changeset
56 int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size);
4175
b3328ed50a5e make mpeg4video_split public as ff_mpeg4video_split
stefang
parents: 4150
diff changeset
57 int ff_mpeg4video_split(AVCodecContext *avctx, const uint8_t *buf,
b3328ed50a5e make mpeg4video_split public as ff_mpeg4video_split
stefang
parents: 4150
diff changeset
58 int buf_size);
4150
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
59 void ff_parse_close(AVCodecParserContext *s);
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
60 void ff_parse1_close(AVCodecParserContext *s);
2205aefb22b7 move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff changeset
61
6995
0e15e9324df2 ff_fetch_timestamp() prototype
michael
parents: 5827
diff changeset
62 /**
0e15e9324df2 ff_fetch_timestamp() prototype
michael
parents: 5827
diff changeset
63 * Fetches timestamps for a specific byte within the current access unit.
6996
9234c354dd3c small spelling/wording fixes
diego
parents: 6995
diff changeset
64 * @param off byte position within the access unit
9234c354dd3c small spelling/wording fixes
diego
parents: 6995
diff changeset
65 * @param remove Found timestamps will be removed if set to 1, kept if set to 0.
6995
0e15e9324df2 ff_fetch_timestamp() prototype
michael
parents: 5827
diff changeset
66 */
0e15e9324df2 ff_fetch_timestamp() prototype
michael
parents: 5827
diff changeset
67 void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove);
0e15e9324df2 ff_fetch_timestamp() prototype
michael
parents: 5827
diff changeset
68
5827
5577fd4f31e1 Fix #endif comment typo.
diego
parents: 4957
diff changeset
69 #endif /* FFMPEG_PARSER_H */