MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / av_parser_change

Function av_parser_change

libavcodec/parser.c:200–231  ·  view source on GitHub ↗

* * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed * @deprecated use AVBitstreamFilter */

Source from the content-addressed store, hash-verified

198 * @deprecated use AVBitstreamFilter
199 */
200int av_parser_change(AVCodecParserContext *s,
201 AVCodecContext *avctx,
202 uint8_t **poutbuf, int *poutbuf_size,
203 const uint8_t *buf, int buf_size, int keyframe){
204
205 if(s && s->parser->split){
206 if((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)){
207 int i= s->parser->split(avctx, buf, buf_size);
208 buf += i;
209 buf_size -= i;
210 }
211 }
212
213 /* cast to avoid warning about discarding qualifiers */
214 *poutbuf= (uint8_t *) buf;
215 *poutbuf_size= buf_size;
216 if(avctx->extradata){
217 if( (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))
218 /*||(s->pict_type != FF_I_TYPE && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_NOKEY))*/
219 /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){
220 int size= buf_size + avctx->extradata_size;
221 *poutbuf_size= size;
222 *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
223
224 memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
225 memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
226 return 1;
227 }
228 }
229
230 return 0;
231}
232
233void av_parser_close(AVCodecParserContext *s)
234{

Callers 1

output_packetFunction · 0.85

Calls 1

av_mallocFunction · 0.85

Tested by

no test coverage detected