Mercurial > libavcodec.hg
annotate parser.h @ 7390:7abedf6425d8 libavcodec
10000l, forgotton }
author | michael |
---|---|
date | Fri, 25 Jul 2008 12:25:28 +0000 |
parents | 9234c354dd3c |
children | c4a4495715dd |
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 | 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 | 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 | 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 | 62 /** |
63 * Fetches timestamps for a specific byte within the current access unit. | |
6996 | 64 * @param off byte position within the access unit |
65 * @param remove Found timestamps will be removed if set to 1, kept if set to 0. | |
6995 | 66 */ |
67 void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove); | |
68 | |
5827 | 69 #endif /* FFMPEG_PARSER_H */ |