Mercurial > libavcodec.hg
annotate chomp_bsf.c @ 12346:015c13a563dd libavcodec
The VP8 decoder does not depend on cabac.o.
author | diego |
---|---|
date | Mon, 02 Aug 2010 23:49:49 +0000 |
parents | 54091478e0c3 |
children |
rev | line source |
---|---|
11747
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
1 /* |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
2 * Chomp bitstream filter |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
3 * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com> |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
4 * |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
5 * This file is part of FFmpeg. |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
6 * |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
11 * |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
16 * |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
20 */ |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
21 |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
22 #include "avcodec.h" |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
23 #include "internal.h" |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
24 |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
25 static int chomp_filter(AVBitStreamFilterContext *bsfc, |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
26 AVCodecContext *avctx, const char *args, |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
27 uint8_t **poutbuf, int *poutbuf_size, |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
28 const uint8_t *buf, int buf_size, |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
29 int keyframe) |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
30 { |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
31 while (buf_size > 0 && !buf[buf_size-1]) |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
32 buf_size--; |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
33 |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
34 *poutbuf = (uint8_t*) buf; |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
35 *poutbuf_size = buf_size; |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
36 |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
37 return 0; |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
38 } |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
39 |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
40 /** |
12073
54091478e0c3
Replace '\0 bytes' by 'NULL bytes' in Doxygen comments.
diego
parents:
11747
diff
changeset
|
41 * This filter removes a string of NULL bytes from the end of a packet. |
11747
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
42 */ |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
43 AVBitStreamFilter chomp_bsf = { |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
44 "chomp", |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
45 0, |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
46 chomp_filter, |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
47 }; |