Originally committed as revision 9065 to svn://svn.ffmpeg.org/ffmpeg/trunk
Aurelien Jacobs authored on 2007/05/19 09:32:11... | ... |
@@ -305,7 +305,7 @@ OBJS-$(CONFIG_PNM_PARSER) += pnm_parser.o pnm.o |
305 | 305 |
OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o |
306 | 306 |
|
307 | 307 |
OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += bitstream_filter.o |
308 |
-OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += bitstream_filter.o |
|
308 |
+OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o |
|
309 | 309 |
OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o |
310 | 310 |
OBJS-$(CONFIG_MP3_HEADER_COMPRESS_BSF) += mp3_header_compress_bsf.o |
311 | 311 |
OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF) += mp3_header_decompress_bsf.o mpegaudiodata.o |
... | ... |
@@ -79,33 +79,6 @@ static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, |
79 | 79 |
return 0; |
80 | 80 |
} |
81 | 81 |
|
82 |
-static int remove_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, |
|
83 |
- uint8_t **poutbuf, int *poutbuf_size, |
|
84 |
- const uint8_t *buf, int buf_size, int keyframe){ |
|
85 |
- int cmd= args ? *args : 0; |
|
86 |
- AVCodecParserContext *s; |
|
87 |
- |
|
88 |
- if(!bsfc->parser){ |
|
89 |
- bsfc->parser= av_parser_init(avctx->codec_id); |
|
90 |
- } |
|
91 |
- s= bsfc->parser; |
|
92 |
- |
|
93 |
- if(s && s->parser->split){ |
|
94 |
- if( (((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)) && cmd=='a') |
|
95 |
- ||(!keyframe && cmd=='k') |
|
96 |
- ||(cmd=='e' || !cmd) |
|
97 |
- ){ |
|
98 |
- int i= s->parser->split(avctx, buf, buf_size); |
|
99 |
- buf += i; |
|
100 |
- buf_size -= i; |
|
101 |
- } |
|
102 |
- } |
|
103 |
- *poutbuf= (uint8_t *) buf; |
|
104 |
- *poutbuf_size= buf_size; |
|
105 |
- |
|
106 |
- return 0; |
|
107 |
-} |
|
108 |
- |
|
109 | 82 |
#ifdef CONFIG_DUMP_EXTRADATA_BSF |
110 | 83 |
AVBitStreamFilter dump_extradata_bsf={ |
111 | 84 |
"dump_extra", |
... | ... |
@@ -113,11 +86,3 @@ AVBitStreamFilter dump_extradata_bsf={ |
113 | 113 |
dump_extradata, |
114 | 114 |
}; |
115 | 115 |
#endif |
116 |
- |
|
117 |
-#ifdef CONFIG_REMOVE_EXTRADATA_BSF |
|
118 |
-AVBitStreamFilter remove_extradata_bsf={ |
|
119 |
- "remove_extra", |
|
120 |
- 0, |
|
121 |
- remove_extradata, |
|
122 |
-}; |
|
123 |
-#endif |
124 | 116 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,55 @@ |
0 |
+/* |
|
1 |
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> |
|
2 |
+ * |
|
3 |
+ * This file is part of FFmpeg. |
|
4 |
+ * |
|
5 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
6 |
+ * modify it under the terms of the GNU Lesser General Public |
|
7 |
+ * License as published by the Free Software Foundation; either |
|
8 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
9 |
+ * |
|
10 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
11 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
+ * Lesser General Public License for more details. |
|
14 |
+ * |
|
15 |
+ * You should have received a copy of the GNU Lesser General Public |
|
16 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
17 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 |
+ */ |
|
19 |
+ |
|
20 |
+#include "avcodec.h" |
|
21 |
+ |
|
22 |
+ |
|
23 |
+static int remove_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, |
|
24 |
+ uint8_t **poutbuf, int *poutbuf_size, |
|
25 |
+ const uint8_t *buf, int buf_size, int keyframe){ |
|
26 |
+ int cmd= args ? *args : 0; |
|
27 |
+ AVCodecParserContext *s; |
|
28 |
+ |
|
29 |
+ if(!bsfc->parser){ |
|
30 |
+ bsfc->parser= av_parser_init(avctx->codec_id); |
|
31 |
+ } |
|
32 |
+ s= bsfc->parser; |
|
33 |
+ |
|
34 |
+ if(s && s->parser->split){ |
|
35 |
+ if( (((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)) && cmd=='a') |
|
36 |
+ ||(!keyframe && cmd=='k') |
|
37 |
+ ||(cmd=='e' || !cmd) |
|
38 |
+ ){ |
|
39 |
+ int i= s->parser->split(avctx, buf, buf_size); |
|
40 |
+ buf += i; |
|
41 |
+ buf_size -= i; |
|
42 |
+ } |
|
43 |
+ } |
|
44 |
+ *poutbuf= (uint8_t *) buf; |
|
45 |
+ *poutbuf_size= buf_size; |
|
46 |
+ |
|
47 |
+ return 0; |
|
48 |
+} |
|
49 |
+ |
|
50 |
+AVBitStreamFilter remove_extradata_bsf={ |
|
51 |
+ "remove_extra", |
|
52 |
+ 0, |
|
53 |
+ remove_extradata, |
|
54 |
+}; |