Mercurial > libavcodec.hg
annotate parser.h @ 8917:422a9dbebb53 libavcodec
Almost cosmetics.
Move some assignments after the checks.
author | iive |
---|---|
date | Sun, 15 Feb 2009 10:14:16 +0000 |
parents | 04423b2f6e0b |
children | fdafbcef52f5 |
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 |
8629
04423b2f6e0b
cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents:
8044
diff
changeset
|
3 * Copyright (c) 2003 Fabrice Bellard |
04423b2f6e0b
cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents:
8044
diff
changeset
|
4 * Copyright (c) 2003 Michael Niedermayer |
4150
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 |
7760 | 23 #ifndef AVCODEC_PARSER_H |
24 #define AVCODEC_PARSER_H | |
4150
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 |
8044
8c1e1047ec78
add state64 field to ParseContext storing last 8 bytes, to be able to check for longer startcodes
bcoudurier
parents:
7760
diff
changeset
|
37 uint64_t state64; ///< contains the last 8 bytes in MSB order |
4150
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
38 } ParseContext; |
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
39 |
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
40 struct MpegEncContext; |
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
41 |
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
42 typedef struct ParseContext1{ |
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
43 ParseContext pc; |
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
44 /* XXX/FIXME PC1 vs. PC */ |
6996 | 45 /* MPEG-2-specific */ |
4150
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
46 AVRational frame_rate; |
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
47 int progressive_sequence; |
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
48 int width, height; |
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
49 |
6996 | 50 /* 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
|
51 struct MpegEncContext *enc; |
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
52 int first_picture; |
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
53 } ParseContext1; |
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
54 |
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
55 #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
|
56 |
4931
0d1cc37d9430
make some parser parameters const to avoid casting const to non-const
aurel
parents:
4911
diff
changeset
|
57 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
|
58 int ff_mpeg4video_split(AVCodecContext *avctx, const uint8_t *buf, |
b3328ed50a5e
make mpeg4video_split public as ff_mpeg4video_split
stefang
parents:
4150
diff
changeset
|
59 int buf_size); |
4150
2205aefb22b7
move AVCodecParser prototypes and definitions to parser.h, and move mpegvideo parser to mpeg12.c
bcoudurier
parents:
diff
changeset
|
60 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
|
61 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
|
62 |
6995 | 63 /** |
64 * Fetches timestamps for a specific byte within the current access unit. | |
6996 | 65 * @param off byte position within the access unit |
66 * @param remove Found timestamps will be removed if set to 1, kept if set to 0. | |
6995 | 67 */ |
68 void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove); | |
69 | |
7760 | 70 #endif /* AVCODEC_PARSER_H */ |